From 03d97457a657911c31ccd245823484279ee8c471 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 21 Jun 2024 09:18:07 +0100 Subject: [PATCH 001/121] Replace cython requirement with pybind11 --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index aef4e037..79bd1706 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,8 +2,8 @@ requires = [ "setuptools >= 42", "wheel", - "cython ~= 3.0", "versioneer", - "numpy ~= 1.17" + "numpy ~= 1.17", + "pybind11 ~= 2.12", ] build-backend = "setuptools.build_meta" From 09e5eced098a63c9860237fc235b2099f8649b20 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 21 Jun 2024 09:19:00 +0100 Subject: [PATCH 002/121] Refactor setup.py to work with pybind11 module --- setup.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/setup.py b/setup.py index 106bb353..9f552082 100644 --- a/setup.py +++ b/setup.py @@ -1,10 +1,11 @@ -from setuptools import setup -from Cython.Build import cythonize +from setuptools import setup, Extension import versioneer import numpy import sysconfig from distutils import ccompiler import sys +import pybind11 +import glob if (sysconfig.get_config_var("CXX") or ccompiler.get_default_compiler()).split()[ 0 @@ -20,8 +21,16 @@ setup( version=versioneer.get_version(), cmdclass=versioneer.get_cmdclass(), - include_dirs=[numpy.get_include()], - ext_modules=cythonize( - f"src/**/*.pyx", language_level=3, aliases={"CPPCARGS": CompileArgs} - ), + include_dirs=["src/amulet_nbt/include", numpy.get_include(), pybind11.get_include()], + ext_modules=[ + Extension( + name="amulet_nbt._nbt", + sources=[ + *glob.glob("src/amulet_nbt/py/**/*.cpp", recursive=True), + # TODO: The following should be moved to a dynamic library. + *glob.glob("src/amulet_nbt/cpp/**/*.cpp", recursive=True) + ], + extra_compile_args=CompileArgs + ) + ] ) From e6b6d16eb1441fc5f18c1430124cfc2a14518159 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 21 Jun 2024 09:19:28 +0100 Subject: [PATCH 003/121] Clean up stub file --- src/amulet_nbt/__init__.pyi | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/amulet_nbt/__init__.pyi b/src/amulet_nbt/__init__.pyi index 8c8707e1..7444106e 100644 --- a/src/amulet_nbt/__init__.pyi +++ b/src/amulet_nbt/__init__.pyi @@ -87,13 +87,9 @@ class NBTError(Exception): class NBTLoadError(NBTError): """The NBT data failed to load for some reason.""" - pass - class NBTFormatError(NBTLoadError): """Indicates the NBT format is invalid.""" - pass - class SNBTParseError(NBTError): """Indicates the SNBT format is invalid.""" @@ -113,10 +109,8 @@ class EncodingPreset: java_encoding: EncodingPreset bedrock_encoding: EncodingPreset -class AbstractBase: - """Abstract Base class for all Tags and the NamedTag""" -class AbstractBaseTag(AbstractBase): +class AbstractBaseTag: """Abstract Base Class for all Tag classes""" tag_id: ClassVar[int] @@ -1511,7 +1505,7 @@ TAG_Compound: TypeAlias = CompoundTag TAG_Int_Array: TypeAlias = IntArrayTag TAG_Long_Array: TypeAlias = LongArrayTag -class NamedTag(AbstractBase, tuple[str | bytes, AnyNBT]): +class NamedTag(tuple[str | bytes, AnyNBT]): def __init__( self, tag: AbstractBaseTag | AnyNBT | None = None, name: str | bytes = "" ) -> None: ... From d113ef7ab3c9b1b171630c362539a1269d8bf79e Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 21 Jun 2024 09:20:29 +0100 Subject: [PATCH 004/121] Don't ignore C++ source files --- .gitignore | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.gitignore b/.gitignore index 500f2795..57787b2e 100644 --- a/.gitignore +++ b/.gitignore @@ -119,9 +119,3 @@ temp *.vs/ *.vcxproj* *.sln - -# C++ files -*.c -!**/_cpp/**/*.c -*.cpp -!**/_cpp/**/*.cpp From a457469f735e047adccf3c536a5089c936a2cd6b Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 21 Jun 2024 09:22:48 +0100 Subject: [PATCH 005/121] Move and refactor C++ header files --- src/amulet_nbt/_tag/_cpp/array.hpp | 37 -------- src/amulet_nbt/_tag/_cpp/nbt.hpp | 83 ----------------- .../include/amulet_nbt/tag/array.hpp | 50 ++++++++++ src/amulet_nbt/include/amulet_nbt/tag/nbt.hpp | 92 +++++++++++++++++++ 4 files changed, 142 insertions(+), 120 deletions(-) delete mode 100644 src/amulet_nbt/_tag/_cpp/array.hpp delete mode 100644 src/amulet_nbt/_tag/_cpp/nbt.hpp create mode 100644 src/amulet_nbt/include/amulet_nbt/tag/array.hpp create mode 100644 src/amulet_nbt/include/amulet_nbt/tag/nbt.hpp diff --git a/src/amulet_nbt/_tag/_cpp/array.hpp b/src/amulet_nbt/_tag/_cpp/array.hpp deleted file mode 100644 index 27ed4bf7..00000000 --- a/src/amulet_nbt/_tag/_cpp/array.hpp +++ /dev/null @@ -1,37 +0,0 @@ -#pragma once - -#include - -// The standard vector class can be resized. -// To make wrapping in numpy easier we will make the size fixed at runtime. -template -class Array : private std::vector -{ - public: - // only methods that do not change the buffer size should be exposed here - using std::vector::vector; - - using typename std::vector::value_type; - using typename std::vector::size_type; - using typename std::vector::difference_type; - using typename std::vector::iterator; - using typename std::vector::const_iterator; - using typename std::vector::reverse_iterator; - using typename std::vector::const_reverse_iterator; - - using std::vector::operator[]; - using std::vector::at; - using std::vector::back; - using std::vector::begin; - using std::vector::empty; - using std::vector::end; - using std::vector::front; - using std::vector::max_size; - using std::vector::size; - using std::vector::data; - - bool operator==(const Array& other) const - { - return static_cast&>(*this) == static_cast&>(other); - } -}; diff --git a/src/amulet_nbt/_tag/_cpp/nbt.hpp b/src/amulet_nbt/_tag/_cpp/nbt.hpp deleted file mode 100644 index 7d36ce83..00000000 --- a/src/amulet_nbt/_tag/_cpp/nbt.hpp +++ /dev/null @@ -1,83 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include "array.hpp" - - -// Base types -typedef std::int8_t CByteTag; -typedef std::int16_t CShortTag; -typedef std::int32_t CIntTag; -typedef std::int64_t CLongTag; -typedef float CFloatTag; -typedef double CDoubleTag; -typedef Array CByteArrayTag; -typedef std::string CStringTag; -class CListTag; -class CCompoundTag; -typedef Array CIntArrayTag; -typedef Array CLongArrayTag; - -// Pointer types -typedef std::shared_ptr CListTagPtr; -typedef std::shared_ptr CCompoundTagPtr; -typedef std::shared_ptr CByteArrayTagPtr; -typedef std::shared_ptr CIntArrayTagPtr; -typedef std::shared_ptr CLongArrayTagPtr; - -// List types -typedef std::vector CByteList; -typedef std::vector CShortList; -typedef std::vector CIntList; -typedef std::vector CLongList; -typedef std::vector CFloatList; -typedef std::vector CDoubleList; -typedef std::vector CByteArrayList; -typedef std::vector CStringList; -typedef std::vector CListList; -typedef std::vector CCompoundList; -typedef std::vector CIntArrayList; -typedef std::vector CLongArrayList; - -class CListTag : public std::variant< - std::monostate, - CByteList, - CShortList, - CIntList, - CLongList, - CFloatList, - CDoubleList, - CByteArrayList, - CStringList, - CListList, - CCompoundList, - CIntArrayList, - CLongArrayList -> { - using variant::variant; -}; - -typedef std::variant< - std::monostate, - CByteTag, - CShortTag, - CIntTag, - CLongTag, - CFloatTag, - CDoubleTag, - CByteArrayTagPtr, - CStringTag, - CListTagPtr, - CCompoundTagPtr, - CIntArrayTagPtr, - CLongArrayTagPtr -> TagNode; - -class CCompoundTag : public std::unordered_map { - using unordered_map::unordered_map; -}; diff --git a/src/amulet_nbt/include/amulet_nbt/tag/array.hpp b/src/amulet_nbt/include/amulet_nbt/tag/array.hpp new file mode 100644 index 00000000..00894125 --- /dev/null +++ b/src/amulet_nbt/include/amulet_nbt/tag/array.hpp @@ -0,0 +1,50 @@ +#pragma once + +#include + +namespace Amulet { + // The standard vector class can be resized. + // To make wrapping in numpy easier we will make the size fixed at runtime. + template + class ArrayTag : private std::vector + { + public: + // only methods that do not change the buffer size should be exposed here + using std::vector::vector; + + // Member types + using typename std::vector::value_type; + using typename std::vector::size_type; + using typename std::vector::difference_type; + using typename std::vector::iterator; + using typename std::vector::const_iterator; + using typename std::vector::reverse_iterator; + using typename std::vector::const_reverse_iterator; + + // Element access + using std::vector::at; + using std::vector::operator[]; + using std::vector::front; + using std::vector::back; + using std::vector::data; + + // Iterators + using std::vector::begin; + using std::vector::cbegin; + using std::vector::end; + using std::vector::cend; + using std::vector::rbegin; + using std::vector::crbegin; + using std::vector::rend; + using std::vector::crend; + + // Capacity + using std::vector::empty; + using std::vector::size; + + bool operator==(const ArrayTag& other) const + { + return static_cast&>(*this) == static_cast&>(other); + } + }; +} diff --git a/src/amulet_nbt/include/amulet_nbt/tag/nbt.hpp b/src/amulet_nbt/include/amulet_nbt/tag/nbt.hpp new file mode 100644 index 00000000..332ed404 --- /dev/null +++ b/src/amulet_nbt/include/amulet_nbt/tag/nbt.hpp @@ -0,0 +1,92 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include "array.hpp" + +namespace Amulet { + // Base types + typedef std::int8_t ByteTag; + typedef std::int16_t ShortTag; + typedef std::int32_t IntTag; + typedef std::int64_t LongTag; + typedef float FloatTag; + typedef double DoubleTag; + typedef ArrayTag ByteArrayTag; + typedef std::string StringTag; + class ListTag; + class CompoundTag; + typedef ArrayTag IntArrayTag; + typedef ArrayTag LongArrayTag; + + // Pointer types + typedef std::shared_ptr ListTagPtr; + typedef std::shared_ptr CompoundTagPtr; + typedef std::shared_ptr ByteArrayTagPtr; + typedef std::shared_ptr IntArrayTagPtr; + typedef std::shared_ptr LongArrayTagPtr; + + // List types + typedef std::vector ByteList; + typedef std::vector ShortList; + typedef std::vector IntList; + typedef std::vector LongList; + typedef std::vector FloatList; + typedef std::vector DoubleList; + typedef std::vector ByteArrayList; + typedef std::vector StringList; + typedef std::vector ListList; + typedef std::vector CompoundList; + typedef std::vector IntArrayList; + typedef std::vector LongArrayList; + + class ListTag : public std::variant< + std::monostate, + ByteList, + ShortList, + IntList, + LongList, + FloatList, + DoubleList, + ByteArrayList, + StringList, + ListList, + CompoundList, + IntArrayList, + LongArrayList + > { + using variant::variant; + }; + + typedef std::variant< + std::monostate, + ByteTag, + ShortTag, + IntTag, + LongTag, + FloatTag, + DoubleTag, + ByteArrayTagPtr, + StringTag, + ListTagPtr, + CompoundTagPtr, + IntArrayTagPtr, + LongArrayTagPtr + > TagNode; + + class CompoundTag : public std::unordered_map { + using unordered_map::unordered_map; + }; + + class NamedTag { + public: + std::string name; + TagNode tag_node; + + NamedTag(const std::string& name, const TagNode& tag_node): name(name), tag_node(tag_node) {} + }; +} From 943068b560051277a6d93df702391cea5d81128b Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 21 Jun 2024 09:24:22 +0100 Subject: [PATCH 006/121] Add nbt wrapper classes pybind11 cannot directly store fundamental types so a custom class is required to wrap them for storage. --- .../include/amulet_nbt/tag/wrapper.hpp | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/amulet_nbt/include/amulet_nbt/tag/wrapper.hpp diff --git a/src/amulet_nbt/include/amulet_nbt/tag/wrapper.hpp b/src/amulet_nbt/include/amulet_nbt/tag/wrapper.hpp new file mode 100644 index 00000000..d28f3ad9 --- /dev/null +++ b/src/amulet_nbt/include/amulet_nbt/tag/wrapper.hpp @@ -0,0 +1,37 @@ +#pragma once + +#include "nbt.hpp" + +namespace Amulet { + + class AbstractBaseTag { + }; + + class AbstractBaseImmutableTag: public AbstractBaseTag {}; + class AbstractBaseMutableTag: public AbstractBaseTag {}; + class AbstractBaseNumericTag: public AbstractBaseImmutableTag {}; + class AbstractBaseIntTag: public AbstractBaseNumericTag {}; + class AbstractBaseFloatTag: public AbstractBaseNumericTag {}; + class AbstractBaseArrayTag: public AbstractBaseMutableTag {}; + + // pybind cannot directly store fundamental types + // This wrapper exists to allow pybind to store fundamental types + template + class TagWrapper: public BaseClassT { + public: + T tag; + TagWrapper(T tag): tag(tag) {}; + }; + typedef TagWrapper ByteTagWrapper; + typedef TagWrapper ShortTagWrapper; + typedef TagWrapper IntTagWrapper; + typedef TagWrapper LongTagWrapper; + typedef TagWrapper FloatTagWrapper; + typedef TagWrapper DoubleTagWrapper; + typedef TagWrapper ByteArrayTagWrapper; + typedef TagWrapper StringTagWrapper; + typedef TagWrapper ListTagWrapper; + typedef TagWrapper CompoundTagWrapper; + typedef TagWrapper IntArrayTagWrapper; + typedef TagWrapper LongArrayTagWrapper; +} From 5277bc6dd548025814db74eb0839c764c4401977 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 21 Jun 2024 09:24:46 +0100 Subject: [PATCH 007/121] Add abstract base pybind11 classes --- src/amulet_nbt/py/tag/abc.cpp | 126 ++++++++++++++++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 src/amulet_nbt/py/tag/abc.cpp diff --git a/src/amulet_nbt/py/tag/abc.cpp b/src/amulet_nbt/py/tag/abc.cpp new file mode 100644 index 00000000..c83d160d --- /dev/null +++ b/src/amulet_nbt/py/tag/abc.cpp @@ -0,0 +1,126 @@ +#include +#include + +template +void abstract_method(const T& self){ + PyErr_SetString(PyExc_NotImplementedError, ""); + throw py::error_already_set(); +} + + +void init_abc(py::module& m) { + py::class_ AbstractBaseTag(m, "AbstractBaseTag", + "Abstract Base Class for all tag classes" + ); + AbstractBaseTag.def_property_readonly( + "py_data", + abstract_method, + "A python representation of the class. Note that the return type is undefined and may change in the future.\n"\ + "\n"\ + "You would be better off using the py_{type} or np_array properties if you require a fixed type.\n"\ + "This is here for convenience to get a python representation under the same property name."\ + ); + AbstractBaseTag.def( + "to_nbt", + abstract_method + ); + AbstractBaseTag.def( + "save_to", + abstract_method + ); + AbstractBaseTag.def( + "to_snbt", + abstract_method + ); + AbstractBaseTag.def( + "__eq__", + abstract_method, + "Check if the instance is equal to another instance.\n" + "\n" + "This will only return True if the tag type is the same and the data contained is the same." + ); + AbstractBaseTag.def( + "__repr__", + abstract_method, + "A string representation of the object to show how it can be constructed." + ); + AbstractBaseTag.def( + "__str__", + abstract_method, + "A string representation of the object." + ); + AbstractBaseTag.def( + "__reduce__", + abstract_method, + "A string representation of the object." + ); + AbstractBaseTag.def( + "__copy__", + abstract_method, + "A string representation of the object." + ); + AbstractBaseTag.def( + "__deepcopy__", + abstract_method, + "A string representation of the object." + ); + + py::class_ AbstractBaseImmutableTag(m, "AbstractBaseImmutableTag", + "Abstract Base Class for all tag classes" + ); + AbstractBaseImmutableTag.def( + "__hash__", + abstract_method, + "A hash of the data in the class." + ); + + py::class_ AbstractBaseNumericTag(m, "AbstractBaseNumericTag", + "Abstract Base Class for all numeric tag classes" + ); + AbstractBaseNumericTag.def( + "__int__", + abstract_method, + "Get a python int representation of the class." + ); + AbstractBaseNumericTag.def( + "__float__", + abstract_method, + "Get a python float representation of the class." + ); + AbstractBaseNumericTag.def( + "__bool__", + abstract_method, + "Get a python bool representation of the class." + ); + + py::class_ AbstractBaseIntTag(m, "AbstractBaseIntTag", + "Abstract Base Class for all int tag classes" + ); + AbstractBaseIntTag.def_property_readonly( + "py_int", + abstract_method, + "A python int representation of the class.\n" + "\n" + "The returned data is immutable so changes will not mirror the instance." + ); + + py::class_ AbstractBaseFloatTag(m, "AbstractBaseFloatTag", + "Abstract Base Class for all float tag classes." + ); + AbstractBaseFloatTag.def_property_readonly( + "py_float", + abstract_method, + "A python float representation of the class.\n" + "\n" + "The returned data is immutable so changes will not mirror the instance." + ); + + py::class_ AbstractBaseMutableTag(m, "AbstractBaseMutableTag", + "Abstract Base Class for all mutable tags." + ); + AbstractBaseMutableTag.attr("__hash__") = py::none(); + + py::class_ AbstractBaseArrayTag(m, "AbstractBaseArrayTag", + "Abstract Base Class for all array tag classes." + ); +} From 708f7abd40bfa59dacd633f5e60816b013b45afc Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 21 Jun 2024 09:25:03 +0100 Subject: [PATCH 008/121] Add int pybind11 classes --- src/amulet_nbt/py/tag/int.cpp | 115 ++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 src/amulet_nbt/py/tag/int.cpp diff --git a/src/amulet_nbt/py/tag/int.cpp b/src/amulet_nbt/py/tag/int.cpp new file mode 100644 index 00000000..9aff3a6c --- /dev/null +++ b/src/amulet_nbt/py/tag/int.cpp @@ -0,0 +1,115 @@ +#include +#include + + +#define PyInt(CLSNAME, BYTEWIDTH, BITPOW, TAGID)\ + py::class_ CLSNAME(m, #CLSNAME,\ + "A "#BYTEWIDTH" byte integer class.\n"\ + "\n"\ + "Can Store numbers between -(2^"#BITPOW") and (2^"#BITPOW" - 1)"\ + );\ + CLSNAME.def(\ + py::init([](py::object value) {\ + return Amulet::CLSNAME##Wrapper(value.cast());\ + }),\ + py::arg("value") = 0,\ + py::doc("__init__(self: amulet_nbt."#CLSNAME", value: typing.SupportsInt) -> None")\ + );\ + CLSNAME.def_readonly(\ + "py_int",\ + &Amulet::CLSNAME##Wrapper::tag,\ + py::doc(\ + "A python int representation of the class.\n"\ + "\n"\ + "The returned data is immutable so changes will not mirror the instance."\ + )\ + );\ + CLSNAME.def_readonly(\ + "py_data",\ + &Amulet::CLSNAME##Wrapper::tag,\ + py::doc(\ + "A python representation of the class. Note that the return type is undefined and may change in the future.\n"\ + "\n"\ + "You would be better off using the py_{type} or np_array properties if you require a fixed type.\n"\ + "This is here for convenience to get a python representation under the same property name.\n"\ + )\ + );\ + CLSNAME.def(\ + "__repr__",\ + [](const Amulet::CLSNAME##Wrapper& self){\ + return #CLSNAME "(" + std::to_string(self.tag) + ")";\ + }\ + );\ + CLSNAME.def(\ + "__str__",\ + [](const Amulet::CLSNAME##Wrapper& self){\ + return std::to_string(self.tag);\ + }\ + );\ + CLSNAME.def(\ + "__hash__",\ + [](const Amulet::CLSNAME##Wrapper& self){\ + return py::hash(py::make_tuple(TAGID, self.tag));\ + }\ + );\ + CLSNAME.def(\ + "__int__",\ + [](const Amulet::CLSNAME##Wrapper& self){\ + return self.tag;\ + }\ + );\ + CLSNAME.def(\ + "__float__",\ + [](const Amulet::CLSNAME##Wrapper& self) -> py::float_ {\ + return py::cast(self.tag);\ + }\ + );\ + CLSNAME.def(\ + "__bool__",\ + [](const Amulet::CLSNAME##Wrapper& self){\ + return self.tag != 0;\ + }\ + );\ + CLSNAME.def(\ + "__eq__",\ + [](const Amulet::CLSNAME##Wrapper& self, const Amulet::CLSNAME##Wrapper& other){\ + return self.tag == other.tag;\ + },\ + py::is_operator()\ + );\ + CLSNAME.def(\ + "__ge__",\ + [](const Amulet::CLSNAME##Wrapper& self, const Amulet::CLSNAME##Wrapper& other){\ + return self.tag >= other.tag;\ + },\ + py::is_operator()\ + );\ + CLSNAME.def(\ + "__gt__",\ + [](const Amulet::CLSNAME##Wrapper& self, const Amulet::CLSNAME##Wrapper& other){\ + return self.tag > other.tag;\ + },\ + py::is_operator()\ + );\ + CLSNAME.def(\ + "__le__",\ + [](const Amulet::CLSNAME##Wrapper& self, const Amulet::CLSNAME##Wrapper& other){\ + return self.tag <= other.tag;\ + },\ + py::is_operator()\ + );\ + CLSNAME.def(\ + "__lt__",\ + [](const Amulet::CLSNAME##Wrapper& self, const Amulet::CLSNAME##Wrapper& other){\ + return self.tag < other.tag;\ + },\ + py::is_operator()\ + ); + + +void init_int(py::module& m) { + PyInt(ByteTag, 1, 7, 1) + PyInt(ShortTag, 2, 15, 2) + PyInt(IntTag, 4, 31, 3) + PyInt(LongTag, 8, 63, 4) +}; From fdc771755fb428c1d700a756773e4fa9f64a16b3 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 21 Jun 2024 09:25:13 +0100 Subject: [PATCH 009/121] Add float pybind11 classes --- src/amulet_nbt/py/tag/float.cpp | 111 ++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 src/amulet_nbt/py/tag/float.cpp diff --git a/src/amulet_nbt/py/tag/float.cpp b/src/amulet_nbt/py/tag/float.cpp new file mode 100644 index 00000000..021cbf16 --- /dev/null +++ b/src/amulet_nbt/py/tag/float.cpp @@ -0,0 +1,111 @@ +#include +#include + + +#define PyFloat(CLSNAME, PRECISION, TAGID)\ + py::class_ CLSNAME(m, #CLSNAME,\ + "A "#PRECISION" precision float class."\ + );\ + CLSNAME.def(\ + py::init([](py::object value) {\ + return Amulet::CLSNAME##Wrapper(value.cast());\ + }),\ + py::arg("value") = 0.0,\ + py::doc("__init__(self: amulet_nbt."#CLSNAME", value: typing.SupportsFloat) -> None")\ + );\ + CLSNAME.def_readonly(\ + "py_float",\ + &Amulet::CLSNAME##Wrapper::tag,\ + py::doc(\ + "A python float representation of the class.\n"\ + "\n"\ + "The returned data is immutable so changes will not mirror the instance."\ + )\ + );\ + CLSNAME.def_readonly(\ + "py_data",\ + &Amulet::CLSNAME##Wrapper::tag,\ + py::doc(\ + "A python representation of the class. Note that the return type is undefined and may change in the future.\n"\ + "\n"\ + "You would be better off using the py_{type} or np_array properties if you require a fixed type.\n"\ + "This is here for convenience to get a python representation under the same property name.\n"\ + )\ + );\ + CLSNAME.def(\ + "__repr__",\ + [](const Amulet::CLSNAME##Wrapper& self){\ + return #CLSNAME "(" + std::to_string(self.tag) + ")";\ + }\ + );\ + CLSNAME.def(\ + "__str__",\ + [](const Amulet::CLSNAME##Wrapper& self){\ + return std::to_string(self.tag);\ + }\ + );\ + CLSNAME.def(\ + "__hash__",\ + [](const Amulet::CLSNAME##Wrapper& self){\ + return py::hash(py::make_tuple(TAGID, self.tag));\ + }\ + );\ + CLSNAME.def(\ + "__int__",\ + [](const Amulet::CLSNAME##Wrapper& self) -> py::int_ {\ + return py::cast(self.tag);\ + }\ + );\ + CLSNAME.def(\ + "__float__",\ + [](const Amulet::CLSNAME##Wrapper& self) {\ + return self.tag;\ + }\ + );\ + CLSNAME.def(\ + "__bool__",\ + [](const Amulet::CLSNAME##Wrapper& self){\ + return self.tag != 0.0;\ + }\ + );\ + CLSNAME.def(\ + "__eq__",\ + [](const Amulet::CLSNAME##Wrapper& self, const Amulet::CLSNAME##Wrapper& other){\ + return self.tag == other.tag;\ + },\ + py::is_operator()\ + );\ + CLSNAME.def(\ + "__ge__",\ + [](const Amulet::CLSNAME##Wrapper& self, const Amulet::CLSNAME##Wrapper& other){\ + return self.tag >= other.tag;\ + },\ + py::is_operator()\ + );\ + CLSNAME.def(\ + "__gt__",\ + [](const Amulet::CLSNAME##Wrapper& self, const Amulet::CLSNAME##Wrapper& other){\ + return self.tag > other.tag;\ + },\ + py::is_operator()\ + );\ + CLSNAME.def(\ + "__le__",\ + [](const Amulet::CLSNAME##Wrapper& self, const Amulet::CLSNAME##Wrapper& other){\ + return self.tag <= other.tag;\ + },\ + py::is_operator()\ + );\ + CLSNAME.def(\ + "__lt__",\ + [](const Amulet::CLSNAME##Wrapper& self, const Amulet::CLSNAME##Wrapper& other){\ + return self.tag < other.tag;\ + },\ + py::is_operator()\ + ); + + +void init_float(py::module& m) { + PyFloat(FloatTag, single, 5) + PyFloat(DoubleTag, double, 6) +} From 2d0e75d6c230509ecde18facbbde39faa5bac3b1 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 21 Jun 2024 09:25:26 +0100 Subject: [PATCH 010/121] Add string pybind11 classes --- src/amulet_nbt/py/tag/string.cpp | 114 +++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 src/amulet_nbt/py/tag/string.cpp diff --git a/src/amulet_nbt/py/tag/string.cpp b/src/amulet_nbt/py/tag/string.cpp new file mode 100644 index 00000000..cf9b0028 --- /dev/null +++ b/src/amulet_nbt/py/tag/string.cpp @@ -0,0 +1,114 @@ +#include +#include + +void init_string(py::module& m) { + py::class_ StringTag(m, "StringTag", + "A class that behaves like a string." + ); + StringTag.def( + py::init([](py::object value) { + return Amulet::StringTagWrapper(value.cast()); + }), + py::arg("value") = "", + py::doc("__init__(self: amulet_nbt.StringTag, value: str | bytes) -> None") + ); + StringTag.def_readonly( + "py_str", + &Amulet::StringTagWrapper::tag, + py::doc( + "The data stored in the class as a python string.\n" + "\n" + "In some rare cases the data cannot be decoded to a string and this will raise a UnicodeDecodeError." + ) + ); + StringTag.def_property_readonly( + "py_bytes", + [](const Amulet::StringTagWrapper& self){ + return py::bytes(self.tag); + }, + py::doc( + "The bytes stored in the class." + ) + ); + StringTag.def_property_readonly( + "py_data", + [](const Amulet::StringTagWrapper& self){ + return py::bytes(self.tag); + }, + py::doc( + "A python representation of the class. Note that the return type is undefined and may change in the future.\n" + "\n" + "You would be better off using the py_{type} or np_array properties if you require a fixed type.\n" + "This is here for convenience to get a python representation under the same property name.\n" + ) + ); + StringTag.def( + "__repr__", + [](const Amulet::StringTagWrapper& self){ + try { + return "StringTag(" + py::repr(py::str(self.tag)).cast() + ")"; + } catch (py::error_already_set&){ + return "StringTag(" + py::repr(py::bytes(self.tag)).cast() + ")"; + } + } + ); + StringTag.def( + "__str__", + [](const Amulet::StringTagWrapper& self){ + return self.tag; + } + ); + StringTag.def( + "__bytes__", + [](const Amulet::StringTagWrapper& self){ + return py::bytes(self.tag); + } + ); + StringTag.def( + "__hash__", + [](const Amulet::StringTagWrapper& self){ + return py::hash(py::make_tuple(8, py::bytes(self.tag))); + } + ); + StringTag.def( + "__bool__", + [](const Amulet::StringTagWrapper& self){ + return !self.tag.empty(); + } + ); + StringTag.def( + "__eq__", + [](const Amulet::StringTagWrapper& self, const Amulet::StringTagWrapper& other){ + return self.tag == other.tag; + }, + py::is_operator() + ); + StringTag.def( + "__ge__", + [](const Amulet::StringTagWrapper& self, const Amulet::StringTagWrapper& other){ + return self.tag >= other.tag; + }, + py::is_operator() + ); + StringTag.def( + "__gt__", + [](const Amulet::StringTagWrapper& self, const Amulet::StringTagWrapper& other){ + return self.tag > other.tag; + }, + py::is_operator() + ); + StringTag.def( + "__le__", + [](const Amulet::StringTagWrapper& self, const Amulet::StringTagWrapper& other){ + return self.tag <= other.tag; + }, + py::is_operator() + ); + StringTag.def( + "__lt__", + [](const Amulet::StringTagWrapper& self, const Amulet::StringTagWrapper& other){ + return self.tag < other.tag; + }, + py::is_operator() + ); +} From d7cb085619113f1f8108ddef0231b944965a7e4c Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 21 Jun 2024 09:25:57 +0100 Subject: [PATCH 011/121] Add pybind11 array classes --- src/amulet_nbt/py/tag/array.cpp | 130 ++++++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 src/amulet_nbt/py/tag/array.cpp diff --git a/src/amulet_nbt/py/tag/array.cpp b/src/amulet_nbt/py/tag/array.cpp new file mode 100644 index 00000000..690e57e6 --- /dev/null +++ b/src/amulet_nbt/py/tag/array.cpp @@ -0,0 +1,130 @@ +#include +#include +#include + + +#define PyArray(CLSNAME, ELEMENTCLS, BITCOUNT, TAGID)\ + py::class_ CLSNAME(m, #CLSNAME, py::buffer_protocol(),\ + "This class stores a fixed size signed "#BITCOUNT" bit vector."\ + );\ + CLSNAME.def(\ + py::init([](py::object value) {\ + /* Is there a better way to do this? */\ + auto v = value.cast> ();\ + Amulet::CLSNAME tag(v.begin(), v.end());\ + std::shared_ptr tag_ptr = std::make_shared(tag);\ + return Amulet::CLSNAME##Wrapper(tag_ptr);\ + }),\ + py::arg("value"),\ + py::doc("__init__(self: amulet_nbt."#CLSNAME", value: collections.abc.Iterable[typing.SupportsInt]) -> None")\ + );\ + CLSNAME.def_buffer(\ + [](Amulet::CLSNAME##Wrapper& self) -> py::buffer_info {\ + return py::buffer_info(\ + self.tag->data(),\ + sizeof(Amulet::ELEMENTCLS),\ + py::format_descriptor::format(),\ + 1,\ + {self.tag->size()},\ + {sizeof(Amulet::ELEMENTCLS)}\ + );\ + }\ + );\ + CLSNAME.def_property_readonly(\ + "np_array",\ + [asarray](const Amulet::CLSNAME##Wrapper& self){\ + return asarray(self);\ + },\ + py::doc(\ + "A numpy array holding the same internal data.\n"\ + "\n"\ + "Changes to the array will also modify the internal state."\ + )\ + );\ + CLSNAME.def_property_readonly(\ + "py_data",\ + [asarray](const Amulet::CLSNAME##Wrapper& self){\ + return asarray(self);\ + },\ + py::doc(\ + "A python representation of the class. Note that the return type is undefined and may change in the future.\n"\ + "\n"\ + "You would be better off using the py_{type} or np_array properties if you require a fixed type.\n"\ + "This is here for convenience to get a python representation under the same property name.\n"\ + )\ + );\ + CLSNAME.def(\ + "__repr__",\ + [](const Amulet::CLSNAME##Wrapper& self){\ + std::string out = #CLSNAME "([";\ + for (size_t i = 0; i < self.tag->size(); i++){\ + if (i){\ + out += ", ";\ + };\ + out += std::to_string((*self.tag)[i]);\ + };\ + out += "])";\ + return out;\ + }\ + );\ + CLSNAME.def(\ + "__str__",\ + [](const Amulet::CLSNAME##Wrapper& self){\ + std::string out = "[";\ + for (size_t i = 0; i < self.tag->size(); i++){\ + if (i){\ + out += ", ";\ + };\ + out += std::to_string((*self.tag)[i]);\ + };\ + out += "]";\ + return out;\ + }\ + );\ + CLSNAME.def(\ + "__eq__",\ + [](const Amulet::CLSNAME##Wrapper& self, const Amulet::CLSNAME##Wrapper& other){\ + return *self.tag == *other.tag;\ + },\ + py::is_operator()\ + );\ + CLSNAME.def(\ + "__len__",\ + [](const Amulet::CLSNAME##Wrapper& self){\ + return self.tag->size();\ + }\ + );\ + CLSNAME.def(\ + "__iter__",\ + [](const Amulet::CLSNAME##Wrapper& self) {return py::make_iterator(self.tag->begin(), self.tag->end());},\ + py::keep_alive<0, 1>() /* Essential: keep object alive while iterator exists */);\ + CLSNAME.def(\ + "__reversed__",\ + [](const Amulet::CLSNAME##Wrapper& self) {return py::make_iterator(self.tag->rbegin(), self.tag->rend());},\ + py::keep_alive<0, 1>() /* Essential: keep object alive while iterator exists */);\ + CLSNAME.def(\ + "__getitem__",\ + [asarray](const Amulet::CLSNAME##Wrapper& self, py::object item){\ + return asarray(self)[item];\ + }\ + );\ + CLSNAME.def(\ + "__setitem__",\ + [asarray](const Amulet::CLSNAME##Wrapper& self, py::object item, py::object value){\ + asarray(self)[item] = value;\ + }\ + );\ + CLSNAME.def(\ + "__contains__",\ + [asarray](const Amulet::CLSNAME##Wrapper& self, py::object value){\ + asarray(self).contains(value);\ + }\ + ); + + +void init_array(py::module& m) { + py::object asarray = py::module_::import("numpy").attr("asarray"); + PyArray(ByteArrayTag, ByteTag, 8, 7) + PyArray(IntArrayTag, IntTag, 32, 11) + PyArray(LongArrayTag, LongTag, 64, 12) +}; From 018e8dc5d918adbd84bf34e7142ba493fa81d40d Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 21 Jun 2024 09:27:15 +0100 Subject: [PATCH 012/121] Add pybind11 module --- src/amulet_nbt/py/amulet_nbt.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/amulet_nbt/py/amulet_nbt.cpp diff --git a/src/amulet_nbt/py/amulet_nbt.cpp b/src/amulet_nbt/py/amulet_nbt.cpp new file mode 100644 index 00000000..f9efd0da --- /dev/null +++ b/src/amulet_nbt/py/amulet_nbt.cpp @@ -0,0 +1,16 @@ +#include + +void init_abc(py::module&); +void init_int(py::module&); +void init_float(py::module&); +void init_string(py::module&); +void init_array(py::module&); + + +PYBIND11_MODULE(_nbt, m) { + init_abc(m); + init_int(m); + init_float(m); + init_string(m); + init_array(m); +} From 29b73534b4ca64fb14e7975ce64922794196917f Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 21 Jun 2024 09:28:18 +0100 Subject: [PATCH 013/121] Add common header --- src/amulet_nbt/include/amulet_nbt/common.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 src/amulet_nbt/include/amulet_nbt/common.hpp diff --git a/src/amulet_nbt/include/amulet_nbt/common.hpp b/src/amulet_nbt/include/amulet_nbt/common.hpp new file mode 100644 index 00000000..39e45f0a --- /dev/null +++ b/src/amulet_nbt/include/amulet_nbt/common.hpp @@ -0,0 +1,10 @@ +#pragma once + +#define PYBIND11_DETAILED_ERROR_MESSAGES + +#include +#include +#include +#include + +namespace py = pybind11; From bae8f2ca86ea48cdd7b36c2e0f1297dd900baf91 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 21 Jun 2024 09:55:38 +0100 Subject: [PATCH 014/121] Renamed list tag types --- src/amulet_nbt/include/amulet_nbt/tag/nbt.hpp | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/amulet_nbt/include/amulet_nbt/tag/nbt.hpp b/src/amulet_nbt/include/amulet_nbt/tag/nbt.hpp index 332ed404..7e50885a 100644 --- a/src/amulet_nbt/include/amulet_nbt/tag/nbt.hpp +++ b/src/amulet_nbt/include/amulet_nbt/tag/nbt.hpp @@ -31,33 +31,33 @@ namespace Amulet { typedef std::shared_ptr LongArrayTagPtr; // List types - typedef std::vector ByteList; - typedef std::vector ShortList; - typedef std::vector IntList; - typedef std::vector LongList; - typedef std::vector FloatList; - typedef std::vector DoubleList; - typedef std::vector ByteArrayList; - typedef std::vector StringList; - typedef std::vector ListList; - typedef std::vector CompoundList; - typedef std::vector IntArrayList; - typedef std::vector LongArrayList; + typedef std::vector ByteListTag; + typedef std::vector ShortListTag; + typedef std::vector IntListTag; + typedef std::vector LongListTag; + typedef std::vector FloatListTag; + typedef std::vector DoubleListTag; + typedef std::vector ByteArrayListTag; + typedef std::vector StringListTag; + typedef std::vector ListListTag; + typedef std::vector CompoundListTag; + typedef std::vector IntArrayListTag; + typedef std::vector LongArrayListTag; class ListTag : public std::variant< std::monostate, - ByteList, - ShortList, - IntList, - LongList, - FloatList, - DoubleList, - ByteArrayList, - StringList, - ListList, - CompoundList, - IntArrayList, - LongArrayList + ByteListTag, + ShortListTag, + IntListTag, + LongListTag, + FloatListTag, + DoubleListTag, + ByteArrayListTag, + StringListTag, + ListListTag, + CompoundListTag, + IntArrayListTag, + LongArrayListTag > { using variant::variant; }; From 6e2fa1b8e48a4450b8624c410540d08dbecf0a3e Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 28 Jun 2024 09:54:59 +0100 Subject: [PATCH 015/121] Remove cython files from manifest.in --- MANIFEST.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MANIFEST.in b/MANIFEST.in index a57f6b52..ba5807f1 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1 +1 @@ -recursive-include src *.pyi py.typed *.py *.pyx *.pxd *.cpp *.hpp +recursive-include src *.pyi py.typed *.py *.cpp *.hpp From 2dec6524a41946dc9509e4b24422287c9c12f17a Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 28 Jun 2024 09:56:47 +0100 Subject: [PATCH 016/121] Refactored setup.py --- setup.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/setup.py b/setup.py index 9f552082..8543173e 100644 --- a/setup.py +++ b/setup.py @@ -21,15 +21,20 @@ setup( version=versioneer.get_version(), cmdclass=versioneer.get_cmdclass(), - include_dirs=["src/amulet_nbt/include", numpy.get_include(), pybind11.get_include()], + libraries=[ + ( + "amulet_nbt", dict( + sources=glob.glob("src/amulet_nbt/cpp/**/*.cpp", recursive=True), + include_dirs=["src/amulet_nbt/include"], + cflags=CompileArgs, + )) + ], ext_modules=[ Extension( name="amulet_nbt._nbt", - sources=[ - *glob.glob("src/amulet_nbt/py/**/*.cpp", recursive=True), - # TODO: The following should be moved to a dynamic library. - *glob.glob("src/amulet_nbt/cpp/**/*.cpp", recursive=True) - ], + sources=glob.glob("src/amulet_nbt/pybind/**/*.cpp", recursive=True), + include_dirs=["src/amulet_nbt/include", numpy.get_include(), pybind11.get_include()], + libraries=["amulet_nbt"], extra_compile_args=CompileArgs ) ] From 1cf80e93742d50ae1beea087519e4e6ea6a37ca5 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 28 Jun 2024 09:58:22 +0100 Subject: [PATCH 017/121] Move cython implementation --- src/amulet_nbt/_tag/_cpp/__init__.pxd | 39 - src/amulet_nbt/_tag/_cpp/array.pxd | 86 - src/amulet_nbt/_tag/_cpp/nbt.pxd | 60 - {src => src_}/amulet_nbt/__init__.pyx | 0 {src => src_}/amulet_nbt/_errors.pyx | 0 {src => src_}/amulet_nbt/_libcpp/__init__.pxd | 0 {src => src_}/amulet_nbt/_libcpp/endian.pxd | 0 {src => src_}/amulet_nbt/_libcpp/variant.pxd | 0 .../amulet_nbt/_nbt_encoding/__init__.pxd | 0 .../amulet_nbt/_nbt_encoding/__init__.pyx | 0 .../_nbt_encoding/_binary/__init__.pxd | 0 .../_nbt_encoding/_binary/__init__.py | 0 .../_nbt_encoding/_binary/_cpp/__init__.pxd | 0 .../_binary/_cpp/_binary/reader.hpp | 0 .../_binary/_cpp/_binary/writer.hpp | 0 .../_nbt_encoding/_binary/_cpp/read_nbt.cpp | 0 .../_nbt_encoding/_binary/_cpp/read_nbt.hpp | 0 .../_nbt_encoding/_binary/_cpp/read_nbt.pxd | 0 .../_nbt_encoding/_binary/_cpp/write_nbt.hpp | 0 .../_nbt_encoding/_binary/_cpp/write_nbt.pxd | 0 .../_nbt_encoding/_binary/encoding_preset.pxd | 0 .../_nbt_encoding/_binary/encoding_preset.pyx | 0 .../amulet_nbt/_nbt_encoding/_binary/read.pxd | 0 .../amulet_nbt/_nbt_encoding/_binary/read.pyx | 0 .../_nbt_encoding/_string/__init__.pxd | 0 .../_nbt_encoding/_string/__init__.py | 0 .../_nbt_encoding/_string/_cpp/__init__.pxd | 0 .../_nbt_encoding/_string/_cpp/write_snbt.hpp | 0 .../_nbt_encoding/_string/_cpp/write_snbt.pxd | 0 .../_nbt_encoding/_string/read_snbt.pyx | 0 src_/amulet_nbt/_string_encoding/__init__.cpp | 4418 +++++++++ .../amulet_nbt/_string_encoding/__init__.pxd | 0 .../amulet_nbt/_string_encoding/__init__.pyx | 0 .../_string_encoding/_cpp/__init__.pxd | 0 .../_string_encoding/_cpp/mutf8.cpp | 0 .../_string_encoding/_cpp/mutf8.hpp | 0 .../_string_encoding/_cpp/mutf8.pxd | 0 .../_string_encoding/_cpp/notes.txt | 0 .../amulet_nbt/_string_encoding/_cpp/utf8.cpp | 0 .../amulet_nbt/_string_encoding/_cpp/utf8.hpp | 0 .../amulet_nbt/_string_encoding/_cpp/utf8.pxd | 0 src_/amulet_nbt/_string_encoding/encoding.cpp | 8574 +++++++++++++++++ .../amulet_nbt/_string_encoding/encoding.pxd | 0 .../amulet_nbt/_string_encoding/encoding.pyx | 0 {src => src_}/amulet_nbt/_tag/__init__.pyx | 0 {src => src_}/amulet_nbt/_tag/abc.pxd | 0 {src => src_}/amulet_nbt/_tag/abc.pyx | 0 {src => src_}/amulet_nbt/_tag/array.pxd | 0 {src => src_}/amulet_nbt/_tag/array.pyx | 0 {src => src_}/amulet_nbt/_tag/array.pyx.tp | 0 {src => src_}/amulet_nbt/_tag/compound.pxd | 0 {src => src_}/amulet_nbt/_tag/compound.pyx | 0 {src => src_}/amulet_nbt/_tag/compound.pyx.tp | 0 {src => src_}/amulet_nbt/_tag/deepcopy.pxd | 0 {src => src_}/amulet_nbt/_tag/deepcopy.pyx | 0 {src => src_}/amulet_nbt/_tag/float.pxd | 0 {src => src_}/amulet_nbt/_tag/float.pyx | 0 {src => src_}/amulet_nbt/_tag/float.pyx.tp | 0 {src => src_}/amulet_nbt/_tag/int.pxd | 0 {src => src_}/amulet_nbt/_tag/int.pyx | 0 {src => src_}/amulet_nbt/_tag/int.pyx.tp | 0 {src => src_}/amulet_nbt/_tag/list.pxd | 0 {src => src_}/amulet_nbt/_tag/list.pyx | 463 - {src => src_}/amulet_nbt/_tag/list.pyx.tp | 0 {src => src_}/amulet_nbt/_tag/named_tag.pxd | 0 {src => src_}/amulet_nbt/_tag/named_tag.pyx | 0 .../amulet_nbt/_tag/named_tag.pyx.tp | 0 {src => src_}/amulet_nbt/_tag/numeric.pxd | 0 {src => src_}/amulet_nbt/_tag/numeric.pyx | 0 {src => src_}/amulet_nbt/_tag/string.pxd | 0 {src => src_}/amulet_nbt/_tag/string.pyx | 0 {src => src_}/amulet_nbt/_tag/string.pyx.tp | 0 {src => src_}/amulet_nbt/tpf/ArrayTag.pyx.tpf | 0 .../amulet_nbt/tpf/Comparison.pyx.tpf | 0 .../tpf/CompoundGetSetdefault.pyx.tpf | 0 {src => src_}/amulet_nbt/tpf/FloatTag.pyx.tpf | 0 .../amulet_nbt/tpf/ImmutableTag.pyx.tpf | 0 {src => src_}/amulet_nbt/tpf/IntTag.pyx.tpf | 0 {src => src_}/amulet_nbt/tpf/ListGet.pyx.tpf | 0 .../amulet_nbt/tpf/NamedTagGet.pyx.tpf | 0 .../amulet_nbt/tpf/NumericTag.pyx.tpf | 0 {src => src_}/amulet_nbt/tpf/to_snbt.pyx.tpf | 0 .../amulet_nbt/tpf/to_snbt_multiline.pyx.tpf | 0 83 files changed, 12992 insertions(+), 648 deletions(-) delete mode 100644 src/amulet_nbt/_tag/_cpp/__init__.pxd delete mode 100644 src/amulet_nbt/_tag/_cpp/array.pxd delete mode 100644 src/amulet_nbt/_tag/_cpp/nbt.pxd rename {src => src_}/amulet_nbt/__init__.pyx (100%) rename {src => src_}/amulet_nbt/_errors.pyx (100%) rename {src => src_}/amulet_nbt/_libcpp/__init__.pxd (100%) rename {src => src_}/amulet_nbt/_libcpp/endian.pxd (100%) rename {src => src_}/amulet_nbt/_libcpp/variant.pxd (100%) rename {src => src_}/amulet_nbt/_nbt_encoding/__init__.pxd (100%) rename {src => src_}/amulet_nbt/_nbt_encoding/__init__.pyx (100%) rename {src => src_}/amulet_nbt/_nbt_encoding/_binary/__init__.pxd (100%) rename {src => src_}/amulet_nbt/_nbt_encoding/_binary/__init__.py (100%) rename {src => src_}/amulet_nbt/_nbt_encoding/_binary/_cpp/__init__.pxd (100%) rename {src => src_}/amulet_nbt/_nbt_encoding/_binary/_cpp/_binary/reader.hpp (100%) rename {src => src_}/amulet_nbt/_nbt_encoding/_binary/_cpp/_binary/writer.hpp (100%) rename {src => src_}/amulet_nbt/_nbt_encoding/_binary/_cpp/read_nbt.cpp (100%) rename {src => src_}/amulet_nbt/_nbt_encoding/_binary/_cpp/read_nbt.hpp (100%) rename {src => src_}/amulet_nbt/_nbt_encoding/_binary/_cpp/read_nbt.pxd (100%) rename {src => src_}/amulet_nbt/_nbt_encoding/_binary/_cpp/write_nbt.hpp (100%) rename {src => src_}/amulet_nbt/_nbt_encoding/_binary/_cpp/write_nbt.pxd (100%) rename {src => src_}/amulet_nbt/_nbt_encoding/_binary/encoding_preset.pxd (100%) rename {src => src_}/amulet_nbt/_nbt_encoding/_binary/encoding_preset.pyx (100%) rename {src => src_}/amulet_nbt/_nbt_encoding/_binary/read.pxd (100%) rename {src => src_}/amulet_nbt/_nbt_encoding/_binary/read.pyx (100%) rename {src => src_}/amulet_nbt/_nbt_encoding/_string/__init__.pxd (100%) rename {src => src_}/amulet_nbt/_nbt_encoding/_string/__init__.py (100%) rename {src => src_}/amulet_nbt/_nbt_encoding/_string/_cpp/__init__.pxd (100%) rename {src => src_}/amulet_nbt/_nbt_encoding/_string/_cpp/write_snbt.hpp (100%) rename {src => src_}/amulet_nbt/_nbt_encoding/_string/_cpp/write_snbt.pxd (100%) rename {src => src_}/amulet_nbt/_nbt_encoding/_string/read_snbt.pyx (100%) create mode 100644 src_/amulet_nbt/_string_encoding/__init__.cpp rename {src => src_}/amulet_nbt/_string_encoding/__init__.pxd (100%) rename {src => src_}/amulet_nbt/_string_encoding/__init__.pyx (100%) rename {src => src_}/amulet_nbt/_string_encoding/_cpp/__init__.pxd (100%) rename {src => src_}/amulet_nbt/_string_encoding/_cpp/mutf8.cpp (100%) rename {src => src_}/amulet_nbt/_string_encoding/_cpp/mutf8.hpp (100%) rename {src => src_}/amulet_nbt/_string_encoding/_cpp/mutf8.pxd (100%) rename {src => src_}/amulet_nbt/_string_encoding/_cpp/notes.txt (100%) rename {src => src_}/amulet_nbt/_string_encoding/_cpp/utf8.cpp (100%) rename {src => src_}/amulet_nbt/_string_encoding/_cpp/utf8.hpp (100%) rename {src => src_}/amulet_nbt/_string_encoding/_cpp/utf8.pxd (100%) create mode 100644 src_/amulet_nbt/_string_encoding/encoding.cpp rename {src => src_}/amulet_nbt/_string_encoding/encoding.pxd (100%) rename {src => src_}/amulet_nbt/_string_encoding/encoding.pyx (100%) rename {src => src_}/amulet_nbt/_tag/__init__.pyx (100%) rename {src => src_}/amulet_nbt/_tag/abc.pxd (100%) rename {src => src_}/amulet_nbt/_tag/abc.pyx (100%) rename {src => src_}/amulet_nbt/_tag/array.pxd (100%) rename {src => src_}/amulet_nbt/_tag/array.pyx (100%) rename {src => src_}/amulet_nbt/_tag/array.pyx.tp (100%) rename {src => src_}/amulet_nbt/_tag/compound.pxd (100%) rename {src => src_}/amulet_nbt/_tag/compound.pyx (100%) rename {src => src_}/amulet_nbt/_tag/compound.pyx.tp (100%) rename {src => src_}/amulet_nbt/_tag/deepcopy.pxd (100%) rename {src => src_}/amulet_nbt/_tag/deepcopy.pyx (100%) rename {src => src_}/amulet_nbt/_tag/float.pxd (100%) rename {src => src_}/amulet_nbt/_tag/float.pyx (100%) rename {src => src_}/amulet_nbt/_tag/float.pyx.tp (100%) rename {src => src_}/amulet_nbt/_tag/int.pxd (100%) rename {src => src_}/amulet_nbt/_tag/int.pyx (100%) rename {src => src_}/amulet_nbt/_tag/int.pyx.tp (100%) rename {src => src_}/amulet_nbt/_tag/list.pxd (100%) rename {src => src_}/amulet_nbt/_tag/list.pyx (84%) rename {src => src_}/amulet_nbt/_tag/list.pyx.tp (100%) rename {src => src_}/amulet_nbt/_tag/named_tag.pxd (100%) rename {src => src_}/amulet_nbt/_tag/named_tag.pyx (100%) rename {src => src_}/amulet_nbt/_tag/named_tag.pyx.tp (100%) rename {src => src_}/amulet_nbt/_tag/numeric.pxd (100%) rename {src => src_}/amulet_nbt/_tag/numeric.pyx (100%) rename {src => src_}/amulet_nbt/_tag/string.pxd (100%) rename {src => src_}/amulet_nbt/_tag/string.pyx (100%) rename {src => src_}/amulet_nbt/_tag/string.pyx.tp (100%) rename {src => src_}/amulet_nbt/tpf/ArrayTag.pyx.tpf (100%) rename {src => src_}/amulet_nbt/tpf/Comparison.pyx.tpf (100%) rename {src => src_}/amulet_nbt/tpf/CompoundGetSetdefault.pyx.tpf (100%) rename {src => src_}/amulet_nbt/tpf/FloatTag.pyx.tpf (100%) rename {src => src_}/amulet_nbt/tpf/ImmutableTag.pyx.tpf (100%) rename {src => src_}/amulet_nbt/tpf/IntTag.pyx.tpf (100%) rename {src => src_}/amulet_nbt/tpf/ListGet.pyx.tpf (100%) rename {src => src_}/amulet_nbt/tpf/NamedTagGet.pyx.tpf (100%) rename {src => src_}/amulet_nbt/tpf/NumericTag.pyx.tpf (100%) rename {src => src_}/amulet_nbt/tpf/to_snbt.pyx.tpf (100%) rename {src => src_}/amulet_nbt/tpf/to_snbt_multiline.pyx.tpf (100%) diff --git a/src/amulet_nbt/_tag/_cpp/__init__.pxd b/src/amulet_nbt/_tag/_cpp/__init__.pxd deleted file mode 100644 index 32eaea64..00000000 --- a/src/amulet_nbt/_tag/_cpp/__init__.pxd +++ /dev/null @@ -1,39 +0,0 @@ -# cython: language_level=3, boundscheck=False, wraparound=False -# distutils: language = c++ -# distutils: extra_compile_args = CPPCARGS - - -from amulet_nbt._tag._cpp.nbt cimport ( - TagNode, - CByteTag, - CShortTag, - CIntTag, - CLongTag, - CFloatTag, - CDoubleTag, - CStringTag, - CListTag, - CCompoundTag, - CByteArrayTag, - CIntArrayTag, - CLongArrayTag, - CListTagPtr, - CCompoundTagPtr, - CByteArrayTagPtr, - CIntArrayTagPtr, - CLongArrayTagPtr, - CByteList, - CShortList, - CIntList, - CLongList, - CFloatList, - CDoubleList, - CByteArrayList, - CStringList, - CListList, - CCompoundList, - CIntArrayList, - CLongArrayList, -) - -from amulet_nbt._tag._cpp.array cimport Array diff --git a/src/amulet_nbt/_tag/_cpp/array.pxd b/src/amulet_nbt/_tag/_cpp/array.pxd deleted file mode 100644 index a130528f..00000000 --- a/src/amulet_nbt/_tag/_cpp/array.pxd +++ /dev/null @@ -1,86 +0,0 @@ -cdef extern from "array.hpp" nogil: - cdef cppclass Array[T]: - ctypedef T value_type - - ctypedef size_t size_type - ctypedef ptrdiff_t difference_type - - cppclass iterator: - T& operator *() - iterator operator++() - iterator operator--() - iterator operator+(size_type) - iterator operator-(size_type) - difference_type operator-(iterator) - bint operator ==(iterator) - bint operator !=(iterator) - bint operator <(iterator) - bint operator >(iterator) - bint operator <=(iterator) - bint operator >=(iterator) - cppclass const_iterator(iterator): - pass - cppclass reverse_iterator: - T& operator *() - reverse_iterator operator++() - reverse_iterator operator--() - reverse_iterator operator+(size_type) - reverse_iterator operator-(size_type) - difference_type operator-(reverse_iterator) - bint operator ==(reverse_iterator) - bint operator !=(reverse_iterator) - bint operator <(reverse_iterator) - bint operator >(reverse_iterator) - bint operator <=(reverse_iterator) - bint operator >=(reverse_iterator) - cppclass const_reverse_iterator(reverse_iterator): - pass - Array() except + - Array(Array &) except + - Array(size_type) except + - Array(size_type, T &) except + - #Array[InputIt](InputIt, InputIt) - T& operator[](size_type) - #Array& operator=(Array&) - bint operator ==(Array &, Array &) - bint operator !=(Array &, Array &) - bint operator <(Array &, Array &) - bint operator >(Array &, Array &) - bint operator <=(Array &, Array &) - bint operator >=(Array &, Array &) - # void assign(size_type, const T&) - # void assign[InputIt](InputIt, InputIt) except + - T& at(size_type) except + - T& back() - iterator begin() - const_iterator const_begin "begin"() - # size_type capacity() - # void clear() - bint empty() - iterator end() - const_iterator const_end "end"() - # iterator erase(iterator) - # iterator erase(iterator, iterator) - T& front() - # iterator insert(iterator, const T&) except + - # iterator insert(iterator, size_type, const T&) except + - # iterator insert[InputIt](iterator, InputIt, InputIt) except + - size_type max_size() - # void pop_back() - # void push_back(T&) except + - # reverse_iterator rbegin() - # const_reverse_iterator const_rbegin "crbegin"() - # reverse_iterator rend() - # const_reverse_iterator const_rend "crend"() - # void reserve(size_type) except + - # void resize(size_type) except + - # void resize(size_type, T&) except + - size_type size() - # void swap(Array&) - - # C++11 methods - T * data() - const T * const_data "data"() - # void shrink_to_fit() except + - # iterator emplace(const_iterator, ...) except + - # T& emplace_back(...) except + diff --git a/src/amulet_nbt/_tag/_cpp/nbt.pxd b/src/amulet_nbt/_tag/_cpp/nbt.pxd deleted file mode 100644 index f5d66ef9..00000000 --- a/src/amulet_nbt/_tag/_cpp/nbt.pxd +++ /dev/null @@ -1,60 +0,0 @@ -# cython: language_level=3, boundscheck=False, wraparound=False -# distutils: language = c++ -# distutils: extra_compile_args = CPPCARGS - -from libc.stdint cimport ( - int8_t, - int16_t, - int32_t, - int64_t -) -from libcpp.string cimport string -from libcpp.memory cimport shared_ptr -from libcpp.unordered_map cimport unordered_map -from libcpp.vector cimport vector -from amulet_nbt._libcpp.variant cimport variant -from .array cimport Array - - -cdef extern from "nbt.hpp" nogil: - # Node variant - ctypedef variant TagNode "TagNode" - - # Base types - ctypedef int8_t CByteTag - ctypedef int16_t CShortTag - ctypedef int32_t CIntTag - ctypedef int64_t CLongTag - ctypedef float CFloatTag; - ctypedef double CDoubleTag - ctypedef Array[CByteTag] CByteArrayTag - ctypedef string CStringTag - cdef cppclass CListTag(variant): - pass - cdef cppclass CCompoundTag(unordered_map[string, TagNode]): - CCompoundTag() except + - CCompoundTag(CCompoundTag &) except + - size_t erase(string &) - ctypedef Array[CIntTag] CIntArrayTag - ctypedef Array[CLongTag] CLongArrayTag - - # Pointer types - ctypedef shared_ptr[CListTag] CListTagPtr - ctypedef shared_ptr[CCompoundTag] CCompoundTagPtr - ctypedef shared_ptr[CByteArrayTag] CByteArrayTagPtr - ctypedef shared_ptr[CIntArrayTag] CIntArrayTagPtr - ctypedef shared_ptr[CLongArrayTag] CLongArrayTagPtr - - # List types - ctypedef vector[CByteTag] CByteList - ctypedef vector[CShortTag] CShortList - ctypedef vector[CIntTag] CIntList - ctypedef vector[CLongTag] CLongList - ctypedef vector[CFloatTag] CFloatList - ctypedef vector[CDoubleTag] CDoubleList - ctypedef vector[CByteArrayTagPtr] CByteArrayList - ctypedef vector[CStringTag] CStringList - ctypedef vector[CListTagPtr] CListList - ctypedef vector[CCompoundTagPtr] CCompoundList - ctypedef vector[CIntArrayTagPtr] CIntArrayList - ctypedef vector[CLongArrayTagPtr] CLongArrayList diff --git a/src/amulet_nbt/__init__.pyx b/src_/amulet_nbt/__init__.pyx similarity index 100% rename from src/amulet_nbt/__init__.pyx rename to src_/amulet_nbt/__init__.pyx diff --git a/src/amulet_nbt/_errors.pyx b/src_/amulet_nbt/_errors.pyx similarity index 100% rename from src/amulet_nbt/_errors.pyx rename to src_/amulet_nbt/_errors.pyx diff --git a/src/amulet_nbt/_libcpp/__init__.pxd b/src_/amulet_nbt/_libcpp/__init__.pxd similarity index 100% rename from src/amulet_nbt/_libcpp/__init__.pxd rename to src_/amulet_nbt/_libcpp/__init__.pxd diff --git a/src/amulet_nbt/_libcpp/endian.pxd b/src_/amulet_nbt/_libcpp/endian.pxd similarity index 100% rename from src/amulet_nbt/_libcpp/endian.pxd rename to src_/amulet_nbt/_libcpp/endian.pxd diff --git a/src/amulet_nbt/_libcpp/variant.pxd b/src_/amulet_nbt/_libcpp/variant.pxd similarity index 100% rename from src/amulet_nbt/_libcpp/variant.pxd rename to src_/amulet_nbt/_libcpp/variant.pxd diff --git a/src/amulet_nbt/_nbt_encoding/__init__.pxd b/src_/amulet_nbt/_nbt_encoding/__init__.pxd similarity index 100% rename from src/amulet_nbt/_nbt_encoding/__init__.pxd rename to src_/amulet_nbt/_nbt_encoding/__init__.pxd diff --git a/src/amulet_nbt/_nbt_encoding/__init__.pyx b/src_/amulet_nbt/_nbt_encoding/__init__.pyx similarity index 100% rename from src/amulet_nbt/_nbt_encoding/__init__.pyx rename to src_/amulet_nbt/_nbt_encoding/__init__.pyx diff --git a/src/amulet_nbt/_nbt_encoding/_binary/__init__.pxd b/src_/amulet_nbt/_nbt_encoding/_binary/__init__.pxd similarity index 100% rename from src/amulet_nbt/_nbt_encoding/_binary/__init__.pxd rename to src_/amulet_nbt/_nbt_encoding/_binary/__init__.pxd diff --git a/src/amulet_nbt/_nbt_encoding/_binary/__init__.py b/src_/amulet_nbt/_nbt_encoding/_binary/__init__.py similarity index 100% rename from src/amulet_nbt/_nbt_encoding/_binary/__init__.py rename to src_/amulet_nbt/_nbt_encoding/_binary/__init__.py diff --git a/src/amulet_nbt/_nbt_encoding/_binary/_cpp/__init__.pxd b/src_/amulet_nbt/_nbt_encoding/_binary/_cpp/__init__.pxd similarity index 100% rename from src/amulet_nbt/_nbt_encoding/_binary/_cpp/__init__.pxd rename to src_/amulet_nbt/_nbt_encoding/_binary/_cpp/__init__.pxd diff --git a/src/amulet_nbt/_nbt_encoding/_binary/_cpp/_binary/reader.hpp b/src_/amulet_nbt/_nbt_encoding/_binary/_cpp/_binary/reader.hpp similarity index 100% rename from src/amulet_nbt/_nbt_encoding/_binary/_cpp/_binary/reader.hpp rename to src_/amulet_nbt/_nbt_encoding/_binary/_cpp/_binary/reader.hpp diff --git a/src/amulet_nbt/_nbt_encoding/_binary/_cpp/_binary/writer.hpp b/src_/amulet_nbt/_nbt_encoding/_binary/_cpp/_binary/writer.hpp similarity index 100% rename from src/amulet_nbt/_nbt_encoding/_binary/_cpp/_binary/writer.hpp rename to src_/amulet_nbt/_nbt_encoding/_binary/_cpp/_binary/writer.hpp diff --git a/src/amulet_nbt/_nbt_encoding/_binary/_cpp/read_nbt.cpp b/src_/amulet_nbt/_nbt_encoding/_binary/_cpp/read_nbt.cpp similarity index 100% rename from src/amulet_nbt/_nbt_encoding/_binary/_cpp/read_nbt.cpp rename to src_/amulet_nbt/_nbt_encoding/_binary/_cpp/read_nbt.cpp diff --git a/src/amulet_nbt/_nbt_encoding/_binary/_cpp/read_nbt.hpp b/src_/amulet_nbt/_nbt_encoding/_binary/_cpp/read_nbt.hpp similarity index 100% rename from src/amulet_nbt/_nbt_encoding/_binary/_cpp/read_nbt.hpp rename to src_/amulet_nbt/_nbt_encoding/_binary/_cpp/read_nbt.hpp diff --git a/src/amulet_nbt/_nbt_encoding/_binary/_cpp/read_nbt.pxd b/src_/amulet_nbt/_nbt_encoding/_binary/_cpp/read_nbt.pxd similarity index 100% rename from src/amulet_nbt/_nbt_encoding/_binary/_cpp/read_nbt.pxd rename to src_/amulet_nbt/_nbt_encoding/_binary/_cpp/read_nbt.pxd diff --git a/src/amulet_nbt/_nbt_encoding/_binary/_cpp/write_nbt.hpp b/src_/amulet_nbt/_nbt_encoding/_binary/_cpp/write_nbt.hpp similarity index 100% rename from src/amulet_nbt/_nbt_encoding/_binary/_cpp/write_nbt.hpp rename to src_/amulet_nbt/_nbt_encoding/_binary/_cpp/write_nbt.hpp diff --git a/src/amulet_nbt/_nbt_encoding/_binary/_cpp/write_nbt.pxd b/src_/amulet_nbt/_nbt_encoding/_binary/_cpp/write_nbt.pxd similarity index 100% rename from src/amulet_nbt/_nbt_encoding/_binary/_cpp/write_nbt.pxd rename to src_/amulet_nbt/_nbt_encoding/_binary/_cpp/write_nbt.pxd diff --git a/src/amulet_nbt/_nbt_encoding/_binary/encoding_preset.pxd b/src_/amulet_nbt/_nbt_encoding/_binary/encoding_preset.pxd similarity index 100% rename from src/amulet_nbt/_nbt_encoding/_binary/encoding_preset.pxd rename to src_/amulet_nbt/_nbt_encoding/_binary/encoding_preset.pxd diff --git a/src/amulet_nbt/_nbt_encoding/_binary/encoding_preset.pyx b/src_/amulet_nbt/_nbt_encoding/_binary/encoding_preset.pyx similarity index 100% rename from src/amulet_nbt/_nbt_encoding/_binary/encoding_preset.pyx rename to src_/amulet_nbt/_nbt_encoding/_binary/encoding_preset.pyx diff --git a/src/amulet_nbt/_nbt_encoding/_binary/read.pxd b/src_/amulet_nbt/_nbt_encoding/_binary/read.pxd similarity index 100% rename from src/amulet_nbt/_nbt_encoding/_binary/read.pxd rename to src_/amulet_nbt/_nbt_encoding/_binary/read.pxd diff --git a/src/amulet_nbt/_nbt_encoding/_binary/read.pyx b/src_/amulet_nbt/_nbt_encoding/_binary/read.pyx similarity index 100% rename from src/amulet_nbt/_nbt_encoding/_binary/read.pyx rename to src_/amulet_nbt/_nbt_encoding/_binary/read.pyx diff --git a/src/amulet_nbt/_nbt_encoding/_string/__init__.pxd b/src_/amulet_nbt/_nbt_encoding/_string/__init__.pxd similarity index 100% rename from src/amulet_nbt/_nbt_encoding/_string/__init__.pxd rename to src_/amulet_nbt/_nbt_encoding/_string/__init__.pxd diff --git a/src/amulet_nbt/_nbt_encoding/_string/__init__.py b/src_/amulet_nbt/_nbt_encoding/_string/__init__.py similarity index 100% rename from src/amulet_nbt/_nbt_encoding/_string/__init__.py rename to src_/amulet_nbt/_nbt_encoding/_string/__init__.py diff --git a/src/amulet_nbt/_nbt_encoding/_string/_cpp/__init__.pxd b/src_/amulet_nbt/_nbt_encoding/_string/_cpp/__init__.pxd similarity index 100% rename from src/amulet_nbt/_nbt_encoding/_string/_cpp/__init__.pxd rename to src_/amulet_nbt/_nbt_encoding/_string/_cpp/__init__.pxd diff --git a/src/amulet_nbt/_nbt_encoding/_string/_cpp/write_snbt.hpp b/src_/amulet_nbt/_nbt_encoding/_string/_cpp/write_snbt.hpp similarity index 100% rename from src/amulet_nbt/_nbt_encoding/_string/_cpp/write_snbt.hpp rename to src_/amulet_nbt/_nbt_encoding/_string/_cpp/write_snbt.hpp diff --git a/src/amulet_nbt/_nbt_encoding/_string/_cpp/write_snbt.pxd b/src_/amulet_nbt/_nbt_encoding/_string/_cpp/write_snbt.pxd similarity index 100% rename from src/amulet_nbt/_nbt_encoding/_string/_cpp/write_snbt.pxd rename to src_/amulet_nbt/_nbt_encoding/_string/_cpp/write_snbt.pxd diff --git a/src/amulet_nbt/_nbt_encoding/_string/read_snbt.pyx b/src_/amulet_nbt/_nbt_encoding/_string/read_snbt.pyx similarity index 100% rename from src/amulet_nbt/_nbt_encoding/_string/read_snbt.pyx rename to src_/amulet_nbt/_nbt_encoding/_string/read_snbt.pyx diff --git a/src_/amulet_nbt/_string_encoding/__init__.cpp b/src_/amulet_nbt/_string_encoding/__init__.cpp new file mode 100644 index 00000000..84e3aed4 --- /dev/null +++ b/src_/amulet_nbt/_string_encoding/__init__.cpp @@ -0,0 +1,4418 @@ +/* Generated by Cython 3.0.8 */ + +/* BEGIN: Cython Metadata +{ + "distutils": { + "depends": [], + "extra_compile_args": [ + "/std:c++20" + ], + "language": "c++", + "name": "amulet_nbt._string_encoding.__init__", + "sources": [ + "src\\amulet_nbt\\_string_encoding\\__init__.pyx" + ] + }, + "module_name": "amulet_nbt._string_encoding.__init__" +} +END: Cython Metadata */ + +#ifndef PY_SSIZE_T_CLEAN +#define PY_SSIZE_T_CLEAN +#endif /* PY_SSIZE_T_CLEAN */ +#if defined(CYTHON_LIMITED_API) && 0 + #ifndef Py_LIMITED_API + #if CYTHON_LIMITED_API+0 > 0x03030000 + #define Py_LIMITED_API CYTHON_LIMITED_API + #else + #define Py_LIMITED_API 0x03030000 + #endif + #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 < 0x02070000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) + #error Cython requires Python 2.7+ or Python 3.3+. +#else +#if defined(CYTHON_LIMITED_API) && CYTHON_LIMITED_API +#define __PYX_EXTRA_ABI_MODULE_NAME "limited" +#else +#define __PYX_EXTRA_ABI_MODULE_NAME "" +#endif +#define CYTHON_ABI "3_0_8" __PYX_EXTRA_ABI_MODULE_NAME +#define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI +#define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." +#define CYTHON_HEX_VERSION 0x030008F0 +#define CYTHON_FUTURE_DIVISION 1 +#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 HAVE_LONG_LONG + #define HAVE_LONG_LONG +#endif +#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_NOGIL 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 + #if PY_VERSION_HEX < 0x03050000 + #undef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 0 + #elif !defined(CYTHON_USE_ASYNC_SLOTS) + #define CYTHON_USE_ASYNC_SLOTS 1 + #endif + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #undef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 1 + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_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 (PY_MAJOR_VERSION >= 3) + #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_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 + #endif +#elif defined(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_NOGIL 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #ifndef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #endif + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #if PY_VERSION_HEX < 0x03050000 + #undef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 0 + #elif !defined(CYTHON_USE_ASYNC_SLOTS) + #define CYTHON_USE_ASYNC_SLOTS 1 + #endif + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #undef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 1 + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_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 (PY_MAJOR_VERSION >= 3) + #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_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1 && PYPY_VERSION_NUM >= 0x07030C00) + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 + #endif +#elif defined(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_NOGIL 0 + #undef CYTHON_CLINE_IN_TRACEBACK + #define CYTHON_CLINE_IN_TRACEBACK 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_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 0 + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #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 + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_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 0 + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 1 + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #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 +#elif defined(Py_GIL_DISABLED) || defined(Py_NOGIL) + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_NOGIL 1 + #ifndef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 1 + #endif + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #ifndef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 1 + #endif + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #ifndef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 1 + #endif + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #ifndef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 0 + #endif + #ifndef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 1 + #endif + #ifndef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 1 + #endif + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 1 + #endif + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 +#else + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_CPYTHON 1 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_NOGIL 0 + #ifndef 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 + #if PY_MAJOR_VERSION < 3 + #undef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 0 + #elif !defined(CYTHON_USE_ASYNC_SLOTS) + #define CYTHON_USE_ASYNC_SLOTS 1 + #endif + #ifndef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 1 + #endif + #ifndef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 1 + #endif + #ifndef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 1 + #endif + #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #elif !defined(CYTHON_USE_UNICODE_WRITER) + #define CYTHON_USE_UNICODE_WRITER 1 + #endif + #ifndef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 0 + #endif + #ifndef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 1 + #endif + #ifndef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 1 + #endif + #ifndef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 1 + #endif + #ifndef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL (PY_MAJOR_VERSION < 3 || PY_VERSION_HEX >= 0x03060000 && PY_VERSION_HEX < 0x030C00A6) + #endif + #ifndef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL (PY_VERSION_HEX >= 0x030700A1) + #endif + #ifndef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 1 + #endif + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif + #if PY_VERSION_HEX < 0x03050000 + #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 + #ifndef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #endif + #if PY_VERSION_HEX < 0x030400a1 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #elif !defined(CYTHON_USE_TP_FINALIZE) + #define CYTHON_USE_TP_FINALIZE 1 + #endif + #if PY_VERSION_HEX < 0x030600B1 + #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) + #endif + #if PY_VERSION_HEX < 0x030700A3 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #elif !defined(CYTHON_USE_EXC_INFO_STACK) + #define CYTHON_USE_EXC_INFO_STACK 1 + #endif + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 1 + #endif +#endif +#if !defined(CYTHON_FAST_PYCCALL) +#define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) +#endif +#if !defined(CYTHON_VECTORCALL) +#define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL && PY_VERSION_HEX >= 0x030800B1) +#endif +#define CYTHON_BACKPORT_VECTORCALL (CYTHON_METH_FASTCALL && PY_VERSION_HEX < 0x030800B1) +#if CYTHON_USE_PYLONG_INTERNALS + #if PY_MAJOR_VERSION < 3 + #include "longintrepr.h" + #endif + #undef SHIFT + #undef BASE + #undef MASK + #ifdef SIZEOF_VOID_P + enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) }; + #endif +#endif +#ifndef __has_attribute + #define __has_attribute(x) 0 +#endif +#ifndef __has_cpp_attribute + #define __has_cpp_attribute(x) 0 +#endif +#ifndef CYTHON_RESTRICT + #if defined(__GNUC__) + #define CYTHON_RESTRICT __restrict__ + #elif defined(_MSC_VER) && _MSC_VER >= 1400 + #define CYTHON_RESTRICT __restrict + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_RESTRICT restrict + #else + #define CYTHON_RESTRICT + #endif +#endif +#ifndef CYTHON_UNUSED + #if defined(__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 +# 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) +#ifdef _MSC_VER + #ifndef _MSC_STDINT_H_ + #if _MSC_VER < 1300 + typedef unsigned char uint8_t; + typedef unsigned short uint16_t; + typedef unsigned int uint32_t; + #else + typedef unsigned __int8 uint8_t; + typedef unsigned __int16 uint16_t; + typedef unsigned __int32 uint32_t; + #endif + #endif + #if _MSC_VER < 1300 + #ifdef _WIN64 + typedef unsigned long long __pyx_uintptr_t; + #else + typedef unsigned int __pyx_uintptr_t; + #endif + #else + #ifdef _WIN64 + typedef unsigned __int64 __pyx_uintptr_t; + #else + typedef unsigned __int32 __pyx_uintptr_t; + #endif + #endif +#else + #include + typedef uintptr_t __pyx_uintptr_t; +#endif +#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 +#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 >= 0x030800b4 && PY_VERSION_HEX < 0x030A0000) +#else + #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000) +#endif +#define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer)) + +#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; +}; + +#define __PYX_BUILD_PY_SSIZE_T "n" +#define CYTHON_FORMAT_SSIZE_T "z" +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" + #define __Pyx_DefaultClassType PyClass_Type + #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) +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" + #define __Pyx_DefaultClassType PyType_Type +#if CYTHON_COMPILING_IN_LIMITED_API + static CYTHON_INLINE 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, "iiiiiOOOOOOiOO", 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, "iiiiiiOOOOOOiOO", 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, "iiiiiiOOOOOOOiOO", 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; + } + #ifndef CO_OPTIMIZED + #define CO_OPTIMIZED 0x0001 + #endif + #ifndef CO_NEWLOCALS + #define CO_NEWLOCALS 0x0002 + #endif + #ifndef CO_VARARGS + #define CO_VARARGS 0x0004 + #endif + #ifndef CO_VARKEYWORDS + #define CO_VARKEYWORDS 0x0008 + #endif + #ifndef CO_ASYNC_GENERATOR + #define CO_ASYNC_GENERATOR 0x0200 + #endif + #ifndef CO_GENERATOR + #define CO_GENERATOR 0x0020 + #endif + #ifndef CO_COROUTINE + #define CO_COROUTINE 0x0080 + #endif +#elif PY_VERSION_HEX >= 0x030B0000 + static CYTHON_INLINE 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; + PyObject *empty_bytes = PyBytes_FromStringAndSize("", 0); + if (!empty_bytes) return NULL; + 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, empty_bytes); + Py_DECREF(empty_bytes); + return result; + } +#elif PY_VERSION_HEX >= 0x030800B2 && !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 +#endif +#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 CO_COROUTINE + #define CO_COROUTINE 0x80 +#endif +#ifndef CO_ASYNC_GENERATOR + #define CO_ASYNC_GENERATOR 0x200 +#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 METH_STACKLESS + #define METH_STACKLESS 0 +#endif +#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL) + #ifndef METH_FASTCALL + #define METH_FASTCALL 0x80 + #endif + typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs); + typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args, + Py_ssize_t nargs, PyObject *kwnames); +#else + #define __Pyx_PyCFunctionFast _PyCFunctionFast + #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords +#endif +#if CYTHON_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)) +#elif CYTHON_BACKPORT_VECTORCALL + typedef PyObject *(*__pyx_vectorcallfunc)(PyObject *callable, PyObject *const *args, + size_t nargsf, PyObject *kwnames); + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET ((size_t)1 << (8 * sizeof(size_t) - 1)) + #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(((size_t)(n)) & ~__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)) +#else + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0 + #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n)) +#endif +#if PY_MAJOR_VERSION >= 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) { +#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 __PYX_LIMITED_VERSION_HEX < 0x030900B1 + #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_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_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() +#elif PY_VERSION_HEX >= 0x03060000 + #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() +#elif PY_VERSION_HEX >= 0x03000000 + #define __Pyx_PyThreadState_Current PyThreadState_GET() +#else + #define __Pyx_PyThreadState_Current _PyThreadState_Current +#endif +#if CYTHON_COMPILING_IN_LIMITED_API +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; +} +#endif +#define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE(obj), name, func_ctype) +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name)) +#else + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name) +#endif +#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT) +#include "pythread.h" +#define Py_tss_NEEDS_INIT 0 +typedef int Py_tss_t; +static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) { + *key = PyThread_create_key(); + return 0; +} +static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) { + Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t)); + *key = Py_tss_NEEDS_INIT; + return key; +} +static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) { + PyObject_Free(key); +} +static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) { + return *key != Py_tss_NEEDS_INIT; +} +static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) { + PyThread_delete_key(*key); + *key = Py_tss_NEEDS_INIT; +} +static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) { + return PyThread_set_key_value(*key, value); +} +static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { + return PyThread_get_key_value(*key); +} +#endif +#if PY_MAJOR_VERSION < 3 + #if CYTHON_COMPILING_IN_PYPY + #if PYPY_VERSION_NUM < 0x07030600 + #if defined(__cplusplus) && __cplusplus >= 201402L + [[deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")]] + #elif defined(__GNUC__) || defined(__clang__) + __attribute__ ((__deprecated__("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6"))) + #elif defined(_MSC_VER) + __declspec(deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")) + #endif + static CYTHON_INLINE int PyGILState_Check(void) { + return 0; + } + #else // PYPY_VERSION_NUM < 0x07030600 + #endif // PYPY_VERSION_NUM < 0x07030600 + #else + static CYTHON_INLINE int PyGILState_Check(void) { + PyThreadState * tstate = _PyThreadState_Current; + return tstate && (tstate == PyGILState_GetThisThreadState()); + } + #endif +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000 || defined(_PyDict_NewPresized) +#define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) +#else +#define __Pyx_PyDict_NewPresized(n) PyDict_New() +#endif +#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030600B4 && PY_VERSION_HEX < 0x030d0000 && 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 PY_MAJOR_VERSION >= 3 && (!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) + #define __Pyx_PyObject_GetIterNextFunc(obj) (Py_TYPE(obj)->tp_iternext) +#else + #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp)) + #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature) + #define __Pyx_PyObject_GetIterNextFunc(obj) PyIter_Next +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_SetItemOnTypeDict(tp, k, v) PyObject_GenericSetAttr((PyObject*)tp, k, v) +#else + #define __Pyx_SetItemOnTypeDict(tp, k, v) PyDict_SetItem(tp->tp_dict, k, v) +#endif +#if CYTHON_USE_TYPE_SPECS && PY_VERSION_HEX >= 0x03080000 +#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 CYTHON_PEP393_ENABLED 1 + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GetLength(u) + #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)) +#elif PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) + #define CYTHON_PEP393_ENABLED 1 + #if PY_VERSION_HEX >= 0x030C0000 + #define __Pyx_PyUnicode_READY(op) (0) + #else + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ + 0 : _PyUnicode_Ready((PyObject *)(op))) + #endif + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) + #define __Pyx_PyUnicode_KIND(u) ((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 +#else + #define CYTHON_PEP393_ENABLED 0 + #define PyUnicode_1BYTE_KIND 1 + #define PyUnicode_2BYTE_KIND 2 + #define PyUnicode_4BYTE_KIND 4 + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535U : 1114111U) + #define __Pyx_PyUnicode_KIND(u) ((int)sizeof(Py_UNICODE)) + #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) + #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = (Py_UNICODE) ch) + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) +#endif +#if CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) + #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) +#else + #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) + #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ + PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) +#endif +#if CYTHON_COMPILING_IN_PYPY + #if !defined(PyUnicode_DecodeUnicodeEscape) + #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors) + #endif + #if !defined(PyUnicode_Contains) || (PY_MAJOR_VERSION == 2 && PYPY_VERSION_NUM < 0x07030500) + #undef 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_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) +#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) +#else + #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) +#endif +#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII) + #define PyObject_ASCII(o) PyObject_Repr(o) +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject + #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check + #define PyString_CheckExact PyUnicode_CheckExact +#ifndef PyObject_Unicode + #define PyObject_Unicode PyObject_Str +#endif +#endif +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) + #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) +#else + #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) + #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) +#endif +#if 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 +#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_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0)) + #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) +#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_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v) + #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) +#endif +#if PY_VERSION_HEX >= 0x030d00A1 + #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name) +#else + static CYTHON_INLINE PyObject *__Pyx_PyImport_AddModuleRef(const char *name) { + PyObject *module = PyImport_AddModule(name); + Py_XINCREF(module); + return module; + } +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define __Pyx_Py3Int_Check(op) PyLong_Check(op) + #define __Pyx_Py3Int_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask + #define PyNumber_Int PyNumber_Long +#else + #define __Pyx_Py3Int_Check(op) (PyLong_Check(op) || PyInt_Check(op)) + #define __Pyx_Py3Int_CheckExact(op) (PyLong_CheckExact(op) || PyInt_CheckExact(op)) +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyBoolObject PyLongObject +#endif +#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY + #ifndef PyUnicode_InternFromString + #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) + #endif +#endif +#if PY_VERSION_HEX < 0x030200A4 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t +#else + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t +#endif +#if CYTHON_USE_ASYNC_SLOTS + #if PY_VERSION_HEX >= 0x030500B1 + #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods + #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) + #else + #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) + #endif +#else + #define __Pyx_PyType_AsAsync(obj) NULL +#endif +#ifndef __Pyx_PyAsyncMethodsStruct + typedef struct { + unaryfunc am_await; + unaryfunc am_aiter; + unaryfunc am_anext; + } __Pyx_PyAsyncMethodsStruct; +#endif + +#if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS) + #if !defined(_USE_MATH_DEFINES) + #define _USE_MATH_DEFINES + #endif +#endif +#include +#ifdef NAN +#define __PYX_NAN() ((float) NAN) +#else +static CYTHON_INLINE float __PYX_NAN() { + float value; + memset(&value, 0xFF, sizeof(value)); + return value; +} +#endif +#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) +#define __Pyx_truncl trunc +#else +#define __Pyx_truncl truncl +#endif + +#define __PYX_MARK_ERR_POS(f_index, lineno) \ + { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; } +#define __PYX_ERR(f_index, lineno, Ln_error) \ + { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; } + +#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__amulet_nbt___string_encoding +#define __PYX_HAVE_API__amulet_nbt___string_encoding +/* Early includes */ +#include +#include +#include "ios" +#include "new" +#include "stdexcept" +#include "typeinfo" +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS) +#define CYTHON_WITHOUT_ASSERTIONS +#endif + +typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding; + const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; + +#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 +#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0 +#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8) +#define __PYX_DEFAULT_STRING_ENCODING "" +#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString +#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize +#define __Pyx_uchar_cast(c) ((unsigned char)c) +#define __Pyx_long_cast(x) ((long)x) +#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ + (sizeof(type) < sizeof(Py_ssize_t)) ||\ + (sizeof(type) > sizeof(Py_ssize_t) &&\ + likely(v < (type)PY_SSIZE_T_MAX ||\ + v == (type)PY_SSIZE_T_MAX) &&\ + (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ + v == (type)PY_SSIZE_T_MIN))) ||\ + (sizeof(type) == sizeof(Py_ssize_t) &&\ + (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ + v == (type)PY_SSIZE_T_MAX))) ) +static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) { + return (size_t) i < (size_t) limit; +} +#if defined (__cplusplus) && __cplusplus >= 201103L + #include + #define __Pyx_sst_abs(value) std::abs(value) +#elif SIZEOF_INT >= SIZEOF_SIZE_T + #define __Pyx_sst_abs(value) abs(value) +#elif SIZEOF_LONG >= SIZEOF_SIZE_T + #define __Pyx_sst_abs(value) labs(value) +#elif defined (_MSC_VER) + #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value)) +#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define __Pyx_sst_abs(value) llabs(value) +#elif defined (__GNUC__) + #define __Pyx_sst_abs(value) __builtin_llabs(value) +#else + #define __Pyx_sst_abs(value) ((value<0) ? -value : value) +#endif +static CYTHON_INLINE 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 PY_MAJOR_VERSION < 3 + #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString + #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize +#else + #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString + #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize +#endif +#define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s)) +#define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s)) +#define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s)) +#define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) +#define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) +#define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) +#define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_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_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) +#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const wchar_t *u) +{ + const wchar_t *u_end = u; + while (*u_end++) ; + return (size_t)(u_end - u - 1); +} +#else +static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) +{ + const Py_UNICODE *u_end = u; + while (*u_end++) ; + return (size_t)(u_end - u - 1); +} +#endif +#define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o) +#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) +#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode +#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode +#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) +#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) +static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b); +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); +#define __Pyx_PySequence_Tuple(obj)\ + (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); +#if CYTHON_ASSUME_SAFE_MACROS +#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) +#else +#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) +#endif +#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) +#if PY_MAJOR_VERSION >= 3 +#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) +#else +#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) +#endif +#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 PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII +#include +static int __Pyx_sys_getdefaultencoding_not_ascii; +static int __Pyx_init_sys_getdefaultencoding_params(void) { + PyObject* sys; + PyObject* default_encoding = NULL; + PyObject* ascii_chars_u = NULL; + PyObject* ascii_chars_b = NULL; + const char* default_encoding_c; + sys = PyImport_ImportModule("sys"); + if (!sys) goto bad; + default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL); + Py_DECREF(sys); + if (!default_encoding) goto bad; + default_encoding_c = PyBytes_AsString(default_encoding); + if (!default_encoding_c) goto bad; + if (strcmp(default_encoding_c, "ascii") == 0) { + __Pyx_sys_getdefaultencoding_not_ascii = 0; + } else { + char ascii_chars[128]; + int c; + for (c = 0; c < 128; c++) { + ascii_chars[c] = (char) c; + } + __Pyx_sys_getdefaultencoding_not_ascii = 1; + ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); + if (!ascii_chars_u) goto bad; + ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); + if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { + PyErr_Format( + PyExc_ValueError, + "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.", + default_encoding_c); + goto bad; + } + Py_DECREF(ascii_chars_u); + Py_DECREF(ascii_chars_b); + } + Py_DECREF(default_encoding); + return 0; +bad: + Py_XDECREF(default_encoding); + Py_XDECREF(ascii_chars_u); + Py_XDECREF(ascii_chars_b); + return -1; +} +#endif +#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 +#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) +#else +#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) +#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT +#include +static char* __PYX_DEFAULT_STRING_ENCODING; +static int __Pyx_init_sys_getdefaultencoding_params(void) { + PyObject* sys; + PyObject* default_encoding = NULL; + char* default_encoding_c; + sys = PyImport_ImportModule("sys"); + if (!sys) goto bad; + default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); + Py_DECREF(sys); + if (!default_encoding) goto bad; + default_encoding_c = PyBytes_AsString(default_encoding); + if (!default_encoding_c) goto bad; + __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1); + if (!__PYX_DEFAULT_STRING_ENCODING) goto bad; + strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); + Py_DECREF(default_encoding); + return 0; +bad: + Py_XDECREF(default_encoding); + return -1; +} +#endif +#endif + + +/* Test for GCC > 2.95 */ +#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) +#else /* !__GNUC__ or GCC < 2.95 */ + #define likely(x) (x) + #define unlikely(x) (x) +#endif /* __GNUC__ */ +static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } + +#if !CYTHON_USE_MODULE_STATE +static PyObject *__pyx_m = NULL; +#endif +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm = __FILE__; +static const char *__pyx_filename; + +/* #### Code section: filename_table ### */ + +static const char *__pyx_f[] = { + "src\\\\amulet_nbt\\\\_string_encoding\\\\__init__.pyx", + "src\\\\amulet_nbt\\\\_string_encoding\\\\encoding.pxd", +}; +/* #### Code section: utility_code_proto_before_types ### */ +/* #### Code section: numeric_typedefs ### */ +/* #### Code section: complex_type_declarations ### */ +/* #### Code section: type_declarations ### */ + +/*--- Type declarations ---*/ +struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding; + +/* "src/amulet_nbt/_string_encoding/_cpp/__init__.pxd":3 + * from libcpp.string cimport string + * + * ctypedef string (*CStringEncode)(const string&) # <<<<<<<<<<<<<< + * ctypedef string (*CStringDecode)(const string&) + */ +typedef std::string (*__pyx_t_10amulet_nbt_16_string_encoding_4_cpp_CStringEncode)(std::string const &); + +/* "src/amulet_nbt/_string_encoding/_cpp/__init__.pxd":4 + * + * ctypedef string (*CStringEncode)(const string&) + * ctypedef string (*CStringDecode)(const string&) # <<<<<<<<<<<<<< + */ +typedef std::string (*__pyx_t_10amulet_nbt_16_string_encoding_4_cpp_CStringDecode)(std::string const &); + +/* "amulet_nbt/_string_encoding/encoding.pxd":4 + * + * + * cdef class StringEncoding: # <<<<<<<<<<<<<< + * cdef CStringEncode encode_cpp + * cdef CStringDecode decode_cpp + */ +struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding { + PyObject_HEAD + __pyx_t_10amulet_nbt_16_string_encoding_4_cpp_CStringEncode encode_cpp; + __pyx_t_10amulet_nbt_16_string_encoding_4_cpp_CStringDecode decode_cpp; +}; + +/* #### 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; +#ifdef WITH_THREAD + #define __Pyx_RefNannySetupContext(name, acquire_gil)\ + if (acquire_gil) {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ + PyGILState_Release(__pyx_gilstate_save);\ + } else {\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ + } + #define __Pyx_RefNannyFinishContextNogil() {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __Pyx_RefNannyFinishContext();\ + PyGILState_Release(__pyx_gilstate_save);\ + } +#else + #define __Pyx_RefNannySetupContext(name, acquire_gil)\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__)) + #define __Pyx_RefNannyFinishContextNogil() __Pyx_RefNannyFinishContext() +#endif + #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) + +/* SetPackagePathFromImportLib.proto */ +#if PY_MAJOR_VERSION >= 3 && !CYTHON_PEP489_MULTI_PHASE_INIT +static int __Pyx_SetPackagePathFromImportLib(PyObject *module_name); +#else +#define __Pyx_SetPackagePathFromImportLib(a) 0 +#endif + +/* TypeImport.proto */ +#ifndef __PYX_HAVE_RT_ImportType_proto_3_0_8 +#define __PYX_HAVE_RT_ImportType_proto_3_0_8 +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L +#include +#endif +#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || __cplusplus >= 201103L +#define __PYX_GET_STRUCT_ALIGNMENT_3_0_8(s) alignof(s) +#else +#define __PYX_GET_STRUCT_ALIGNMENT_3_0_8(s) sizeof(void*) +#endif +enum __Pyx_ImportType_CheckSize_3_0_8 { + __Pyx_ImportType_CheckSize_Error_3_0_8 = 0, + __Pyx_ImportType_CheckSize_Warn_3_0_8 = 1, + __Pyx_ImportType_CheckSize_Ignore_3_0_8 = 2 +}; +static PyTypeObject *__Pyx_ImportType_3_0_8(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_8 check_size); +#endif + +/* PyObjectGetAttrStr.proto */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); +#else +#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) +#endif + +/* IncludeStringH.proto */ +#include + +/* Import.proto */ +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); + +/* ImportFrom.proto */ +static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); + +/* PyDictVersioning.proto */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) +#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) +#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ + (version_var) = __PYX_GET_DICT_VERSION(dict);\ + (cache_var) = (value); +#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ + static PY_UINT64_T __pyx_dict_version = 0;\ + static PyObject *__pyx_dict_cached_value = NULL;\ + if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ + (VAR) = __pyx_dict_cached_value;\ + } else {\ + (VAR) = __pyx_dict_cached_value = (LOOKUP);\ + __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ + }\ +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); +#else +#define __PYX_GET_DICT_VERSION(dict) (0) +#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) +#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); +#endif + +/* 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 + +/* PyThreadStateGet.proto */ +#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 */ +#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 */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); + +/* CLineInTraceback.proto */ +#ifdef CYTHON_CLINE_IN_TRACEBACK +#define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) +#else +static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); +#endif + +/* CodeObjectCache.proto */ +#if !CYTHON_COMPILING_IN_LIMITED_API +typedef struct { + PyCodeObject* code_object; + int code_line; +} __Pyx_CodeObjectCacheEntry; +struct __Pyx_CodeObjectCache { + int count; + int max_count; + __Pyx_CodeObjectCacheEntry* entries; +}; +static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); +static PyCodeObject *__pyx_find_code_object(int code_line); +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); +#endif + +/* AddTraceback.proto */ +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename); + +/* FormatTypeName.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API +typedef PyObject *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%U" +static __Pyx_TypeName __Pyx_PyType_GetName(PyTypeObject* tp); +#define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj) +#else +typedef const char *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%.200s" +#define __Pyx_PyType_GetName(tp) ((tp)->tp_name) +#define __Pyx_DECREF_TypeName(obj) +#endif + +/* GCCDiagnostics.proto */ +#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) +#define __Pyx_HAS_GCC_DIAGNOSTIC +#endif + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); + +/* CIntFromPy.proto */ +static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); + +/* CIntFromPy.proto */ +static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); + +/* 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) +#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (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) + +/* CheckBinaryVersion.proto */ +static unsigned long __Pyx_get_runtime_version(void); +static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer); + +/* InitStrings.proto */ +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); + +/* #### Code section: module_declarations ### */ + +/* Module declarations from "libc.string" */ + +/* Module declarations from "libcpp.string" */ + +/* Module declarations from "amulet_nbt._string_encoding._cpp" */ + +/* Module declarations from "amulet_nbt._string_encoding.encoding" */ + +/* Module declarations from "amulet_nbt._string_encoding" */ +/* #### Code section: typeinfo ### */ +/* #### Code section: before_global_var ### */ +#define __Pyx_MODULE_NAME "amulet_nbt._string_encoding.__init__" +extern int __pyx_module_is_main_amulet_nbt___string_encoding____init__; +int __pyx_module_is_main_amulet_nbt___string_encoding____init__ = 0; + +/* Implementation of "amulet_nbt._string_encoding" */ +/* #### Code section: global_var ### */ +/* #### Code section: string_decls ### */ +static const char __pyx_k_[] = "."; +static const char __pyx_k__2[] = "?"; +static const char __pyx_k_main[] = "__main__"; +static const char __pyx_k_name[] = "__name__"; +static const char __pyx_k_test[] = "__test__"; +static const char __pyx_k_import[] = "__import__"; +static const char __pyx_k_utf8_encoding[] = "utf8_encoding"; +static const char __pyx_k_mutf8_encoding[] = "mutf8_encoding"; +static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; +static const char __pyx_k_utf8_escape_encoding[] = "utf8_escape_encoding"; +static const char __pyx_k_amulet_nbt__string_encoding___in[] = "amulet_nbt._string_encoding.__init__"; +static const char __pyx_k_amulet_nbt__string_encoding_enco[] = "amulet_nbt._string_encoding.encoding"; +/* #### Code section: decls ### */ +/* #### Code section: late_includes ### */ +/* #### Code section: module_state ### */ +typedef struct { + PyObject *__pyx_d; + PyObject *__pyx_b; + PyObject *__pyx_cython_runtime; + PyObject *__pyx_empty_tuple; + PyObject *__pyx_empty_bytes; + PyObject *__pyx_empty_unicode; + #ifdef __Pyx_CyFunction_USED + PyTypeObject *__pyx_CyFunctionType; + #endif + #ifdef __Pyx_FusedFunction_USED + PyTypeObject *__pyx_FusedFunctionType; + #endif + #ifdef __Pyx_Generator_USED + PyTypeObject *__pyx_GeneratorType; + #endif + #ifdef __Pyx_IterableCoroutine_USED + PyTypeObject *__pyx_IterableCoroutineType; + #endif + #ifdef __Pyx_Coroutine_USED + PyTypeObject *__pyx_CoroutineAwaitType; + #endif + #ifdef __Pyx_Coroutine_USED + PyTypeObject *__pyx_CoroutineType; + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + PyTypeObject *__pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding; + #if CYTHON_USE_MODULE_STATE + #endif + PyObject *__pyx_kp_u_; + PyObject *__pyx_n_s__2; + PyObject *__pyx_kp_u_amulet_nbt__string_encoding___in; + PyObject *__pyx_n_s_amulet_nbt__string_encoding_enco; + PyObject *__pyx_n_s_cline_in_traceback; + PyObject *__pyx_n_s_import; + PyObject *__pyx_n_s_main; + PyObject *__pyx_n_s_mutf8_encoding; + PyObject *__pyx_n_s_name; + PyObject *__pyx_n_s_test; + PyObject *__pyx_n_s_utf8_encoding; + PyObject *__pyx_n_s_utf8_escape_encoding; +} __pyx_mstate; + +#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(o) ((__pyx_mstate *)__Pyx_PyModule_GetState(o)) + +#define __pyx_mstate_global (__pyx_mstate(PyState_FindModule(&__pyx_moduledef))) + +#define __pyx_m (PyState_FindModule(&__pyx_moduledef)) +#else +static __pyx_mstate __pyx_mstate_global_static = +#ifdef __cplusplus + {}; +#else + {0}; +#endif +static __pyx_mstate *__pyx_mstate_global = &__pyx_mstate_global_static; +#endif +/* #### Code section: module_state_clear ### */ +#if CYTHON_USE_MODULE_STATE +static int __pyx_m_clear(PyObject *m) { + __pyx_mstate *clear_module_state = __pyx_mstate(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); + #ifdef __Pyx_CyFunction_USED + Py_CLEAR(clear_module_state->__pyx_CyFunctionType); + #endif + #ifdef __Pyx_FusedFunction_USED + Py_CLEAR(clear_module_state->__pyx_FusedFunctionType); + #endif + Py_CLEAR(clear_module_state->__pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding); + Py_CLEAR(clear_module_state->__pyx_kp_u_); + Py_CLEAR(clear_module_state->__pyx_n_s__2); + Py_CLEAR(clear_module_state->__pyx_kp_u_amulet_nbt__string_encoding___in); + Py_CLEAR(clear_module_state->__pyx_n_s_amulet_nbt__string_encoding_enco); + Py_CLEAR(clear_module_state->__pyx_n_s_cline_in_traceback); + Py_CLEAR(clear_module_state->__pyx_n_s_import); + Py_CLEAR(clear_module_state->__pyx_n_s_main); + Py_CLEAR(clear_module_state->__pyx_n_s_mutf8_encoding); + Py_CLEAR(clear_module_state->__pyx_n_s_name); + Py_CLEAR(clear_module_state->__pyx_n_s_test); + Py_CLEAR(clear_module_state->__pyx_n_s_utf8_encoding); + Py_CLEAR(clear_module_state->__pyx_n_s_utf8_escape_encoding); + return 0; +} +#endif +/* #### Code section: module_state_traverse ### */ +#if CYTHON_USE_MODULE_STATE +static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { + __pyx_mstate *traverse_module_state = __pyx_mstate(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); + Py_VISIT(traverse_module_state->__pyx_empty_tuple); + Py_VISIT(traverse_module_state->__pyx_empty_bytes); + Py_VISIT(traverse_module_state->__pyx_empty_unicode); + #ifdef __Pyx_CyFunction_USED + Py_VISIT(traverse_module_state->__pyx_CyFunctionType); + #endif + #ifdef __Pyx_FusedFunction_USED + Py_VISIT(traverse_module_state->__pyx_FusedFunctionType); + #endif + Py_VISIT(traverse_module_state->__pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding); + Py_VISIT(traverse_module_state->__pyx_kp_u_); + Py_VISIT(traverse_module_state->__pyx_n_s__2); + Py_VISIT(traverse_module_state->__pyx_kp_u_amulet_nbt__string_encoding___in); + Py_VISIT(traverse_module_state->__pyx_n_s_amulet_nbt__string_encoding_enco); + Py_VISIT(traverse_module_state->__pyx_n_s_cline_in_traceback); + Py_VISIT(traverse_module_state->__pyx_n_s_import); + Py_VISIT(traverse_module_state->__pyx_n_s_main); + Py_VISIT(traverse_module_state->__pyx_n_s_mutf8_encoding); + Py_VISIT(traverse_module_state->__pyx_n_s_name); + Py_VISIT(traverse_module_state->__pyx_n_s_test); + Py_VISIT(traverse_module_state->__pyx_n_s_utf8_encoding); + Py_VISIT(traverse_module_state->__pyx_n_s_utf8_escape_encoding); + return 0; +} +#endif +/* #### Code section: module_state_defines ### */ +#define __pyx_d __pyx_mstate_global->__pyx_d +#define __pyx_b __pyx_mstate_global->__pyx_b +#define __pyx_cython_runtime __pyx_mstate_global->__pyx_cython_runtime +#define __pyx_empty_tuple __pyx_mstate_global->__pyx_empty_tuple +#define __pyx_empty_bytes __pyx_mstate_global->__pyx_empty_bytes +#define __pyx_empty_unicode __pyx_mstate_global->__pyx_empty_unicode +#ifdef __Pyx_CyFunction_USED +#define __pyx_CyFunctionType __pyx_mstate_global->__pyx_CyFunctionType +#endif +#ifdef __Pyx_FusedFunction_USED +#define __pyx_FusedFunctionType __pyx_mstate_global->__pyx_FusedFunctionType +#endif +#ifdef __Pyx_Generator_USED +#define __pyx_GeneratorType __pyx_mstate_global->__pyx_GeneratorType +#endif +#ifdef __Pyx_IterableCoroutine_USED +#define __pyx_IterableCoroutineType __pyx_mstate_global->__pyx_IterableCoroutineType +#endif +#ifdef __Pyx_Coroutine_USED +#define __pyx_CoroutineAwaitType __pyx_mstate_global->__pyx_CoroutineAwaitType +#endif +#ifdef __Pyx_Coroutine_USED +#define __pyx_CoroutineType __pyx_mstate_global->__pyx_CoroutineType +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#define __pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding __pyx_mstate_global->__pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding +#if CYTHON_USE_MODULE_STATE +#endif +#define __pyx_kp_u_ __pyx_mstate_global->__pyx_kp_u_ +#define __pyx_n_s__2 __pyx_mstate_global->__pyx_n_s__2 +#define __pyx_kp_u_amulet_nbt__string_encoding___in __pyx_mstate_global->__pyx_kp_u_amulet_nbt__string_encoding___in +#define __pyx_n_s_amulet_nbt__string_encoding_enco __pyx_mstate_global->__pyx_n_s_amulet_nbt__string_encoding_enco +#define __pyx_n_s_cline_in_traceback __pyx_mstate_global->__pyx_n_s_cline_in_traceback +#define __pyx_n_s_import __pyx_mstate_global->__pyx_n_s_import +#define __pyx_n_s_main __pyx_mstate_global->__pyx_n_s_main +#define __pyx_n_s_mutf8_encoding __pyx_mstate_global->__pyx_n_s_mutf8_encoding +#define __pyx_n_s_name __pyx_mstate_global->__pyx_n_s_name +#define __pyx_n_s_test __pyx_mstate_global->__pyx_n_s_test +#define __pyx_n_s_utf8_encoding __pyx_mstate_global->__pyx_n_s_utf8_encoding +#define __pyx_n_s_utf8_escape_encoding __pyx_mstate_global->__pyx_n_s_utf8_escape_encoding +/* #### Code section: module_code ### */ + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; +#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 +/* #### Code section: pystring_table ### */ + +static int __Pyx_CreateStringTabAndInitStrings(void) { + __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp_u_, __pyx_k_, sizeof(__pyx_k_), 0, 1, 0, 0}, + {&__pyx_n_s__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 0, 1, 1}, + {&__pyx_kp_u_amulet_nbt__string_encoding___in, __pyx_k_amulet_nbt__string_encoding___in, sizeof(__pyx_k_amulet_nbt__string_encoding___in), 0, 1, 0, 0}, + {&__pyx_n_s_amulet_nbt__string_encoding_enco, __pyx_k_amulet_nbt__string_encoding_enco, sizeof(__pyx_k_amulet_nbt__string_encoding_enco), 0, 0, 1, 1}, + {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, + {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, + {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, + {&__pyx_n_s_mutf8_encoding, __pyx_k_mutf8_encoding, sizeof(__pyx_k_mutf8_encoding), 0, 0, 1, 1}, + {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, + {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, + {&__pyx_n_s_utf8_encoding, __pyx_k_utf8_encoding, sizeof(__pyx_k_utf8_encoding), 0, 0, 1, 1}, + {&__pyx_n_s_utf8_escape_encoding, __pyx_k_utf8_escape_encoding, sizeof(__pyx_k_utf8_escape_encoding), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} + }; + return __Pyx_InitStrings(__pyx_string_tab); +} +/* #### Code section: cached_builtins ### */ +static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { + return 0; +} +/* #### Code section: cached_constants ### */ + +static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); + __Pyx_RefNannyFinishContext(); + return 0; +} +/* #### Code section: init_constants ### */ + +static CYTHON_SMALL_CODE int __Pyx_InitConstants(void) { + if (__Pyx_CreateStringTabAndInitStrings() < 0) __PYX_ERR(0, 1, __pyx_L1_error); + return 0; + __pyx_L1_error:; + return -1; +} +/* #### Code section: init_globals ### */ + +static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { + return 0; +} +/* #### Code section: init_module ### */ + +static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/ + +static int __Pyx_modinit_global_init_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); + /*--- Global init code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_variable_export_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); + /*--- Variable export code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_function_export_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); + /*--- Function export code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_type_init_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); + /*--- Type init code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_type_import_code(void) { + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); + /*--- Type import code ---*/ + __pyx_t_1 = PyImport_ImportModule("amulet_nbt._string_encoding.encoding"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding = __Pyx_ImportType_3_0_8(__pyx_t_1, "amulet_nbt._string_encoding.encoding", "StringEncoding", sizeof(struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding), __PYX_GET_STRUCT_ALIGNMENT_3_0_8(struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding),__Pyx_ImportType_CheckSize_Warn_3_0_8); if (!__pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_modinit_variable_import_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); + /*--- Variable import code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_function_import_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); + /*--- Function import code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + + +#if PY_MAJOR_VERSION >= 3 +#if CYTHON_PEP489_MULTI_PHASE_INIT +static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ +static int __pyx_pymod_exec__string_encoding(PyObject* module); /*proto*/ +static PyModuleDef_Slot __pyx_moduledef_slots[] = { + {Py_mod_create, (void*)__pyx_pymod_create}, + {Py_mod_exec, (void*)__pyx_pymod_exec__string_encoding}, + {0, NULL} +}; +#endif + +#ifdef __cplusplus +namespace { + struct PyModuleDef __pyx_moduledef = + #else + static struct PyModuleDef __pyx_moduledef = + #endif + { + PyModuleDef_HEAD_INIT, + "_string_encoding", + 0, /* m_doc */ + #if CYTHON_PEP489_MULTI_PHASE_INIT + 0, /* m_size */ + #elif CYTHON_USE_MODULE_STATE + sizeof(__pyx_mstate), /* m_size */ + #else + -1, /* m_size */ + #endif + __pyx_methods /* m_methods */, + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_moduledef_slots, /* m_slots */ + #else + NULL, /* m_reload */ + #endif + #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 +#endif + +#ifndef CYTHON_NO_PYINIT_EXPORT +#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC +#elif PY_MAJOR_VERSION < 3 +#ifdef __cplusplus +#define __Pyx_PyMODINIT_FUNC extern "C" void +#else +#define __Pyx_PyMODINIT_FUNC void +#endif +#else +#ifdef __cplusplus +#define __Pyx_PyMODINIT_FUNC extern "C" PyObject * +#else +#define __Pyx_PyMODINIT_FUNC PyObject * +#endif +#endif + + +#if PY_MAJOR_VERSION < 3 +__Pyx_PyMODINIT_FUNC init_string_encoding(void) CYTHON_SMALL_CODE; /*proto*/ +#if !defined(CYTHON_NO_PYINIT_EXPORT) && (defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) +__Pyx_PyMODINIT_FUNC init__init__(void) { init_string_encoding(); } +#endif +__Pyx_PyMODINIT_FUNC init_string_encoding(void) +#else +__Pyx_PyMODINIT_FUNC PyInit__string_encoding(void) CYTHON_SMALL_CODE; /*proto*/ +#if !defined(CYTHON_NO_PYINIT_EXPORT) && (defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) +__Pyx_PyMODINIT_FUNC PyInit___init__(void) { return PyInit__string_encoding(); } +#endif +__Pyx_PyMODINIT_FUNC PyInit__string_encoding(void) +#if CYTHON_PEP489_MULTI_PHASE_INIT +{ + return PyModuleDef_Init(&__pyx_moduledef); +} +static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { + #if PY_VERSION_HEX >= 0x030700A1 + static PY_INT64_T main_interpreter_id = -1; + PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); + if (main_interpreter_id == -1) { + main_interpreter_id = current_id; + return (unlikely(current_id == -1)) ? -1 : 0; + } else if (unlikely(main_interpreter_id != current_id)) + #else + static PyInterpreterState *main_interpreter = NULL; + PyInterpreterState *current_interpreter = PyThreadState_Get()->interp; + if (!main_interpreter) { + main_interpreter = current_interpreter; + } else if (unlikely(main_interpreter != current_interpreter)) + #endif + { + PyErr_SetString( + PyExc_ImportError, + "Interpreter change detected - this module can only be loaded into one interpreter per process."); + return -1; + } + return 0; +} +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *module, const char* from_name, const char* to_name, int allow_none) +#else +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) +#endif +{ + PyObject *value = PyObject_GetAttrString(spec, from_name); + int result = 0; + if (likely(value)) { + if (allow_none || value != Py_None) { +#if CYTHON_COMPILING_IN_LIMITED_API + result = PyModule_AddObject(module, to_name, value); +#else + result = PyDict_SetItemString(moddict, to_name, value); +#endif + } + 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 (__Pyx_check_single_interpreter()) + return NULL; + if (__pyx_m) + return __Pyx_NewRef(__pyx_m); + modname = PyObject_GetAttrString(spec, "name"); + if (unlikely(!modname)) goto bad; + module = PyModule_NewObject(modname); + Py_DECREF(modname); + if (unlikely(!module)) goto bad; +#if CYTHON_COMPILING_IN_LIMITED_API + moddict = module; +#else + moddict = PyModule_GetDict(module); + if (unlikely(!moddict)) goto bad; +#endif + 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__string_encoding(PyObject *__pyx_pyinit_module) +#endif +#endif +{ + int stringtab_initialized = 0; + #if CYTHON_USE_MODULE_STATE + int pystate_addmodule_run = 0; + #endif + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + #if CYTHON_PEP489_MULTI_PHASE_INIT + if (__pyx_m) { + if (__pyx_m == __pyx_pyinit_module) return 0; + PyErr_SetString(PyExc_RuntimeError, "Module '_string_encoding' has already been imported. Re-initialisation is not supported."); + return -1; + } + #elif PY_MAJOR_VERSION >= 3 + if (__pyx_m) return __Pyx_NewRef(__pyx_m); + #endif + /*--- Module creation code ---*/ + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_m = __pyx_pyinit_module; + Py_INCREF(__pyx_m); + #else + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4("_string_encoding", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); + if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) + #elif CYTHON_USE_MODULE_STATE + __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + { + int add_module_result = PyState_AddModule(__pyx_t_1, &__pyx_moduledef); + __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to "_string_encoding" pseudovariable */ + if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + pystate_addmodule_run = 1; + } + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #endif + CYTHON_UNUSED_VAR(__pyx_t_1); + __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_d); + __pyx_b = __Pyx_PyImport_AddModuleRef(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_cython_runtime = __Pyx_PyImport_AddModuleRef((const char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) + if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #if CYTHON_REFNANNY +__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); +if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); +} +#endif + __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit__string_encoding(void)", 0); + 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) + #ifdef __Pxy_PyFrame_Initialize_Offsets + __Pxy_PyFrame_Initialize_Offsets(); + #endif + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) + #ifdef __Pyx_CyFunction_USED + if (__pyx_CyFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_FusedFunction_USED + if (__pyx_FusedFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_Coroutine_USED + if (__pyx_Coroutine_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_Generator_USED + if (__pyx_Generator_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_AsyncGen_USED + if (__pyx_AsyncGen_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_StopAsyncIteration_USED + if (__pyx_StopAsyncIteration_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + PyEval_InitThreads(); + #endif + /*--- Initialize various global constants etc. ---*/ + if (__Pyx_InitConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + stringtab_initialized = 1; + if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) + if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + if (__pyx_module_is_main_amulet_nbt___string_encoding____init__) { + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + } + if (!CYTHON_PEP489_MULTI_PHASE_INIT) { + if (unlikely((__Pyx_SetPackagePathFromImportLib(__pyx_kp_u_amulet_nbt__string_encoding___in) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + } + #if PY_MAJOR_VERSION >= 3 + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) + if (!PyDict_GetItemString(modules, "amulet_nbt._string_encoding")) { + if (unlikely((PyDict_SetItemString(modules, "amulet_nbt._string_encoding", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + } + } + #endif + /*--- Builtin init code ---*/ + if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Constants init code ---*/ + if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Global type/function init code ---*/ + (void)__Pyx_modinit_global_init_code(); + (void)__Pyx_modinit_variable_export_code(); + (void)__Pyx_modinit_function_export_code(); + (void)__Pyx_modinit_type_init_code(); + if (unlikely((__Pyx_modinit_type_import_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error) + (void)__Pyx_modinit_variable_import_code(); + (void)__Pyx_modinit_function_import_code(); + /*--- Execution code ---*/ + #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) + if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + + /* "amulet_nbt/_string_encoding/__init__.pyx":5 + * + * from amulet_nbt._string_encoding.encoding import ( + * mutf8_encoding, # <<<<<<<<<<<<<< + * utf8_encoding, + * utf8_escape_encoding + */ + __pyx_t_2 = PyList_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_n_s_mutf8_encoding); + __Pyx_GIVEREF(__pyx_n_s_mutf8_encoding); + if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_mutf8_encoding)) __PYX_ERR(0, 5, __pyx_L1_error); + __Pyx_INCREF(__pyx_n_s_utf8_encoding); + __Pyx_GIVEREF(__pyx_n_s_utf8_encoding); + if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_utf8_encoding)) __PYX_ERR(0, 5, __pyx_L1_error); + __Pyx_INCREF(__pyx_n_s_utf8_escape_encoding); + __Pyx_GIVEREF(__pyx_n_s_utf8_escape_encoding); + if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_s_utf8_escape_encoding)) __PYX_ERR(0, 5, __pyx_L1_error); + + /* "amulet_nbt/_string_encoding/__init__.pyx":4 + * # distutils: extra_compile_args = CPPCARGS + * + * from amulet_nbt._string_encoding.encoding import ( # <<<<<<<<<<<<<< + * mutf8_encoding, + * utf8_encoding, + */ + __pyx_t_3 = __Pyx_Import(__pyx_n_s_amulet_nbt__string_encoding_enco, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_mutf8_encoding); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_mutf8_encoding, __pyx_t_2) < 0) __PYX_ERR(0, 5, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_utf8_encoding); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_utf8_encoding, __pyx_t_2) < 0) __PYX_ERR(0, 6, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_utf8_escape_encoding); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_utf8_escape_encoding, __pyx_t_2) < 0) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "amulet_nbt/_string_encoding/__init__.pyx":1 + * # distutils: language = c++ # <<<<<<<<<<<<<< + * # distutils: extra_compile_args = CPPCARGS + * + */ + __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_3) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /*--- Wrapped vars code ---*/ + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + if (__pyx_m) { + if (__pyx_d && stringtab_initialized) { + __Pyx_AddTraceback("init amulet_nbt._string_encoding", __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 amulet_nbt._string_encoding"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if CYTHON_PEP489_MULTI_PHASE_INIT + return (__pyx_m != NULL) ? 0 : -1; + #elif PY_MAJOR_VERSION >= 3 + return __pyx_m; + #else + return; + #endif +} +/* #### 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 + +/* SetPackagePathFromImportLib */ +#if PY_MAJOR_VERSION >= 3 && !CYTHON_PEP489_MULTI_PHASE_INIT +static int __Pyx_SetPackagePathFromImportLib(PyObject *module_name) { + PyObject *importlib, *osmod, *ossep, *parts, *package_path; + PyObject *file_path = NULL; + int result; + PyObject *spec; + importlib = PyImport_ImportModule("importlib.util"); + if (unlikely(!importlib)) + goto bad; + spec = PyObject_CallMethod(importlib, "find_spec", "(O)", module_name); + Py_DECREF(importlib); + if (unlikely(!spec)) + goto bad; + file_path = PyObject_GetAttrString(spec, "origin"); + Py_DECREF(spec); + if (unlikely(!file_path)) + goto bad; + if (unlikely(PyObject_SetAttrString(__pyx_m, "__file__", file_path) < 0)) + goto bad; + osmod = PyImport_ImportModule("os"); + if (unlikely(!osmod)) + goto bad; + ossep = PyObject_GetAttrString(osmod, "sep"); + Py_DECREF(osmod); + if (unlikely(!ossep)) + goto bad; + parts = PyObject_CallMethod(file_path, "rsplit", "(Oi)", ossep, 1); + Py_DECREF(file_path); file_path = NULL; + Py_DECREF(ossep); + if (unlikely(!parts)) + goto bad; + package_path = Py_BuildValue("[O]", PyList_GET_ITEM(parts, 0)); + Py_DECREF(parts); + if (unlikely(!package_path)) + goto bad; + goto set_path; +bad: + PyErr_WriteUnraisable(module_name); + Py_XDECREF(file_path); + PyErr_Clear(); + package_path = PyList_New(0); + if (unlikely(!package_path)) + return -1; +set_path: + result = PyObject_SetAttrString(__pyx_m, "__path__", package_path); + Py_DECREF(package_path); + return result; +} +#endif + +/* TypeImport */ +#ifndef __PYX_HAVE_RT_ImportType_3_0_8 +#define __PYX_HAVE_RT_ImportType_3_0_8 +static PyTypeObject *__Pyx_ImportType_3_0_8(PyObject *module, const char *module_name, const char *class_name, + size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_8 check_size) +{ + PyObject *result = 0; + char warning[200]; + Py_ssize_t basicsize; + Py_ssize_t itemsize; +#if 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 !CYTHON_COMPILING_IN_LIMITED_API + basicsize = ((PyTypeObject *)result)->tp_basicsize; + itemsize = ((PyTypeObject *)result)->tp_itemsize; +#else + py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); + if (!py_basicsize) + goto bad; + basicsize = PyLong_AsSsize_t(py_basicsize); + Py_DECREF(py_basicsize); + py_basicsize = 0; + if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) + goto bad; + py_itemsize = PyObject_GetAttrString(result, "__itemsize__"); + if (!py_itemsize) + goto bad; + itemsize = PyLong_AsSsize_t(py_itemsize); + Py_DECREF(py_itemsize); + py_itemsize = 0; + if (itemsize == (Py_ssize_t)-1 && PyErr_Occurred()) + goto bad; +#endif + if (itemsize) { + if (size % alignment) { + alignment = size % alignment; + } + if (itemsize < (Py_ssize_t)alignment) + itemsize = (Py_ssize_t)alignment; + } + if ((size_t)(basicsize + itemsize) < size) { + PyErr_Format(PyExc_ValueError, + "%.200s.%.200s size changed, may indicate binary incompatibility. " + "Expected %zd from C header, got %zd from PyObject", + module_name, class_name, size, basicsize+itemsize); + goto bad; + } + if (check_size == __Pyx_ImportType_CheckSize_Error_3_0_8 && + ((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_0_8 && (size_t)basicsize > size) { + PyOS_snprintf(warning, sizeof(warning), + "%s.%s size changed, may indicate binary incompatibility. " + "Expected %zd from C header, got %zd from PyObject", + module_name, class_name, size, basicsize); + if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; + } + return (PyTypeObject *)result; +bad: + Py_XDECREF(result); + return NULL; +} +#endif + +/* PyObjectGetAttrStr */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro)) + return tp->tp_getattro(obj, attr_name); +#if PY_MAJOR_VERSION < 3 + if (likely(tp->tp_getattr)) + return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); +#endif + return PyObject_GetAttr(obj, attr_name); +} +#endif + +/* Import */ +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { + PyObject *module = 0; + PyObject *empty_dict = 0; + PyObject *empty_list = 0; + #if PY_MAJOR_VERSION < 3 + PyObject *py_import; + py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); + if (unlikely(!py_import)) + goto bad; + if (!from_list) { + empty_list = PyList_New(0); + if (unlikely(!empty_list)) + goto bad; + from_list = empty_list; + } + #endif + empty_dict = PyDict_New(); + if (unlikely(!empty_dict)) + goto bad; + { + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if (strchr(__Pyx_MODULE_NAME, '.') != NULL) { + module = PyImport_ImportModuleLevelObject( + name, __pyx_d, empty_dict, from_list, 1); + if (unlikely(!module)) { + if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError))) + goto bad; + PyErr_Clear(); + } + } + level = 0; + } + #endif + if (!module) { + #if PY_MAJOR_VERSION < 3 + PyObject *py_level = PyInt_FromLong(level); + if (unlikely(!py_level)) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, __pyx_d, empty_dict, from_list, py_level, (PyObject *)NULL); + Py_DECREF(py_level); + #else + module = PyImport_ImportModuleLevelObject( + name, __pyx_d, empty_dict, from_list, level); + #endif + } + } +bad: + Py_XDECREF(empty_dict); + Py_XDECREF(empty_list); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(py_import); + #endif + return module; +} + +/* ImportFrom */ +static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { + PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); + if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { + 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_kp_u_); + if (unlikely(!module_dot)) { goto modbad; } + full_name = PyUnicode_Concat(module_dot, name); + if (unlikely(!full_name)) { goto modbad; } + #if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) + { + 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, + #if PY_MAJOR_VERSION < 3 + "cannot import name %.230s", PyString_AS_STRING(name)); + #else + "cannot import name %S", name); + #endif + } + return value; +} + +/* 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 + +/* PyErrExceptionMatches */ +#if CYTHON_FAST_THREAD_STATE +static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(tuple); +#if PY_MAJOR_VERSION >= 3 + for (i=0; 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 */ +#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 */ +#if __PYX_LIMITED_VERSION_HEX < 0x030d00A1 +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 >= 0x030d00A1 + (void) PyObject_GetOptionalAttr(obj, attr_name, &result); + return result; +#else +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1 + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { + return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); + } +#endif + result = __Pyx_PyObject_GetAttrStr(obj, attr_name); + if (unlikely(!result)) { + __Pyx_PyObject_GetAttrStr_ClearAttributeError(); + } + return result; +#endif +} + +/* CLineInTraceback */ +#ifndef CYTHON_CLINE_IN_TRACEBACK +static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { + PyObject *use_cline; + PyObject *ptype, *pvalue, *ptraceback; +#if CYTHON_COMPILING_IN_CPYTHON + PyObject **cython_runtime_dict; +#endif + CYTHON_MAYBE_UNUSED_VAR(tstate); + if (unlikely(!__pyx_cython_runtime)) { + return c_line; + } + __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); +#if CYTHON_COMPILING_IN_CPYTHON + cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime); + if (likely(cython_runtime_dict)) { + __PYX_PY_DICT_LOOKUP_IF_MODIFIED( + use_cline, *cython_runtime_dict, + __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback)) + } else +#endif + { + PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStrNoError(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); + if (use_cline_obj) { + use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True; + Py_DECREF(use_cline_obj); + } else { + PyErr_Clear(); + use_cline = NULL; + } + } + if (!use_cline) { + c_line = 0; + (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); + } + else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { + c_line = 0; + } + __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); + return c_line; +} +#endif + +/* CodeObjectCache */ +#if !CYTHON_COMPILING_IN_LIMITED_API +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = start + (end - start) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } +} +static PyCodeObject *__pyx_find_code_object(int code_line) { + PyCodeObject* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { + return NULL; + } + code_object = __pyx_code_cache.entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = 64; + __pyx_code_cache.count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { + PyCodeObject* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_DECREF(tmp); + return; + } + if (__pyx_code_cache.count == __pyx_code_cache.max_count) { + int new_max = __pyx_code_cache.max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = new_max; + } + for (i=__pyx_code_cache.count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + __pyx_code_cache.count++; + Py_INCREF(code_object); +} +#endif + +/* AddTraceback */ +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API + #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; + result = PyObject_Call(replace, __pyx_empty_tuple, scratch_dict); + Py_DECREF(replace); + return result; + } + PyErr_Clear(); + #if __PYX_LIMITED_VERSION_HEX < 0x030780000 + { + PyObject *compiled = NULL, *result = NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "code", code))) return NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "type", (PyObject*)(&PyType_Type)))) return NULL; + compiled = Py_CompileString( + "out = type(code)(\n" + " code.co_argcount, code.co_kwonlyargcount, code.co_nlocals, code.co_stacksize,\n" + " code.co_flags, code.co_code, code.co_consts, code.co_names,\n" + " code.co_varnames, code.co_filename, co_name, co_firstlineno,\n" + " code.co_lnotab)\n", "", Py_file_input); + if (!compiled) return NULL; + result = PyEval_EvalCode(compiled, scratch_dict, scratch_dict); + Py_DECREF(compiled); + if (!result) PyErr_Print(); + Py_DECREF(result); + result = PyDict_GetItemString(scratch_dict, "out"); + if (result) Py_INCREF(result); + return result; + } + #else + return NULL; + #endif +} +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) { + (void) __pyx_cfilenm; + (void) __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line); + } + PyErr_Fetch(&exc_type, &exc_value, &exc_traceback); + 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; + 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; + 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 PY_MAJOR_VERSION < 3 + PyObject *py_srcfile = NULL; + py_srcfile = PyString_FromString(filename); + if (!py_srcfile) goto bad; + #endif + if (c_line) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + if (!py_funcname) goto bad; + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + if (!py_funcname) goto bad; + funcname = PyUnicode_AsUTF8(py_funcname); + if (!funcname) goto bad; + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + if (!py_funcname) goto bad; + #endif + } + #if PY_MAJOR_VERSION < 3 + py_code = __Pyx_PyCode_New( + 0, + 0, + 0, + 0, + 0, + 0, + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + py_line, + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + Py_DECREF(py_srcfile); + #else + py_code = PyCode_NewEmpty(filename, funcname, py_line); + #endif + Py_XDECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_funcname); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(py_srcfile); + #endif + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject *ptype, *pvalue, *ptraceback; + if (c_line) { + c_line = __Pyx_CLineForTraceback(tstate, c_line); + } + py_code = __pyx_find_code_object(c_line ? -c_line : py_line); + if (!py_code) { + __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) { + /* If the code object creation fails, then we should clear the + fetched exception references and propagate the new exception */ + Py_XDECREF(ptype); + Py_XDECREF(pvalue); + Py_XDECREF(ptraceback); + goto bad; + } + __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); + __pyx_insert_code_object(c_line ? -c_line : py_line, py_code); + } + py_frame = PyFrame_New( + tstate, /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + __pyx_d, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + __Pyx_PyFrame_SetLineNumber(py_frame, py_line); + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} +#endif + +/* FormatTypeName */ +#if CYTHON_COMPILING_IN_LIMITED_API +static __Pyx_TypeName +__Pyx_PyType_GetName(PyTypeObject* tp) +{ + PyObject *name = __Pyx_PyObject_GetAttrStr((PyObject *)tp, + __pyx_n_s_name); + if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) { + PyErr_Clear(); + Py_XDECREF(name); + name = __Pyx_NewRef(__pyx_n_s__2); + } + return name; +} +#endif + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const long neg_one = (long) -1, const_zero = (long) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(long) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(long) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(long) <= sizeof(long)) { + return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); +#endif + } + } + { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 + return _PyLong_FromByteArray(bytes, sizeof(long), + little, !is_unsigned); +#else + PyObject *from_bytes, *result = NULL; + PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = 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; + arg_tuple = PyTuple_Pack(2, py_bytes, order_str); + if (!arg_tuple) goto limited_bad; + if (!is_unsigned) { + kwds = PyDict_New(); + if (!kwds) goto limited_bad; + if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad; + } + result = PyObject_Call(from_bytes, arg_tuple, kwds); + limited_bad: + Py_XDECREF(kwds); + Py_XDECREF(arg_tuple); + Py_XDECREF(order_str); + Py_XDECREF(py_bytes); + Py_XDECREF(from_bytes); + return result; +#endif + } +} + +/* CIntFromPyVerify */ +#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ + __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) +#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ + __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) +#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ + {\ + func_type value = func_value;\ + if (sizeof(target_type) < sizeof(func_type)) {\ + if (unlikely(value != (func_type) (target_type) value)) {\ + func_type zero = 0;\ + if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ + return (target_type) -1;\ + if (is_unsigned && unlikely(value < zero))\ + goto raise_neg_overflow;\ + else\ + goto raise_overflow;\ + }\ + }\ + return (target_type) value;\ + } + +/* CIntFromPy */ +static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const long neg_one = (long) -1, const_zero = (long) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + if ((sizeof(long) < sizeof(long))) { + __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) + } else { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + goto raise_neg_overflow; + } + return (long) val; + } + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + 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)) +#ifdef HAVE_LONG_LONG + } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) +#endif + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + 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)) +#ifdef HAVE_LONG_LONG + } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) +#endif + } + } + { + long val; + PyObject *v = __Pyx_PyNumber_IntOrLong(x); +#if PY_MAJOR_VERSION < 3 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } +#endif + if (likely(v)) { + int ret = -1; +#if 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 *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (long) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (long) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (long) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (long) -1; + } else { + stepval = __Pyx_NewRef(v); + } + 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; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((long) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + 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 CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + 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 + Py_DECREF(v); + if (likely(!ret)) + return val; + } + return (long) -1; + } + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); + if (!tmp) return (long) -1; + val = __Pyx_PyInt_As_long(tmp); + Py_DECREF(tmp); + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to long"); + return (long) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long) -1; +} + +/* CIntFromPy */ +static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const int neg_one = (int) -1, const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + if ((sizeof(int) < sizeof(long))) { + __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) + } else { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + goto raise_neg_overflow; + } + return (int) val; + } + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + 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)) +#ifdef HAVE_LONG_LONG + } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) +#endif + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + 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)) +#ifdef HAVE_LONG_LONG + } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) +#endif + } + } + { + int val; + PyObject *v = __Pyx_PyNumber_IntOrLong(x); +#if PY_MAJOR_VERSION < 3 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } +#endif + if (likely(v)) { + int ret = -1; +#if 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 *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (int) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (int) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (int) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (int) -1; + } else { + stepval = __Pyx_NewRef(v); + } + 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; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((int) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + 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 CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + 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 + Py_DECREF(v); + if (likely(!ret)) + return val; + } + return (int) -1; + } + } else { + int val; + PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); + if (!tmp) return (int) -1; + val = __Pyx_PyInt_As_int(tmp); + Py_DECREF(tmp); + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to int"); + return (int) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to int"); + return (int) -1; +} + +/* 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); +} +#if PY_MAJOR_VERSION == 2 +static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { + PyObject *exception, *value, *tb; + int res; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&exception, &value, &tb); + res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0; + if (unlikely(res == -1)) { + PyErr_WriteUnraisable(err); + res = 0; + } + if (!res) { + res = PyObject_IsSubclass(err, exc_type2); + if (unlikely(res == -1)) { + PyErr_WriteUnraisable(err); + res = 0; + } + } + __Pyx_ErrRestore(exception, value, tb); + return res; +} +#else +static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { + if (exc_type1) { + return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2); + } else { + return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); + } +} +#endif +static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + assert(PyExceptionClass_Check(exc_type)); + n = PyTuple_GET_SIZE(tuple); +#if PY_MAJOR_VERSION >= 3 + for (i=0; i= 0x030B00A4 + return Py_Version & ~0xFFUL; +#else + 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; + } + return version; +#endif +} +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); + } +} + +/* InitStrings */ +#if PY_MAJOR_VERSION >= 3 +static int __Pyx_InitString(__Pyx_StringTabEntry t, PyObject **str) { + if (t.is_unicode | t.is_str) { + if (t.intern) { + *str = PyUnicode_InternFromString(t.s); + } else if (t.encoding) { + *str = PyUnicode_Decode(t.s, t.n - 1, t.encoding, NULL); + } else { + *str = PyUnicode_FromStringAndSize(t.s, t.n - 1); + } + } else { + *str = PyBytes_FromStringAndSize(t.s, t.n - 1); + } + if (!*str) + return -1; + if (PyObject_Hash(*str) == -1) + return -1; + return 0; +} +#endif +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + #if PY_MAJOR_VERSION >= 3 + __Pyx_InitString(*t, t->p); + #else + if (t->is_unicode) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + if (!*t->p) + return -1; + if (PyObject_Hash(*t->p) == -1) + return -1; + #endif + ++t; + } + return 0; +} + +#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_DEFAULT +#if !CYTHON_PEP393_ENABLED +static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { + char* defenc_c; + PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); + if (!defenc) return NULL; + defenc_c = PyBytes_AS_STRING(defenc); +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + { + char* end = defenc_c + PyBytes_GET_SIZE(defenc); + char* c; + for (c = defenc_c; c < end; c++) { + if ((unsigned char) (*c) >= 128) { + PyUnicode_AsASCIIString(o); + return NULL; + } + } + } +#endif + *length = PyBytes_GET_SIZE(defenc); + return defenc_c; +} +#else +static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { + if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL; +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + if (likely(PyUnicode_IS_ASCII(o))) { + *length = PyUnicode_GET_LENGTH(o); + return PyUnicode_AsUTF8(o); + } else { + PyUnicode_AsASCIIString(o); + return NULL; + } +#else + return PyUnicode_AsUTF8AndSize(o, length); +#endif +} +#endif +#endif +static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT + if ( +#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + __Pyx_sys_getdefaultencoding_not_ascii && +#endif + PyUnicode_Check(o)) { + return __Pyx_PyUnicode_AsStringAndSize(o, length); + } else +#endif +#if (!CYTHON_COMPILING_IN_PYPY && !CYTHON_COMPILING_IN_LIMITED_API) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) + if (PyByteArray_Check(o)) { + *length = PyByteArray_GET_SIZE(o); + return PyByteArray_AS_STRING(o); + } else +#endif + { + char* result; + int r = PyBytes_AsStringAndSize(o, &result, length); + if (unlikely(r < 0)) { + return NULL; + } else { + return result; + } + } +} +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} +static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { + int retval; + if (unlikely(!x)) return -1; + retval = __Pyx_PyObject_IsTrue(x); + Py_DECREF(x); + return retval; +} +static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) { + __Pyx_TypeName result_type_name = __Pyx_PyType_GetName(Py_TYPE(result)); +#if PY_MAJOR_VERSION >= 3 + 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; + } +#endif + PyErr_Format(PyExc_TypeError, + "__%.4s__ returned non-%.4s (type " __Pyx_FMT_TYPENAME ")", + type_name, type_name, result_type_name); + __Pyx_DECREF_TypeName(result_type_name); + Py_DECREF(result); + return NULL; +} +static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) { +#if CYTHON_USE_TYPE_SLOTS + PyNumberMethods *m; +#endif + const char *name = NULL; + PyObject *res = NULL; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x) || PyLong_Check(x))) +#else + if (likely(PyLong_Check(x))) +#endif + return __Pyx_NewRef(x); +#if CYTHON_USE_TYPE_SLOTS + m = Py_TYPE(x)->tp_as_number; + #if PY_MAJOR_VERSION < 3 + if (m && m->nb_int) { + name = "int"; + res = m->nb_int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = m->nb_long(x); + } + #else + if (likely(m && m->nb_int)) { + name = "int"; + res = m->nb_int(x); + } + #endif +#else + if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) { + res = PyNumber_Int(x); + } +#endif + if (likely(res)) { +#if PY_MAJOR_VERSION < 3 + if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) { +#else + if (unlikely(!PyLong_CheckExact(res))) { +#endif + return __Pyx_PyNumber_IntOrLongWrongResultType(res, name); + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject *x; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_CheckExact(b))) { + if (sizeof(Py_ssize_t) >= sizeof(long)) + return PyInt_AS_LONG(b); + else + return PyInt_AsSsize_t(b); + } +#endif + if (likely(PyLong_CheckExact(b))) { + #if CYTHON_USE_PYLONG_INTERNALS + 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 = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; +} +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) { + if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) { + return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o); +#if PY_MAJOR_VERSION < 3 + } else if (likely(PyInt_CheckExact(o))) { + return PyInt_AS_LONG(o); +#endif + } else { + Py_ssize_t ival; + PyObject *x; + x = PyNumber_Index(o); + if (!x) return -1; + ival = PyInt_AsLong(x); + Py_DECREF(x); + return ival; + } +} +static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { + return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False); +} +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { + return PyInt_FromSize_t(ival); +} + + +/* #### Code section: utility_code_pragmas_end ### */ +#ifdef _MSC_VER +#pragma warning( pop ) +#endif + + + +/* #### Code section: end ### */ +#endif /* Py_PYTHON_H */ diff --git a/src/amulet_nbt/_string_encoding/__init__.pxd b/src_/amulet_nbt/_string_encoding/__init__.pxd similarity index 100% rename from src/amulet_nbt/_string_encoding/__init__.pxd rename to src_/amulet_nbt/_string_encoding/__init__.pxd diff --git a/src/amulet_nbt/_string_encoding/__init__.pyx b/src_/amulet_nbt/_string_encoding/__init__.pyx similarity index 100% rename from src/amulet_nbt/_string_encoding/__init__.pyx rename to src_/amulet_nbt/_string_encoding/__init__.pyx diff --git a/src/amulet_nbt/_string_encoding/_cpp/__init__.pxd b/src_/amulet_nbt/_string_encoding/_cpp/__init__.pxd similarity index 100% rename from src/amulet_nbt/_string_encoding/_cpp/__init__.pxd rename to src_/amulet_nbt/_string_encoding/_cpp/__init__.pxd diff --git a/src/amulet_nbt/_string_encoding/_cpp/mutf8.cpp b/src_/amulet_nbt/_string_encoding/_cpp/mutf8.cpp similarity index 100% rename from src/amulet_nbt/_string_encoding/_cpp/mutf8.cpp rename to src_/amulet_nbt/_string_encoding/_cpp/mutf8.cpp diff --git a/src/amulet_nbt/_string_encoding/_cpp/mutf8.hpp b/src_/amulet_nbt/_string_encoding/_cpp/mutf8.hpp similarity index 100% rename from src/amulet_nbt/_string_encoding/_cpp/mutf8.hpp rename to src_/amulet_nbt/_string_encoding/_cpp/mutf8.hpp diff --git a/src/amulet_nbt/_string_encoding/_cpp/mutf8.pxd b/src_/amulet_nbt/_string_encoding/_cpp/mutf8.pxd similarity index 100% rename from src/amulet_nbt/_string_encoding/_cpp/mutf8.pxd rename to src_/amulet_nbt/_string_encoding/_cpp/mutf8.pxd diff --git a/src/amulet_nbt/_string_encoding/_cpp/notes.txt b/src_/amulet_nbt/_string_encoding/_cpp/notes.txt similarity index 100% rename from src/amulet_nbt/_string_encoding/_cpp/notes.txt rename to src_/amulet_nbt/_string_encoding/_cpp/notes.txt diff --git a/src/amulet_nbt/_string_encoding/_cpp/utf8.cpp b/src_/amulet_nbt/_string_encoding/_cpp/utf8.cpp similarity index 100% rename from src/amulet_nbt/_string_encoding/_cpp/utf8.cpp rename to src_/amulet_nbt/_string_encoding/_cpp/utf8.cpp diff --git a/src/amulet_nbt/_string_encoding/_cpp/utf8.hpp b/src_/amulet_nbt/_string_encoding/_cpp/utf8.hpp similarity index 100% rename from src/amulet_nbt/_string_encoding/_cpp/utf8.hpp rename to src_/amulet_nbt/_string_encoding/_cpp/utf8.hpp diff --git a/src/amulet_nbt/_string_encoding/_cpp/utf8.pxd b/src_/amulet_nbt/_string_encoding/_cpp/utf8.pxd similarity index 100% rename from src/amulet_nbt/_string_encoding/_cpp/utf8.pxd rename to src_/amulet_nbt/_string_encoding/_cpp/utf8.pxd diff --git a/src_/amulet_nbt/_string_encoding/encoding.cpp b/src_/amulet_nbt/_string_encoding/encoding.cpp new file mode 100644 index 00000000..361d13bd --- /dev/null +++ b/src_/amulet_nbt/_string_encoding/encoding.cpp @@ -0,0 +1,8574 @@ +/* Generated by Cython 3.0.8 */ + +/* BEGIN: Cython Metadata +{ + "distutils": { + "depends": [ + "src\\amulet_nbt\\_string_encoding\\_cpp\\mutf8.hpp", + "src\\amulet_nbt\\_string_encoding\\_cpp\\utf8.hpp" + ], + "extra_compile_args": [ + "/std:c++20" + ], + "include_dirs": [ + "src\\amulet_nbt\\_string_encoding\\_cpp" + ], + "language": "c++", + "name": "amulet_nbt._string_encoding.encoding", + "sources": [ + "src\\amulet_nbt\\_string_encoding\\encoding.pyx", + "src/amulet_nbt/_string_encoding/_cpp/mutf8.cpp", + "src/amulet_nbt/_string_encoding/_cpp/utf8.cpp" + ] + }, + "module_name": "amulet_nbt._string_encoding.encoding" +} +END: Cython Metadata */ + +#ifndef PY_SSIZE_T_CLEAN +#define PY_SSIZE_T_CLEAN +#endif /* PY_SSIZE_T_CLEAN */ +#if defined(CYTHON_LIMITED_API) && 0 + #ifndef Py_LIMITED_API + #if CYTHON_LIMITED_API+0 > 0x03030000 + #define Py_LIMITED_API CYTHON_LIMITED_API + #else + #define Py_LIMITED_API 0x03030000 + #endif + #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 < 0x02070000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) + #error Cython requires Python 2.7+ or Python 3.3+. +#else +#if defined(CYTHON_LIMITED_API) && CYTHON_LIMITED_API +#define __PYX_EXTRA_ABI_MODULE_NAME "limited" +#else +#define __PYX_EXTRA_ABI_MODULE_NAME "" +#endif +#define CYTHON_ABI "3_0_8" __PYX_EXTRA_ABI_MODULE_NAME +#define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI +#define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." +#define CYTHON_HEX_VERSION 0x030008F0 +#define CYTHON_FUTURE_DIVISION 1 +#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 HAVE_LONG_LONG + #define HAVE_LONG_LONG +#endif +#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_NOGIL 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 + #if PY_VERSION_HEX < 0x03050000 + #undef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 0 + #elif !defined(CYTHON_USE_ASYNC_SLOTS) + #define CYTHON_USE_ASYNC_SLOTS 1 + #endif + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #undef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 1 + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_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 (PY_MAJOR_VERSION >= 3) + #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_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 + #endif +#elif defined(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_NOGIL 0 + #undef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 0 + #ifndef CYTHON_USE_TYPE_SPECS + #define CYTHON_USE_TYPE_SPECS 0 + #endif + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #if PY_VERSION_HEX < 0x03050000 + #undef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 0 + #elif !defined(CYTHON_USE_ASYNC_SLOTS) + #define CYTHON_USE_ASYNC_SLOTS 1 + #endif + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #undef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 1 + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_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 (PY_MAJOR_VERSION >= 3) + #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_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1 && PYPY_VERSION_NUM >= 0x07030C00) + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 + #endif +#elif defined(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_NOGIL 0 + #undef CYTHON_CLINE_IN_TRACEBACK + #define CYTHON_CLINE_IN_TRACEBACK 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_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 0 + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #undef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 0 + #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 + #undef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 0 + #undef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 0 + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_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 0 + #undef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 1 + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #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 +#elif defined(Py_GIL_DISABLED) || defined(Py_NOGIL) + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_CPYTHON 0 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_NOGIL 1 + #ifndef CYTHON_USE_TYPE_SLOTS + #define CYTHON_USE_TYPE_SLOTS 1 + #endif + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #ifndef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 1 + #endif + #undef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 0 + #ifndef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 1 + #endif + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #undef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 0 + #ifndef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 0 + #endif + #ifndef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 1 + #endif + #ifndef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 1 + #endif + #undef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 0 + #undef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 0 + #ifndef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 1 + #endif + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 1 + #endif + #undef CYTHON_USE_DICT_VERSIONS + #define CYTHON_USE_DICT_VERSIONS 0 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 +#else + #define CYTHON_COMPILING_IN_PYPY 0 + #define CYTHON_COMPILING_IN_CPYTHON 1 + #define CYTHON_COMPILING_IN_LIMITED_API 0 + #define CYTHON_COMPILING_IN_GRAAL 0 + #define CYTHON_COMPILING_IN_NOGIL 0 + #ifndef 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 + #if PY_MAJOR_VERSION < 3 + #undef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 0 + #elif !defined(CYTHON_USE_ASYNC_SLOTS) + #define CYTHON_USE_ASYNC_SLOTS 1 + #endif + #ifndef CYTHON_USE_PYLONG_INTERNALS + #define CYTHON_USE_PYLONG_INTERNALS 1 + #endif + #ifndef CYTHON_USE_PYLIST_INTERNALS + #define CYTHON_USE_PYLIST_INTERNALS 1 + #endif + #ifndef CYTHON_USE_UNICODE_INTERNALS + #define CYTHON_USE_UNICODE_INTERNALS 1 + #endif + #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2 + #undef CYTHON_USE_UNICODE_WRITER + #define CYTHON_USE_UNICODE_WRITER 0 + #elif !defined(CYTHON_USE_UNICODE_WRITER) + #define CYTHON_USE_UNICODE_WRITER 1 + #endif + #ifndef CYTHON_AVOID_BORROWED_REFS + #define CYTHON_AVOID_BORROWED_REFS 0 + #endif + #ifndef CYTHON_ASSUME_SAFE_MACROS + #define CYTHON_ASSUME_SAFE_MACROS 1 + #endif + #ifndef CYTHON_UNPACK_METHODS + #define CYTHON_UNPACK_METHODS 1 + #endif + #ifndef CYTHON_FAST_THREAD_STATE + #define CYTHON_FAST_THREAD_STATE 1 + #endif + #ifndef CYTHON_FAST_GIL + #define CYTHON_FAST_GIL (PY_MAJOR_VERSION < 3 || PY_VERSION_HEX >= 0x03060000 && PY_VERSION_HEX < 0x030C00A6) + #endif + #ifndef CYTHON_METH_FASTCALL + #define CYTHON_METH_FASTCALL (PY_VERSION_HEX >= 0x030700A1) + #endif + #ifndef CYTHON_FAST_PYCALL + #define CYTHON_FAST_PYCALL 1 + #endif + #ifndef CYTHON_PEP487_INIT_SUBCLASS + #define CYTHON_PEP487_INIT_SUBCLASS 1 + #endif + #if PY_VERSION_HEX < 0x03050000 + #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 + #ifndef CYTHON_USE_MODULE_STATE + #define CYTHON_USE_MODULE_STATE 0 + #endif + #if PY_VERSION_HEX < 0x030400a1 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 + #elif !defined(CYTHON_USE_TP_FINALIZE) + #define CYTHON_USE_TP_FINALIZE 1 + #endif + #if PY_VERSION_HEX < 0x030600B1 + #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) + #endif + #if PY_VERSION_HEX < 0x030700A3 + #undef CYTHON_USE_EXC_INFO_STACK + #define CYTHON_USE_EXC_INFO_STACK 0 + #elif !defined(CYTHON_USE_EXC_INFO_STACK) + #define CYTHON_USE_EXC_INFO_STACK 1 + #endif + #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC + #define CYTHON_UPDATE_DESCRIPTOR_DOC 1 + #endif +#endif +#if !defined(CYTHON_FAST_PYCCALL) +#define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) +#endif +#if !defined(CYTHON_VECTORCALL) +#define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL && PY_VERSION_HEX >= 0x030800B1) +#endif +#define CYTHON_BACKPORT_VECTORCALL (CYTHON_METH_FASTCALL && PY_VERSION_HEX < 0x030800B1) +#if CYTHON_USE_PYLONG_INTERNALS + #if PY_MAJOR_VERSION < 3 + #include "longintrepr.h" + #endif + #undef SHIFT + #undef BASE + #undef MASK + #ifdef SIZEOF_VOID_P + enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) }; + #endif +#endif +#ifndef __has_attribute + #define __has_attribute(x) 0 +#endif +#ifndef __has_cpp_attribute + #define __has_cpp_attribute(x) 0 +#endif +#ifndef CYTHON_RESTRICT + #if defined(__GNUC__) + #define CYTHON_RESTRICT __restrict__ + #elif defined(_MSC_VER) && _MSC_VER >= 1400 + #define CYTHON_RESTRICT __restrict + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_RESTRICT restrict + #else + #define CYTHON_RESTRICT + #endif +#endif +#ifndef CYTHON_UNUSED + #if defined(__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 +# 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) +#ifdef _MSC_VER + #ifndef _MSC_STDINT_H_ + #if _MSC_VER < 1300 + typedef unsigned char uint8_t; + typedef unsigned short uint16_t; + typedef unsigned int uint32_t; + #else + typedef unsigned __int8 uint8_t; + typedef unsigned __int16 uint16_t; + typedef unsigned __int32 uint32_t; + #endif + #endif + #if _MSC_VER < 1300 + #ifdef _WIN64 + typedef unsigned long long __pyx_uintptr_t; + #else + typedef unsigned int __pyx_uintptr_t; + #endif + #else + #ifdef _WIN64 + typedef unsigned __int64 __pyx_uintptr_t; + #else + typedef unsigned __int32 __pyx_uintptr_t; + #endif + #endif +#else + #include + typedef uintptr_t __pyx_uintptr_t; +#endif +#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 +#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 >= 0x030800b4 && PY_VERSION_HEX < 0x030A0000) +#else + #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000) +#endif +#define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer)) + +#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; +}; + +#define __PYX_BUILD_PY_SSIZE_T "n" +#define CYTHON_FORMAT_SSIZE_T "z" +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" + #define __Pyx_DefaultClassType PyClass_Type + #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) +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" + #define __Pyx_DefaultClassType PyType_Type +#if CYTHON_COMPILING_IN_LIMITED_API + static CYTHON_INLINE 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, "iiiiiOOOOOOiOO", 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, "iiiiiiOOOOOOiOO", 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, "iiiiiiOOOOOOOiOO", 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; + } + #ifndef CO_OPTIMIZED + #define CO_OPTIMIZED 0x0001 + #endif + #ifndef CO_NEWLOCALS + #define CO_NEWLOCALS 0x0002 + #endif + #ifndef CO_VARARGS + #define CO_VARARGS 0x0004 + #endif + #ifndef CO_VARKEYWORDS + #define CO_VARKEYWORDS 0x0008 + #endif + #ifndef CO_ASYNC_GENERATOR + #define CO_ASYNC_GENERATOR 0x0200 + #endif + #ifndef CO_GENERATOR + #define CO_GENERATOR 0x0020 + #endif + #ifndef CO_COROUTINE + #define CO_COROUTINE 0x0080 + #endif +#elif PY_VERSION_HEX >= 0x030B0000 + static CYTHON_INLINE 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; + PyObject *empty_bytes = PyBytes_FromStringAndSize("", 0); + if (!empty_bytes) return NULL; + 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, empty_bytes); + Py_DECREF(empty_bytes); + return result; + } +#elif PY_VERSION_HEX >= 0x030800B2 && !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 +#endif +#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 CO_COROUTINE + #define CO_COROUTINE 0x80 +#endif +#ifndef CO_ASYNC_GENERATOR + #define CO_ASYNC_GENERATOR 0x200 +#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 METH_STACKLESS + #define METH_STACKLESS 0 +#endif +#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL) + #ifndef METH_FASTCALL + #define METH_FASTCALL 0x80 + #endif + typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs); + typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args, + Py_ssize_t nargs, PyObject *kwnames); +#else + #define __Pyx_PyCFunctionFast _PyCFunctionFast + #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords +#endif +#if CYTHON_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)) +#elif CYTHON_BACKPORT_VECTORCALL + typedef PyObject *(*__pyx_vectorcallfunc)(PyObject *callable, PyObject *const *args, + size_t nargsf, PyObject *kwnames); + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET ((size_t)1 << (8 * sizeof(size_t) - 1)) + #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(((size_t)(n)) & ~__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)) +#else + #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0 + #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n)) +#endif +#if PY_MAJOR_VERSION >= 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) { +#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 __PYX_LIMITED_VERSION_HEX < 0x030900B1 + #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_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_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() +#elif PY_VERSION_HEX >= 0x03060000 + #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() +#elif PY_VERSION_HEX >= 0x03000000 + #define __Pyx_PyThreadState_Current PyThreadState_GET() +#else + #define __Pyx_PyThreadState_Current _PyThreadState_Current +#endif +#if CYTHON_COMPILING_IN_LIMITED_API +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; +} +#endif +#define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE(obj), name, func_ctype) +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name)) +#else + #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name) +#endif +#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT) +#include "pythread.h" +#define Py_tss_NEEDS_INIT 0 +typedef int Py_tss_t; +static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) { + *key = PyThread_create_key(); + return 0; +} +static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) { + Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t)); + *key = Py_tss_NEEDS_INIT; + return key; +} +static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) { + PyObject_Free(key); +} +static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) { + return *key != Py_tss_NEEDS_INIT; +} +static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) { + PyThread_delete_key(*key); + *key = Py_tss_NEEDS_INIT; +} +static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) { + return PyThread_set_key_value(*key, value); +} +static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { + return PyThread_get_key_value(*key); +} +#endif +#if PY_MAJOR_VERSION < 3 + #if CYTHON_COMPILING_IN_PYPY + #if PYPY_VERSION_NUM < 0x07030600 + #if defined(__cplusplus) && __cplusplus >= 201402L + [[deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")]] + #elif defined(__GNUC__) || defined(__clang__) + __attribute__ ((__deprecated__("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6"))) + #elif defined(_MSC_VER) + __declspec(deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")) + #endif + static CYTHON_INLINE int PyGILState_Check(void) { + return 0; + } + #else // PYPY_VERSION_NUM < 0x07030600 + #endif // PYPY_VERSION_NUM < 0x07030600 + #else + static CYTHON_INLINE int PyGILState_Check(void) { + PyThreadState * tstate = _PyThreadState_Current; + return tstate && (tstate == PyGILState_GetThisThreadState()); + } + #endif +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000 || defined(_PyDict_NewPresized) +#define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) +#else +#define __Pyx_PyDict_NewPresized(n) PyDict_New() +#endif +#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030600B4 && PY_VERSION_HEX < 0x030d0000 && 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 PY_MAJOR_VERSION >= 3 && (!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) + #define __Pyx_PyObject_GetIterNextFunc(obj) (Py_TYPE(obj)->tp_iternext) +#else + #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp)) + #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature) + #define __Pyx_PyObject_GetIterNextFunc(obj) PyIter_Next +#endif +#if CYTHON_COMPILING_IN_LIMITED_API + #define __Pyx_SetItemOnTypeDict(tp, k, v) PyObject_GenericSetAttr((PyObject*)tp, k, v) +#else + #define __Pyx_SetItemOnTypeDict(tp, k, v) PyDict_SetItem(tp->tp_dict, k, v) +#endif +#if CYTHON_USE_TYPE_SPECS && PY_VERSION_HEX >= 0x03080000 +#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 CYTHON_PEP393_ENABLED 1 + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GetLength(u) + #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)) +#elif PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) + #define CYTHON_PEP393_ENABLED 1 + #if PY_VERSION_HEX >= 0x030C0000 + #define __Pyx_PyUnicode_READY(op) (0) + #else + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ + 0 : _PyUnicode_Ready((PyObject *)(op))) + #endif + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) + #define __Pyx_PyUnicode_KIND(u) ((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 +#else + #define CYTHON_PEP393_ENABLED 0 + #define PyUnicode_1BYTE_KIND 1 + #define PyUnicode_2BYTE_KIND 2 + #define PyUnicode_4BYTE_KIND 4 + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) + #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535U : 1114111U) + #define __Pyx_PyUnicode_KIND(u) ((int)sizeof(Py_UNICODE)) + #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) + #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) + #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = (Py_UNICODE) ch) + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) +#endif +#if CYTHON_COMPILING_IN_PYPY + #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) + #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) +#else + #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) + #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ + PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) +#endif +#if CYTHON_COMPILING_IN_PYPY + #if !defined(PyUnicode_DecodeUnicodeEscape) + #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors) + #endif + #if !defined(PyUnicode_Contains) || (PY_MAJOR_VERSION == 2 && PYPY_VERSION_NUM < 0x07030500) + #undef 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_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) +#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) +#else + #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) +#endif +#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII) + #define PyObject_ASCII(o) PyObject_Repr(o) +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject + #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check + #define PyString_CheckExact PyUnicode_CheckExact +#ifndef PyObject_Unicode + #define PyObject_Unicode PyObject_Str +#endif +#endif +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) + #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) +#else + #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) + #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) +#endif +#if 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 +#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_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0)) + #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) +#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_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v) + #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) +#endif +#if PY_VERSION_HEX >= 0x030d00A1 + #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name) +#else + static CYTHON_INLINE PyObject *__Pyx_PyImport_AddModuleRef(const char *name) { + PyObject *module = PyImport_AddModule(name); + Py_XINCREF(module); + return module; + } +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define __Pyx_Py3Int_Check(op) PyLong_Check(op) + #define __Pyx_Py3Int_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask + #define PyNumber_Int PyNumber_Long +#else + #define __Pyx_Py3Int_Check(op) (PyLong_Check(op) || PyInt_Check(op)) + #define __Pyx_Py3Int_CheckExact(op) (PyLong_CheckExact(op) || PyInt_CheckExact(op)) +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyBoolObject PyLongObject +#endif +#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY + #ifndef PyUnicode_InternFromString + #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) + #endif +#endif +#if PY_VERSION_HEX < 0x030200A4 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t +#else + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t +#endif +#if CYTHON_USE_ASYNC_SLOTS + #if PY_VERSION_HEX >= 0x030500B1 + #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods + #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) + #else + #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) + #endif +#else + #define __Pyx_PyType_AsAsync(obj) NULL +#endif +#ifndef __Pyx_PyAsyncMethodsStruct + typedef struct { + unaryfunc am_await; + unaryfunc am_aiter; + unaryfunc am_anext; + } __Pyx_PyAsyncMethodsStruct; +#endif + +#if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS) + #if !defined(_USE_MATH_DEFINES) + #define _USE_MATH_DEFINES + #endif +#endif +#include +#ifdef NAN +#define __PYX_NAN() ((float) NAN) +#else +static CYTHON_INLINE float __PYX_NAN() { + float value; + memset(&value, 0xFF, sizeof(value)); + return value; +} +#endif +#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) +#define __Pyx_truncl trunc +#else +#define __Pyx_truncl truncl +#endif + +#define __PYX_MARK_ERR_POS(f_index, lineno) \ + { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; } +#define __PYX_ERR(f_index, lineno, Ln_error) \ + { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; } + +#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__amulet_nbt___string_encoding__encoding +#define __PYX_HAVE_API__amulet_nbt___string_encoding__encoding +/* Early includes */ +#include +#include +#include "ios" +#include "new" +#include "stdexcept" +#include "typeinfo" +#include "utf8.hpp" +#include "mutf8.hpp" +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS) +#define CYTHON_WITHOUT_ASSERTIONS +#endif + +typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding; + const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; + +#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 +#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0 +#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8) +#define __PYX_DEFAULT_STRING_ENCODING "" +#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString +#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize +#define __Pyx_uchar_cast(c) ((unsigned char)c) +#define __Pyx_long_cast(x) ((long)x) +#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ + (sizeof(type) < sizeof(Py_ssize_t)) ||\ + (sizeof(type) > sizeof(Py_ssize_t) &&\ + likely(v < (type)PY_SSIZE_T_MAX ||\ + v == (type)PY_SSIZE_T_MAX) &&\ + (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ + v == (type)PY_SSIZE_T_MIN))) ||\ + (sizeof(type) == sizeof(Py_ssize_t) &&\ + (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ + v == (type)PY_SSIZE_T_MAX))) ) +static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) { + return (size_t) i < (size_t) limit; +} +#if defined (__cplusplus) && __cplusplus >= 201103L + #include + #define __Pyx_sst_abs(value) std::abs(value) +#elif SIZEOF_INT >= SIZEOF_SIZE_T + #define __Pyx_sst_abs(value) abs(value) +#elif SIZEOF_LONG >= SIZEOF_SIZE_T + #define __Pyx_sst_abs(value) labs(value) +#elif defined (_MSC_VER) + #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value)) +#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define __Pyx_sst_abs(value) llabs(value) +#elif defined (__GNUC__) + #define __Pyx_sst_abs(value) __builtin_llabs(value) +#else + #define __Pyx_sst_abs(value) ((value<0) ? -value : value) +#endif +static CYTHON_INLINE 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 PY_MAJOR_VERSION < 3 + #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString + #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize +#else + #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString + #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize +#endif +#define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s)) +#define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s)) +#define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s)) +#define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) +#define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) +#define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) +#define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_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_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) +#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const wchar_t *u) +{ + const wchar_t *u_end = u; + while (*u_end++) ; + return (size_t)(u_end - u - 1); +} +#else +static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) +{ + const Py_UNICODE *u_end = u; + while (*u_end++) ; + return (size_t)(u_end - u - 1); +} +#endif +#define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o) +#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) +#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode +#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode +#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) +#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) +static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b); +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); +#define __Pyx_PySequence_Tuple(obj)\ + (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); +#if CYTHON_ASSUME_SAFE_MACROS +#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) +#else +#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) +#endif +#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) +#if PY_MAJOR_VERSION >= 3 +#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) +#else +#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) +#endif +#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 PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII +#include +static int __Pyx_sys_getdefaultencoding_not_ascii; +static int __Pyx_init_sys_getdefaultencoding_params(void) { + PyObject* sys; + PyObject* default_encoding = NULL; + PyObject* ascii_chars_u = NULL; + PyObject* ascii_chars_b = NULL; + const char* default_encoding_c; + sys = PyImport_ImportModule("sys"); + if (!sys) goto bad; + default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL); + Py_DECREF(sys); + if (!default_encoding) goto bad; + default_encoding_c = PyBytes_AsString(default_encoding); + if (!default_encoding_c) goto bad; + if (strcmp(default_encoding_c, "ascii") == 0) { + __Pyx_sys_getdefaultencoding_not_ascii = 0; + } else { + char ascii_chars[128]; + int c; + for (c = 0; c < 128; c++) { + ascii_chars[c] = (char) c; + } + __Pyx_sys_getdefaultencoding_not_ascii = 1; + ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); + if (!ascii_chars_u) goto bad; + ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); + if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { + PyErr_Format( + PyExc_ValueError, + "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.", + default_encoding_c); + goto bad; + } + Py_DECREF(ascii_chars_u); + Py_DECREF(ascii_chars_b); + } + Py_DECREF(default_encoding); + return 0; +bad: + Py_XDECREF(default_encoding); + Py_XDECREF(ascii_chars_u); + Py_XDECREF(ascii_chars_b); + return -1; +} +#endif +#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 +#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) +#else +#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) +#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT +#include +static char* __PYX_DEFAULT_STRING_ENCODING; +static int __Pyx_init_sys_getdefaultencoding_params(void) { + PyObject* sys; + PyObject* default_encoding = NULL; + char* default_encoding_c; + sys = PyImport_ImportModule("sys"); + if (!sys) goto bad; + default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); + Py_DECREF(sys); + if (!default_encoding) goto bad; + default_encoding_c = PyBytes_AsString(default_encoding); + if (!default_encoding_c) goto bad; + __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1); + if (!__PYX_DEFAULT_STRING_ENCODING) goto bad; + strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); + Py_DECREF(default_encoding); + return 0; +bad: + Py_XDECREF(default_encoding); + return -1; +} +#endif +#endif + + +/* Test for GCC > 2.95 */ +#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) +#else /* !__GNUC__ or GCC < 2.95 */ + #define likely(x) (x) + #define unlikely(x) (x) +#endif /* __GNUC__ */ +static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } + +#if !CYTHON_USE_MODULE_STATE +static PyObject *__pyx_m = NULL; +#endif +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm = __FILE__; +static const char *__pyx_filename; + +/* #### Code section: filename_table ### */ + +static const char *__pyx_f[] = { + "", + "src\\\\amulet_nbt\\\\_string_encoding\\\\encoding.pyx", +}; +/* #### Code section: utility_code_proto_before_types ### */ +/* ForceInitThreads.proto */ +#ifndef __PYX_FORCE_INIT_THREADS + #define __PYX_FORCE_INIT_THREADS 0 +#endif + +/* #### Code section: numeric_typedefs ### */ +/* #### Code section: complex_type_declarations ### */ +/* #### Code section: type_declarations ### */ + +/*--- Type declarations ---*/ +struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding; + +/* "src/amulet_nbt/_string_encoding/_cpp/__init__.pxd":3 + * from libcpp.string cimport string + * + * ctypedef string (*CStringEncode)(const string&) # <<<<<<<<<<<<<< + * ctypedef string (*CStringDecode)(const string&) + */ +typedef std::string (*__pyx_t_10amulet_nbt_16_string_encoding_4_cpp_CStringEncode)(std::string const &); + +/* "src/amulet_nbt/_string_encoding/_cpp/__init__.pxd":4 + * + * ctypedef string (*CStringEncode)(const string&) + * ctypedef string (*CStringDecode)(const string&) # <<<<<<<<<<<<<< + */ +typedef std::string (*__pyx_t_10amulet_nbt_16_string_encoding_4_cpp_CStringDecode)(std::string const &); + +/* "amulet_nbt/_string_encoding/encoding.pxd":4 + * + * + * cdef class StringEncoding: # <<<<<<<<<<<<<< + * cdef CStringEncode encode_cpp + * cdef CStringDecode decode_cpp + */ +struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding { + PyObject_HEAD + __pyx_t_10amulet_nbt_16_string_encoding_4_cpp_CStringEncode encode_cpp; + __pyx_t_10amulet_nbt_16_string_encoding_4_cpp_CStringDecode decode_cpp; +}; + +/* #### 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; +#ifdef WITH_THREAD + #define __Pyx_RefNannySetupContext(name, acquire_gil)\ + if (acquire_gil) {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ + PyGILState_Release(__pyx_gilstate_save);\ + } else {\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ + } + #define __Pyx_RefNannyFinishContextNogil() {\ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ + __Pyx_RefNannyFinishContext();\ + PyGILState_Release(__pyx_gilstate_save);\ + } +#else + #define __Pyx_RefNannySetupContext(name, acquire_gil)\ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__)) + #define __Pyx_RefNannyFinishContextNogil() __Pyx_RefNannyFinishContext() +#endif + #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 */ +#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 */ +#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 */ +#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 */ +#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 */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); + +/* GetBuiltinName.proto */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name); + +/* TupleAndListFromArray.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n); +static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n); +#endif + +/* IncludeStringH.proto */ +#include + +/* BytesEquals.proto */ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); + +/* UnicodeEquals.proto */ +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); + +/* fastcall.proto */ +#if CYTHON_AVOID_BORROWED_REFS + #define __Pyx_Arg_VARARGS(args, i) PySequence_GetItem(args, i) +#elif CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_Arg_VARARGS(args, i) PyTuple_GET_ITEM(args, i) +#else + #define __Pyx_Arg_VARARGS(args, i) PyTuple_GetItem(args, i) +#endif +#if CYTHON_AVOID_BORROWED_REFS + #define __Pyx_Arg_NewRef_VARARGS(arg) __Pyx_NewRef(arg) + #define __Pyx_Arg_XDECREF_VARARGS(arg) Py_XDECREF(arg) +#else + #define __Pyx_Arg_NewRef_VARARGS(arg) arg + #define __Pyx_Arg_XDECREF_VARARGS(arg) +#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_Arg_FASTCALL(args, i) args[i] + #define __Pyx_NumKwargs_FASTCALL(kwds) 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_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues); + #else + #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw) + #endif + #define __Pyx_Arg_NewRef_FASTCALL(arg) arg /* no-op, __Pyx_Arg_FASTCALL is direct and this needs + to have the same reference counting */ + #define __Pyx_Arg_XDECREF_FASTCALL(arg) +#else + #define __Pyx_Arg_FASTCALL __Pyx_Arg_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 + #define __Pyx_Arg_NewRef_FASTCALL(arg) __Pyx_Arg_NewRef_VARARGS(arg) + #define __Pyx_Arg_XDECREF_FASTCALL(arg) __Pyx_Arg_XDECREF_VARARGS(arg) +#endif +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS +#define __Pyx_ArgsSlice_VARARGS(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_VARARGS(args, start), stop - start) +#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_FASTCALL(args, start), stop - start) +#else +#define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop) +#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop) +#endif + +/* RaiseDoubleKeywords.proto */ +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); + +/* ParseKeywords.proto */ +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject *const *kwvalues, + PyObject **argnames[], + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, + const char* function_name); + +/* RaiseArgTupleInvalid.proto */ +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); + +/* 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)) +static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact); + +/* KeywordStringCheck.proto */ +static int __Pyx_CheckKeywordStrings(PyObject *kw, const char* function_name, int kw_allowed); + +/* RaiseException.proto */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); + +/* IncludeStructmemberH.proto */ +#include + +/* FixUpExtensionType.proto */ +#if CYTHON_USE_TYPE_SPECS +static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type); +#endif + +/* PyFunctionFastCall.proto */ +#if CYTHON_FAST_PYCALL +#if !CYTHON_VECTORCALL +#define __Pyx_PyFunction_FastCall(func, args, nargs)\ + __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) +static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs); +#endif +#define __Pyx_BUILD_ASSERT_EXPR(cond)\ + (sizeof(char [1 - 2*!(cond)]) - 1) +#ifndef Py_MEMBER_SIZE +#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) +#endif +#if !CYTHON_VECTORCALL +#if PY_VERSION_HEX >= 0x03080000 + #include "frameobject.h" +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API + #ifndef Py_BUILD_CORE + #define Py_BUILD_CORE 1 + #endif + #include "internal/pycore_frame.h" +#endif + #define __Pxy_PyFrame_Initialize_Offsets() + #define __Pyx_PyFrame_GetLocalsplus(frame) ((frame)->f_localsplus) +#else + static size_t __pyx_pyframe_localsplus_offset = 0; + #include "frameobject.h" + #define __Pxy_PyFrame_Initialize_Offsets()\ + ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\ + (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus))) + #define __Pyx_PyFrame_GetLocalsplus(frame)\ + (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset)) +#endif +#endif +#endif + +/* PyObjectCall.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); +#else +#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) +#endif + +/* PyObjectCallMethO.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); +#endif + +/* 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 **args, size_t nargs, PyObject *kwargs); + +/* PyObjectCallNoArg.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); + +/* PyObjectCallOneArg.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); + +/* PyObjectGetMethod.proto */ +static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method); + +/* PyObjectCallMethod0.proto */ +static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name); + +/* ValidateBasesTuple.proto */ +#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); + +/* PyObject_GenericGetAttrNoDict.proto */ +#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 +static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name); +#else +#define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr +#endif + +/* PyObject_GenericGetAttr.proto */ +#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 +static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name); +#else +#define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr +#endif + +/* SetupReduce.proto */ +#if !CYTHON_COMPILING_IN_LIMITED_API +static int __Pyx_setup_reduce(PyObject* type_obj); +#endif + +/* FetchSharedCythonModule.proto */ +static PyObject *__Pyx_FetchSharedCythonABIModule(void); + +/* FetchCommonType.proto */ +#if !CYTHON_USE_TYPE_SPECS +static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); +#else +static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases); +#endif + +/* PyMethodNew.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API +static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { + PyObject *typesModule=NULL, *methodType=NULL, *result=NULL; + CYTHON_UNUSED_VAR(typ); + if (!self) + return __Pyx_NewRef(func); + typesModule = PyImport_ImportModule("types"); + if (!typesModule) return NULL; + methodType = PyObject_GetAttrString(typesModule, "MethodType"); + Py_DECREF(typesModule); + if (!methodType) return NULL; + result = PyObject_CallFunctionObjArgs(methodType, func, self, NULL); + Py_DECREF(methodType); + return result; +} +#elif PY_MAJOR_VERSION >= 3 +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); +} +#else + #define __Pyx_PyMethod_New PyMethod_New +#endif + +/* PyVectorcallFastCallDict.proto */ +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw); +#endif + +/* CythonFunctionShared.proto */ +#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_BACKPORT_VECTORCALL + __pyx_vectorcallfunc func_vectorcall; +#endif +#if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API + PyObject *func_weakreflist; +#endif + PyObject *func_dict; + PyObject *func_name; + PyObject *func_qualname; + PyObject *func_doc; + PyObject *func_globals; + PyObject *func_code; + PyObject *func_closure; +#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + PyObject *func_classobj; +#endif + void *defaults; + int defaults_pyobjects; + size_t defaults_size; + 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_CyFunctionType) +#define __Pyx_CyOrPyCFunction_Check(obj) __Pyx_TypeCheck2(obj, __pyx_CyFunctionType, &PyCFunction_Type) +#define __Pyx_CyFunction_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_CyFunctionType) +static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void *cfunc); +#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 void *__Pyx_CyFunction_InitDefaults(PyObject *m, + size_t size, + int pyobjects); +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m, + PyObject *tuple); +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, + PyObject *dict); +static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, + PyObject *dict); +static int __pyx_CyFunction_init(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_BACKPORT_VECTORCALL +#define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall) +#else +#define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall) +#endif +#endif + +/* CythonFunction.proto */ +static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, + int flags, PyObject* qualname, + PyObject *closure, + PyObject *module, PyObject *globals, + PyObject* code); + +/* PyDictVersioning.proto */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) +#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) +#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ + (version_var) = __PYX_GET_DICT_VERSION(dict);\ + (cache_var) = (value); +#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ + static PY_UINT64_T __pyx_dict_version = 0;\ + static PyObject *__pyx_dict_cached_value = NULL;\ + if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ + (VAR) = __pyx_dict_cached_value;\ + } else {\ + (VAR) = __pyx_dict_cached_value = (LOOKUP);\ + __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ + }\ +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); +#else +#define __PYX_GET_DICT_VERSION(dict) (0) +#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) +#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); +#endif + +/* CLineInTraceback.proto */ +#ifdef CYTHON_CLINE_IN_TRACEBACK +#define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) +#else +static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); +#endif + +/* CodeObjectCache.proto */ +#if !CYTHON_COMPILING_IN_LIMITED_API +typedef struct { + PyCodeObject* code_object; + int code_line; +} __Pyx_CodeObjectCacheEntry; +struct __Pyx_CodeObjectCache { + int count; + int max_count; + __Pyx_CodeObjectCacheEntry* entries; +}; +static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); +static PyCodeObject *__pyx_find_code_object(int code_line); +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); +#endif + +/* 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 + +/* FormatTypeName.proto */ +#if CYTHON_COMPILING_IN_LIMITED_API +typedef PyObject *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%U" +static __Pyx_TypeName __Pyx_PyType_GetName(PyTypeObject* tp); +#define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj) +#else +typedef const char *__Pyx_TypeName; +#define __Pyx_FMT_TYPENAME "%.200s" +#define __Pyx_PyType_GetName(tp) ((tp)->tp_name) +#define __Pyx_DECREF_TypeName(obj) +#endif + +/* GCCDiagnostics.proto */ +#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) +#define __Pyx_HAS_GCC_DIAGNOSTIC +#endif + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); + +/* CIntFromPy.proto */ +static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); + +/* CIntFromPy.proto */ +static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); + +/* 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) +#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (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) + +/* CheckBinaryVersion.proto */ +static unsigned long __Pyx_get_runtime_version(void); +static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer); + +/* InitStrings.proto */ +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); + +/* #### Code section: module_declarations ### */ + +/* Module declarations from "libc.string" */ + +/* Module declarations from "libcpp.string" */ + +/* Module declarations from "amulet_nbt._string_encoding._cpp" */ + +/* Module declarations from "amulet_nbt._string_encoding._cpp.utf8" */ + +/* Module declarations from "amulet_nbt._string_encoding._cpp.mutf8" */ + +/* Module declarations from "amulet_nbt._string_encoding.encoding" */ +static struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding *__pyx_v_10amulet_nbt_16_string_encoding_8encoding__mutf8_encoding = 0; +static struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding *__pyx_v_10amulet_nbt_16_string_encoding_8encoding__utf8_encoding = 0; +static struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding *__pyx_v_10amulet_nbt_16_string_encoding_8encoding__utf8_escape_encoding = 0; +static std::string __pyx_convert_string_from_py_std__in_string(PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_convert_PyObject_string_to_py_std__in_string(std::string const &); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_convert_PyUnicode_string_to_py_std__in_string(std::string const &); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_convert_PyStr_string_to_py_std__in_string(std::string const &); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_convert_PyBytes_string_to_py_std__in_string(std::string const &); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_std__in_string(std::string const &); /*proto*/ +/* #### Code section: typeinfo ### */ +/* #### Code section: before_global_var ### */ +#define __Pyx_MODULE_NAME "amulet_nbt._string_encoding.encoding" +extern int __pyx_module_is_main_amulet_nbt___string_encoding__encoding; +int __pyx_module_is_main_amulet_nbt___string_encoding__encoding = 0; + +/* Implementation of "amulet_nbt._string_encoding.encoding" */ +/* #### Code section: global_var ### */ +static PyObject *__pyx_builtin_TypeError; +/* #### Code section: string_decls ### */ +static const char __pyx_k__8[] = "?"; +static const char __pyx_k_gc[] = "gc"; +static const char __pyx_k_data[] = "data"; +static const char __pyx_k_main[] = "__main__"; +static const char __pyx_k_name[] = "__name__"; +static const char __pyx_k_self[] = "self"; +static const char __pyx_k_test[] = "__test__"; +static const char __pyx_k_bytes[] = "bytes"; +static const char __pyx_k_decode[] = "decode"; +static const char __pyx_k_enable[] = "enable"; +static const char __pyx_k_encode[] = "encode"; +static const char __pyx_k_reduce[] = "__reduce__"; +static const char __pyx_k_return[] = "return"; +static const char __pyx_k_disable[] = "disable"; +static const char __pyx_k_getstate[] = "__getstate__"; +static const char __pyx_k_setstate[] = "__setstate__"; +static const char __pyx_k_TypeError[] = "TypeError"; +static const char __pyx_k_isenabled[] = "isenabled"; +static const char __pyx_k_pyx_state[] = "__pyx_state"; +static const char __pyx_k_reduce_ex[] = "__reduce_ex__"; +static const char __pyx_k_is_coroutine[] = "_is_coroutine"; +static const char __pyx_k_stringsource[] = ""; +static const char __pyx_k_reduce_cython[] = "__reduce_cython__"; +static const char __pyx_k_utf8_encoding[] = "utf8_encoding"; +static const char __pyx_k_StringEncoding[] = "StringEncoding"; +static const char __pyx_k_mutf8_encoding[] = "mutf8_encoding"; +static const char __pyx_k_setstate_cython[] = "__setstate_cython__"; +static const char __pyx_k_asyncio_coroutines[] = "asyncio.coroutines"; +static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; +static const char __pyx_k_utf8_escape_encoding[] = "utf8_escape_encoding"; +static const char __pyx_k_StringEncoding_decode[] = "StringEncoding.decode"; +static const char __pyx_k_StringEncoding_encode[] = "StringEncoding.encode"; +static const char __pyx_k_StringEncoding___reduce_cython[] = "StringEncoding.__reduce_cython__"; +static const char __pyx_k_self_decode_cpp_self_encode_cpp[] = "self.decode_cpp,self.encode_cpp cannot be converted to a Python object for pickling"; +static const char __pyx_k_src_amulet_nbt__string_encoding[] = "src\\amulet_nbt\\_string_encoding\\encoding.pyx"; +static const char __pyx_k_StringEncoding___setstate_cython[] = "StringEncoding.__setstate_cython__"; +static const char __pyx_k_amulet_nbt__string_encoding_enco[] = "amulet_nbt._string_encoding.encoding"; +/* #### Code section: decls ### */ +static PyObject *__pyx_pf_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_encode(struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding *__pyx_v_self, PyObject *__pyx_v_data); /* proto */ +static PyObject *__pyx_pf_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_2decode(struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding *__pyx_v_self, PyObject *__pyx_v_data); /* proto */ +static PyObject *__pyx_pf_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_tp_new_10amulet_nbt_16_string_encoding_8encoding_StringEncoding(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +/* #### Code section: late_includes ### */ +/* #### Code section: module_state ### */ +typedef struct { + PyObject *__pyx_d; + PyObject *__pyx_b; + PyObject *__pyx_cython_runtime; + PyObject *__pyx_empty_tuple; + PyObject *__pyx_empty_bytes; + PyObject *__pyx_empty_unicode; + #ifdef __Pyx_CyFunction_USED + PyTypeObject *__pyx_CyFunctionType; + #endif + #ifdef __Pyx_FusedFunction_USED + PyTypeObject *__pyx_FusedFunctionType; + #endif + #ifdef __Pyx_Generator_USED + PyTypeObject *__pyx_GeneratorType; + #endif + #ifdef __Pyx_IterableCoroutine_USED + PyTypeObject *__pyx_IterableCoroutineType; + #endif + #ifdef __Pyx_Coroutine_USED + PyTypeObject *__pyx_CoroutineAwaitType; + #endif + #ifdef __Pyx_Coroutine_USED + PyTypeObject *__pyx_CoroutineType; + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + #endif + #if CYTHON_USE_MODULE_STATE + PyObject *__pyx_type_10amulet_nbt_16_string_encoding_8encoding_StringEncoding; + #endif + PyTypeObject *__pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding; + PyObject *__pyx_n_s_StringEncoding; + PyObject *__pyx_n_s_StringEncoding___reduce_cython; + PyObject *__pyx_n_s_StringEncoding___setstate_cython; + PyObject *__pyx_n_s_StringEncoding_decode; + PyObject *__pyx_n_s_StringEncoding_encode; + PyObject *__pyx_n_s_TypeError; + PyObject *__pyx_n_s__8; + PyObject *__pyx_n_s_amulet_nbt__string_encoding_enco; + PyObject *__pyx_n_s_asyncio_coroutines; + PyObject *__pyx_n_s_bytes; + PyObject *__pyx_n_s_cline_in_traceback; + PyObject *__pyx_n_s_data; + PyObject *__pyx_n_s_decode; + PyObject *__pyx_kp_u_disable; + PyObject *__pyx_kp_u_enable; + PyObject *__pyx_n_s_encode; + PyObject *__pyx_kp_u_gc; + PyObject *__pyx_n_s_getstate; + PyObject *__pyx_n_s_is_coroutine; + PyObject *__pyx_kp_u_isenabled; + PyObject *__pyx_n_s_main; + PyObject *__pyx_n_s_mutf8_encoding; + PyObject *__pyx_n_s_name; + PyObject *__pyx_n_s_pyx_state; + PyObject *__pyx_n_s_reduce; + PyObject *__pyx_n_s_reduce_cython; + PyObject *__pyx_n_s_reduce_ex; + PyObject *__pyx_n_s_return; + PyObject *__pyx_n_s_self; + PyObject *__pyx_kp_s_self_decode_cpp_self_encode_cpp; + PyObject *__pyx_n_s_setstate; + PyObject *__pyx_n_s_setstate_cython; + PyObject *__pyx_kp_s_src_amulet_nbt__string_encoding; + PyObject *__pyx_kp_s_stringsource; + PyObject *__pyx_n_s_test; + PyObject *__pyx_n_s_utf8_encoding; + PyObject *__pyx_n_s_utf8_escape_encoding; + PyObject *__pyx_tuple_; + PyObject *__pyx_tuple__4; + PyObject *__pyx_tuple__6; + PyObject *__pyx_codeobj__2; + PyObject *__pyx_codeobj__3; + PyObject *__pyx_codeobj__5; + PyObject *__pyx_codeobj__7; +} __pyx_mstate; + +#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(o) ((__pyx_mstate *)__Pyx_PyModule_GetState(o)) + +#define __pyx_mstate_global (__pyx_mstate(PyState_FindModule(&__pyx_moduledef))) + +#define __pyx_m (PyState_FindModule(&__pyx_moduledef)) +#else +static __pyx_mstate __pyx_mstate_global_static = +#ifdef __cplusplus + {}; +#else + {0}; +#endif +static __pyx_mstate *__pyx_mstate_global = &__pyx_mstate_global_static; +#endif +/* #### Code section: module_state_clear ### */ +#if CYTHON_USE_MODULE_STATE +static int __pyx_m_clear(PyObject *m) { + __pyx_mstate *clear_module_state = __pyx_mstate(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); + #ifdef __Pyx_CyFunction_USED + Py_CLEAR(clear_module_state->__pyx_CyFunctionType); + #endif + #ifdef __Pyx_FusedFunction_USED + Py_CLEAR(clear_module_state->__pyx_FusedFunctionType); + #endif + Py_CLEAR(clear_module_state->__pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding); + Py_CLEAR(clear_module_state->__pyx_type_10amulet_nbt_16_string_encoding_8encoding_StringEncoding); + Py_CLEAR(clear_module_state->__pyx_n_s_StringEncoding); + Py_CLEAR(clear_module_state->__pyx_n_s_StringEncoding___reduce_cython); + Py_CLEAR(clear_module_state->__pyx_n_s_StringEncoding___setstate_cython); + Py_CLEAR(clear_module_state->__pyx_n_s_StringEncoding_decode); + Py_CLEAR(clear_module_state->__pyx_n_s_StringEncoding_encode); + Py_CLEAR(clear_module_state->__pyx_n_s_TypeError); + Py_CLEAR(clear_module_state->__pyx_n_s__8); + Py_CLEAR(clear_module_state->__pyx_n_s_amulet_nbt__string_encoding_enco); + Py_CLEAR(clear_module_state->__pyx_n_s_asyncio_coroutines); + Py_CLEAR(clear_module_state->__pyx_n_s_bytes); + Py_CLEAR(clear_module_state->__pyx_n_s_cline_in_traceback); + Py_CLEAR(clear_module_state->__pyx_n_s_data); + Py_CLEAR(clear_module_state->__pyx_n_s_decode); + Py_CLEAR(clear_module_state->__pyx_kp_u_disable); + Py_CLEAR(clear_module_state->__pyx_kp_u_enable); + Py_CLEAR(clear_module_state->__pyx_n_s_encode); + Py_CLEAR(clear_module_state->__pyx_kp_u_gc); + Py_CLEAR(clear_module_state->__pyx_n_s_getstate); + Py_CLEAR(clear_module_state->__pyx_n_s_is_coroutine); + Py_CLEAR(clear_module_state->__pyx_kp_u_isenabled); + Py_CLEAR(clear_module_state->__pyx_n_s_main); + Py_CLEAR(clear_module_state->__pyx_n_s_mutf8_encoding); + Py_CLEAR(clear_module_state->__pyx_n_s_name); + Py_CLEAR(clear_module_state->__pyx_n_s_pyx_state); + Py_CLEAR(clear_module_state->__pyx_n_s_reduce); + Py_CLEAR(clear_module_state->__pyx_n_s_reduce_cython); + Py_CLEAR(clear_module_state->__pyx_n_s_reduce_ex); + Py_CLEAR(clear_module_state->__pyx_n_s_return); + Py_CLEAR(clear_module_state->__pyx_n_s_self); + Py_CLEAR(clear_module_state->__pyx_kp_s_self_decode_cpp_self_encode_cpp); + Py_CLEAR(clear_module_state->__pyx_n_s_setstate); + Py_CLEAR(clear_module_state->__pyx_n_s_setstate_cython); + Py_CLEAR(clear_module_state->__pyx_kp_s_src_amulet_nbt__string_encoding); + Py_CLEAR(clear_module_state->__pyx_kp_s_stringsource); + Py_CLEAR(clear_module_state->__pyx_n_s_test); + Py_CLEAR(clear_module_state->__pyx_n_s_utf8_encoding); + Py_CLEAR(clear_module_state->__pyx_n_s_utf8_escape_encoding); + Py_CLEAR(clear_module_state->__pyx_tuple_); + Py_CLEAR(clear_module_state->__pyx_tuple__4); + Py_CLEAR(clear_module_state->__pyx_tuple__6); + Py_CLEAR(clear_module_state->__pyx_codeobj__2); + Py_CLEAR(clear_module_state->__pyx_codeobj__3); + Py_CLEAR(clear_module_state->__pyx_codeobj__5); + Py_CLEAR(clear_module_state->__pyx_codeobj__7); + return 0; +} +#endif +/* #### Code section: module_state_traverse ### */ +#if CYTHON_USE_MODULE_STATE +static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { + __pyx_mstate *traverse_module_state = __pyx_mstate(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); + Py_VISIT(traverse_module_state->__pyx_empty_tuple); + Py_VISIT(traverse_module_state->__pyx_empty_bytes); + Py_VISIT(traverse_module_state->__pyx_empty_unicode); + #ifdef __Pyx_CyFunction_USED + Py_VISIT(traverse_module_state->__pyx_CyFunctionType); + #endif + #ifdef __Pyx_FusedFunction_USED + Py_VISIT(traverse_module_state->__pyx_FusedFunctionType); + #endif + Py_VISIT(traverse_module_state->__pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding); + Py_VISIT(traverse_module_state->__pyx_type_10amulet_nbt_16_string_encoding_8encoding_StringEncoding); + Py_VISIT(traverse_module_state->__pyx_n_s_StringEncoding); + Py_VISIT(traverse_module_state->__pyx_n_s_StringEncoding___reduce_cython); + Py_VISIT(traverse_module_state->__pyx_n_s_StringEncoding___setstate_cython); + Py_VISIT(traverse_module_state->__pyx_n_s_StringEncoding_decode); + Py_VISIT(traverse_module_state->__pyx_n_s_StringEncoding_encode); + Py_VISIT(traverse_module_state->__pyx_n_s_TypeError); + Py_VISIT(traverse_module_state->__pyx_n_s__8); + Py_VISIT(traverse_module_state->__pyx_n_s_amulet_nbt__string_encoding_enco); + Py_VISIT(traverse_module_state->__pyx_n_s_asyncio_coroutines); + Py_VISIT(traverse_module_state->__pyx_n_s_bytes); + Py_VISIT(traverse_module_state->__pyx_n_s_cline_in_traceback); + Py_VISIT(traverse_module_state->__pyx_n_s_data); + Py_VISIT(traverse_module_state->__pyx_n_s_decode); + Py_VISIT(traverse_module_state->__pyx_kp_u_disable); + Py_VISIT(traverse_module_state->__pyx_kp_u_enable); + Py_VISIT(traverse_module_state->__pyx_n_s_encode); + Py_VISIT(traverse_module_state->__pyx_kp_u_gc); + Py_VISIT(traverse_module_state->__pyx_n_s_getstate); + Py_VISIT(traverse_module_state->__pyx_n_s_is_coroutine); + Py_VISIT(traverse_module_state->__pyx_kp_u_isenabled); + Py_VISIT(traverse_module_state->__pyx_n_s_main); + Py_VISIT(traverse_module_state->__pyx_n_s_mutf8_encoding); + Py_VISIT(traverse_module_state->__pyx_n_s_name); + Py_VISIT(traverse_module_state->__pyx_n_s_pyx_state); + Py_VISIT(traverse_module_state->__pyx_n_s_reduce); + Py_VISIT(traverse_module_state->__pyx_n_s_reduce_cython); + Py_VISIT(traverse_module_state->__pyx_n_s_reduce_ex); + Py_VISIT(traverse_module_state->__pyx_n_s_return); + Py_VISIT(traverse_module_state->__pyx_n_s_self); + Py_VISIT(traverse_module_state->__pyx_kp_s_self_decode_cpp_self_encode_cpp); + Py_VISIT(traverse_module_state->__pyx_n_s_setstate); + Py_VISIT(traverse_module_state->__pyx_n_s_setstate_cython); + Py_VISIT(traverse_module_state->__pyx_kp_s_src_amulet_nbt__string_encoding); + Py_VISIT(traverse_module_state->__pyx_kp_s_stringsource); + Py_VISIT(traverse_module_state->__pyx_n_s_test); + Py_VISIT(traverse_module_state->__pyx_n_s_utf8_encoding); + Py_VISIT(traverse_module_state->__pyx_n_s_utf8_escape_encoding); + Py_VISIT(traverse_module_state->__pyx_tuple_); + Py_VISIT(traverse_module_state->__pyx_tuple__4); + Py_VISIT(traverse_module_state->__pyx_tuple__6); + Py_VISIT(traverse_module_state->__pyx_codeobj__2); + Py_VISIT(traverse_module_state->__pyx_codeobj__3); + Py_VISIT(traverse_module_state->__pyx_codeobj__5); + Py_VISIT(traverse_module_state->__pyx_codeobj__7); + return 0; +} +#endif +/* #### Code section: module_state_defines ### */ +#define __pyx_d __pyx_mstate_global->__pyx_d +#define __pyx_b __pyx_mstate_global->__pyx_b +#define __pyx_cython_runtime __pyx_mstate_global->__pyx_cython_runtime +#define __pyx_empty_tuple __pyx_mstate_global->__pyx_empty_tuple +#define __pyx_empty_bytes __pyx_mstate_global->__pyx_empty_bytes +#define __pyx_empty_unicode __pyx_mstate_global->__pyx_empty_unicode +#ifdef __Pyx_CyFunction_USED +#define __pyx_CyFunctionType __pyx_mstate_global->__pyx_CyFunctionType +#endif +#ifdef __Pyx_FusedFunction_USED +#define __pyx_FusedFunctionType __pyx_mstate_global->__pyx_FusedFunctionType +#endif +#ifdef __Pyx_Generator_USED +#define __pyx_GeneratorType __pyx_mstate_global->__pyx_GeneratorType +#endif +#ifdef __Pyx_IterableCoroutine_USED +#define __pyx_IterableCoroutineType __pyx_mstate_global->__pyx_IterableCoroutineType +#endif +#ifdef __Pyx_Coroutine_USED +#define __pyx_CoroutineAwaitType __pyx_mstate_global->__pyx_CoroutineAwaitType +#endif +#ifdef __Pyx_Coroutine_USED +#define __pyx_CoroutineType __pyx_mstate_global->__pyx_CoroutineType +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#endif +#if CYTHON_USE_MODULE_STATE +#define __pyx_type_10amulet_nbt_16_string_encoding_8encoding_StringEncoding __pyx_mstate_global->__pyx_type_10amulet_nbt_16_string_encoding_8encoding_StringEncoding +#endif +#define __pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding __pyx_mstate_global->__pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding +#define __pyx_n_s_StringEncoding __pyx_mstate_global->__pyx_n_s_StringEncoding +#define __pyx_n_s_StringEncoding___reduce_cython __pyx_mstate_global->__pyx_n_s_StringEncoding___reduce_cython +#define __pyx_n_s_StringEncoding___setstate_cython __pyx_mstate_global->__pyx_n_s_StringEncoding___setstate_cython +#define __pyx_n_s_StringEncoding_decode __pyx_mstate_global->__pyx_n_s_StringEncoding_decode +#define __pyx_n_s_StringEncoding_encode __pyx_mstate_global->__pyx_n_s_StringEncoding_encode +#define __pyx_n_s_TypeError __pyx_mstate_global->__pyx_n_s_TypeError +#define __pyx_n_s__8 __pyx_mstate_global->__pyx_n_s__8 +#define __pyx_n_s_amulet_nbt__string_encoding_enco __pyx_mstate_global->__pyx_n_s_amulet_nbt__string_encoding_enco +#define __pyx_n_s_asyncio_coroutines __pyx_mstate_global->__pyx_n_s_asyncio_coroutines +#define __pyx_n_s_bytes __pyx_mstate_global->__pyx_n_s_bytes +#define __pyx_n_s_cline_in_traceback __pyx_mstate_global->__pyx_n_s_cline_in_traceback +#define __pyx_n_s_data __pyx_mstate_global->__pyx_n_s_data +#define __pyx_n_s_decode __pyx_mstate_global->__pyx_n_s_decode +#define __pyx_kp_u_disable __pyx_mstate_global->__pyx_kp_u_disable +#define __pyx_kp_u_enable __pyx_mstate_global->__pyx_kp_u_enable +#define __pyx_n_s_encode __pyx_mstate_global->__pyx_n_s_encode +#define __pyx_kp_u_gc __pyx_mstate_global->__pyx_kp_u_gc +#define __pyx_n_s_getstate __pyx_mstate_global->__pyx_n_s_getstate +#define __pyx_n_s_is_coroutine __pyx_mstate_global->__pyx_n_s_is_coroutine +#define __pyx_kp_u_isenabled __pyx_mstate_global->__pyx_kp_u_isenabled +#define __pyx_n_s_main __pyx_mstate_global->__pyx_n_s_main +#define __pyx_n_s_mutf8_encoding __pyx_mstate_global->__pyx_n_s_mutf8_encoding +#define __pyx_n_s_name __pyx_mstate_global->__pyx_n_s_name +#define __pyx_n_s_pyx_state __pyx_mstate_global->__pyx_n_s_pyx_state +#define __pyx_n_s_reduce __pyx_mstate_global->__pyx_n_s_reduce +#define __pyx_n_s_reduce_cython __pyx_mstate_global->__pyx_n_s_reduce_cython +#define __pyx_n_s_reduce_ex __pyx_mstate_global->__pyx_n_s_reduce_ex +#define __pyx_n_s_return __pyx_mstate_global->__pyx_n_s_return +#define __pyx_n_s_self __pyx_mstate_global->__pyx_n_s_self +#define __pyx_kp_s_self_decode_cpp_self_encode_cpp __pyx_mstate_global->__pyx_kp_s_self_decode_cpp_self_encode_cpp +#define __pyx_n_s_setstate __pyx_mstate_global->__pyx_n_s_setstate +#define __pyx_n_s_setstate_cython __pyx_mstate_global->__pyx_n_s_setstate_cython +#define __pyx_kp_s_src_amulet_nbt__string_encoding __pyx_mstate_global->__pyx_kp_s_src_amulet_nbt__string_encoding +#define __pyx_kp_s_stringsource __pyx_mstate_global->__pyx_kp_s_stringsource +#define __pyx_n_s_test __pyx_mstate_global->__pyx_n_s_test +#define __pyx_n_s_utf8_encoding __pyx_mstate_global->__pyx_n_s_utf8_encoding +#define __pyx_n_s_utf8_escape_encoding __pyx_mstate_global->__pyx_n_s_utf8_escape_encoding +#define __pyx_tuple_ __pyx_mstate_global->__pyx_tuple_ +#define __pyx_tuple__4 __pyx_mstate_global->__pyx_tuple__4 +#define __pyx_tuple__6 __pyx_mstate_global->__pyx_tuple__6 +#define __pyx_codeobj__2 __pyx_mstate_global->__pyx_codeobj__2 +#define __pyx_codeobj__3 __pyx_mstate_global->__pyx_codeobj__3 +#define __pyx_codeobj__5 __pyx_mstate_global->__pyx_codeobj__5 +#define __pyx_codeobj__7 __pyx_mstate_global->__pyx_codeobj__7 +/* #### Code section: module_code ### */ + +/* "string.from_py":13 + * + * @cname("__pyx_convert_string_from_py_std__in_string") + * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *: # <<<<<<<<<<<<<< + * cdef Py_ssize_t length = 0 + * cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length) + */ + +static std::string __pyx_convert_string_from_py_std__in_string(PyObject *__pyx_v_o) { + Py_ssize_t __pyx_v_length; + char const *__pyx_v_data; + std::string __pyx_r; + char const *__pyx_t_1; + std::string __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + + /* "string.from_py":14 + * @cname("__pyx_convert_string_from_py_std__in_string") + * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *: + * cdef Py_ssize_t length = 0 # <<<<<<<<<<<<<< + * cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length) + * return string(data, length) + */ + __pyx_v_length = 0; + + /* "string.from_py":15 + * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *: + * cdef Py_ssize_t length = 0 + * cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length) # <<<<<<<<<<<<<< + * return string(data, length) + * + */ + __pyx_t_1 = __Pyx_PyObject_AsStringAndSize(__pyx_v_o, (&__pyx_v_length)); if (unlikely(__pyx_t_1 == ((char const *)NULL))) __PYX_ERR(0, 15, __pyx_L1_error) + __pyx_v_data = __pyx_t_1; + + /* "string.from_py":16 + * cdef Py_ssize_t length = 0 + * cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length) + * return string(data, length) # <<<<<<<<<<<<<< + * + * + */ + try { + __pyx_t_2 = std::string(__pyx_v_data, __pyx_v_length); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 16, __pyx_L1_error) + } + __pyx_r = __pyx_t_2; + goto __pyx_L0; + + /* "string.from_py":13 + * + * @cname("__pyx_convert_string_from_py_std__in_string") + * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *: # <<<<<<<<<<<<<< + * cdef Py_ssize_t length = 0 + * cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("string.from_py.__pyx_convert_string_from_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + return __pyx_r; +} + +/* "string.to_py":31 + * + * @cname("__pyx_convert_PyObject_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyObject_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< + * return __Pyx_PyObject_FromStringAndSize(s.data(), s.size()) + * cdef extern from *: + */ + +static CYTHON_INLINE PyObject *__pyx_convert_PyObject_string_to_py_std__in_string(std::string const &__pyx_v_s) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_convert_PyObject_string_to_py_std__in_string", 1); + + /* "string.to_py":32 + * @cname("__pyx_convert_PyObject_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyObject_string_to_py_std__in_string(const string& s): + * return __Pyx_PyObject_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< + * cdef extern from *: + * cdef object __Pyx_PyUnicode_FromStringAndSize(const char*, size_t) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 32, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "string.to_py":31 + * + * @cname("__pyx_convert_PyObject_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyObject_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< + * return __Pyx_PyObject_FromStringAndSize(s.data(), s.size()) + * cdef extern from *: + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("string.to_py.__pyx_convert_PyObject_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "string.to_py":37 + * + * @cname("__pyx_convert_PyUnicode_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyUnicode_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< + * return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size()) + * cdef extern from *: + */ + +static CYTHON_INLINE PyObject *__pyx_convert_PyUnicode_string_to_py_std__in_string(std::string const &__pyx_v_s) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_convert_PyUnicode_string_to_py_std__in_string", 1); + + /* "string.to_py":38 + * @cname("__pyx_convert_PyUnicode_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyUnicode_string_to_py_std__in_string(const string& s): + * return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< + * cdef extern from *: + * cdef object __Pyx_PyStr_FromStringAndSize(const char*, size_t) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyUnicode_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "string.to_py":37 + * + * @cname("__pyx_convert_PyUnicode_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyUnicode_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< + * return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size()) + * cdef extern from *: + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("string.to_py.__pyx_convert_PyUnicode_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "string.to_py":43 + * + * @cname("__pyx_convert_PyStr_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyStr_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< + * return __Pyx_PyStr_FromStringAndSize(s.data(), s.size()) + * cdef extern from *: + */ + +static CYTHON_INLINE PyObject *__pyx_convert_PyStr_string_to_py_std__in_string(std::string const &__pyx_v_s) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_convert_PyStr_string_to_py_std__in_string", 1); + + /* "string.to_py":44 + * @cname("__pyx_convert_PyStr_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyStr_string_to_py_std__in_string(const string& s): + * return __Pyx_PyStr_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< + * cdef extern from *: + * cdef object __Pyx_PyBytes_FromStringAndSize(const char*, size_t) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyStr_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "string.to_py":43 + * + * @cname("__pyx_convert_PyStr_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyStr_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< + * return __Pyx_PyStr_FromStringAndSize(s.data(), s.size()) + * cdef extern from *: + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("string.to_py.__pyx_convert_PyStr_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "string.to_py":49 + * + * @cname("__pyx_convert_PyBytes_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyBytes_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< + * return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size()) + * cdef extern from *: + */ + +static CYTHON_INLINE PyObject *__pyx_convert_PyBytes_string_to_py_std__in_string(std::string const &__pyx_v_s) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_convert_PyBytes_string_to_py_std__in_string", 1); + + /* "string.to_py":50 + * @cname("__pyx_convert_PyBytes_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyBytes_string_to_py_std__in_string(const string& s): + * return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< + * cdef extern from *: + * cdef object __Pyx_PyByteArray_FromStringAndSize(const char*, size_t) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "string.to_py":49 + * + * @cname("__pyx_convert_PyBytes_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyBytes_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< + * return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size()) + * cdef extern from *: + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("string.to_py.__pyx_convert_PyBytes_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "string.to_py":55 + * + * @cname("__pyx_convert_PyByteArray_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyByteArray_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< + * return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size()) + * + */ + +static CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_std__in_string(std::string const &__pyx_v_s) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_convert_PyByteArray_string_to_py_std__in_string", 1); + + /* "string.to_py":56 + * @cname("__pyx_convert_PyByteArray_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyByteArray_string_to_py_std__in_string(const string& s): + * return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyByteArray_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "string.to_py":55 + * + * @cname("__pyx_convert_PyByteArray_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyByteArray_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< + * return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size()) + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("string.to_py.__pyx_convert_PyByteArray_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "amulet_nbt/_string_encoding/encoding.pyx":13 + * + * cdef class StringEncoding: + * def encode(self, bytes data: bytes) -> bytes: # <<<<<<<<<<<<<< + * return self.encode_cpp(data) + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_1encode(PyObject *__pyx_v_self, +#if 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_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_1encode = {"encode", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_1encode, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_1encode(PyObject *__pyx_v_self, +#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_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("encode (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __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 **__pyx_pyargnames[] = {&__pyx_n_s_data,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_data)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 13, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "encode") < 0)) __PYX_ERR(1, 13, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v_data = ((PyObject*)values[0]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("encode", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 13, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("amulet_nbt._string_encoding.encoding.StringEncoding.encode", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), (&PyBytes_Type), 0, "data", 1))) __PYX_ERR(1, 13, __pyx_L1_error) + __pyx_r = __pyx_pf_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_encode(((struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding *)__pyx_v_self), __pyx_v_data); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_encode(struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding *__pyx_v_self, PyObject *__pyx_v_data) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + std::string __pyx_t_1; + std::string __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("encode", 1); + + /* "amulet_nbt/_string_encoding/encoding.pyx":14 + * cdef class StringEncoding: + * def encode(self, bytes data: bytes) -> bytes: + * return self.encode_cpp(data) # <<<<<<<<<<<<<< + * + * def decode(self, bytes data: bytes) -> bytes: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_convert_string_from_py_std__in_string(__pyx_v_data); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 14, __pyx_L1_error) + __pyx_t_2 = __pyx_v_self->encode_cpp(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 14, __pyx_L1_error) + __pyx_t_3 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "amulet_nbt/_string_encoding/encoding.pyx":13 + * + * cdef class StringEncoding: + * def encode(self, bytes data: bytes) -> bytes: # <<<<<<<<<<<<<< + * return self.encode_cpp(data) + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("amulet_nbt._string_encoding.encoding.StringEncoding.encode", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "amulet_nbt/_string_encoding/encoding.pyx":16 + * return self.encode_cpp(data) + * + * def decode(self, bytes data: bytes) -> bytes: # <<<<<<<<<<<<<< + * return self.decode_cpp(data) + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_3decode(PyObject *__pyx_v_self, +#if 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_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_3decode = {"decode", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_3decode, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_3decode(PyObject *__pyx_v_self, +#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_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("decode (wrapper)", 0); + #if !CYTHON_METH_FASTCALL + #if CYTHON_ASSUME_SAFE_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __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 **__pyx_pyargnames[] = {&__pyx_n_s_data,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_data)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 16, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "decode") < 0)) __PYX_ERR(1, 16, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __pyx_v_data = ((PyObject*)values[0]); + } + goto __pyx_L6_skip; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("decode", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 16, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("amulet_nbt._string_encoding.encoding.StringEncoding.decode", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), (&PyBytes_Type), 0, "data", 1))) __PYX_ERR(1, 16, __pyx_L1_error) + __pyx_r = __pyx_pf_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_2decode(((struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding *)__pyx_v_self), __pyx_v_data); + + /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_2decode(struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding *__pyx_v_self, PyObject *__pyx_v_data) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + std::string __pyx_t_1; + std::string __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("decode", 1); + + /* "amulet_nbt/_string_encoding/encoding.pyx":17 + * + * def decode(self, bytes data: bytes) -> bytes: + * return self.decode_cpp(data) # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_convert_string_from_py_std__in_string(__pyx_v_data); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 17, __pyx_L1_error) + __pyx_t_2 = __pyx_v_self->decode_cpp(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 17, __pyx_L1_error) + __pyx_t_3 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "amulet_nbt/_string_encoding/encoding.pyx":16 + * return self.encode_cpp(data) + * + * def decode(self, bytes data: bytes) -> bytes: # <<<<<<<<<<<<<< + * return self.decode_cpp(data) + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("amulet_nbt._string_encoding.encoding.StringEncoding.decode", __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.decode_cpp,self.encode_cpp cannot be converted to a Python object for pickling" + * def __setstate_cython__(self, __pyx_state): + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_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*/ +static PyMethodDef __pyx_mdef_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_5__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_5__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_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_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __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;} + if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL; + __pyx_r = __pyx_pf_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_4__reduce_cython__(((struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding *__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__", 1); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError, "self.decode_cpp,self.encode_cpp cannot be converted to a Python object for pickling" # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "self.decode_cpp,self.encode_cpp cannot be converted to a Python object for pickling" + */ + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_self_decode_cpp_self_encode_cpp, 0, 0); + __PYX_ERR(0, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "self.decode_cpp,self.encode_cpp cannot be converted to a Python object for pickling" + * def __setstate_cython__(self, __pyx_state): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("amulet_nbt._string_encoding.encoding.StringEncoding.__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.decode_cpp,self.encode_cpp cannot be converted to a Python object for pickling" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "self.decode_cpp,self.encode_cpp cannot be converted to a Python object for pickling" + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_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*/ +static PyMethodDef __pyx_mdef_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_7__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_7__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_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_MACROS + __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); + #else + __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 **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0}; + if (__pyx_kwds) { + Py_ssize_t kw_args; + switch (__pyx_nargs) { + case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); + switch (__pyx_nargs) { + case 0: + if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3, __pyx_L3_error) + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + const Py_ssize_t kwd_pos_args = __pyx_nargs; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(0, 3, __pyx_L3_error) + } + } else if (unlikely(__pyx_nargs != 1)) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); + } + __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(0, 3, __pyx_L3_error) + __pyx_L6_skip:; + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_AddTraceback("amulet_nbt._string_encoding.encoding.StringEncoding.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_6__setstate_cython__(((struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding *)__pyx_v_self), __pyx_v___pyx_state); + + /* function exit code */ + { + Py_ssize_t __pyx_temp; + for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { + __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); + } + } + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding *__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__", 1); + + /* "(tree fragment)":4 + * raise TypeError, "self.decode_cpp,self.encode_cpp cannot be converted to a Python object for pickling" + * def __setstate_cython__(self, __pyx_state): + * raise TypeError, "self.decode_cpp,self.encode_cpp cannot be converted to a Python object for pickling" # <<<<<<<<<<<<<< + */ + __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_self_decode_cpp_self_encode_cpp, 0, 0); + __PYX_ERR(0, 4, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "self.decode_cpp,self.encode_cpp cannot be converted to a Python object for pickling" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "self.decode_cpp,self.encode_cpp cannot be converted to a Python object for pickling" + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("amulet_nbt._string_encoding.encoding.StringEncoding.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_tp_new_10amulet_nbt_16_string_encoding_8encoding_StringEncoding(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + PyObject *o; + #if CYTHON_COMPILING_IN_LIMITED_API + allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); + o = alloc_func(t, 0); + #else + if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + #endif + return o; +} + +static void __pyx_tp_dealloc_10amulet_nbt_16_string_encoding_8encoding_StringEncoding(PyObject *o) { + #if CYTHON_USE_TP_FINALIZE + if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __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_10amulet_nbt_16_string_encoding_8encoding_StringEncoding) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + } + #endif + #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY + (*Py_TYPE(o)->tp_free)(o); + #else + { + freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free); + if (tp_free) tp_free(o); + } + #endif +} + +static PyMethodDef __pyx_methods_10amulet_nbt_16_string_encoding_8encoding_StringEncoding[] = { + {"encode", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_1encode, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"decode", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_3decode, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_5__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_7__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, + {0, 0, 0, 0} +}; +#if CYTHON_USE_TYPE_SPECS +static PyType_Slot __pyx_type_10amulet_nbt_16_string_encoding_8encoding_StringEncoding_slots[] = { + {Py_tp_dealloc, (void *)__pyx_tp_dealloc_10amulet_nbt_16_string_encoding_8encoding_StringEncoding}, + {Py_tp_methods, (void *)__pyx_methods_10amulet_nbt_16_string_encoding_8encoding_StringEncoding}, + {Py_tp_new, (void *)__pyx_tp_new_10amulet_nbt_16_string_encoding_8encoding_StringEncoding}, + {0, 0}, +}; +static PyType_Spec __pyx_type_10amulet_nbt_16_string_encoding_8encoding_StringEncoding_spec = { + "amulet_nbt._string_encoding.encoding.StringEncoding", + sizeof(struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding), + 0, + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, + __pyx_type_10amulet_nbt_16_string_encoding_8encoding_StringEncoding_slots, +}; +#else + +static PyTypeObject __pyx_type_10amulet_nbt_16_string_encoding_8encoding_StringEncoding = { + PyVarObject_HEAD_INIT(0, 0) + "amulet_nbt._string_encoding.encoding.""StringEncoding", /*tp_name*/ + sizeof(struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_10amulet_nbt_16_string_encoding_8encoding_StringEncoding, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_10amulet_nbt_16_string_encoding_8encoding_StringEncoding, /*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_10amulet_nbt_16_string_encoding_8encoding_StringEncoding, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + #if CYTHON_USE_TP_FINALIZE + 0, /*tp_finalize*/ + #else + NULL, /*tp_finalize*/ + #endif + #endif + #if PY_VERSION_HEX >= 0x030800b1 && (!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 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} +}; +#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 +/* #### Code section: pystring_table ### */ + +static int __Pyx_CreateStringTabAndInitStrings(void) { + __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_n_s_StringEncoding, __pyx_k_StringEncoding, sizeof(__pyx_k_StringEncoding), 0, 0, 1, 1}, + {&__pyx_n_s_StringEncoding___reduce_cython, __pyx_k_StringEncoding___reduce_cython, sizeof(__pyx_k_StringEncoding___reduce_cython), 0, 0, 1, 1}, + {&__pyx_n_s_StringEncoding___setstate_cython, __pyx_k_StringEncoding___setstate_cython, sizeof(__pyx_k_StringEncoding___setstate_cython), 0, 0, 1, 1}, + {&__pyx_n_s_StringEncoding_decode, __pyx_k_StringEncoding_decode, sizeof(__pyx_k_StringEncoding_decode), 0, 0, 1, 1}, + {&__pyx_n_s_StringEncoding_encode, __pyx_k_StringEncoding_encode, sizeof(__pyx_k_StringEncoding_encode), 0, 0, 1, 1}, + {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1}, + {&__pyx_n_s__8, __pyx_k__8, sizeof(__pyx_k__8), 0, 0, 1, 1}, + {&__pyx_n_s_amulet_nbt__string_encoding_enco, __pyx_k_amulet_nbt__string_encoding_enco, sizeof(__pyx_k_amulet_nbt__string_encoding_enco), 0, 0, 1, 1}, + {&__pyx_n_s_asyncio_coroutines, __pyx_k_asyncio_coroutines, sizeof(__pyx_k_asyncio_coroutines), 0, 0, 1, 1}, + {&__pyx_n_s_bytes, __pyx_k_bytes, sizeof(__pyx_k_bytes), 0, 0, 1, 1}, + {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, + {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1}, + {&__pyx_n_s_decode, __pyx_k_decode, sizeof(__pyx_k_decode), 0, 0, 1, 1}, + {&__pyx_kp_u_disable, __pyx_k_disable, sizeof(__pyx_k_disable), 0, 1, 0, 0}, + {&__pyx_kp_u_enable, __pyx_k_enable, sizeof(__pyx_k_enable), 0, 1, 0, 0}, + {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1}, + {&__pyx_kp_u_gc, __pyx_k_gc, sizeof(__pyx_k_gc), 0, 1, 0, 0}, + {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1}, + {&__pyx_n_s_is_coroutine, __pyx_k_is_coroutine, sizeof(__pyx_k_is_coroutine), 0, 0, 1, 1}, + {&__pyx_kp_u_isenabled, __pyx_k_isenabled, sizeof(__pyx_k_isenabled), 0, 1, 0, 0}, + {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, + {&__pyx_n_s_mutf8_encoding, __pyx_k_mutf8_encoding, sizeof(__pyx_k_mutf8_encoding), 0, 0, 1, 1}, + {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1}, + {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1}, + {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1}, + {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1}, + {&__pyx_n_s_return, __pyx_k_return, sizeof(__pyx_k_return), 0, 0, 1, 1}, + {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1}, + {&__pyx_kp_s_self_decode_cpp_self_encode_cpp, __pyx_k_self_decode_cpp_self_encode_cpp, sizeof(__pyx_k_self_decode_cpp_self_encode_cpp), 0, 0, 1, 0}, + {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1}, + {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1}, + {&__pyx_kp_s_src_amulet_nbt__string_encoding, __pyx_k_src_amulet_nbt__string_encoding, sizeof(__pyx_k_src_amulet_nbt__string_encoding), 0, 0, 1, 0}, + {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0}, + {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, + {&__pyx_n_s_utf8_encoding, __pyx_k_utf8_encoding, sizeof(__pyx_k_utf8_encoding), 0, 0, 1, 1}, + {&__pyx_n_s_utf8_escape_encoding, __pyx_k_utf8_escape_encoding, sizeof(__pyx_k_utf8_escape_encoding), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} + }; + return __Pyx_InitStrings(__pyx_string_tab); +} +/* #### Code section: cached_builtins ### */ +static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 2, __pyx_L1_error) + return 0; + __pyx_L1_error:; + return -1; +} +/* #### Code section: cached_constants ### */ + +static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); + + /* "amulet_nbt/_string_encoding/encoding.pyx":13 + * + * cdef class StringEncoding: + * def encode(self, bytes data: bytes) -> bytes: # <<<<<<<<<<<<<< + * return self.encode_cpp(data) + * + */ + __pyx_tuple_ = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_data); if (unlikely(!__pyx_tuple_)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple_); + __Pyx_GIVEREF(__pyx_tuple_); + __pyx_codeobj__2 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple_, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_amulet_nbt__string_encoding, __pyx_n_s_encode, 13, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__2)) __PYX_ERR(1, 13, __pyx_L1_error) + + /* "amulet_nbt/_string_encoding/encoding.pyx":16 + * return self.encode_cpp(data) + * + * def decode(self, bytes data: bytes) -> bytes: # <<<<<<<<<<<<<< + * return self.decode_cpp(data) + * + */ + __pyx_codeobj__3 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple_, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_amulet_nbt__string_encoding, __pyx_n_s_decode, 16, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__3)) __PYX_ERR(1, 16, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "self.decode_cpp,self.encode_cpp cannot be converted to a Python object for pickling" + * def __setstate_cython__(self, __pyx_state): + */ + __pyx_tuple__4 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__4); + __Pyx_GIVEREF(__pyx_tuple__4); + __pyx_codeobj__5 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__4, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__5)) __PYX_ERR(0, 1, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "self.decode_cpp,self.encode_cpp cannot be converted to a Python object for pickling" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "self.decode_cpp,self.encode_cpp cannot be converted to a Python object for pickling" + */ + __pyx_tuple__6 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_pyx_state); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 3, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__6); + __Pyx_GIVEREF(__pyx_tuple__6); + __pyx_codeobj__7 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__6, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 3, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__7)) __PYX_ERR(0, 3, __pyx_L1_error) + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} +/* #### Code section: init_constants ### */ + +static CYTHON_SMALL_CODE int __Pyx_InitConstants(void) { + if (__Pyx_CreateStringTabAndInitStrings() < 0) __PYX_ERR(1, 1, __pyx_L1_error); + return 0; + __pyx_L1_error:; + return -1; +} +/* #### Code section: init_globals ### */ + +static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { + return 0; +} +/* #### Code section: init_module ### */ + +static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/ + +static int __Pyx_modinit_global_init_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); + /*--- Global init code ---*/ + __pyx_v_10amulet_nbt_16_string_encoding_8encoding__mutf8_encoding = ((struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding *)Py_None); Py_INCREF(Py_None); + __pyx_v_10amulet_nbt_16_string_encoding_8encoding__utf8_encoding = ((struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding *)Py_None); Py_INCREF(Py_None); + __pyx_v_10amulet_nbt_16_string_encoding_8encoding__utf8_escape_encoding = ((struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding *)Py_None); Py_INCREF(Py_None); + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_variable_export_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); + /*--- Variable export code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_function_export_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); + /*--- Function export code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_type_init_code(void) { + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); + /*--- Type init code ---*/ + #if CYTHON_USE_TYPE_SPECS + __pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_10amulet_nbt_16_string_encoding_8encoding_StringEncoding_spec, NULL); if (unlikely(!__pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding)) __PYX_ERR(1, 12, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_10amulet_nbt_16_string_encoding_8encoding_StringEncoding_spec, __pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding) < 0) __PYX_ERR(1, 12, __pyx_L1_error) + #else + __pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding = &__pyx_type_10amulet_nbt_16_string_encoding_8encoding_StringEncoding; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + #endif + #if !CYTHON_USE_TYPE_SPECS + if (__Pyx_PyType_Ready(__pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding) < 0) __PYX_ERR(1, 12, __pyx_L1_error) + #endif + #if PY_MAJOR_VERSION < 3 + __pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding->tp_print = 0; + #endif + #if !CYTHON_COMPILING_IN_LIMITED_API + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding->tp_dictoffset && __pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding->tp_getattro == PyObject_GenericGetAttr)) { + __pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding->tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + #endif + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_StringEncoding, (PyObject *) __pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding) < 0) __PYX_ERR(1, 12, __pyx_L1_error) + #if !CYTHON_COMPILING_IN_LIMITED_API + if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding) < 0) __PYX_ERR(1, 12, __pyx_L1_error) + #endif + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_modinit_type_import_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); + /*--- Type import code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_variable_import_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); + /*--- Variable import code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_function_import_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); + /*--- Function import code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + + +#if PY_MAJOR_VERSION >= 3 +#if CYTHON_PEP489_MULTI_PHASE_INIT +static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ +static int __pyx_pymod_exec_encoding(PyObject* module); /*proto*/ +static PyModuleDef_Slot __pyx_moduledef_slots[] = { + {Py_mod_create, (void*)__pyx_pymod_create}, + {Py_mod_exec, (void*)__pyx_pymod_exec_encoding}, + {0, NULL} +}; +#endif + +#ifdef __cplusplus +namespace { + struct PyModuleDef __pyx_moduledef = + #else + static struct PyModuleDef __pyx_moduledef = + #endif + { + PyModuleDef_HEAD_INIT, + "encoding", + 0, /* m_doc */ + #if CYTHON_PEP489_MULTI_PHASE_INIT + 0, /* m_size */ + #elif CYTHON_USE_MODULE_STATE + sizeof(__pyx_mstate), /* m_size */ + #else + -1, /* m_size */ + #endif + __pyx_methods /* m_methods */, + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_moduledef_slots, /* m_slots */ + #else + NULL, /* m_reload */ + #endif + #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 +#endif + +#ifndef CYTHON_NO_PYINIT_EXPORT +#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC +#elif PY_MAJOR_VERSION < 3 +#ifdef __cplusplus +#define __Pyx_PyMODINIT_FUNC extern "C" void +#else +#define __Pyx_PyMODINIT_FUNC void +#endif +#else +#ifdef __cplusplus +#define __Pyx_PyMODINIT_FUNC extern "C" PyObject * +#else +#define __Pyx_PyMODINIT_FUNC PyObject * +#endif +#endif + + +#if PY_MAJOR_VERSION < 3 +__Pyx_PyMODINIT_FUNC initencoding(void) CYTHON_SMALL_CODE; /*proto*/ +__Pyx_PyMODINIT_FUNC initencoding(void) +#else +__Pyx_PyMODINIT_FUNC PyInit_encoding(void) CYTHON_SMALL_CODE; /*proto*/ +__Pyx_PyMODINIT_FUNC PyInit_encoding(void) +#if CYTHON_PEP489_MULTI_PHASE_INIT +{ + return PyModuleDef_Init(&__pyx_moduledef); +} +static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { + #if PY_VERSION_HEX >= 0x030700A1 + static PY_INT64_T main_interpreter_id = -1; + PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); + if (main_interpreter_id == -1) { + main_interpreter_id = current_id; + return (unlikely(current_id == -1)) ? -1 : 0; + } else if (unlikely(main_interpreter_id != current_id)) + #else + static PyInterpreterState *main_interpreter = NULL; + PyInterpreterState *current_interpreter = PyThreadState_Get()->interp; + if (!main_interpreter) { + main_interpreter = current_interpreter; + } else if (unlikely(main_interpreter != current_interpreter)) + #endif + { + PyErr_SetString( + PyExc_ImportError, + "Interpreter change detected - this module can only be loaded into one interpreter per process."); + return -1; + } + return 0; +} +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *module, const char* from_name, const char* to_name, int allow_none) +#else +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) +#endif +{ + PyObject *value = PyObject_GetAttrString(spec, from_name); + int result = 0; + if (likely(value)) { + if (allow_none || value != Py_None) { +#if CYTHON_COMPILING_IN_LIMITED_API + result = PyModule_AddObject(module, to_name, value); +#else + result = PyDict_SetItemString(moddict, to_name, value); +#endif + } + 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 (__Pyx_check_single_interpreter()) + return NULL; + if (__pyx_m) + return __Pyx_NewRef(__pyx_m); + modname = PyObject_GetAttrString(spec, "name"); + if (unlikely(!modname)) goto bad; + module = PyModule_NewObject(modname); + Py_DECREF(modname); + if (unlikely(!module)) goto bad; +#if CYTHON_COMPILING_IN_LIMITED_API + moddict = module; +#else + moddict = PyModule_GetDict(module); + if (unlikely(!moddict)) goto bad; +#endif + 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_encoding(PyObject *__pyx_pyinit_module) +#endif +#endif +{ + int stringtab_initialized = 0; + #if CYTHON_USE_MODULE_STATE + int pystate_addmodule_run = 0; + #endif + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + #if CYTHON_PEP489_MULTI_PHASE_INIT + if (__pyx_m) { + if (__pyx_m == __pyx_pyinit_module) return 0; + PyErr_SetString(PyExc_RuntimeError, "Module 'encoding' has already been imported. Re-initialisation is not supported."); + return -1; + } + #elif PY_MAJOR_VERSION >= 3 + if (__pyx_m) return __Pyx_NewRef(__pyx_m); + #endif + /*--- Module creation code ---*/ + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_m = __pyx_pyinit_module; + Py_INCREF(__pyx_m); + #else + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4("encoding", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); + if (unlikely(!__pyx_m)) __PYX_ERR(1, 1, __pyx_L1_error) + #elif CYTHON_USE_MODULE_STATE + __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error) + { + int add_module_result = PyState_AddModule(__pyx_t_1, &__pyx_moduledef); + __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to "encoding" pseudovariable */ + if (unlikely((add_module_result < 0))) __PYX_ERR(1, 1, __pyx_L1_error) + pystate_addmodule_run = 1; + } + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + if (unlikely(!__pyx_m)) __PYX_ERR(1, 1, __pyx_L1_error) + #endif + #endif + CYTHON_UNUSED_VAR(__pyx_t_1); + __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(1, 1, __pyx_L1_error) + Py_INCREF(__pyx_d); + __pyx_b = __Pyx_PyImport_AddModuleRef(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(1, 1, __pyx_L1_error) + __pyx_cython_runtime = __Pyx_PyImport_AddModuleRef((const char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(1, 1, __pyx_L1_error) + if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(1, 1, __pyx_L1_error) + #if CYTHON_REFNANNY +__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); +if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); +} +#endif + __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_encoding(void)", 0); + if (__Pyx_check_binary_version(__PYX_LIMITED_VERSION_HEX, __Pyx_get_runtime_version(), CYTHON_COMPILING_IN_LIMITED_API) < 0) __PYX_ERR(1, 1, __pyx_L1_error) + #ifdef __Pxy_PyFrame_Initialize_Offsets + __Pxy_PyFrame_Initialize_Offsets(); + #endif + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(1, 1, __pyx_L1_error) + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(1, 1, __pyx_L1_error) + __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(1, 1, __pyx_L1_error) + #ifdef __Pyx_CyFunction_USED + if (__pyx_CyFunction_init(__pyx_m) < 0) __PYX_ERR(1, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_FusedFunction_USED + if (__pyx_FusedFunction_init(__pyx_m) < 0) __PYX_ERR(1, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_Coroutine_USED + if (__pyx_Coroutine_init(__pyx_m) < 0) __PYX_ERR(1, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_Generator_USED + if (__pyx_Generator_init(__pyx_m) < 0) __PYX_ERR(1, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_AsyncGen_USED + if (__pyx_AsyncGen_init(__pyx_m) < 0) __PYX_ERR(1, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_StopAsyncIteration_USED + if (__pyx_StopAsyncIteration_init(__pyx_m) < 0) __PYX_ERR(1, 1, __pyx_L1_error) + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + PyEval_InitThreads(); + #endif + /*--- Initialize various global constants etc. ---*/ + if (__Pyx_InitConstants() < 0) __PYX_ERR(1, 1, __pyx_L1_error) + stringtab_initialized = 1; + if (__Pyx_InitGlobals() < 0) __PYX_ERR(1, 1, __pyx_L1_error) + #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) + if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(1, 1, __pyx_L1_error) + #endif + if (__pyx_module_is_main_amulet_nbt___string_encoding__encoding) { + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(1, 1, __pyx_L1_error) + } + #if PY_MAJOR_VERSION >= 3 + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(1, 1, __pyx_L1_error) + if (!PyDict_GetItemString(modules, "amulet_nbt._string_encoding.encoding")) { + if (unlikely((PyDict_SetItemString(modules, "amulet_nbt._string_encoding.encoding", __pyx_m) < 0))) __PYX_ERR(1, 1, __pyx_L1_error) + } + } + #endif + /*--- Builtin init code ---*/ + if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(1, 1, __pyx_L1_error) + /*--- Constants init code ---*/ + if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(1, 1, __pyx_L1_error) + /*--- Global type/function init code ---*/ + (void)__Pyx_modinit_global_init_code(); + (void)__Pyx_modinit_variable_export_code(); + (void)__Pyx_modinit_function_export_code(); + if (unlikely((__Pyx_modinit_type_init_code() < 0))) __PYX_ERR(1, 1, __pyx_L1_error) + (void)__Pyx_modinit_type_import_code(); + (void)__Pyx_modinit_variable_import_code(); + (void)__Pyx_modinit_function_import_code(); + /*--- Execution code ---*/ + #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) + if (__Pyx_patch_abc() < 0) __PYX_ERR(1, 1, __pyx_L1_error) + #endif + + /* "amulet_nbt/_string_encoding/encoding.pyx":13 + * + * cdef class StringEncoding: + * def encode(self, bytes data: bytes) -> bytes: # <<<<<<<<<<<<<< + * return self.encode_cpp(data) + * + */ + __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_data, __pyx_n_s_bytes) < 0) __PYX_ERR(1, 13, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, __pyx_n_s_bytes) < 0) __PYX_ERR(1, 13, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_1encode, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_StringEncoding_encode, NULL, __pyx_n_s_amulet_nbt__string_encoding_enco, __pyx_d, ((PyObject *)__pyx_codeobj__2)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding, __pyx_n_s_encode, __pyx_t_3) < 0) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + PyType_Modified(__pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding); + + /* "amulet_nbt/_string_encoding/encoding.pyx":16 + * return self.encode_cpp(data) + * + * def decode(self, bytes data: bytes) -> bytes: # <<<<<<<<<<<<<< + * return self.decode_cpp(data) + * + */ + __pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 16, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_data, __pyx_n_s_bytes) < 0) __PYX_ERR(1, 16, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_n_s_bytes) < 0) __PYX_ERR(1, 16, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_3decode, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_StringEncoding_decode, NULL, __pyx_n_s_amulet_nbt__string_encoding_enco, __pyx_d, ((PyObject *)__pyx_codeobj__3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 16, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding, __pyx_n_s_decode, __pyx_t_2) < 0) __PYX_ERR(1, 16, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + PyType_Modified(__pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding); + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError, "self.decode_cpp,self.encode_cpp cannot be converted to a Python object for pickling" + * def __setstate_cython__(self, __pyx_state): + */ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_5__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_StringEncoding___reduce_cython, NULL, __pyx_n_s_amulet_nbt__string_encoding_enco, __pyx_d, ((PyObject *)__pyx_codeobj__5)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_reduce_cython, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError, "self.decode_cpp,self.encode_cpp cannot be converted to a Python object for pickling" + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError, "self.decode_cpp,self.encode_cpp cannot be converted to a Python object for pickling" + */ + __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_7__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_StringEncoding___setstate_cython, NULL, __pyx_n_s_amulet_nbt__string_encoding_enco, __pyx_d, ((PyObject *)__pyx_codeobj__7)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_setstate_cython, __pyx_t_2) < 0) __PYX_ERR(0, 3, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "amulet_nbt/_string_encoding/encoding.pyx":20 + * + * + * cdef StringEncoding _mutf8_encoding = StringEncoding() # <<<<<<<<<<<<<< + * _mutf8_encoding.decode_cpp = mutf8_to_utf8 + * _mutf8_encoding.encode_cpp = utf8_to_mutf8 + */ + __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 20, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XGOTREF((PyObject *)__pyx_v_10amulet_nbt_16_string_encoding_8encoding__mutf8_encoding); + __Pyx_DECREF_SET(__pyx_v_10amulet_nbt_16_string_encoding_8encoding__mutf8_encoding, ((struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding *)__pyx_t_2)); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + + /* "amulet_nbt/_string_encoding/encoding.pyx":21 + * + * cdef StringEncoding _mutf8_encoding = StringEncoding() + * _mutf8_encoding.decode_cpp = mutf8_to_utf8 # <<<<<<<<<<<<<< + * _mutf8_encoding.encode_cpp = utf8_to_mutf8 + * mutf8_encoding = _mutf8_encoding + */ + __pyx_v_10amulet_nbt_16_string_encoding_8encoding__mutf8_encoding->decode_cpp = mutf8_to_utf8; + + /* "amulet_nbt/_string_encoding/encoding.pyx":22 + * cdef StringEncoding _mutf8_encoding = StringEncoding() + * _mutf8_encoding.decode_cpp = mutf8_to_utf8 + * _mutf8_encoding.encode_cpp = utf8_to_mutf8 # <<<<<<<<<<<<<< + * mutf8_encoding = _mutf8_encoding + * + */ + __pyx_v_10amulet_nbt_16_string_encoding_8encoding__mutf8_encoding->encode_cpp = utf8_to_mutf8; + + /* "amulet_nbt/_string_encoding/encoding.pyx":23 + * _mutf8_encoding.decode_cpp = mutf8_to_utf8 + * _mutf8_encoding.encode_cpp = utf8_to_mutf8 + * mutf8_encoding = _mutf8_encoding # <<<<<<<<<<<<<< + * + * cdef StringEncoding _utf8_encoding = StringEncoding() + */ + if (PyDict_SetItem(__pyx_d, __pyx_n_s_mutf8_encoding, ((PyObject *)__pyx_v_10amulet_nbt_16_string_encoding_8encoding__mutf8_encoding)) < 0) __PYX_ERR(1, 23, __pyx_L1_error) + + /* "amulet_nbt/_string_encoding/encoding.pyx":25 + * mutf8_encoding = _mutf8_encoding + * + * cdef StringEncoding _utf8_encoding = StringEncoding() # <<<<<<<<<<<<<< + * _utf8_encoding.decode_cpp = utf8_to_utf8 + * _utf8_encoding.encode_cpp = utf8_to_utf8 + */ + __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 25, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XGOTREF((PyObject *)__pyx_v_10amulet_nbt_16_string_encoding_8encoding__utf8_encoding); + __Pyx_DECREF_SET(__pyx_v_10amulet_nbt_16_string_encoding_8encoding__utf8_encoding, ((struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding *)__pyx_t_2)); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + + /* "amulet_nbt/_string_encoding/encoding.pyx":26 + * + * cdef StringEncoding _utf8_encoding = StringEncoding() + * _utf8_encoding.decode_cpp = utf8_to_utf8 # <<<<<<<<<<<<<< + * _utf8_encoding.encode_cpp = utf8_to_utf8 + * utf8_encoding = _utf8_encoding + */ + __pyx_v_10amulet_nbt_16_string_encoding_8encoding__utf8_encoding->decode_cpp = utf8_to_utf8; + + /* "amulet_nbt/_string_encoding/encoding.pyx":27 + * cdef StringEncoding _utf8_encoding = StringEncoding() + * _utf8_encoding.decode_cpp = utf8_to_utf8 + * _utf8_encoding.encode_cpp = utf8_to_utf8 # <<<<<<<<<<<<<< + * utf8_encoding = _utf8_encoding + * + */ + __pyx_v_10amulet_nbt_16_string_encoding_8encoding__utf8_encoding->encode_cpp = utf8_to_utf8; + + /* "amulet_nbt/_string_encoding/encoding.pyx":28 + * _utf8_encoding.decode_cpp = utf8_to_utf8 + * _utf8_encoding.encode_cpp = utf8_to_utf8 + * utf8_encoding = _utf8_encoding # <<<<<<<<<<<<<< + * + * cdef StringEncoding _utf8_escape_encoding = StringEncoding() + */ + if (PyDict_SetItem(__pyx_d, __pyx_n_s_utf8_encoding, ((PyObject *)__pyx_v_10amulet_nbt_16_string_encoding_8encoding__utf8_encoding)) < 0) __PYX_ERR(1, 28, __pyx_L1_error) + + /* "amulet_nbt/_string_encoding/encoding.pyx":30 + * utf8_encoding = _utf8_encoding + * + * cdef StringEncoding _utf8_escape_encoding = StringEncoding() # <<<<<<<<<<<<<< + * _utf8_escape_encoding.decode_cpp = utf8_escape_to_utf8 + * _utf8_escape_encoding.encode_cpp = utf8_to_utf8_escape + */ + __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 30, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XGOTREF((PyObject *)__pyx_v_10amulet_nbt_16_string_encoding_8encoding__utf8_escape_encoding); + __Pyx_DECREF_SET(__pyx_v_10amulet_nbt_16_string_encoding_8encoding__utf8_escape_encoding, ((struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding *)__pyx_t_2)); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + + /* "amulet_nbt/_string_encoding/encoding.pyx":31 + * + * cdef StringEncoding _utf8_escape_encoding = StringEncoding() + * _utf8_escape_encoding.decode_cpp = utf8_escape_to_utf8 # <<<<<<<<<<<<<< + * _utf8_escape_encoding.encode_cpp = utf8_to_utf8_escape + * utf8_escape_encoding = _utf8_escape_encoding + */ + __pyx_v_10amulet_nbt_16_string_encoding_8encoding__utf8_escape_encoding->decode_cpp = utf8_escape_to_utf8; + + /* "amulet_nbt/_string_encoding/encoding.pyx":32 + * cdef StringEncoding _utf8_escape_encoding = StringEncoding() + * _utf8_escape_encoding.decode_cpp = utf8_escape_to_utf8 + * _utf8_escape_encoding.encode_cpp = utf8_to_utf8_escape # <<<<<<<<<<<<<< + * utf8_escape_encoding = _utf8_escape_encoding + */ + __pyx_v_10amulet_nbt_16_string_encoding_8encoding__utf8_escape_encoding->encode_cpp = utf8_to_utf8_escape; + + /* "amulet_nbt/_string_encoding/encoding.pyx":33 + * _utf8_escape_encoding.decode_cpp = utf8_escape_to_utf8 + * _utf8_escape_encoding.encode_cpp = utf8_to_utf8_escape + * utf8_escape_encoding = _utf8_escape_encoding # <<<<<<<<<<<<<< + */ + if (PyDict_SetItem(__pyx_d, __pyx_n_s_utf8_escape_encoding, ((PyObject *)__pyx_v_10amulet_nbt_16_string_encoding_8encoding__utf8_escape_encoding)) < 0) __PYX_ERR(1, 33, __pyx_L1_error) + + /* "amulet_nbt/_string_encoding/encoding.pyx":1 + * # distutils: language = c++ # <<<<<<<<<<<<<< + * # distutils: extra_compile_args = CPPCARGS + * # distutils: sources = [src/amulet_nbt/_string_encoding/_cpp/mutf8.cpp, src/amulet_nbt/_string_encoding/_cpp/utf8.cpp] + */ + __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /*--- Wrapped vars code ---*/ + + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + if (__pyx_m) { + if (__pyx_d && stringtab_initialized) { + __Pyx_AddTraceback("init amulet_nbt._string_encoding.encoding", __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 amulet_nbt._string_encoding.encoding"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if CYTHON_PEP489_MULTI_PHASE_INIT + return (__pyx_m != NULL) ? 0 : -1; + #elif PY_MAJOR_VERSION >= 3 + return __pyx_m; + #else + return; + #endif +} +/* #### 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 */ +#if CYTHON_FAST_THREAD_STATE +static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(tuple); +#if PY_MAJOR_VERSION >= 3 + for (i=0; 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 */ +#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 */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro)) + return tp->tp_getattro(obj, attr_name); +#if PY_MAJOR_VERSION < 3 + if (likely(tp->tp_getattr)) + return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); +#endif + return PyObject_GetAttr(obj, attr_name); +} +#endif + +/* PyObjectGetAttrStrNoError */ +#if __PYX_LIMITED_VERSION_HEX < 0x030d00A1 +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 >= 0x030d00A1 + (void) PyObject_GetOptionalAttr(obj, attr_name, &result); + return result; +#else +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1 + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { + return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); + } +#endif + result = __Pyx_PyObject_GetAttrStr(obj, attr_name); + if (unlikely(!result)) { + __Pyx_PyObject_GetAttrStr_ClearAttributeError(); + } + return result; +#endif +} + +/* GetBuiltinName */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name) { + PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_b, name); + if (unlikely(!result) && !PyErr_Occurred()) { + PyErr_Format(PyExc_NameError, +#if PY_MAJOR_VERSION >= 3 + "name '%U' is not defined", name); +#else + "name '%.200s' is not defined", PyString_AS_STRING(name)); +#endif + } + return result; +} + +/* TupleAndListFromArray */ +#if 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) { + Py_INCREF(__pyx_empty_tuple); + return __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 */ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API + return PyObject_RichCompareBool(s1, s2, equals); +#else + if (s1 == s2) { + return (equals == Py_EQ); + } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { + const char *ps1, *ps2; + Py_ssize_t length = PyBytes_GET_SIZE(s1); + if (length != PyBytes_GET_SIZE(s2)) + return (equals == Py_NE); + ps1 = PyBytes_AS_STRING(s1); + ps2 = PyBytes_AS_STRING(s2); + if (ps1[0] != ps2[0]) { + return (equals == Py_NE); + } else if (length == 1) { + return (equals == Py_EQ); + } else { + int result; +#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000) + Py_hash_t hash1, hash2; + hash1 = ((PyBytesObject*)s1)->ob_shash; + hash2 = ((PyBytesObject*)s2)->ob_shash; + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + return (equals == Py_NE); + } +#endif + result = memcmp(ps1, ps2, (size_t)length); + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { + return (equals == Py_NE); + } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { + return (equals == Py_NE); + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +#endif +} + +/* UnicodeEquals */ +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { +#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API + return PyObject_RichCompareBool(s1, s2, equals); +#else +#if PY_MAJOR_VERSION < 3 + PyObject* owned_ref = NULL; +#endif + int s1_is_unicode, s2_is_unicode; + if (s1 == s2) { + goto return_eq; + } + s1_is_unicode = PyUnicode_CheckExact(s1); + s2_is_unicode = PyUnicode_CheckExact(s2); +#if PY_MAJOR_VERSION < 3 + if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) { + owned_ref = PyUnicode_FromObject(s2); + if (unlikely(!owned_ref)) + return -1; + s2 = owned_ref; + s2_is_unicode = 1; + } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) { + owned_ref = PyUnicode_FromObject(s1); + if (unlikely(!owned_ref)) + return -1; + s1 = owned_ref; + s1_is_unicode = 1; + } else if (((!s2_is_unicode) & (!s1_is_unicode))) { + return __Pyx_PyBytes_Equals(s1, s2, equals); + } +#endif + if (s1_is_unicode & s2_is_unicode) { + Py_ssize_t length; + int kind; + void *data1, *data2; + if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) + return -1; + length = __Pyx_PyUnicode_GET_LENGTH(s1); + if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { + goto return_ne; + } +#if CYTHON_USE_UNICODE_INTERNALS + { + Py_hash_t hash1, hash2; + #if CYTHON_PEP393_ENABLED + hash1 = ((PyASCIIObject*)s1)->hash; + hash2 = ((PyASCIIObject*)s2)->hash; + #else + hash1 = ((PyUnicodeObject*)s1)->hash; + hash2 = ((PyUnicodeObject*)s2)->hash; + #endif + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + goto return_ne; + } + } +#endif + kind = __Pyx_PyUnicode_KIND(s1); + if (kind != __Pyx_PyUnicode_KIND(s2)) { + goto return_ne; + } + data1 = __Pyx_PyUnicode_DATA(s1); + data2 = __Pyx_PyUnicode_DATA(s2); + if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { + goto return_ne; + } else if (length == 1) { + goto return_eq; + } else { + int result = memcmp(data1, data2, (size_t)(length * kind)); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & s2_is_unicode) { + goto return_ne; + } else if ((s2 == Py_None) & s1_is_unicode) { + goto return_ne; + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +return_eq: + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_EQ); +return_ne: + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif + return (equals == Py_NE); +#endif +} + +/* fastcall */ +#if CYTHON_METH_FASTCALL +static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s) +{ + Py_ssize_t i, n = PyTuple_GET_SIZE(kwnames); + for (i = 0; i < n; i++) + { + if (s == PyTuple_GET_ITEM(kwnames, i)) return kwvalues[i]; + } + for (i = 0; i < n; i++) + { + int eq = __Pyx_PyUnicode_Equals(s, PyTuple_GET_ITEM(kwnames, i), 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_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues) { + Py_ssize_t i, nkwargs = PyTuple_GET_SIZE(kwnames); + PyObject *dict; + dict = PyDict_New(); + if (unlikely(!dict)) + return NULL; + for (i=0; i= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AsString(kw_name)); + #endif +} + +/* ParseKeywords */ +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject *const *kwvalues, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + int kwds_is_tuple = CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds)); + while (1) { + Py_XDECREF(key); key = NULL; + Py_XDECREF(value); value = NULL; + if (kwds_is_tuple) { + Py_ssize_t size; +#if CYTHON_ASSUME_SAFE_MACROS + size = PyTuple_GET_SIZE(kwds); +#else + size = PyTuple_Size(kwds); + if (size < 0) goto bad; +#endif + if (pos >= size) break; +#if CYTHON_AVOID_BORROWED_REFS + key = __Pyx_PySequence_ITEM(kwds, pos); + if (!key) goto bad; +#elif CYTHON_ASSUME_SAFE_MACROS + key = PyTuple_GET_ITEM(kwds, pos); +#else + key = PyTuple_GetItem(kwds, pos); + if (!key) goto bad; +#endif + value = kwvalues[pos]; + pos++; + } + else + { + if (!PyDict_Next(kwds, &pos, &key, &value)) break; +#if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(key); +#endif + } + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; +#if CYTHON_AVOID_BORROWED_REFS + Py_INCREF(value); + Py_DECREF(key); +#endif + key = NULL; + value = NULL; + continue; + } +#if !CYTHON_AVOID_BORROWED_REFS + Py_INCREF(key); +#endif + Py_INCREF(value); + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { + values[name-argnames] = value; +#if CYTHON_AVOID_BORROWED_REFS + value = NULL; +#endif + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; + } + argname++; + } + } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = ( + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key) + ); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; +#if CYTHON_AVOID_BORROWED_REFS + value = NULL; +#endif + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; + } + } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + Py_XDECREF(key); + Py_XDECREF(value); + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + #if PY_MAJOR_VERSION < 3 + PyErr_Format(PyExc_TypeError, + "%.200s() got an unexpected keyword argument '%.200s'", + function_name, PyString_AsString(key)); + #else + PyErr_Format(PyExc_TypeError, + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + Py_XDECREF(key); + Py_XDECREF(value); + return -1; +} + +/* RaiseArgTupleInvalid */ +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +/* ArgTypeTest */ +static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) +{ + __Pyx_TypeName type_name; + __Pyx_TypeName obj_type_name; + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; + } + else if (exact) { + #if PY_MAJOR_VERSION == 2 + if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; + #endif + } + else { + if (likely(__Pyx_TypeCheck(obj, type))) return 1; + } + type_name = __Pyx_PyType_GetName(type); + obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); + PyErr_Format(PyExc_TypeError, + "Argument '%.200s' has incorrect type (expected " __Pyx_FMT_TYPENAME + ", got " __Pyx_FMT_TYPENAME ")", name, type_name, obj_type_name); + __Pyx_DECREF_TypeName(type_name); + __Pyx_DECREF_TypeName(obj_type_name); + return 0; +} + +/* KeywordStringCheck */ +static int __Pyx_CheckKeywordStrings( + PyObject *kw, + const char* function_name, + int kw_allowed) +{ + PyObject* key = 0; + Py_ssize_t pos = 0; +#if CYTHON_COMPILING_IN_PYPY + if (!kw_allowed && PyDict_Next(kw, &pos, &key, 0)) + goto invalid_keyword; + return 1; +#else + if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kw))) { + Py_ssize_t kwsize; +#if CYTHON_ASSUME_SAFE_MACROS + kwsize = PyTuple_GET_SIZE(kw); +#else + kwsize = PyTuple_Size(kw); + if (kwsize < 0) return 0; +#endif + if (unlikely(kwsize == 0)) + return 1; + if (!kw_allowed) { +#if CYTHON_ASSUME_SAFE_MACROS + key = PyTuple_GET_ITEM(kw, 0); +#else + key = PyTuple_GetItem(kw, pos); + if (!key) return 0; +#endif + goto invalid_keyword; + } +#if PY_VERSION_HEX < 0x03090000 + for (pos = 0; pos < kwsize; pos++) { +#if CYTHON_ASSUME_SAFE_MACROS + key = PyTuple_GET_ITEM(kw, pos); +#else + key = PyTuple_GetItem(kw, pos); + if (!key) return 0; +#endif + if (unlikely(!PyUnicode_Check(key))) + goto invalid_keyword_type; + } +#endif + return 1; + } + while (PyDict_Next(kw, &pos, &key, 0)) { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_Check(key))) + #endif + if (unlikely(!PyUnicode_Check(key))) + goto invalid_keyword_type; + } + if (!kw_allowed && unlikely(key)) + goto invalid_keyword; + return 1; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + return 0; +#endif +invalid_keyword: + #if PY_MAJOR_VERSION < 3 + PyErr_Format(PyExc_TypeError, + "%.200s() got an unexpected keyword argument '%.200s'", + function_name, PyString_AsString(key)); + #else + PyErr_Format(PyExc_TypeError, + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif + return 0; +} + +/* RaiseException */ +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + __Pyx_PyThreadState_declare + CYTHON_UNUSED_VAR(cause); + Py_XINCREF(type); + if (!value || value == Py_None) + value = NULL; + else + Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + } + if (PyType_Check(type)) { +#if CYTHON_COMPILING_IN_PYPY + if (!value) { + Py_INCREF(Py_None); + value = Py_None; + } +#endif + PyErr_NormalizeException(&type, &value, &tb); + } else { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + value = type; + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } + } + __Pyx_PyThreadState_assign + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; +} +#else +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (PyExceptionClass_Check(type)) { + PyObject *instance_class = NULL; + if (value && PyExceptionInstance_Check(value)) { + instance_class = (PyObject*) Py_TYPE(value); + if (instance_class != type) { + int is_subclass = PyObject_IsSubclass(instance_class, type); + if (!is_subclass) { + instance_class = NULL; + } else if (unlikely(is_subclass == -1)) { + goto bad; + } else { + type = instance_class; + } + } + } + if (!instance_class) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyObject_Call(type, args, NULL); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } + } + } else { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } + if (cause) { + PyObject *fixed_cause; + if (cause == Py_None) { + fixed_cause = NULL; + } else if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + PyException_SetCause(value, fixed_cause); + } + PyErr_SetObject(type, value); + if (tb) { + #if 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; +} +#endif + +/* FixUpExtensionType */ +#if CYTHON_USE_TYPE_SPECS +static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) { +#if PY_VERSION_HEX > 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API + CYTHON_UNUSED_VAR(spec); + CYTHON_UNUSED_VAR(type); +#else + const PyType_Slot *slot = spec->slots; + while (slot && slot->slot && slot->slot != Py_tp_members) + slot++; + if (slot && slot->slot == Py_tp_members) { + int changed = 0; +#if !(PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON) + const +#endif + PyMemberDef *memb = (PyMemberDef*) slot->pfunc; + while (memb && memb->name) { + if (memb->name[0] == '_' && memb->name[1] == '_') { +#if PY_VERSION_HEX < 0x030900b1 + 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); +#if PY_VERSION_HEX >= 0x030800b4 + type->tp_vectorcall_offset = memb->offset; +#else + type->tp_print = (printfunc) memb->offset; +#endif + changed = 1; + } +#endif +#else + if ((0)); +#endif +#if PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON + 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; + if (unlikely(PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr) < 0)) { + Py_DECREF(descr); + return -1; + } + Py_DECREF(descr); + changed = 1; + } +#endif + } + memb++; + } + if (changed) + PyType_Modified(type); + } +#endif + return 0; +} +#endif + +/* PyFunctionFastCall */ +#if CYTHON_FAST_PYCALL && !CYTHON_VECTORCALL +static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, + PyObject *globals) { + PyFrameObject *f; + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject **fastlocals; + Py_ssize_t i; + PyObject *result; + assert(globals != NULL); + /* XXX Perhaps we should create a specialized + PyFrame_New() that doesn't take locals, but does + take builtins without sanity checking them. + */ + assert(tstate != NULL); + f = PyFrame_New(tstate, co, globals, NULL); + if (f == NULL) { + return NULL; + } + fastlocals = __Pyx_PyFrame_GetLocalsplus(f); + for (i = 0; i < na; i++) { + Py_INCREF(*args); + fastlocals[i] = *args++; + } + result = PyEval_EvalFrameEx(f,0); + ++tstate->recursion_depth; + Py_DECREF(f); + --tstate->recursion_depth; + return result; +} +static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) { + PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); + PyObject *globals = PyFunction_GET_GLOBALS(func); + PyObject *argdefs = PyFunction_GET_DEFAULTS(func); + PyObject *closure; +#if PY_MAJOR_VERSION >= 3 + PyObject *kwdefs; +#endif + PyObject *kwtuple, **k; + PyObject **d; + Py_ssize_t nd; + Py_ssize_t nk; + PyObject *result; + assert(kwargs == NULL || PyDict_Check(kwargs)); + nk = kwargs ? PyDict_Size(kwargs) : 0; + #if PY_MAJOR_VERSION < 3 + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) { + return NULL; + } + #else + if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) { + return NULL; + } + #endif + if ( +#if PY_MAJOR_VERSION >= 3 + co->co_kwonlyargcount == 0 && +#endif + likely(kwargs == NULL || nk == 0) && + co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { + if (argdefs == NULL && co->co_argcount == nargs) { + result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); + goto done; + } + else if (nargs == 0 && argdefs != NULL + && co->co_argcount == Py_SIZE(argdefs)) { + /* function called with no arguments, but all parameters have + a default value: use default values as arguments .*/ + args = &PyTuple_GET_ITEM(argdefs, 0); + result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); + goto done; + } + } + if (kwargs != NULL) { + Py_ssize_t pos, i; + kwtuple = PyTuple_New(2 * nk); + if (kwtuple == NULL) { + result = NULL; + goto done; + } + k = &PyTuple_GET_ITEM(kwtuple, 0); + pos = i = 0; + while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { + Py_INCREF(k[i]); + Py_INCREF(k[i+1]); + i += 2; + } + nk = i / 2; + } + else { + kwtuple = NULL; + k = NULL; + } + closure = PyFunction_GET_CLOSURE(func); +#if PY_MAJOR_VERSION >= 3 + kwdefs = PyFunction_GET_KW_DEFAULTS(func); +#endif + if (argdefs != NULL) { + d = &PyTuple_GET_ITEM(argdefs, 0); + nd = Py_SIZE(argdefs); + } + else { + d = NULL; + nd = 0; + } +#if PY_MAJOR_VERSION >= 3 + result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, + args, (int)nargs, + k, (int)nk, + d, (int)nd, kwdefs, closure); +#else + result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, + args, (int)nargs, + k, (int)nk, + d, (int)nd, closure); +#endif + Py_XDECREF(kwtuple); +done: + Py_LeaveRecursiveCall(); + return result; +} +#endif + +/* PyObjectCall */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { + PyObject *result; + ternaryfunc call = Py_TYPE(func)->tp_call; + if (unlikely(!call)) + return PyObject_Call(func, arg, kw); + #if PY_MAJOR_VERSION < 3 + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) + return NULL; + #else + if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) + return NULL; + #endif + result = (*call)(func, arg, kw); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +/* PyObjectCallMethO */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { + PyObject *self, *result; + PyCFunction cfunc; + cfunc = __Pyx_CyOrPyCFunction_GET_FUNCTION(func); + self = __Pyx_CyOrPyCFunction_GET_SELF(func); + #if PY_MAJOR_VERSION < 3 + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) + return NULL; + #else + if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) + return NULL; + #endif + 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 **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 +static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **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 PY_VERSION_HEX < 0x030800B1 + #if CYTHON_FAST_PYCCALL + if (PyCFunction_Check(func)) { + if (kwargs) { + return _PyCFunction_FastCallDict(func, args, nargs, kwargs); + } else { + return _PyCFunction_FastCallKeywords(func, args, nargs, NULL); + } + } + #if PY_VERSION_HEX >= 0x030700A1 + if (!kwargs && __Pyx_IS_TYPE(func, &PyMethodDescr_Type)) { + return _PyMethodDescr_FastCallKeywords(func, args, nargs, NULL); + } + #endif + #endif + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(func)) { + return __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs); + } + #endif + #endif + if (kwargs == NULL) { + #if CYTHON_VECTORCALL + #if PY_VERSION_HEX < 0x03090000 + vectorcallfunc f = _PyVectorcall_Function(func); + #else + vectorcallfunc f = PyVectorcall_Function(func); + #endif + if (f) { + return f(func, args, (size_t)nargs, NULL); + } + #elif defined(__Pyx_CyFunction_USED) && CYTHON_BACKPORT_VECTORCALL + if (__Pyx_CyFunction_CheckExact(func)) { + __pyx_vectorcallfunc f = __Pyx_CyFunction_func_vectorcall(func); + if (f) return f(func, args, (size_t)nargs, NULL); + } + #endif + } + if (nargs == 0) { + return __Pyx_PyObject_Call(func, __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 +} + +/* PyObjectCallNoArg */ +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); +} + +/* PyObjectCallOneArg */ +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); +} + +/* PyObjectGetMethod */ +static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) { + PyObject *attr; +#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP + __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)) +#elif PY_MAJOR_VERSION >= 3 + #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 +#else + #ifdef __Pyx_CyFunction_USED + if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr))) + #else + if (likely(PyFunction_Check(descr))) + #endif +#endif + { + meth_found = 1; + } else { + f = Py_TYPE(descr)->tp_descr_get; + if (f != NULL && PyDescr_IsData(descr)) { + attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); + Py_DECREF(descr); + goto try_unpack; + } + } + } + dictptr = _PyObject_GetDictPtr(obj); + if (dictptr != NULL && (dict = *dictptr) != NULL) { + Py_INCREF(dict); + attr = __Pyx_PyDict_GetItemStr(dict, name); + if (attr != NULL) { + Py_INCREF(attr); + Py_DECREF(dict); + Py_XDECREF(descr); + goto try_unpack; + } + Py_DECREF(dict); + } + if (meth_found) { + *method = descr; + return 1; + } + if (f != NULL) { + attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); + Py_DECREF(descr); + goto try_unpack; + } + if (likely(descr != NULL)) { + *method = descr; + return 0; + } + type_name = __Pyx_PyType_GetName(tp); + PyErr_Format(PyExc_AttributeError, +#if PY_MAJOR_VERSION >= 3 + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'", + type_name, name); +#else + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'", + type_name, PyString_AS_STRING(name)); +#endif + __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; +} + +/* PyObjectCallMethod0 */ +static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) { + PyObject *method = NULL, *result = NULL; + int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); + if (likely(is_method)) { + result = __Pyx_PyObject_CallOneArg(method, obj); + Py_DECREF(method); + return result; + } + if (unlikely(!method)) goto bad; + result = __Pyx_PyObject_CallNoArg(method); + Py_DECREF(method); +bad: + return result; +} + +/* ValidateBasesTuple */ +#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_MACROS + n = PyTuple_GET_SIZE(bases); +#else + n = PyTuple_Size(bases); + if (n < 0) return -1; +#endif + for (i = 1; i < n; i++) + { +#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 + PyTypeObject *b; +#if PY_MAJOR_VERSION < 3 + if (PyClass_Check(b0)) + { + PyErr_Format(PyExc_TypeError, "base class '%.200s' is an old-style class", + PyString_AS_STRING(((PyClassObject*)b0)->cl_name)); +#if CYTHON_AVOID_BORROWED_REFS + Py_DECREF(b0); +#endif + return -1; + } +#endif + b = (PyTypeObject*) b0; + if (!__Pyx_PyType_HasFeature(b, Py_TPFLAGS_HEAPTYPE)) + { + __Pyx_TypeName b_name = __Pyx_PyType_GetName(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 || CYTHON_COMPILING_IN_PYPY + 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_GetName(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 || CYTHON_COMPILING_IN_PYPY) + 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 */ +static int __Pyx_PyType_Ready(PyTypeObject *t) { +#if CYTHON_USE_TYPE_SPECS || !(CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API) || 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; + 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 PY_VERSION_HEX >= 0x03050000 && !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 PY_VERSION_HEX >= 0x030700a1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM+0 >= 0x07030400) + gc = PyImport_GetModule(__pyx_kp_u_gc); + #endif + if (unlikely(!gc)) gc = PyImport_Import(__pyx_kp_u_gc); + if (unlikely(!gc)) return -1; + py_status = __Pyx_PyObject_CallMethod0(gc, __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_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 PY_VERSION_HEX >= 0x03050000 && !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_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 +} + +/* PyObject_GenericGetAttrNoDict */ +#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 +static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) { + __Pyx_TypeName type_name = __Pyx_PyType_GetName(tp); + PyErr_Format(PyExc_AttributeError, +#if PY_MAJOR_VERSION >= 3 + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'", + type_name, attr_name); +#else + "'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'", + type_name, PyString_AS_STRING(attr_name)); +#endif + __Pyx_DECREF_TypeName(type_name); + return NULL; +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) { + PyObject *descr; + PyTypeObject *tp = Py_TYPE(obj); + if (unlikely(!PyString_Check(attr_name))) { + return PyObject_GenericGetAttr(obj, attr_name); + } + assert(!tp->tp_dictoffset); + descr = _PyType_Lookup(tp, attr_name); + if (unlikely(!descr)) { + return __Pyx_RaiseGenericGetAttributeError(tp, attr_name); + } + Py_INCREF(descr); + #if PY_MAJOR_VERSION < 3 + if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS))) + #endif + { + descrgetfunc f = Py_TYPE(descr)->tp_descr_get; + if (unlikely(f)) { + PyObject *res = f(descr, obj, (PyObject *)tp); + Py_DECREF(descr); + return res; + } + } + return descr; +} +#endif + +/* PyObject_GenericGetAttr */ +#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 +static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) { + if (unlikely(Py_TYPE(obj)->tp_dictoffset)) { + return PyObject_GenericGetAttr(obj, attr_name); + } + return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name); +} +#endif + +/* SetupReduce */ +#if !CYTHON_COMPILING_IN_LIMITED_API +static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) { + int ret; + PyObject *name_attr; + name_attr = __Pyx_PyObject_GetAttrStrNoError(meth, __pyx_n_s_name); + if (likely(name_attr)) { + ret = PyObject_RichCompareBool(name_attr, name, Py_EQ); + } else { + ret = -1; + } + if (unlikely(ret < 0)) { + PyErr_Clear(); + ret = 0; + } + Py_XDECREF(name_attr); + return ret; +} +static int __Pyx_setup_reduce(PyObject* type_obj) { + int ret = 0; + PyObject *object_reduce = NULL; + PyObject *object_getstate = NULL; + PyObject *object_reduce_ex = NULL; + PyObject *reduce = NULL; + PyObject *reduce_ex = NULL; + PyObject *reduce_cython = NULL; + PyObject *setstate = NULL; + PyObject *setstate_cython = NULL; + PyObject *getstate = NULL; +#if CYTHON_USE_PYTYPE_LOOKUP + getstate = _PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate); +#else + getstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_getstate); + if (!getstate && PyErr_Occurred()) { + goto __PYX_BAD; + } +#endif + if (getstate) { +#if CYTHON_USE_PYTYPE_LOOKUP + object_getstate = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_getstate); +#else + object_getstate = __Pyx_PyObject_GetAttrStrNoError((PyObject*)&PyBaseObject_Type, __pyx_n_s_getstate); + if (!object_getstate && PyErr_Occurred()) { + goto __PYX_BAD; + } +#endif + if (object_getstate != getstate) { + goto __PYX_GOOD; + } + } +#if CYTHON_USE_PYTYPE_LOOKUP + object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; +#else + object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; +#endif + reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD; + if (reduce_ex == object_reduce_ex) { +#if CYTHON_USE_PYTYPE_LOOKUP + object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD; +#else + object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD; +#endif + reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD; + if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) { + reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython); + if (likely(reduce_cython)) { + ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + } else if (reduce == object_reduce || PyErr_Occurred()) { + goto __PYX_BAD; + } + setstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate); + if (!setstate) PyErr_Clear(); + if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) { + setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython); + if (likely(setstate_cython)) { + ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + } else if (!setstate || PyErr_Occurred()) { + goto __PYX_BAD; + } + } + PyType_Modified((PyTypeObject*)type_obj); + } + } + goto __PYX_GOOD; +__PYX_BAD: + if (!PyErr_Occurred()) { + __Pyx_TypeName type_obj_name = + __Pyx_PyType_GetName((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; +} +#endif + +/* FetchSharedCythonModule */ +static PyObject *__Pyx_FetchSharedCythonABIModule(void) { + return __Pyx_PyImport_AddModuleRef((char*) __PYX_ABI_MODULE_NAME); +} + +/* FetchCommonType */ +static int __Pyx_VerifyCachedType(PyObject *cached_type, + const char *name, + Py_ssize_t basicsize, + Py_ssize_t expected_basicsize) { + if (!PyType_Check(cached_type)) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s is not a type object", name); + return -1; + } + if (basicsize != expected_basicsize) { + PyErr_Format(PyExc_TypeError, + "Shared Cython type %.200s has the wrong size, try recompiling", + name); + return -1; + } + return 0; +} +#if !CYTHON_USE_TYPE_SPECS +static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { + PyObject* abi_module; + const char* object_name; + PyTypeObject *cached_type = NULL; + abi_module = __Pyx_FetchSharedCythonABIModule(); + if (!abi_module) return NULL; + object_name = strrchr(type->tp_name, '.'); + object_name = object_name ? object_name+1 : type->tp_name; + cached_type = (PyTypeObject*) PyObject_GetAttrString(abi_module, object_name); + if (cached_type) { + if (__Pyx_VerifyCachedType( + (PyObject *)cached_type, + object_name, + cached_type->tp_basicsize, + type->tp_basicsize) < 0) { + goto bad; + } + goto done; + } + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; + PyErr_Clear(); + if (PyType_Ready(type) < 0) goto bad; + if (PyObject_SetAttrString(abi_module, object_name, (PyObject *)type) < 0) + goto bad; + Py_INCREF(type); + cached_type = type; +done: + Py_DECREF(abi_module); + return cached_type; +bad: + Py_XDECREF(cached_type); + cached_type = NULL; + goto done; +} +#else +static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases) { + PyObject *abi_module, *cached_type = NULL; + const char* object_name = strrchr(spec->name, '.'); + object_name = object_name ? object_name+1 : spec->name; + abi_module = __Pyx_FetchSharedCythonABIModule(); + if (!abi_module) return NULL; + cached_type = PyObject_GetAttrString(abi_module, object_name); + if (cached_type) { + Py_ssize_t basicsize; +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *py_basicsize; + py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__"); + if (unlikely(!py_basicsize)) goto bad; + basicsize = PyLong_AsSsize_t(py_basicsize); + Py_DECREF(py_basicsize); + py_basicsize = 0; + if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; +#else + basicsize = likely(PyType_Check(cached_type)) ? ((PyTypeObject*) cached_type)->tp_basicsize : -1; +#endif + if (__Pyx_VerifyCachedType( + cached_type, + object_name, + basicsize, + spec->basicsize) < 0) { + goto bad; + } + goto done; + } + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; + PyErr_Clear(); + CYTHON_UNUSED_VAR(module); + cached_type = __Pyx_PyType_FromModuleAndSpec(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; + if (PyObject_SetAttrString(abi_module, object_name, cached_type) < 0) goto bad; +done: + Py_DECREF(abi_module); + assert(cached_type == NULL || PyType_Check(cached_type)); + return (PyTypeObject *) cached_type; +bad: + Py_XDECREF(cached_type); + cached_type = NULL; + goto done; +} +#endif + +/* PyVectorcallFastCallDict */ +#if CYTHON_METH_FASTCALL +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, pos; + size_t j; + PyObject *key, *value; + unsigned long keys_are_strings; + Py_ssize_t nkw = PyDict_GET_SIZE(kw); + 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 = i = 0; + keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS; + while (PyDict_Next(kw, &pos, &key, &value)) { + keys_are_strings &= Py_TYPE(key)->tp_flags; + Py_INCREF(key); + Py_INCREF(value); + PyTuple_SET_ITEM(kwnames, i, key); + 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: + 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) +{ + if (likely(kw == NULL) || PyDict_GET_SIZE(kw) == 0) { + return vc(func, args, nargs, NULL); + } + return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw); +} +#endif + +/* CythonFunctionShared */ +#if CYTHON_COMPILING_IN_LIMITED_API +static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void *cfunc) { + 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; +} +#else +static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void *cfunc) { + 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(__pyx_CyFunctionObject *op, void *closure) +{ + CYTHON_UNUSED_VAR(closure); + 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) { +#if PY_MAJOR_VERSION >= 3 + op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); +#else + op->func_doc = PyString_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); +#endif + 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 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_Py_XDECREF_SET(op->func_doc, value); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(op->func_name == NULL)) { +#if CYTHON_COMPILING_IN_LIMITED_API + op->func_name = PyObject_GetAttrString(op->func, "__name__"); +#elif PY_MAJOR_VERSION >= 3 + op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); +#else + op->func_name = PyString_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 int +__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); +#if PY_MAJOR_VERSION >= 3 + if (unlikely(value == NULL || !PyUnicode_Check(value))) +#else + if (unlikely(value == NULL || !PyString_Check(value))) +#endif + { + PyErr_SetString(PyExc_TypeError, + "__name__ must be set to a string object"); + return -1; + } + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(op->func_name, value); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context) +{ + CYTHON_UNUSED_VAR(context); + Py_INCREF(op->func_qualname); + return op->func_qualname; +} +static int +__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); +#if PY_MAJOR_VERSION >= 3 + if (unlikely(value == NULL || !PyUnicode_Check(value))) +#else + if (unlikely(value == NULL || !PyString_Check(value))) +#endif + { + PyErr_SetString(PyExc_TypeError, + "__qualname__ must be set to a string object"); + return -1; + } + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(op->func_qualname, value); + return 0; +} +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; +} +static int +__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, void *context) +{ + CYTHON_UNUSED_VAR(context); + if (unlikely(value == NULL)) { + PyErr_SetString(PyExc_TypeError, + "function's dictionary may not be deleted"); + return -1; + } + if (unlikely(!PyDict_Check(value))) { + PyErr_SetString(PyExc_TypeError, + "setting function's dictionary to a non-dict"); + return -1; + } + Py_INCREF(value); + __Pyx_Py_XDECREF_SET(op->func_dict, value); + return 0; +} +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_Py_XDECREF_SET(op->defaults_tuple, value); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) { + PyObject* result = op->defaults_tuple; + CYTHON_UNUSED_VAR(context); + 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 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_Py_XDECREF_SET(op->defaults_kwdict, value); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) { + PyObject* result = op->defaults_kwdict; + CYTHON_UNUSED_VAR(context); + 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 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_Py_XDECREF_SET(op->func_annotations, value); + return 0; +} +static PyObject * +__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) { + PyObject* result = op->func_annotations; + CYTHON_UNUSED_VAR(context); + 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_is_coroutine(__pyx_CyFunctionObject *op, void *context) { + int is_coroutine; + CYTHON_UNUSED_VAR(context); + if (op->func_is_coroutine) { + return __Pyx_NewRef(op->func_is_coroutine); + } + is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE; +#if PY_VERSION_HEX >= 0x03050000 + if (is_coroutine) { + PyObject *module, *fromlist, *marker = __pyx_n_s_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_n_s_asyncio_coroutines, NULL, NULL, fromlist, 0); + Py_DECREF(fromlist); + if (unlikely(!module)) goto ignore; + op->func_is_coroutine = __Pyx_PyObject_GetAttrStr(module, marker); + Py_DECREF(module); + if (likely(op->func_is_coroutine)) { + return __Pyx_NewRef(op->func_is_coroutine); + } +ignore: + PyErr_Clear(); + } +#endif + op->func_is_coroutine = __Pyx_PyBool_FromLong(is_coroutine); + return __Pyx_NewRef(op->func_is_coroutine); +} +#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[] = { + {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, + {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, + {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, + {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, + {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, + {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, + {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, + {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, + {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, + {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, + {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, + {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, + {(char *) "_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 + {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0}, +#endif +#if CYTHON_USE_TYPE_SPECS + {(char *) "__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0}, +#if CYTHON_METH_FASTCALL +#if CYTHON_BACKPORT_VECTORCALL + {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0}, +#else +#if !CYTHON_COMPILING_IN_LIMITED_API + {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0}, +#endif +#endif +#endif +#if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API + {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0}, +#else + {(char *) "__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) +{ + CYTHON_UNUSED_VAR(args); +#if PY_MAJOR_VERSION >= 3 + Py_INCREF(m->func_qualname); + return m->func_qualname; +#else + return PyString_FromString(((PyCFunctionObject*)m)->m_ml->ml_name); +#endif +} +static PyMethodDef __pyx_CyFunction_methods[] = { + {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, + {0, 0, 0, 0} +}; +#if PY_VERSION_HEX < 0x030500A0 || 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 + op->func_dict = NULL; + 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_pyobjects = 0; + op->defaults_size = 0; + op->defaults = NULL; + op->defaults_tuple = NULL; + op->defaults_kwdict = NULL; + op->defaults_getter = NULL; + op->func_annotations = NULL; + 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 + Py_CLEAR(m->func_dict); + Py_CLEAR(m->func_name); + Py_CLEAR(m->func_qualname); + Py_CLEAR(m->func_doc); + Py_CLEAR(m->func_globals); + Py_CLEAR(m->func_code); +#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); + if (m->defaults) { + PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); + int i; + for (i = 0; i < m->defaults_pyobjects; i++) + Py_XDECREF(pydefaults[i]); + PyObject_Free(m->defaults); + m->defaults = NULL; + } + return 0; +} +static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m) +{ + if (__Pyx_CyFunction_weakreflist(m) != NULL) + PyObject_ClearWeakRefs((PyObject *) m); + __Pyx_CyFunction_clear(m); + __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) +{ + Py_VISIT(m->func_closure); +#if CYTHON_COMPILING_IN_LIMITED_API + Py_VISIT(m->func); +#else + Py_VISIT(((PyCFunctionObject*)m)->m_module); +#endif + Py_VISIT(m->func_dict); + Py_VISIT(m->func_name); + Py_VISIT(m->func_qualname); + Py_VISIT(m->func_doc); + Py_VISIT(m->func_globals); + Py_VISIT(m->func_code); +#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); + if (m->defaults) { + PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); + int i; + for (i = 0; i < m->defaults_pyobjects; i++) + Py_VISIT(pydefaults[i]); + } + return 0; +} +static PyObject* +__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) +{ +#if PY_MAJOR_VERSION >= 3 + return PyUnicode_FromFormat("", + op->func_qualname, (void *)op); +#else + return PyString_FromFormat("", + PyString_AsString(op->func_qualname), (void *)op); +#endif +} +static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) { +#if CYTHON_COMPILING_IN_LIMITED_API + PyObject *f = ((__pyx_CyFunctionObject*)func)->func; + PyObject *py_name = NULL; + 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*)meth)(self, arg, kw); + case METH_NOARGS: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) { +#if CYTHON_ASSUME_SAFE_MACROS + 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); +#if CYTHON_COMPILING_IN_LIMITED_API + py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL); + if (!py_name) return NULL; + PyErr_Format(PyExc_TypeError, + "%.200S() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", + py_name, size); + Py_DECREF(py_name); +#else + PyErr_Format(PyExc_TypeError, + "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", + f->m_ml->ml_name, size); +#endif + return NULL; + } + break; + case METH_O: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) { +#if CYTHON_ASSUME_SAFE_MACROS + 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; + } +#if CYTHON_COMPILING_IN_LIMITED_API + py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL); + if (!py_name) return NULL; + PyErr_Format(PyExc_TypeError, + "%.200S() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", + py_name, size); + Py_DECREF(py_name); +#else + PyErr_Format(PyExc_TypeError, + "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", + f->m_ml->ml_name, size); +#endif + return NULL; + } + break; + default: + PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); + return NULL; + } +#if CYTHON_COMPILING_IN_LIMITED_API + py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL); + if (!py_name) return NULL; + PyErr_Format(PyExc_TypeError, "%.200S() takes no keyword arguments", + py_name); + Py_DECREF(py_name); +#else + PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", + f->m_ml->ml_name); +#endif + 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 + __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc); + if (vc) { +#if CYTHON_ASSUME_SAFE_MACROS + 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_MACROS + 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); +#if PY_MAJOR_VERSION > 2 + PyErr_Format(PyExc_TypeError, + "unbound method %.200S() needs an argument", + cyfunc->func_qualname); +#else + PyErr_SetString(PyExc_TypeError, + "unbound method needs an argument"); +#endif + return NULL; + } + result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw); + Py_DECREF(new_args); + } else { + result = __Pyx_CyFunction_Call(func, args, kw); + } + return result; +} +#if CYTHON_METH_FASTCALL +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)) { + PyErr_Format(PyExc_TypeError, "%.200s() needs an argument", + ((PyCFunctionObject*)cyfunc)->m_ml->ml_name); + return -1; + } + ret = 1; + } + if (unlikely(kwnames) && unlikely(PyTuple_GET_SIZE(kwnames))) { + PyErr_Format(PyExc_TypeError, + "%.200s() takes no keyword arguments", ((PyCFunctionObject*)cyfunc)->m_ml->ml_name); + 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; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; + } + if (unlikely(nargs != 0)) { + PyErr_Format(PyExc_TypeError, + "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", + def->ml_name, nargs); + return NULL; + } + return def->ml_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; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; + } + if (unlikely(nargs != 1)) { + PyErr_Format(PyExc_TypeError, + "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", + def->ml_name, nargs); + return NULL; + } + return def->ml_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; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; + } + return ((_PyCFunctionFastWithKeywords)(void(*)(void))def->ml_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; + PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; + PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc); +#if CYTHON_BACKPORT_VECTORCALL + Py_ssize_t nargs = (Py_ssize_t)nargsf; +#else + Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); +#endif + PyObject *self; + switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { + case 1: + self = args[0]; + args += 1; + nargs -= 1; + break; + case 0: + self = ((PyCFunctionObject*)cyfunc)->m_self; + break; + default: + return NULL; + } + return ((__Pyx_PyCMethod)(void(*)(void))def->ml_meth)(self, cls, args, (size_t)nargs, kwnames); +} +#endif +#if CYTHON_USE_TYPE_SPECS +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 (defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL) + _Py_TPFLAGS_HAVE_VECTORCALL | +#endif + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, + __pyx_CyFunctionType_slots +}; +#else +static PyTypeObject __pyx_CyFunctionType_type = { + PyVarObject_HEAD_INIT(0, 0) + __PYX_TYPE_MODULE_PREFIX "cython_function_or_method", + sizeof(__pyx_CyFunctionObject), + 0, + (destructor) __Pyx_CyFunction_dealloc, +#if !CYTHON_METH_FASTCALL + 0, +#elif CYTHON_BACKPORT_VECTORCALL + (printfunc)offsetof(__pyx_CyFunctionObject, func_vectorcall), +#else + offsetof(PyCFunctionObject, vectorcall), +#endif + 0, + 0, +#if PY_MAJOR_VERSION < 3 + 0, +#else + 0, +#endif + (reprfunc) __Pyx_CyFunction_repr, + 0, + 0, + 0, + 0, + __Pyx_CyFunction_CallAsMethod, + 0, + 0, + 0, + 0, +#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR + Py_TPFLAGS_METHOD_DESCRIPTOR | +#endif +#if defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL + _Py_TPFLAGS_HAVE_VECTORCALL | +#endif + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, + 0, + (traverseproc) __Pyx_CyFunction_traverse, + (inquiry) __Pyx_CyFunction_clear, + 0, +#if PY_VERSION_HEX < 0x030500A0 + offsetof(__pyx_CyFunctionObject, func_weakreflist), +#else + offsetof(PyCFunctionObject, m_weakreflist), +#endif + 0, + 0, + __pyx_CyFunction_methods, + __pyx_CyFunction_members, + __pyx_CyFunction_getsets, + 0, + 0, + __Pyx_PyMethod_New, + 0, + offsetof(__pyx_CyFunctionObject, func_dict), + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, +#if PY_VERSION_HEX >= 0x030400a1 + 0, +#endif +#if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) + 0, +#endif +#if __PYX_NEED_TP_PRINT_SLOT + 0, +#endif +#if PY_VERSION_HEX >= 0x030C0000 + 0, +#endif +#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 + 0, +#endif +}; +#endif +static int __pyx_CyFunction_init(PyObject *module) { +#if CYTHON_USE_TYPE_SPECS + __pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx_CyFunctionType_spec, NULL); +#else + CYTHON_UNUSED_VAR(module); + __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type); +#endif + if (unlikely(__pyx_CyFunctionType == NULL)) { + return -1; + } + return 0; +} +static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults = PyObject_Malloc(size); + if (unlikely(!m->defaults)) + return PyErr_NoMemory(); + memset(m->defaults, 0, size); + m->defaults_pyobjects = pyobjects; + m->defaults_size = size; + return m->defaults; +} +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_tuple = tuple; + Py_INCREF(tuple); +} +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_kwdict = dict; + Py_INCREF(dict); +} +static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->func_annotations = dict; + Py_INCREF(dict); +} + +/* CythonFunction */ +static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname, + PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { + PyObject *op = __Pyx_CyFunction_Init( + PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType), + ml, flags, qualname, closure, module, globals, code + ); + if (likely(op)) { + PyObject_GC_Track(op); + } + return op; +} + +/* 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 + +/* CLineInTraceback */ +#ifndef CYTHON_CLINE_IN_TRACEBACK +static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { + PyObject *use_cline; + PyObject *ptype, *pvalue, *ptraceback; +#if CYTHON_COMPILING_IN_CPYTHON + PyObject **cython_runtime_dict; +#endif + CYTHON_MAYBE_UNUSED_VAR(tstate); + if (unlikely(!__pyx_cython_runtime)) { + return c_line; + } + __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); +#if CYTHON_COMPILING_IN_CPYTHON + cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime); + if (likely(cython_runtime_dict)) { + __PYX_PY_DICT_LOOKUP_IF_MODIFIED( + use_cline, *cython_runtime_dict, + __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback)) + } else +#endif + { + PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStrNoError(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); + if (use_cline_obj) { + use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True; + Py_DECREF(use_cline_obj); + } else { + PyErr_Clear(); + use_cline = NULL; + } + } + if (!use_cline) { + c_line = 0; + (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); + } + else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { + c_line = 0; + } + __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); + return c_line; +} +#endif + +/* CodeObjectCache */ +#if !CYTHON_COMPILING_IN_LIMITED_API +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = start + (end - start) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } +} +static PyCodeObject *__pyx_find_code_object(int code_line) { + PyCodeObject* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { + return NULL; + } + code_object = __pyx_code_cache.entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = 64; + __pyx_code_cache.count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { + PyCodeObject* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_DECREF(tmp); + return; + } + if (__pyx_code_cache.count == __pyx_code_cache.max_count) { + int new_max = __pyx_code_cache.max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = new_max; + } + for (i=__pyx_code_cache.count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + __pyx_code_cache.count++; + Py_INCREF(code_object); +} +#endif + +/* AddTraceback */ +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" +#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API + #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; + result = PyObject_Call(replace, __pyx_empty_tuple, scratch_dict); + Py_DECREF(replace); + return result; + } + PyErr_Clear(); + #if __PYX_LIMITED_VERSION_HEX < 0x030780000 + { + PyObject *compiled = NULL, *result = NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "code", code))) return NULL; + if (unlikely(PyDict_SetItemString(scratch_dict, "type", (PyObject*)(&PyType_Type)))) return NULL; + compiled = Py_CompileString( + "out = type(code)(\n" + " code.co_argcount, code.co_kwonlyargcount, code.co_nlocals, code.co_stacksize,\n" + " code.co_flags, code.co_code, code.co_consts, code.co_names,\n" + " code.co_varnames, code.co_filename, co_name, co_firstlineno,\n" + " code.co_lnotab)\n", "", Py_file_input); + if (!compiled) return NULL; + result = PyEval_EvalCode(compiled, scratch_dict, scratch_dict); + Py_DECREF(compiled); + if (!result) PyErr_Print(); + Py_DECREF(result); + result = PyDict_GetItemString(scratch_dict, "out"); + if (result) Py_INCREF(result); + return result; + } + #else + return NULL; + #endif +} +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) { + (void) __pyx_cfilenm; + (void) __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line); + } + PyErr_Fetch(&exc_type, &exc_value, &exc_traceback); + 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; + 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; + 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 PY_MAJOR_VERSION < 3 + PyObject *py_srcfile = NULL; + py_srcfile = PyString_FromString(filename); + if (!py_srcfile) goto bad; + #endif + if (c_line) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + if (!py_funcname) goto bad; + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + if (!py_funcname) goto bad; + funcname = PyUnicode_AsUTF8(py_funcname); + if (!funcname) goto bad; + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + if (!py_funcname) goto bad; + #endif + } + #if PY_MAJOR_VERSION < 3 + py_code = __Pyx_PyCode_New( + 0, + 0, + 0, + 0, + 0, + 0, + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + py_line, + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + Py_DECREF(py_srcfile); + #else + py_code = PyCode_NewEmpty(filename, funcname, py_line); + #endif + Py_XDECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_funcname); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(py_srcfile); + #endif + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject *ptype, *pvalue, *ptraceback; + if (c_line) { + c_line = __Pyx_CLineForTraceback(tstate, c_line); + } + py_code = __pyx_find_code_object(c_line ? -c_line : py_line); + if (!py_code) { + __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) { + /* If the code object creation fails, then we should clear the + fetched exception references and propagate the new exception */ + Py_XDECREF(ptype); + Py_XDECREF(pvalue); + Py_XDECREF(ptraceback); + goto bad; + } + __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); + __pyx_insert_code_object(c_line ? -c_line : py_line, py_code); + } + py_frame = PyFrame_New( + tstate, /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + __pyx_d, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + __Pyx_PyFrame_SetLineNumber(py_frame, py_line); + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} +#endif + +/* FormatTypeName */ +#if CYTHON_COMPILING_IN_LIMITED_API +static __Pyx_TypeName +__Pyx_PyType_GetName(PyTypeObject* tp) +{ + PyObject *name = __Pyx_PyObject_GetAttrStr((PyObject *)tp, + __pyx_n_s_name); + if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) { + PyErr_Clear(); + Py_XDECREF(name); + name = __Pyx_NewRef(__pyx_n_s__8); + } + return name; +} +#endif + +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const long neg_one = (long) -1, const_zero = (long) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(long) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(long) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(long) <= sizeof(long)) { + return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); +#endif + } + } + { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&value; +#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 + return _PyLong_FromByteArray(bytes, sizeof(long), + little, !is_unsigned); +#else + PyObject *from_bytes, *result = NULL; + PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = 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; + arg_tuple = PyTuple_Pack(2, py_bytes, order_str); + if (!arg_tuple) goto limited_bad; + if (!is_unsigned) { + kwds = PyDict_New(); + if (!kwds) goto limited_bad; + if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad; + } + result = PyObject_Call(from_bytes, arg_tuple, kwds); + limited_bad: + Py_XDECREF(kwds); + Py_XDECREF(arg_tuple); + Py_XDECREF(order_str); + Py_XDECREF(py_bytes); + Py_XDECREF(from_bytes); + return result; +#endif + } +} + +/* CIntFromPyVerify */ +#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ + __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) +#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ + __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) +#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ + {\ + func_type value = func_value;\ + if (sizeof(target_type) < sizeof(func_type)) {\ + if (unlikely(value != (func_type) (target_type) value)) {\ + func_type zero = 0;\ + if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ + return (target_type) -1;\ + if (is_unsigned && unlikely(value < zero))\ + goto raise_neg_overflow;\ + else\ + goto raise_overflow;\ + }\ + }\ + return (target_type) value;\ + } + +/* CIntFromPy */ +static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const long neg_one = (long) -1, const_zero = (long) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + if ((sizeof(long) < sizeof(long))) { + __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) + } else { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + goto raise_neg_overflow; + } + return (long) val; + } + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + 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)) +#ifdef HAVE_LONG_LONG + } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) +#endif + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + 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)) +#ifdef HAVE_LONG_LONG + } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) +#endif + } + } + { + long val; + PyObject *v = __Pyx_PyNumber_IntOrLong(x); +#if PY_MAJOR_VERSION < 3 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } +#endif + if (likely(v)) { + int ret = -1; +#if 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 *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (long) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (long) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (long) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (long) -1; + } else { + stepval = __Pyx_NewRef(v); + } + 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; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((long) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + 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 CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + 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 + Py_DECREF(v); + if (likely(!ret)) + return val; + } + return (long) -1; + } + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); + if (!tmp) return (long) -1; + val = __Pyx_PyInt_As_long(tmp); + Py_DECREF(tmp); + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to long"); + return (long) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long) -1; +} + +/* CIntFromPy */ +static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const int neg_one = (int) -1, const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + if ((sizeof(int) < sizeof(long))) { + __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) + } else { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + goto raise_neg_overflow; + } + return (int) val; + } + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + 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)) +#ifdef HAVE_LONG_LONG + } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) +#endif + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + 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)) +#ifdef HAVE_LONG_LONG + } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) { + __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) +#endif + } + } + { + int val; + PyObject *v = __Pyx_PyNumber_IntOrLong(x); +#if PY_MAJOR_VERSION < 3 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } +#endif + if (likely(v)) { + int ret = -1; +#if 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 *)v, + bytes, sizeof(val), + is_little, !is_unsigned); +#else + PyObject *stepval = NULL, *mask = NULL, *shift = NULL; + int bits, remaining_bits, is_negative = 0; + long idigit; + int chunk_size = (sizeof(long) < 8) ? 30 : 62; + if (unlikely(!PyLong_CheckExact(v))) { + PyObject *tmp = v; + v = PyNumber_Long(v); + assert(PyLong_CheckExact(v)); + Py_DECREF(tmp); + if (unlikely(!v)) return (int) -1; + } +#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(x) == 0) + return (int) 0; + is_negative = Py_SIZE(x) < 0; +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (int) -1; + is_negative = result == 1; + } +#endif + if (is_unsigned && unlikely(is_negative)) { + goto raise_neg_overflow; + } else if (is_negative) { + stepval = PyNumber_Invert(v); + if (unlikely(!stepval)) + return (int) -1; + } else { + stepval = __Pyx_NewRef(v); + } + 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; + digit = PyNumber_And(stepval, mask); + if (unlikely(!digit)) goto done; + idigit = PyLong_AsLong(digit); + Py_DECREF(digit); + if (unlikely(idigit < 0)) goto done; + tmp = PyNumber_Rshift(stepval, shift); + if (unlikely(!tmp)) goto done; + Py_DECREF(stepval); stepval = tmp; + val |= ((int) idigit) << bits; + #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + if (Py_SIZE(stepval) == 0) + goto unpacking_done; + #endif + } + 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 CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 + unpacking_done: + #endif + 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 + Py_DECREF(v); + if (likely(!ret)) + return val; + } + return (int) -1; + } + } else { + int val; + PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); + if (!tmp) return (int) -1; + val = __Pyx_PyInt_As_int(tmp); + Py_DECREF(tmp); + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to int"); + return (int) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to int"); + return (int) -1; +} + +/* 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); +} +#if PY_MAJOR_VERSION == 2 +static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { + PyObject *exception, *value, *tb; + int res; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&exception, &value, &tb); + res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0; + if (unlikely(res == -1)) { + PyErr_WriteUnraisable(err); + res = 0; + } + if (!res) { + res = PyObject_IsSubclass(err, exc_type2); + if (unlikely(res == -1)) { + PyErr_WriteUnraisable(err); + res = 0; + } + } + __Pyx_ErrRestore(exception, value, tb); + return res; +} +#else +static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { + if (exc_type1) { + return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2); + } else { + return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); + } +} +#endif +static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + assert(PyExceptionClass_Check(exc_type)); + n = PyTuple_GET_SIZE(tuple); +#if PY_MAJOR_VERSION >= 3 + for (i=0; i= 0x030B00A4 + return Py_Version & ~0xFFUL; +#else + 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; + } + return version; +#endif +} +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); + } +} + +/* InitStrings */ +#if PY_MAJOR_VERSION >= 3 +static int __Pyx_InitString(__Pyx_StringTabEntry t, PyObject **str) { + if (t.is_unicode | t.is_str) { + if (t.intern) { + *str = PyUnicode_InternFromString(t.s); + } else if (t.encoding) { + *str = PyUnicode_Decode(t.s, t.n - 1, t.encoding, NULL); + } else { + *str = PyUnicode_FromStringAndSize(t.s, t.n - 1); + } + } else { + *str = PyBytes_FromStringAndSize(t.s, t.n - 1); + } + if (!*str) + return -1; + if (PyObject_Hash(*str) == -1) + return -1; + return 0; +} +#endif +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + #if PY_MAJOR_VERSION >= 3 + __Pyx_InitString(*t, t->p); + #else + if (t->is_unicode) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + if (!*t->p) + return -1; + if (PyObject_Hash(*t->p) == -1) + return -1; + #endif + ++t; + } + return 0; +} + +#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_DEFAULT +#if !CYTHON_PEP393_ENABLED +static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { + char* defenc_c; + PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); + if (!defenc) return NULL; + defenc_c = PyBytes_AS_STRING(defenc); +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + { + char* end = defenc_c + PyBytes_GET_SIZE(defenc); + char* c; + for (c = defenc_c; c < end; c++) { + if ((unsigned char) (*c) >= 128) { + PyUnicode_AsASCIIString(o); + return NULL; + } + } + } +#endif + *length = PyBytes_GET_SIZE(defenc); + return defenc_c; +} +#else +static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { + if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL; +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + if (likely(PyUnicode_IS_ASCII(o))) { + *length = PyUnicode_GET_LENGTH(o); + return PyUnicode_AsUTF8(o); + } else { + PyUnicode_AsASCIIString(o); + return NULL; + } +#else + return PyUnicode_AsUTF8AndSize(o, length); +#endif +} +#endif +#endif +static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT + if ( +#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + __Pyx_sys_getdefaultencoding_not_ascii && +#endif + PyUnicode_Check(o)) { + return __Pyx_PyUnicode_AsStringAndSize(o, length); + } else +#endif +#if (!CYTHON_COMPILING_IN_PYPY && !CYTHON_COMPILING_IN_LIMITED_API) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) + if (PyByteArray_Check(o)) { + *length = PyByteArray_GET_SIZE(o); + return PyByteArray_AS_STRING(o); + } else +#endif + { + char* result; + int r = PyBytes_AsStringAndSize(o, &result, length); + if (unlikely(r < 0)) { + return NULL; + } else { + return result; + } + } +} +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} +static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { + int retval; + if (unlikely(!x)) return -1; + retval = __Pyx_PyObject_IsTrue(x); + Py_DECREF(x); + return retval; +} +static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) { + __Pyx_TypeName result_type_name = __Pyx_PyType_GetName(Py_TYPE(result)); +#if PY_MAJOR_VERSION >= 3 + 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; + } +#endif + PyErr_Format(PyExc_TypeError, + "__%.4s__ returned non-%.4s (type " __Pyx_FMT_TYPENAME ")", + type_name, type_name, result_type_name); + __Pyx_DECREF_TypeName(result_type_name); + Py_DECREF(result); + return NULL; +} +static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) { +#if CYTHON_USE_TYPE_SLOTS + PyNumberMethods *m; +#endif + const char *name = NULL; + PyObject *res = NULL; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x) || PyLong_Check(x))) +#else + if (likely(PyLong_Check(x))) +#endif + return __Pyx_NewRef(x); +#if CYTHON_USE_TYPE_SLOTS + m = Py_TYPE(x)->tp_as_number; + #if PY_MAJOR_VERSION < 3 + if (m && m->nb_int) { + name = "int"; + res = m->nb_int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = m->nb_long(x); + } + #else + if (likely(m && m->nb_int)) { + name = "int"; + res = m->nb_int(x); + } + #endif +#else + if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) { + res = PyNumber_Int(x); + } +#endif + if (likely(res)) { +#if PY_MAJOR_VERSION < 3 + if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) { +#else + if (unlikely(!PyLong_CheckExact(res))) { +#endif + return __Pyx_PyNumber_IntOrLongWrongResultType(res, name); + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject *x; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_CheckExact(b))) { + if (sizeof(Py_ssize_t) >= sizeof(long)) + return PyInt_AS_LONG(b); + else + return PyInt_AsSsize_t(b); + } +#endif + if (likely(PyLong_CheckExact(b))) { + #if CYTHON_USE_PYLONG_INTERNALS + 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 = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; +} +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) { + if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) { + return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o); +#if PY_MAJOR_VERSION < 3 + } else if (likely(PyInt_CheckExact(o))) { + return PyInt_AS_LONG(o); +#endif + } else { + Py_ssize_t ival; + PyObject *x; + x = PyNumber_Index(o); + if (!x) return -1; + ival = PyInt_AsLong(x); + Py_DECREF(x); + return ival; + } +} +static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { + return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False); +} +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { + return PyInt_FromSize_t(ival); +} + + +/* #### Code section: utility_code_pragmas_end ### */ +#ifdef _MSC_VER +#pragma warning( pop ) +#endif + + + +/* #### Code section: end ### */ +#endif /* Py_PYTHON_H */ diff --git a/src/amulet_nbt/_string_encoding/encoding.pxd b/src_/amulet_nbt/_string_encoding/encoding.pxd similarity index 100% rename from src/amulet_nbt/_string_encoding/encoding.pxd rename to src_/amulet_nbt/_string_encoding/encoding.pxd diff --git a/src/amulet_nbt/_string_encoding/encoding.pyx b/src_/amulet_nbt/_string_encoding/encoding.pyx similarity index 100% rename from src/amulet_nbt/_string_encoding/encoding.pyx rename to src_/amulet_nbt/_string_encoding/encoding.pyx diff --git a/src/amulet_nbt/_tag/__init__.pyx b/src_/amulet_nbt/_tag/__init__.pyx similarity index 100% rename from src/amulet_nbt/_tag/__init__.pyx rename to src_/amulet_nbt/_tag/__init__.pyx diff --git a/src/amulet_nbt/_tag/abc.pxd b/src_/amulet_nbt/_tag/abc.pxd similarity index 100% rename from src/amulet_nbt/_tag/abc.pxd rename to src_/amulet_nbt/_tag/abc.pxd diff --git a/src/amulet_nbt/_tag/abc.pyx b/src_/amulet_nbt/_tag/abc.pyx similarity index 100% rename from src/amulet_nbt/_tag/abc.pyx rename to src_/amulet_nbt/_tag/abc.pyx diff --git a/src/amulet_nbt/_tag/array.pxd b/src_/amulet_nbt/_tag/array.pxd similarity index 100% rename from src/amulet_nbt/_tag/array.pxd rename to src_/amulet_nbt/_tag/array.pxd diff --git a/src/amulet_nbt/_tag/array.pyx b/src_/amulet_nbt/_tag/array.pyx similarity index 100% rename from src/amulet_nbt/_tag/array.pyx rename to src_/amulet_nbt/_tag/array.pyx diff --git a/src/amulet_nbt/_tag/array.pyx.tp b/src_/amulet_nbt/_tag/array.pyx.tp similarity index 100% rename from src/amulet_nbt/_tag/array.pyx.tp rename to src_/amulet_nbt/_tag/array.pyx.tp diff --git a/src/amulet_nbt/_tag/compound.pxd b/src_/amulet_nbt/_tag/compound.pxd similarity index 100% rename from src/amulet_nbt/_tag/compound.pxd rename to src_/amulet_nbt/_tag/compound.pxd diff --git a/src/amulet_nbt/_tag/compound.pyx b/src_/amulet_nbt/_tag/compound.pyx similarity index 100% rename from src/amulet_nbt/_tag/compound.pyx rename to src_/amulet_nbt/_tag/compound.pyx diff --git a/src/amulet_nbt/_tag/compound.pyx.tp b/src_/amulet_nbt/_tag/compound.pyx.tp similarity index 100% rename from src/amulet_nbt/_tag/compound.pyx.tp rename to src_/amulet_nbt/_tag/compound.pyx.tp diff --git a/src/amulet_nbt/_tag/deepcopy.pxd b/src_/amulet_nbt/_tag/deepcopy.pxd similarity index 100% rename from src/amulet_nbt/_tag/deepcopy.pxd rename to src_/amulet_nbt/_tag/deepcopy.pxd diff --git a/src/amulet_nbt/_tag/deepcopy.pyx b/src_/amulet_nbt/_tag/deepcopy.pyx similarity index 100% rename from src/amulet_nbt/_tag/deepcopy.pyx rename to src_/amulet_nbt/_tag/deepcopy.pyx diff --git a/src/amulet_nbt/_tag/float.pxd b/src_/amulet_nbt/_tag/float.pxd similarity index 100% rename from src/amulet_nbt/_tag/float.pxd rename to src_/amulet_nbt/_tag/float.pxd diff --git a/src/amulet_nbt/_tag/float.pyx b/src_/amulet_nbt/_tag/float.pyx similarity index 100% rename from src/amulet_nbt/_tag/float.pyx rename to src_/amulet_nbt/_tag/float.pyx diff --git a/src/amulet_nbt/_tag/float.pyx.tp b/src_/amulet_nbt/_tag/float.pyx.tp similarity index 100% rename from src/amulet_nbt/_tag/float.pyx.tp rename to src_/amulet_nbt/_tag/float.pyx.tp diff --git a/src/amulet_nbt/_tag/int.pxd b/src_/amulet_nbt/_tag/int.pxd similarity index 100% rename from src/amulet_nbt/_tag/int.pxd rename to src_/amulet_nbt/_tag/int.pxd diff --git a/src/amulet_nbt/_tag/int.pyx b/src_/amulet_nbt/_tag/int.pyx similarity index 100% rename from src/amulet_nbt/_tag/int.pyx rename to src_/amulet_nbt/_tag/int.pyx diff --git a/src/amulet_nbt/_tag/int.pyx.tp b/src_/amulet_nbt/_tag/int.pyx.tp similarity index 100% rename from src/amulet_nbt/_tag/int.pyx.tp rename to src_/amulet_nbt/_tag/int.pyx.tp diff --git a/src/amulet_nbt/_tag/list.pxd b/src_/amulet_nbt/_tag/list.pxd similarity index 100% rename from src/amulet_nbt/_tag/list.pxd rename to src_/amulet_nbt/_tag/list.pxd diff --git a/src/amulet_nbt/_tag/list.pyx b/src_/amulet_nbt/_tag/list.pyx similarity index 84% rename from src/amulet_nbt/_tag/list.pyx rename to src_/amulet_nbt/_tag/list.pyx index d6f1ffcd..c912f80f 100644 --- a/src/amulet_nbt/_tag/list.pyx +++ b/src_/amulet_nbt/_tag/list.pyx @@ -51,272 +51,6 @@ from .array cimport ByteArrayTag, IntArrayTag, LongArrayTag from .deepcopy cimport CListTagPtr_deepcopy from .compound cimport is_compound_eq - -cdef inline bool _is_byte_tag_list_eq(CListTagPtr a, CListTagPtr b) noexcept nogil: - cdef CByteList* byte_list_a = &get[CByteList](dereference(a)) - if dereference(b).index() != 1: - return dereference(byte_list_a).size() == 0 and ListTag_len(b) == 0 - cdef CByteList* byte_list_b = &get[CByteList](dereference(b)) - cdef size_t size = dereference(byte_list_a).size() - cdef size_t i - - if size != dereference(byte_list_b).size(): - return False - - for i in range(size): - if dereference(byte_list_a)[i] != dereference(byte_list_b)[i]: - return False - return True - - -cdef inline bool _is_short_tag_list_eq(CListTagPtr a, CListTagPtr b) noexcept nogil: - cdef CShortList* short_list_a = &get[CShortList](dereference(a)) - if dereference(b).index() != 2: - return dereference(short_list_a).size() == 0 and ListTag_len(b) == 0 - cdef CShortList* short_list_b = &get[CShortList](dereference(b)) - cdef size_t size = dereference(short_list_a).size() - cdef size_t i - - if size != dereference(short_list_b).size(): - return False - - for i in range(size): - if dereference(short_list_a)[i] != dereference(short_list_b)[i]: - return False - return True - - -cdef inline bool _is_int_tag_list_eq(CListTagPtr a, CListTagPtr b) noexcept nogil: - cdef CIntList* int_list_a = &get[CIntList](dereference(a)) - if dereference(b).index() != 3: - return dereference(int_list_a).size() == 0 and ListTag_len(b) == 0 - cdef CIntList* int_list_b = &get[CIntList](dereference(b)) - cdef size_t size = dereference(int_list_a).size() - cdef size_t i - - if size != dereference(int_list_b).size(): - return False - - for i in range(size): - if dereference(int_list_a)[i] != dereference(int_list_b)[i]: - return False - return True - - -cdef inline bool _is_long_tag_list_eq(CListTagPtr a, CListTagPtr b) noexcept nogil: - cdef CLongList* long_list_a = &get[CLongList](dereference(a)) - if dereference(b).index() != 4: - return dereference(long_list_a).size() == 0 and ListTag_len(b) == 0 - cdef CLongList* long_list_b = &get[CLongList](dereference(b)) - cdef size_t size = dereference(long_list_a).size() - cdef size_t i - - if size != dereference(long_list_b).size(): - return False - - for i in range(size): - if dereference(long_list_a)[i] != dereference(long_list_b)[i]: - return False - return True - - -cdef inline bool _is_float_tag_list_eq(CListTagPtr a, CListTagPtr b) noexcept nogil: - cdef CFloatList* float_list_a = &get[CFloatList](dereference(a)) - if dereference(b).index() != 5: - return dereference(float_list_a).size() == 0 and ListTag_len(b) == 0 - cdef CFloatList* float_list_b = &get[CFloatList](dereference(b)) - cdef size_t size = dereference(float_list_a).size() - cdef size_t i - - if size != dereference(float_list_b).size(): - return False - - for i in range(size): - if dereference(float_list_a)[i] != dereference(float_list_b)[i]: - return False - return True - - -cdef inline bool _is_double_tag_list_eq(CListTagPtr a, CListTagPtr b) noexcept nogil: - cdef CDoubleList* double_list_a = &get[CDoubleList](dereference(a)) - if dereference(b).index() != 6: - return dereference(double_list_a).size() == 0 and ListTag_len(b) == 0 - cdef CDoubleList* double_list_b = &get[CDoubleList](dereference(b)) - cdef size_t size = dereference(double_list_a).size() - cdef size_t i - - if size != dereference(double_list_b).size(): - return False - - for i in range(size): - if dereference(double_list_a)[i] != dereference(double_list_b)[i]: - return False - return True - - -cdef inline bool _is_byte_array_tag_list_eq(CListTagPtr a, CListTagPtr b) noexcept nogil: - cdef CByteArrayList* byte_array_list_a = &get[CByteArrayList](dereference(a)) - if dereference(b).index() != 7: - return dereference(byte_array_list_a).size() == 0 and ListTag_len(b) == 0 - cdef CByteArrayList* byte_array_list_b = &get[CByteArrayList](dereference(b)) - cdef size_t size = dereference(byte_array_list_a).size() - cdef size_t i - - if size != dereference(byte_array_list_b).size(): - return False - - for i in range(size): - if dereference(dereference(byte_array_list_a)[i]) != dereference(dereference(byte_array_list_b)[i]): - return False - return True - - -cdef inline bool _is_string_tag_list_eq(CListTagPtr a, CListTagPtr b) noexcept nogil: - cdef CStringList* string_list_a = &get[CStringList](dereference(a)) - if dereference(b).index() != 8: - return dereference(string_list_a).size() == 0 and ListTag_len(b) == 0 - cdef CStringList* string_list_b = &get[CStringList](dereference(b)) - cdef size_t size = dereference(string_list_a).size() - cdef size_t i - - if size != dereference(string_list_b).size(): - return False - - for i in range(size): - if dereference(string_list_a)[i] != dereference(string_list_b)[i]: - return False - return True - - -cdef inline bool _is_list_tag_list_eq(CListTagPtr a, CListTagPtr b) noexcept nogil: - cdef CListList* list_list_a = &get[CListList](dereference(a)) - if dereference(b).index() != 9: - return dereference(list_list_a).size() == 0 and ListTag_len(b) == 0 - cdef CListList* list_list_b = &get[CListList](dereference(b)) - cdef size_t size = dereference(list_list_a).size() - cdef size_t i - - if size != dereference(list_list_b).size(): - return False - - for i in range(size): - if not is_list_eq(dereference(list_list_a)[i], dereference(list_list_b)[i]): - return False - return True - - -cdef inline bool _is_compound_tag_list_eq(CListTagPtr a, CListTagPtr b) noexcept nogil: - cdef CCompoundList* compound_list_a = &get[CCompoundList](dereference(a)) - if dereference(b).index() != 10: - return dereference(compound_list_a).size() == 0 and ListTag_len(b) == 0 - cdef CCompoundList* compound_list_b = &get[CCompoundList](dereference(b)) - cdef size_t size = dereference(compound_list_a).size() - cdef size_t i - - if size != dereference(compound_list_b).size(): - return False - - for i in range(size): - if not is_compound_eq(dereference(compound_list_a)[i], dereference(compound_list_b)[i]): - return False - return True - - -cdef inline bool _is_int_array_tag_list_eq(CListTagPtr a, CListTagPtr b) noexcept nogil: - cdef CIntArrayList* int_array_list_a = &get[CIntArrayList](dereference(a)) - if dereference(b).index() != 11: - return dereference(int_array_list_a).size() == 0 and ListTag_len(b) == 0 - cdef CIntArrayList* int_array_list_b = &get[CIntArrayList](dereference(b)) - cdef size_t size = dereference(int_array_list_a).size() - cdef size_t i - - if size != dereference(int_array_list_b).size(): - return False - - for i in range(size): - if dereference(dereference(int_array_list_a)[i]) != dereference(dereference(int_array_list_b)[i]): - return False - return True - - -cdef inline bool _is_long_array_tag_list_eq(CListTagPtr a, CListTagPtr b) noexcept nogil: - cdef CLongArrayList* long_array_list_a = &get[CLongArrayList](dereference(a)) - if dereference(b).index() != 12: - return dereference(long_array_list_a).size() == 0 and ListTag_len(b) == 0 - cdef CLongArrayList* long_array_list_b = &get[CLongArrayList](dereference(b)) - cdef size_t size = dereference(long_array_list_a).size() - cdef size_t i - - if size != dereference(long_array_list_b).size(): - return False - - for i in range(size): - if dereference(dereference(long_array_list_a)[i]) != dereference(dereference(long_array_list_b)[i]): - return False - return True - - -cdef bool is_list_eq(CListTagPtr a, CListTagPtr b) noexcept nogil: - cdef size_t index = dereference(a).index() - if index == 0: - return ListTag_len(b) == 0 - elif index == 1: - return _is_byte_tag_list_eq(a, b) - elif index == 2: - return _is_short_tag_list_eq(a, b) - elif index == 3: - return _is_int_tag_list_eq(a, b) - elif index == 4: - return _is_long_tag_list_eq(a, b) - elif index == 5: - return _is_float_tag_list_eq(a, b) - elif index == 6: - return _is_double_tag_list_eq(a, b) - elif index == 7: - return _is_byte_array_tag_list_eq(a, b) - elif index == 8: - return _is_string_tag_list_eq(a, b) - elif index == 9: - return _is_list_tag_list_eq(a, b) - elif index == 10: - return _is_compound_tag_list_eq(a, b) - elif index == 11: - return _is_int_array_tag_list_eq(a, b) - elif index == 12: - return _is_long_array_tag_list_eq(a, b) - return False - - -cdef inline size_t ListTag_len(CListTagPtr cpp) noexcept nogil: - cdef size_t index = dereference(cpp).index() - if index == 1: - return get[CByteList](dereference(cpp)).size() - elif index == 2: - return get[CShortList](dereference(cpp)).size() - elif index == 3: - return get[CIntList](dereference(cpp)).size() - elif index == 4: - return get[CLongList](dereference(cpp)).size() - elif index == 5: - return get[CFloatList](dereference(cpp)).size() - elif index == 6: - return get[CDoubleList](dereference(cpp)).size() - elif index == 7: - return get[CByteArrayList](dereference(cpp)).size() - elif index == 8: - return get[CStringList](dereference(cpp)).size() - elif index == 9: - return get[CListList](dereference(cpp)).size() - elif index == 10: - return get[CCompoundList](dereference(cpp)).size() - elif index == 11: - return get[CIntArrayList](dereference(cpp)).size() - elif index == 12: - return get[CLongArrayList](dereference(cpp)).size() - - return 0 - - cdef inline ByteTag ListTag_get_item_byte_tag(CListTagPtr cpp, ptrdiff_t item): cdef CByteList* byte_list = &get[CByteList](dereference(cpp)) if item < 0: @@ -2294,203 +2028,6 @@ cdef inline void ListTag_insert(CListTagPtr cpp, ptrdiff_t item, AbstractBaseTag raise TypeError(f"Unsupported type {type(value)}") -cdef inline void ListTag_append_byte_tag(CListTagPtr cpp, ByteTag value): - cdef CByteList* byte_list - - if dereference(cpp).index() == 1: - byte_list = &get[CByteList](dereference(cpp)) - elif ListTag_len(cpp) == 0: - dereference(cpp).emplace[CByteList]() - byte_list = &get[CByteList](dereference(cpp)) - else: - raise TypeError("ListTag can only contain one NBT data type.") - - dereference(byte_list).push_back(value.cpp) - - -cdef inline void ListTag_append_short_tag(CListTagPtr cpp, ShortTag value): - cdef CShortList* short_list - - if dereference(cpp).index() == 2: - short_list = &get[CShortList](dereference(cpp)) - elif ListTag_len(cpp) == 0: - dereference(cpp).emplace[CShortList]() - short_list = &get[CShortList](dereference(cpp)) - else: - raise TypeError("ListTag can only contain one NBT data type.") - - dereference(short_list).push_back(value.cpp) - - -cdef inline void ListTag_append_int_tag(CListTagPtr cpp, IntTag value): - cdef CIntList* int_list - - if dereference(cpp).index() == 3: - int_list = &get[CIntList](dereference(cpp)) - elif ListTag_len(cpp) == 0: - dereference(cpp).emplace[CIntList]() - int_list = &get[CIntList](dereference(cpp)) - else: - raise TypeError("ListTag can only contain one NBT data type.") - - dereference(int_list).push_back(value.cpp) - - -cdef inline void ListTag_append_long_tag(CListTagPtr cpp, LongTag value): - cdef CLongList* long_list - - if dereference(cpp).index() == 4: - long_list = &get[CLongList](dereference(cpp)) - elif ListTag_len(cpp) == 0: - dereference(cpp).emplace[CLongList]() - long_list = &get[CLongList](dereference(cpp)) - else: - raise TypeError("ListTag can only contain one NBT data type.") - - dereference(long_list).push_back(value.cpp) - - -cdef inline void ListTag_append_float_tag(CListTagPtr cpp, FloatTag value): - cdef CFloatList* float_list - - if dereference(cpp).index() == 5: - float_list = &get[CFloatList](dereference(cpp)) - elif ListTag_len(cpp) == 0: - dereference(cpp).emplace[CFloatList]() - float_list = &get[CFloatList](dereference(cpp)) - else: - raise TypeError("ListTag can only contain one NBT data type.") - - dereference(float_list).push_back(value.cpp) - - -cdef inline void ListTag_append_double_tag(CListTagPtr cpp, DoubleTag value): - cdef CDoubleList* double_list - - if dereference(cpp).index() == 6: - double_list = &get[CDoubleList](dereference(cpp)) - elif ListTag_len(cpp) == 0: - dereference(cpp).emplace[CDoubleList]() - double_list = &get[CDoubleList](dereference(cpp)) - else: - raise TypeError("ListTag can only contain one NBT data type.") - - dereference(double_list).push_back(value.cpp) - - -cdef inline void ListTag_append_byte_array_tag(CListTagPtr cpp, ByteArrayTag value): - cdef CByteArrayList* byte_array_list - - if dereference(cpp).index() == 7: - byte_array_list = &get[CByteArrayList](dereference(cpp)) - elif ListTag_len(cpp) == 0: - dereference(cpp).emplace[CByteArrayList]() - byte_array_list = &get[CByteArrayList](dereference(cpp)) - else: - raise TypeError("ListTag can only contain one NBT data type.") - - dereference(byte_array_list).push_back(value.cpp) - - -cdef inline void ListTag_append_string_tag(CListTagPtr cpp, StringTag value): - cdef CStringList* string_list - - if dereference(cpp).index() == 8: - string_list = &get[CStringList](dereference(cpp)) - elif ListTag_len(cpp) == 0: - dereference(cpp).emplace[CStringList]() - string_list = &get[CStringList](dereference(cpp)) - else: - raise TypeError("ListTag can only contain one NBT data type.") - - dereference(string_list).push_back(value.cpp) - - -cdef inline void ListTag_append_list_tag(CListTagPtr cpp, ListTag value): - cdef CListList* list_list - - if dereference(cpp).index() == 9: - list_list = &get[CListList](dereference(cpp)) - elif ListTag_len(cpp) == 0: - dereference(cpp).emplace[CListList]() - list_list = &get[CListList](dereference(cpp)) - else: - raise TypeError("ListTag can only contain one NBT data type.") - - dereference(list_list).push_back(value.cpp) - - -cdef inline void ListTag_append_compound_tag(CListTagPtr cpp, CompoundTag value): - cdef CCompoundList* compound_list - - if dereference(cpp).index() == 10: - compound_list = &get[CCompoundList](dereference(cpp)) - elif ListTag_len(cpp) == 0: - dereference(cpp).emplace[CCompoundList]() - compound_list = &get[CCompoundList](dereference(cpp)) - else: - raise TypeError("ListTag can only contain one NBT data type.") - - dereference(compound_list).push_back(value.cpp) - - -cdef inline void ListTag_append_int_array_tag(CListTagPtr cpp, IntArrayTag value): - cdef CIntArrayList* int_array_list - - if dereference(cpp).index() == 11: - int_array_list = &get[CIntArrayList](dereference(cpp)) - elif ListTag_len(cpp) == 0: - dereference(cpp).emplace[CIntArrayList]() - int_array_list = &get[CIntArrayList](dereference(cpp)) - else: - raise TypeError("ListTag can only contain one NBT data type.") - - dereference(int_array_list).push_back(value.cpp) - - -cdef inline void ListTag_append_long_array_tag(CListTagPtr cpp, LongArrayTag value): - cdef CLongArrayList* long_array_list - - if dereference(cpp).index() == 12: - long_array_list = &get[CLongArrayList](dereference(cpp)) - elif ListTag_len(cpp) == 0: - dereference(cpp).emplace[CLongArrayList]() - long_array_list = &get[CLongArrayList](dereference(cpp)) - else: - raise TypeError("ListTag can only contain one NBT data type.") - - dereference(long_array_list).push_back(value.cpp) - - -cdef inline void ListTag_append(CListTagPtr cpp, AbstractBaseTag value): - if isinstance(value, ByteTag): - ListTag_append_byte_tag(cpp, value) - elif isinstance(value, ShortTag): - ListTag_append_short_tag(cpp, value) - elif isinstance(value, IntTag): - ListTag_append_int_tag(cpp, value) - elif isinstance(value, LongTag): - ListTag_append_long_tag(cpp, value) - elif isinstance(value, FloatTag): - ListTag_append_float_tag(cpp, value) - elif isinstance(value, DoubleTag): - ListTag_append_double_tag(cpp, value) - elif isinstance(value, ByteArrayTag): - ListTag_append_byte_array_tag(cpp, value) - elif isinstance(value, StringTag): - ListTag_append_string_tag(cpp, value) - elif isinstance(value, ListTag): - ListTag_append_list_tag(cpp, value) - elif isinstance(value, CompoundTag): - ListTag_append_compound_tag(cpp, value) - elif isinstance(value, IntArrayTag): - ListTag_append_int_array_tag(cpp, value) - elif isinstance(value, LongArrayTag): - ListTag_append_long_array_tag(cpp, value) - else: - raise TypeError(f"Unsupported type {type(value)}") - - def _unpickle(string data) -> ListTag: cdef pair[string, TagNode] named_tag = read_named_tag(data, endian.big, utf8_to_utf8_escape) return ListTag.wrap(get[CListTagPtr](named_tag.second)) diff --git a/src/amulet_nbt/_tag/list.pyx.tp b/src_/amulet_nbt/_tag/list.pyx.tp similarity index 100% rename from src/amulet_nbt/_tag/list.pyx.tp rename to src_/amulet_nbt/_tag/list.pyx.tp diff --git a/src/amulet_nbt/_tag/named_tag.pxd b/src_/amulet_nbt/_tag/named_tag.pxd similarity index 100% rename from src/amulet_nbt/_tag/named_tag.pxd rename to src_/amulet_nbt/_tag/named_tag.pxd diff --git a/src/amulet_nbt/_tag/named_tag.pyx b/src_/amulet_nbt/_tag/named_tag.pyx similarity index 100% rename from src/amulet_nbt/_tag/named_tag.pyx rename to src_/amulet_nbt/_tag/named_tag.pyx diff --git a/src/amulet_nbt/_tag/named_tag.pyx.tp b/src_/amulet_nbt/_tag/named_tag.pyx.tp similarity index 100% rename from src/amulet_nbt/_tag/named_tag.pyx.tp rename to src_/amulet_nbt/_tag/named_tag.pyx.tp diff --git a/src/amulet_nbt/_tag/numeric.pxd b/src_/amulet_nbt/_tag/numeric.pxd similarity index 100% rename from src/amulet_nbt/_tag/numeric.pxd rename to src_/amulet_nbt/_tag/numeric.pxd diff --git a/src/amulet_nbt/_tag/numeric.pyx b/src_/amulet_nbt/_tag/numeric.pyx similarity index 100% rename from src/amulet_nbt/_tag/numeric.pyx rename to src_/amulet_nbt/_tag/numeric.pyx diff --git a/src/amulet_nbt/_tag/string.pxd b/src_/amulet_nbt/_tag/string.pxd similarity index 100% rename from src/amulet_nbt/_tag/string.pxd rename to src_/amulet_nbt/_tag/string.pxd diff --git a/src/amulet_nbt/_tag/string.pyx b/src_/amulet_nbt/_tag/string.pyx similarity index 100% rename from src/amulet_nbt/_tag/string.pyx rename to src_/amulet_nbt/_tag/string.pyx diff --git a/src/amulet_nbt/_tag/string.pyx.tp b/src_/amulet_nbt/_tag/string.pyx.tp similarity index 100% rename from src/amulet_nbt/_tag/string.pyx.tp rename to src_/amulet_nbt/_tag/string.pyx.tp diff --git a/src/amulet_nbt/tpf/ArrayTag.pyx.tpf b/src_/amulet_nbt/tpf/ArrayTag.pyx.tpf similarity index 100% rename from src/amulet_nbt/tpf/ArrayTag.pyx.tpf rename to src_/amulet_nbt/tpf/ArrayTag.pyx.tpf diff --git a/src/amulet_nbt/tpf/Comparison.pyx.tpf b/src_/amulet_nbt/tpf/Comparison.pyx.tpf similarity index 100% rename from src/amulet_nbt/tpf/Comparison.pyx.tpf rename to src_/amulet_nbt/tpf/Comparison.pyx.tpf diff --git a/src/amulet_nbt/tpf/CompoundGetSetdefault.pyx.tpf b/src_/amulet_nbt/tpf/CompoundGetSetdefault.pyx.tpf similarity index 100% rename from src/amulet_nbt/tpf/CompoundGetSetdefault.pyx.tpf rename to src_/amulet_nbt/tpf/CompoundGetSetdefault.pyx.tpf diff --git a/src/amulet_nbt/tpf/FloatTag.pyx.tpf b/src_/amulet_nbt/tpf/FloatTag.pyx.tpf similarity index 100% rename from src/amulet_nbt/tpf/FloatTag.pyx.tpf rename to src_/amulet_nbt/tpf/FloatTag.pyx.tpf diff --git a/src/amulet_nbt/tpf/ImmutableTag.pyx.tpf b/src_/amulet_nbt/tpf/ImmutableTag.pyx.tpf similarity index 100% rename from src/amulet_nbt/tpf/ImmutableTag.pyx.tpf rename to src_/amulet_nbt/tpf/ImmutableTag.pyx.tpf diff --git a/src/amulet_nbt/tpf/IntTag.pyx.tpf b/src_/amulet_nbt/tpf/IntTag.pyx.tpf similarity index 100% rename from src/amulet_nbt/tpf/IntTag.pyx.tpf rename to src_/amulet_nbt/tpf/IntTag.pyx.tpf diff --git a/src/amulet_nbt/tpf/ListGet.pyx.tpf b/src_/amulet_nbt/tpf/ListGet.pyx.tpf similarity index 100% rename from src/amulet_nbt/tpf/ListGet.pyx.tpf rename to src_/amulet_nbt/tpf/ListGet.pyx.tpf diff --git a/src/amulet_nbt/tpf/NamedTagGet.pyx.tpf b/src_/amulet_nbt/tpf/NamedTagGet.pyx.tpf similarity index 100% rename from src/amulet_nbt/tpf/NamedTagGet.pyx.tpf rename to src_/amulet_nbt/tpf/NamedTagGet.pyx.tpf diff --git a/src/amulet_nbt/tpf/NumericTag.pyx.tpf b/src_/amulet_nbt/tpf/NumericTag.pyx.tpf similarity index 100% rename from src/amulet_nbt/tpf/NumericTag.pyx.tpf rename to src_/amulet_nbt/tpf/NumericTag.pyx.tpf diff --git a/src/amulet_nbt/tpf/to_snbt.pyx.tpf b/src_/amulet_nbt/tpf/to_snbt.pyx.tpf similarity index 100% rename from src/amulet_nbt/tpf/to_snbt.pyx.tpf rename to src_/amulet_nbt/tpf/to_snbt.pyx.tpf diff --git a/src/amulet_nbt/tpf/to_snbt_multiline.pyx.tpf b/src_/amulet_nbt/tpf/to_snbt_multiline.pyx.tpf similarity index 100% rename from src/amulet_nbt/tpf/to_snbt_multiline.pyx.tpf rename to src_/amulet_nbt/tpf/to_snbt_multiline.pyx.tpf From 8b07d0d8138596bd68aa80434e6153fcb70f0894 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 28 Jun 2024 09:59:34 +0100 Subject: [PATCH 018/121] Added generation macros --- src/amulet_nbt/include/amulet_nbt/tag/nbt.hpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/amulet_nbt/include/amulet_nbt/tag/nbt.hpp b/src/amulet_nbt/include/amulet_nbt/tag/nbt.hpp index 7e50885a..493f25a5 100644 --- a/src/amulet_nbt/include/amulet_nbt/tag/nbt.hpp +++ b/src/amulet_nbt/include/amulet_nbt/tag/nbt.hpp @@ -89,4 +89,23 @@ namespace Amulet { NamedTag(const std::string& name, const TagNode& tag_node): name(name), tag_node(tag_node) {} }; + + #define FOR_EACH_LIST_TAG(MACRO)\ + MACRO(1, "byte", ByteTag, Amulet::ByteTag, Amulet::ByteListTag)\ + MACRO(2, "short", ShortTag, Amulet::ShortTag, Amulet::ShortListTag)\ + MACRO(3, "int", IntTag, Amulet::IntTag, Amulet::IntListTag)\ + MACRO(4, "long", LongTag, Amulet::LongTag, Amulet::LongListTag)\ + MACRO(5, "float", FloatTag, Amulet::FloatTag, Amulet::FloatListTag)\ + MACRO(6, "double", DoubleTag, Amulet::DoubleTag, Amulet::DoubleListTag)\ + MACRO(7, "string", ByteArrayTag, Amulet::ByteArrayTagPtr, Amulet::ByteArrayListTag)\ + MACRO(8, "list", StringTag, Amulet::StringTag, Amulet::StringListTag)\ + MACRO(9, "compound", ListTag, Amulet::ListTagPtr, Amulet::ListListTag)\ + MACRO(10, "byte_array", CompoundTag, Amulet::CompoundTagPtr, Amulet::CompoundListTag)\ + MACRO(11, "int_array", IntArrayTag, Amulet::IntArrayTagPtr, Amulet::IntArrayListTag)\ + MACRO(12, "long_array", LongArrayTag, Amulet::LongArrayTagPtr, Amulet::LongArrayListTag) + + #define FOR_EACH_LIST_TAG2(MACRO)\ + MACRO(0, "end", std::monostate, std::monostate, std::monostate)\ + FOR_EACH_LIST_TAG(MACRO) +} } From c407e4a354779a2de8dc70bf754bc7cf81066048 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 28 Jun 2024 09:59:53 +0100 Subject: [PATCH 019/121] Fix variant functions --- src/amulet_nbt/include/amulet_nbt/tag/nbt.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/amulet_nbt/include/amulet_nbt/tag/nbt.hpp b/src/amulet_nbt/include/amulet_nbt/tag/nbt.hpp index 493f25a5..e9ca9f41 100644 --- a/src/amulet_nbt/include/amulet_nbt/tag/nbt.hpp +++ b/src/amulet_nbt/include/amulet_nbt/tag/nbt.hpp @@ -108,4 +108,8 @@ namespace Amulet { MACRO(0, "end", std::monostate, std::monostate, std::monostate)\ FOR_EACH_LIST_TAG(MACRO) } + +namespace std { + template <> struct variant_size: std::variant_size {}; + template struct variant_alternative : variant_alternative {}; } From 74cc227a93126ea64ae7632953e013b6e1af9c10 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 28 Jun 2024 10:01:05 +0100 Subject: [PATCH 020/121] Move TagWrapper base class out of template The template now only takes the tag and the base class is deduced in the class. This allows looking up the template based only on the tag. --- .../include/amulet_nbt/tag/wrapper.hpp | 43 +++++++++++++------ 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/src/amulet_nbt/include/amulet_nbt/tag/wrapper.hpp b/src/amulet_nbt/include/amulet_nbt/tag/wrapper.hpp index d28f3ad9..423a28be 100644 --- a/src/amulet_nbt/include/amulet_nbt/tag/wrapper.hpp +++ b/src/amulet_nbt/include/amulet_nbt/tag/wrapper.hpp @@ -16,22 +16,37 @@ namespace Amulet { // pybind cannot directly store fundamental types // This wrapper exists to allow pybind to store fundamental types - template - class TagWrapper: public BaseClassT { + template + class TagWrapper: public + std::conditional_t, AbstractBaseIntTag, + std::conditional_t, AbstractBaseIntTag, + std::conditional_t, AbstractBaseIntTag, + std::conditional_t, AbstractBaseIntTag, + std::conditional_t, AbstractBaseFloatTag, + std::conditional_t, AbstractBaseFloatTag, + std::conditional_t, AbstractBaseArrayTag, + std::conditional_t, AbstractBaseImmutableTag, + std::conditional_t, AbstractBaseMutableTag, + std::conditional_t, AbstractBaseMutableTag, + std::conditional_t, AbstractBaseArrayTag, + std::conditional_t, AbstractBaseArrayTag, + void + >>>>>>>>>>>> { public: T tag; TagWrapper(T tag): tag(tag) {}; }; - typedef TagWrapper ByteTagWrapper; - typedef TagWrapper ShortTagWrapper; - typedef TagWrapper IntTagWrapper; - typedef TagWrapper LongTagWrapper; - typedef TagWrapper FloatTagWrapper; - typedef TagWrapper DoubleTagWrapper; - typedef TagWrapper ByteArrayTagWrapper; - typedef TagWrapper StringTagWrapper; - typedef TagWrapper ListTagWrapper; - typedef TagWrapper CompoundTagWrapper; - typedef TagWrapper IntArrayTagWrapper; - typedef TagWrapper LongArrayTagWrapper; + typedef TagWrapper ByteTagWrapper; + typedef TagWrapper ShortTagWrapper; + typedef TagWrapper IntTagWrapper; + typedef TagWrapper LongTagWrapper; + typedef TagWrapper FloatTagWrapper; + typedef TagWrapper DoubleTagWrapper; + typedef TagWrapper ByteArrayTagWrapper; + typedef TagWrapper StringTagWrapper; + typedef TagWrapper ListTagWrapper; + typedef TagWrapper CompoundTagWrapper; + typedef TagWrapper IntArrayTagWrapper; + typedef TagWrapper LongArrayTagWrapper; + } From 0f21ded20bf7890e28fa0b5e5aab8d7509b406b1 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 28 Jun 2024 10:01:34 +0100 Subject: [PATCH 021/121] Added a wrapper variant This makes it easier to pass the wrappers to python --- .../include/amulet_nbt/tag/wrapper.hpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/amulet_nbt/include/amulet_nbt/tag/wrapper.hpp b/src/amulet_nbt/include/amulet_nbt/tag/wrapper.hpp index 423a28be..40a53f42 100644 --- a/src/amulet_nbt/include/amulet_nbt/tag/wrapper.hpp +++ b/src/amulet_nbt/include/amulet_nbt/tag/wrapper.hpp @@ -49,4 +49,21 @@ namespace Amulet { typedef TagWrapper IntArrayTagWrapper; typedef TagWrapper LongArrayTagWrapper; + typedef std::variant< + std::monostate, + ByteTagWrapper, + ShortTagWrapper, + IntTagWrapper, + LongTagWrapper, + FloatTagWrapper, + DoubleTagWrapper, + ByteArrayTagWrapper, + StringTagWrapper, + ListTagWrapper, + CompoundTagWrapper, + IntArrayTagWrapper, + LongArrayTagWrapper + > WrapperNode; + + WrapperNode wrap_node(Amulet::TagNode node); } From 6b4ae1ac69ecb4ae6e1f0af9c4db2e1ffe94c931 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 28 Jun 2024 10:02:15 +0100 Subject: [PATCH 022/121] Renamed the pybind directory --- src/amulet_nbt/{py => pybind}/amulet_nbt.cpp | 9 ++++++++- src/amulet_nbt/{py => pybind}/tag/abc.cpp | 7 ++++++- src/amulet_nbt/{py => pybind}/tag/array.cpp | 8 +++++++- src/amulet_nbt/{py => pybind}/tag/float.cpp | 7 ++++++- src/amulet_nbt/{py => pybind}/tag/int.cpp | 7 ++++++- src/amulet_nbt/{py => pybind}/tag/string.cpp | 7 ++++++- 6 files changed, 39 insertions(+), 6 deletions(-) rename src/amulet_nbt/{py => pybind}/amulet_nbt.cpp (55%) rename src/amulet_nbt/{py => pybind}/tag/abc.cpp (97%) rename src/amulet_nbt/{py => pybind}/tag/array.cpp (97%) rename src/amulet_nbt/{py => pybind}/tag/float.cpp (96%) rename src/amulet_nbt/{py => pybind}/tag/int.cpp (96%) rename src/amulet_nbt/{py => pybind}/tag/string.cpp (97%) diff --git a/src/amulet_nbt/py/amulet_nbt.cpp b/src/amulet_nbt/pybind/amulet_nbt.cpp similarity index 55% rename from src/amulet_nbt/py/amulet_nbt.cpp rename to src/amulet_nbt/pybind/amulet_nbt.cpp index f9efd0da..c920c6ff 100644 --- a/src/amulet_nbt/py/amulet_nbt.cpp +++ b/src/amulet_nbt/pybind/amulet_nbt.cpp @@ -1,10 +1,14 @@ -#include +#include +namespace py = pybind11; void init_abc(py::module&); void init_int(py::module&); void init_float(py::module&); void init_string(py::module&); void init_array(py::module&); +void init_list(py::module&); +void init_compound(py::module&); +void init_named_tag(py::module&); PYBIND11_MODULE(_nbt, m) { @@ -13,4 +17,7 @@ PYBIND11_MODULE(_nbt, m) { init_float(m); init_string(m); init_array(m); + init_compound(m); + init_list(m); + init_named_tag(m); } diff --git a/src/amulet_nbt/py/tag/abc.cpp b/src/amulet_nbt/pybind/tag/abc.cpp similarity index 97% rename from src/amulet_nbt/py/tag/abc.cpp rename to src/amulet_nbt/pybind/tag/abc.cpp index c83d160d..fa96b743 100644 --- a/src/amulet_nbt/py/tag/abc.cpp +++ b/src/amulet_nbt/pybind/tag/abc.cpp @@ -1,6 +1,11 @@ -#include #include +#include +#include +#include + +namespace py = pybind11; + template void abstract_method(const T& self){ PyErr_SetString(PyExc_NotImplementedError, ""); diff --git a/src/amulet_nbt/py/tag/array.cpp b/src/amulet_nbt/pybind/tag/array.cpp similarity index 97% rename from src/amulet_nbt/py/tag/array.cpp rename to src/amulet_nbt/pybind/tag/array.cpp index 690e57e6..6744b7d8 100644 --- a/src/amulet_nbt/py/tag/array.cpp +++ b/src/amulet_nbt/pybind/tag/array.cpp @@ -1,7 +1,13 @@ #include -#include #include +#include +#include +#include +#include + +namespace py = pybind11; + #define PyArray(CLSNAME, ELEMENTCLS, BITCOUNT, TAGID)\ py::class_ CLSNAME(m, #CLSNAME, py::buffer_protocol(),\ diff --git a/src/amulet_nbt/py/tag/float.cpp b/src/amulet_nbt/pybind/tag/float.cpp similarity index 96% rename from src/amulet_nbt/py/tag/float.cpp rename to src/amulet_nbt/pybind/tag/float.cpp index 021cbf16..4ce61a7c 100644 --- a/src/amulet_nbt/py/tag/float.cpp +++ b/src/amulet_nbt/pybind/tag/float.cpp @@ -1,6 +1,11 @@ -#include #include +#include +#include +#include + +namespace py = pybind11; + #define PyFloat(CLSNAME, PRECISION, TAGID)\ py::class_ CLSNAME(m, #CLSNAME,\ diff --git a/src/amulet_nbt/py/tag/int.cpp b/src/amulet_nbt/pybind/tag/int.cpp similarity index 96% rename from src/amulet_nbt/py/tag/int.cpp rename to src/amulet_nbt/pybind/tag/int.cpp index 9aff3a6c..d9a8db96 100644 --- a/src/amulet_nbt/py/tag/int.cpp +++ b/src/amulet_nbt/pybind/tag/int.cpp @@ -1,6 +1,11 @@ -#include #include +#include +#include +#include + +namespace py = pybind11; + #define PyInt(CLSNAME, BYTEWIDTH, BITPOW, TAGID)\ py::class_ CLSNAME(m, #CLSNAME,\ diff --git a/src/amulet_nbt/py/tag/string.cpp b/src/amulet_nbt/pybind/tag/string.cpp similarity index 97% rename from src/amulet_nbt/py/tag/string.cpp rename to src/amulet_nbt/pybind/tag/string.cpp index cf9b0028..82e0d64c 100644 --- a/src/amulet_nbt/py/tag/string.cpp +++ b/src/amulet_nbt/pybind/tag/string.cpp @@ -1,6 +1,11 @@ -#include #include +#include +#include +#include + +namespace py = pybind11; + void init_string(py::module& m) { py::class_ StringTag(m, "StringTag", "A class that behaves like a string." From 483f3e42f3b6f9e9ec29cc97dd656cfe6d57f891 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 28 Jun 2024 10:03:52 +0100 Subject: [PATCH 023/121] Added __init__.py --- src/amulet_nbt/__init__.py | 123 +++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 src/amulet_nbt/__init__.py diff --git a/src/amulet_nbt/__init__.py b/src/amulet_nbt/__init__.py new file mode 100644 index 00000000..8d61962c --- /dev/null +++ b/src/amulet_nbt/__init__.py @@ -0,0 +1,123 @@ +def get_include() -> str: + import os + return os.path.join(__path__[0], "include") + + +from ._nbt import ( + # Abstract classes + AbstractBaseTag, + AbstractBaseImmutableTag, + AbstractBaseMutableTag, + AbstractBaseNumericTag, + AbstractBaseIntTag, + AbstractBaseFloatTag, + AbstractBaseArrayTag, + + # Tag classes + ByteTag, + ShortTag, + IntTag, + LongTag, + FloatTag, + DoubleTag, + ByteArrayTag, + StringTag, + ListTag, + CompoundTag, + IntArrayTag, + LongArrayTag, + + # Tag class aliases + ByteTag as TAG_Byte, + ShortTag as TAG_Short, + IntTag as TAG_Int, + LongTag as TAG_Long, + FloatTag as TAG_Float, + DoubleTag as TAG_Double, + ByteArrayTag as TAG_Byte_Array, + StringTag as TAG_String, + ListTag as TAG_List, + CompoundTag as TAG_Compound, + IntArrayTag as TAG_Int_Array, + LongArrayTag as TAG_Long_Array, + + # NamedTag, + + # load, + # load_array, + # ReadOffset, + # from_snbt, + # NBTError, + # NBTLoadError, + # NBTFormatError, + # SNBTParseError, + # SNBTType, + # IntType, + # FloatType, + # NumberType, + # ArrayType, + # AnyNBT, + # StringEncoding, + # mutf8_encoding, + # utf8_encoding, + # utf8_escape_encoding, + # EncodingPreset, + # java_encoding, + # bedrock_encoding, +) + +__all__ = [ + "AbstractBaseTag", + "AbstractBaseImmutableTag", + "AbstractBaseMutableTag", + "AbstractBaseNumericTag", + "AbstractBaseIntTag", + "ByteTag", + "TAG_Byte", + "ShortTag", + "TAG_Short", + "IntTag", + "TAG_Int", + "LongTag", + "TAG_Long", + "AbstractBaseFloatTag", + "FloatTag", + "TAG_Float", + "DoubleTag", + "TAG_Double", + "AbstractBaseArrayTag", + "ByteArrayTag", + "TAG_Byte_Array", + "IntArrayTag", + "TAG_Int_Array", + "LongArrayTag", + "TAG_Long_Array", + "StringTag", + "TAG_String", + "ListTag", + "TAG_List", + "CompoundTag", + "TAG_Compound", + "NamedTag", + "load", + "load_array", + "ReadOffset", + "from_snbt", + "NBTError", + "NBTLoadError", + "NBTFormatError", + "SNBTParseError", + "SNBTType", + "IntType", + "FloatType", + "NumberType", + "ArrayType", + "AnyNBT", + "StringEncoding", + "mutf8_encoding", + "utf8_encoding", + "utf8_escape_encoding", + "EncodingPreset", + "java_encoding", + "bedrock_encoding", +] From 9c1488423813bdc1353530c97ff81a165b663f10 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 28 Jun 2024 10:04:17 +0100 Subject: [PATCH 024/121] Added equals functions --- src/amulet_nbt/cpp/tag/eq.cpp | 87 ++++++++++++++++++++ src/amulet_nbt/include/amulet_nbt/tag/eq.hpp | 21 +++++ 2 files changed, 108 insertions(+) create mode 100644 src/amulet_nbt/cpp/tag/eq.cpp create mode 100644 src/amulet_nbt/include/amulet_nbt/tag/eq.hpp diff --git a/src/amulet_nbt/cpp/tag/eq.cpp b/src/amulet_nbt/cpp/tag/eq.cpp new file mode 100644 index 00000000..7d4330b5 --- /dev/null +++ b/src/amulet_nbt/cpp/tag/eq.cpp @@ -0,0 +1,87 @@ +#include +#include + +#include +#include + +template +struct is_shared_ptr : std::false_type {}; + +template +struct is_shared_ptr> : std::true_type {}; + +namespace Amulet{ + bool NBTTag_eq(const Amulet::ByteTag a, const Amulet::ByteTag b){return a == b;}; + bool NBTTag_eq(const Amulet::ShortTag a, const Amulet::ShortTag b){return a == b;}; + bool NBTTag_eq(const Amulet::IntTag a, const Amulet::IntTag b){return a == b;}; + bool NBTTag_eq(const Amulet::LongTag a, const Amulet::LongTag b){return a == b;}; + bool NBTTag_eq(const Amulet::FloatTag a, const Amulet::FloatTag b){return a == b;}; + bool NBTTag_eq(const Amulet::DoubleTag a, const Amulet::DoubleTag b){return a == b;}; + bool NBTTag_eq(const Amulet::StringTag a, const Amulet::StringTag b){return a == b;}; + bool NBTTag_eq(const Amulet::ByteArrayTagPtr a, const Amulet::ByteArrayTagPtr b){return *a == *b;}; + bool NBTTag_eq(const Amulet::IntArrayTagPtr a, const Amulet::IntArrayTagPtr b){return *a == *b;}; + bool NBTTag_eq(const Amulet::LongArrayTagPtr a, const Amulet::LongArrayTagPtr b){return *a == *b;}; + + template + inline bool ListTag_eq(const Amulet::ListTagPtr a, const Amulet::ListTagPtr b){ + const SelfT& a_vec = get(*a); + if (b->index() != variant_index()){ + return a_vec.size() == 0 && ListTag_size(*b) == 0; + } + const SelfT& b_vec = get(*b); + + if constexpr (is_shared_ptr::value){ + // Values are shared pointers + if (a_vec.size() != b_vec.size()){ + return false; + } + for (size_t i = 0; iindex()){ + #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG) case ID: return ListTag_eq(a, b); + case 0: + return ListTag_size(*b) == 0; + FOR_EACH_LIST_TAG(CASE) + #undef CASE + } + return false; + }; + bool NBTTag_eq(const Amulet::CompoundTagPtr a, const Amulet::CompoundTagPtr b){ + if (a->size() != b->size()){ + // Size does not match + return false; + } + for (auto& [key, value]: *a){ + Amulet::CompoundTag::iterator it = b->find(key); + if (it == b->end()){ + // Key not in b + return false; + } + if (!NBTTag_eq(value, it->second)){ + // Value does not match + return false; + } + } + return true; + }; + bool NBTTag_eq(const Amulet::TagNode a, const Amulet::TagNode b){ + switch(a.index()){ + #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG) case ID: return b.index() == ID && NBTTag_eq(get(a), get(b)); + case 0: + return b.index() == 0; + FOR_EACH_LIST_TAG(CASE) + #undef CASE + } + return false; + }; +} diff --git a/src/amulet_nbt/include/amulet_nbt/tag/eq.hpp b/src/amulet_nbt/include/amulet_nbt/tag/eq.hpp new file mode 100644 index 00000000..c3a1b091 --- /dev/null +++ b/src/amulet_nbt/include/amulet_nbt/tag/eq.hpp @@ -0,0 +1,21 @@ +// All of the NBT equal functions + +#pragma once + +#include + +namespace Amulet { + bool NBTTag_eq(const Amulet::ByteTag a, const Amulet::ByteTag b); + bool NBTTag_eq(const Amulet::ShortTag a, const Amulet::ShortTag b); + bool NBTTag_eq(const Amulet::IntTag a, const Amulet::IntTag b); + bool NBTTag_eq(const Amulet::LongTag a, const Amulet::LongTag b); + bool NBTTag_eq(const Amulet::FloatTag a, const Amulet::FloatTag b); + bool NBTTag_eq(const Amulet::DoubleTag a, const Amulet::DoubleTag b); + bool NBTTag_eq(const Amulet::ByteArrayTagPtr a, const Amulet::ByteArrayTagPtr b); + bool NBTTag_eq(const Amulet::StringTag a, const Amulet::StringTag b); + bool NBTTag_eq(const Amulet::ListTagPtr a, const Amulet::ListTagPtr b); + bool NBTTag_eq(const Amulet::CompoundTagPtr a, const Amulet::CompoundTagPtr b); + bool NBTTag_eq(const Amulet::IntArrayTagPtr a, const Amulet::IntArrayTagPtr b); + bool NBTTag_eq(const Amulet::LongArrayTagPtr a, const Amulet::LongArrayTagPtr b); + bool NBTTag_eq(const Amulet::TagNode a, const Amulet::TagNode b); +} From 4ac488b9ec81219f1c0c661ccb3fc42b012c4d88 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 28 Jun 2024 10:04:47 +0100 Subject: [PATCH 025/121] Added wrap node function --- src/amulet_nbt/cpp/tag/wrapper.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/amulet_nbt/cpp/tag/wrapper.cpp diff --git a/src/amulet_nbt/cpp/tag/wrapper.cpp b/src/amulet_nbt/cpp/tag/wrapper.cpp new file mode 100644 index 00000000..8b1d2a82 --- /dev/null +++ b/src/amulet_nbt/cpp/tag/wrapper.cpp @@ -0,0 +1,13 @@ +#include + +namespace Amulet { + WrapperNode wrap_node(Amulet::TagNode node){ + switch(node.index()){ + #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG) case ID: return Amulet::WrapperNode(TagWrapper(get(node))); + FOR_EACH_LIST_TAG(CASE) + default: + return Amulet::WrapperNode(); + #undef CASE + } + } +} From 52b1b7cc03dc2a88266f2d25adcad310db34beb4 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 28 Jun 2024 10:06:01 +0100 Subject: [PATCH 026/121] Added list functions --- src/amulet_nbt/cpp/tag/list.cpp | 37 ++++ .../include/amulet_nbt/tag/list.hpp | 206 ++++++++++++++++++ 2 files changed, 243 insertions(+) create mode 100644 src/amulet_nbt/cpp/tag/list.cpp create mode 100644 src/amulet_nbt/include/amulet_nbt/tag/list.hpp diff --git a/src/amulet_nbt/cpp/tag/list.cpp b/src/amulet_nbt/cpp/tag/list.cpp new file mode 100644 index 00000000..59311c50 --- /dev/null +++ b/src/amulet_nbt/cpp/tag/list.cpp @@ -0,0 +1,37 @@ +#include +#include +#include +#include +#include + +namespace Amulet { + size_t ListTag_size(const Amulet::ListTag& self){ + switch(self.index()){ + #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG) case ID: return get(self).size(); + FOR_EACH_LIST_TAG(CASE) + #undef CASE + } + return 0; + }; + + void ListTag_append(Amulet::ListTag& self, Amulet::TagNode tag){ + switch(self.index()){ + #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG)\ + case ID:\ + ListTag_append(self, get(tag));\ + break; + case 0: + throw std::invalid_argument("Cannot append null TagNode"); + FOR_EACH_LIST_TAG(CASE) + #undef CASE + } + } + + ListTagIterator::ListTagIterator(Amulet::ListTagPtr tag, size_t start, std::ptrdiff_t step): tag(tag), index(start), step(step) {}; + Amulet::TagNode ListTagIterator::next() { + return Amulet::ListTag_get_node(*tag, index++); + } + bool ListTagIterator::has_next(){ + return index >= 0 && index < ListTag_size(*tag); + } +} diff --git a/src/amulet_nbt/include/amulet_nbt/tag/list.hpp b/src/amulet_nbt/include/amulet_nbt/tag/list.hpp new file mode 100644 index 00000000..94a76268 --- /dev/null +++ b/src/amulet_nbt/include/amulet_nbt/tag/list.hpp @@ -0,0 +1,206 @@ +// Utility functions for the ListTag + +#pragma once + +#include +#include +#include +#include +#include +#include +#include + +namespace Amulet { + size_t ListTag_size(const Amulet::ListTag&); + + template + void ListTag_append(Amulet::ListTag& self, tagT tag){ + if (self.index() == variant_index>()){ + get>(self).push_back(tag); + } else if (ListTag_size(self) == 0){ + self.emplace>().push_back(tag); + } else { + throw std::invalid_argument( + "ListTag has element type " + + std::to_string(self.index()) + + " but the tag has type " + + std::to_string(variant_index>()) + ); + } + }; + + void ListTag_append(Amulet::ListTag& self, Amulet::TagNode tag); + + template + size_t ListTag_bounds_check(size_t size, indexT index){ + if constexpr (std::is_signed_v){ + if (index < 0){ + index += size; + } + if constexpr (clamp){ + if (index < 0){ + index = 0; + } + } else { + if (index < 0){ + throw std::out_of_range("ListTag index is out of range."); + } + } + } + size_t abs_index = index; + if constexpr (clamp){ + if (size < abs_index){ + abs_index = size; + } + } else { + if (size <= abs_index){ + throw std::out_of_range("ListTag index is out of range."); + } + } + return abs_index; + }; + + template + tagT ListTag_get(const Amulet::ListTag& self, indexT index){ + auto& list_tag = get>(self); + return list_tag[Amulet::ListTag_bounds_check(list_tag.size(), index)]; + } + + template + Amulet::TagNode ListTag_get_node(const Amulet::ListTag& self, indexT index){ + switch(self.index()){ + #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG)\ + case ID:\ + return Amulet::TagNode(ListTag_get(self, index)); + FOR_EACH_LIST_TAG(CASE) + default: + throw std::invalid_argument("Cannot get from null ListTag."); + #undef CASE + } + } + + template + void ListTag_set(const Amulet::ListTag& self, indexT index, tagT tag){ + // Get the unsigned index. Also do bounds checking. + size_t abs_index = ListTag_bounds_check(ListTag_size(self), index); + if (self.index() == variant_index>()){ + // If the list type is the same as the tag + auto& list_tag = get>(self); + list_tag[abs_index] = tag; + } else if (ListTag_size(self) == 1 && abs_index == 0){ + // Overwriting the only value + self.emplace({tag}); + } else { + throw std::invalid_argument("NBT ListTag item mismatch."); + } + } + + template + void ListTag_remove(Amulet::ListTag& self, indexT index){ + switch(self.index()){ + #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG)\ + case ID:\ + {\ + LIST_TAG& list_tag = get(self);\ + size_t abs_index = Amulet::ListTag_bounds_check(list_tag.size(), index);\ + list_tag.erase(list_tag.begin() + abs_index);\ + break;\ + } + FOR_EACH_LIST_TAG(CASE) + #undef CASE + } + } + + template + Amulet::TagNode ListTag_pop(Amulet::ListTag& self, indexT index){ + switch(self.index()){ + #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG)\ + case ID:\ + {\ + LIST_TAG& list_tag = get(self);\ + size_t abs_index = Amulet::ListTag_bounds_check(list_tag.size(), index);\ + TAG_STORAGE tag = list_tag[abs_index];\ + list_tag.erase(list_tag.begin() + abs_index);\ + return tag;\ + } + FOR_EACH_LIST_TAG(CASE) + #undef CASE + } + throw std::out_of_range("ListTag index is out of range."); + } + + template + void ListTag_insert(Amulet::ListTag& self, indexT index, tagT tag){ + if (self.index() != variant_index>()){ + if (ListTag_size(self) == 0) { + self.emplace>(); + } else { + throw std::invalid_argument( + "ListTag has element type " + + std::to_string(self.index()) + + " but the tag has type " + + std::to_string(variant_index>()) + ); + } + } + auto& list_tag = get>(self); + size_t abs_index = ListTag_bounds_check(list_tag.size(), index); + list_tag.insert(list_tag.begin() + abs_index, tag); + } + + template + void ListTag_insert(Amulet::ListTag& self, indexT index, Amulet::TagNode node){ + switch(self.index()){ + #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG)\ + case ID:\ + ListTag_insert(self, index, get(node));\ + break; + FOR_EACH_LIST_TAG(CASE) + #undef CASE + } + } + + template + size_t ListTag_index(Amulet::ListTag& self, tagT tag, indexT start=0, indexT stop=std::numeric_limits::max()){ + if (self.index() != variant_index>()){ + throw std::invalid_argument("item is not in the ListTag"); + } + auto& list_tag = get>(self); + size_t abs_start = ListTag_bounds_check(list_tag.size(), start); + size_t abs_stop = ListTag_bounds_check(list_tag.size(), stop); + for (size_t i = abs_start; i < abs_stop; i++){ + tagT tag_i = list_tag[i]; + if (NBTTag_eq(tag, tag_i)){ + return i; + } + } + throw std::invalid_argument("item is not in the ListTag"); + } + + template + size_t ListTag_count(Amulet::ListTag& self, tagT tag){ + if (self.index() != variant_index>()){ + return 0; + } + auto& list_tag = get>(self); + size_t count = 0; + for (tagT tag_i: list_tag){ + if (NBTTag_eq(tag, tag_i)){ + count++; + } + } + return count; + } + + // A class to emulate python's iteration mechanic + class ListTagIterator { + private: + Amulet::ListTagPtr tag; + size_t index; + std::ptrdiff_t step; + public: + ListTagIterator(Amulet::ListTagPtr, size_t start, std::ptrdiff_t step); + Amulet::TagNode next(); + bool has_next(); + }; +} From 5a04c5084b8f5e7cd45c8d4cae5e2939b359b030 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 28 Jun 2024 10:06:34 +0100 Subject: [PATCH 027/121] Added a template function to find the variant index --- src/amulet_nbt/include/amulet_nbt/common.hpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/amulet_nbt/include/amulet_nbt/common.hpp b/src/amulet_nbt/include/amulet_nbt/common.hpp index 39e45f0a..5bc17c3c 100644 --- a/src/amulet_nbt/include/amulet_nbt/common.hpp +++ b/src/amulet_nbt/include/amulet_nbt/common.hpp @@ -1,10 +1,14 @@ #pragma once -#define PYBIND11_DETAILED_ERROR_MESSAGES +#include +#include -#include -#include -#include -#include - -namespace py = pybind11; +template +constexpr size_t variant_index() { + static_assert(I < std::variant_size_v, "Type T is not a member of variant V"); + if constexpr (std::is_same_v, T>) { + return (I); + } else { + return (variant_index()); + } +} From 505604c79c02b742bf74107c9af3f7acb01348f4 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 28 Jun 2024 10:07:26 +0100 Subject: [PATCH 028/121] Added compound and named tag classes There is nothing in the class yet --- src/amulet_nbt/pybind/tag/compound.cpp | 11 +++++++++++ src/amulet_nbt/pybind/tag/named_tag.cpp | 11 +++++++++++ 2 files changed, 22 insertions(+) create mode 100644 src/amulet_nbt/pybind/tag/compound.cpp create mode 100644 src/amulet_nbt/pybind/tag/named_tag.cpp diff --git a/src/amulet_nbt/pybind/tag/compound.cpp b/src/amulet_nbt/pybind/tag/compound.cpp new file mode 100644 index 00000000..1d74419e --- /dev/null +++ b/src/amulet_nbt/pybind/tag/compound.cpp @@ -0,0 +1,11 @@ +#include + +#include +#include +#include + +namespace py = pybind11; + +void init_compound(py::module& m) { + py::class_ CompoundTag(m, "CompoundTag"); +} diff --git a/src/amulet_nbt/pybind/tag/named_tag.cpp b/src/amulet_nbt/pybind/tag/named_tag.cpp new file mode 100644 index 00000000..05445a32 --- /dev/null +++ b/src/amulet_nbt/pybind/tag/named_tag.cpp @@ -0,0 +1,11 @@ +#include + +#include +#include +#include + +namespace py = pybind11; + +void init_named_tag(py::module& m) { + +} From c6957c8c5df1e9e7196a87645a972dca52ea1241 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 28 Jun 2024 10:08:01 +0100 Subject: [PATCH 029/121] Added most of the list tag implementation --- src/amulet_nbt/pybind/tag/list.cpp | 411 +++++++++++++++++++++++++++++ 1 file changed, 411 insertions(+) create mode 100644 src/amulet_nbt/pybind/tag/list.cpp diff --git a/src/amulet_nbt/pybind/tag/list.cpp b/src/amulet_nbt/pybind/tag/list.cpp new file mode 100644 index 00000000..16cbecde --- /dev/null +++ b/src/amulet_nbt/pybind/tag/list.cpp @@ -0,0 +1,411 @@ +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +namespace py = pybind11; + +void ListTag_extend(Amulet::ListTagPtr tag, py::object value){ + // The caller must ensure value is not tag + auto it = py::iter(value); + while (it != py::iterator::sentinel()){ + Amulet::WrapperNode node = py::cast(*it); + + switch(node.index()){ + #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG) case ID: Amulet::ListTag_append(*tag, get>(node).tag); break; + case 0: + throw std::invalid_argument("Cannot append null TagNode"); + FOR_EACH_LIST_TAG(CASE) + #undef CASE + } + ++it; + } +} + + +void init_list(py::module& m) { + py::class_> ListTagIterator(m, "ListTagIterator"); + ListTagIterator.def( + "__next__", + [](Amulet::ListTagIterator& self){ + if (self.has_next()){ + return Amulet::wrap_node(self.next()); + } + throw py::stop_iteration(""); + } + ); + ListTagIterator.def( + "__iter__", + [](Amulet::ListTagIterator& self){ + return self; + } + ); + + py::class_ ListTag(m, "ListTag", + "A Python wrapper around a C++ vector.\n" + "\n" + "All contained data must be of the same NBT data type." + ); + ListTag.def( + py::init([](py::object value, std::uint8_t element_tag_id) { + Amulet::ListTagPtr tag = std::make_shared(); + switch(element_tag_id){ + #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG) case ID: tag->emplace(); break; + FOR_EACH_LIST_TAG2(CASE) + default: + throw std::invalid_argument("element_tag_id must be in the range 0-12"); + #undef CASE + } + ListTag_extend(tag, value); + return Amulet::ListTagWrapper(tag); + }), + py::arg("value") = py::tuple(), py::arg("element_tag_id") = 1, + py::doc("__init__(self: amulet_nbt.ListTag, value: typing.Iterable[amulet_nbt.ByteTag] | typing.Iterable[amulet_nbt.ShortTag] | typing.Iterable[amulet_nbt.IntTag] | typing.Iterable[amulet_nbt.LongTag] | typing.Iterable[amulet_nbt.FloatTag] | typing.Iterable[amulet_nbt.DoubleTag] | typing.Iterable[amulet_nbt.ByteArrayTag] | typing.Iterable[amulet_nbt.StringTag] | typing.Iterable[amulet_nbt.ListTag] | typing.Iterable[amulet_nbt.CompoundTag] | typing.Iterable[amulet_nbt.IntArrayTag] | typing.Iterable[amulet_nbt.LongArrayTag] = (), element_tag_id=1) -> None") + ); + ListTag.attr("__class_getitem__") = PyClassMethod_New( + py::cpp_function([](const py::type &cls, const py::args &args){return cls;}).ptr() + ); + auto py_getter = [](const Amulet::ListTagWrapper& self){ + py::list list; + switch(self.tag->index()){ + #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG)\ + case ID:\ + {\ + LIST_TAG& tag = get(*self.tag);\ + for (size_t i = 0; i < tag.size(); i++){\ + list.append(\ + Amulet::TagWrapper(tag[i])\ + );\ + };\ + break;\ + } + FOR_EACH_LIST_TAG(CASE) + #undef CASE + } + return list; + }; + ListTag.def_property_readonly( + "py_list", + &py_getter, + py::doc( + "A python list representation of the class.\n" + "\n" + "The returned list is a shallow copy of the class, meaning changes will not mirror the instance.\n" + "Use the public API to modify the internal data.\n" + ) + ); + ListTag.def_property_readonly( + "py_data", + &py_getter, + py::doc( + "A python representation of the class. Note that the return type is undefined and may change in the future.\n" + "\n" + "You would be better off using the py_{type} or np_array properties if you require a fixed type.\n" + "This is here for convenience to get a python representation under the same property name.\n" + ) + ); + ListTag.def( + "__repr__", + [](const Amulet::ListTagWrapper& self){ + std::string out; + out += "ListTag(["; + + switch(self.tag->index()){ + case 0: + break; + #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG)\ + case ID:\ + {\ + LIST_TAG& list_tag = get(*self.tag);\ + for (auto& tag: list_tag){\ + out += py::repr(py::cast(Amulet::TagWrapper(tag)));\ + out += ", ";\ + }\ + };\ + break; + FOR_EACH_LIST_TAG(CASE) + #undef CASE + } + + out += "], "; + out += std::to_string(self.tag->index()); + out += ")"; + return out; + } + ); + ListTag.def( + "__str__", + [](const Amulet::ListTagWrapper& self){ + return py::str(py::list(py::cast(self))); + } + ); + ListTag.def( + "__eq__", + [](const Amulet::ListTagWrapper& self, const Amulet::ListTagWrapper& other){ + return Amulet::NBTTag_eq(self.tag, other.tag); + }, + py::is_operator() + ); + ListTag.def( + "__len__", + [](const Amulet::ListTagWrapper& self){ + return Amulet::ListTag_size(*self.tag); + } + ); + ListTag.def( + "__bool__", + [](const Amulet::ListTagWrapper& self){ + return Amulet::ListTag_size(*self.tag) != 0; + } + ); + ListTag.def_property_readonly( + "element_tag_id", + [](const Amulet::ListTagWrapper& self){ + return self.tag->index(); + } + ); + const std::array NBTClasses = { + py::none(), + m.attr("ByteTag"), + m.attr("ShortTag"), + m.attr("IntTag"), + m.attr("LongTag"), + m.attr("FloatTag"), + m.attr("DoubleTag"), + m.attr("ByteArrayTag"), + m.attr("StringTag"), + ListTag, + m.attr("CompoundTag"), + m.attr("IntArrayTag"), + m.attr("LongArrayTag"), + }; + ListTag.def_property_readonly( + "element_class", + [NBTClasses](const Amulet::ListTagWrapper& self){ + return NBTClasses[self.tag->index()]; + } + ); + ListTag.def( + "__getitem__", + [](const Amulet::ListTagWrapper& self, std::ptrdiff_t item){ + return Amulet::wrap_node(Amulet::ListTag_get_node(*self.tag, item)); + } + ); + ListTag.def( + "__getitem__", + [](const Amulet::ListTagWrapper& self, const py::slice& slice) { + py::list out; + size_t start = 0, stop = 0, step = 0, slicelength = 0; + if (!slice.compute(ListTag_size(*self.tag), &start, &stop, &step, &slicelength)) { + throw py::error_already_set(); + } + for (size_t i = 0; i < slicelength; ++i) { + out.append(Amulet::wrap_node(Amulet::ListTag_get_node(*self.tag, i))); + start += step; + } + return out; + }); + ListTag.def( + "__iter__", + [](const Amulet::ListTagWrapper& self) { + return Amulet::ListTagIterator(self.tag, 0, 1); + } + ); + ListTag.def( + "__reversed__", + [](const Amulet::ListTagWrapper& self) { + return Amulet::ListTagIterator(self.tag, ListTag_size(*self.tag), -1); + } + ); + ListTag.def( + "__contains__", + [](const Amulet::ListTagWrapper& self, Amulet::WrapperNode item){ + if (item.index() != self.tag->index()){ + return false; + } + switch(item.index()){ + case 0: + return false; + #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG)\ + case ID:\ + {\ + TAG_STORAGE item_tag = get>(item).tag;\ + LIST_TAG& list_tag = get(*self.tag);\ + for (TAG_STORAGE tag: list_tag){\ + if (Amulet::NBTTag_eq(tag, item_tag)){\ + return true;\ + }\ + }\ + return false;\ + }\ + break; + FOR_EACH_LIST_TAG(CASE) + #undef CASE + default: + return false; + } + } + ); + ListTag.def( + "index", + [](const Amulet::ListTagWrapper& self, Amulet::WrapperNode tag, std::ptrdiff_t start, std::ptrdiff_t stop) -> size_t { + switch(tag.index()){ + #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG)\ + case ID:\ + return Amulet::ListTag_index(*self.tag, get>(tag).tag, start, stop); + FOR_EACH_LIST_TAG(CASE) + #undef CASE + } + throw std::invalid_argument("item is not in the ListTag"); + }, + py::arg("tag"), py::arg("start") = 0, py::arg("stop") = std::numeric_limits::max() + ); + ListTag.def( + "count", + [](const Amulet::ListTagWrapper& self, Amulet::WrapperNode tag) -> size_t { + switch(tag.index()){ + #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG)\ + case ID:\ + return Amulet::ListTag_count(*self.tag, get>(tag).tag); + FOR_EACH_LIST_TAG(CASE) + #undef CASE + } + return 0; + } + ); + ListTag.def( + "__setitem__", + [](const Amulet::ListTagWrapper& self, std::ptrdiff_t index, Amulet::WrapperNode tag){ + switch(tag.index()){ + #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG)\ + case ID:\ + Amulet::ListTag_set(*self.tag, index, get>(tag).tag);\ + break; + FOR_EACH_LIST_TAG(CASE) + #undef CASE + default: + throw std::invalid_argument("Invalid tag to set."); + } + } + ); +// ListTag.def( +// "__setitem__", +// [](const Amulet::ListTagWrapper& self, const py::slice &slice, py::object values){ +// py::list +// } +// ); +// ListTag.def( +// "__delitem__", +// [](const Amulet::ListTagWrapper& self, std::ptrdiff_t item){ +// +// } +// ); + ListTag.def( + "insert", + [](const Amulet::ListTagWrapper& self, std::ptrdiff_t index, Amulet::WrapperNode tag){ + switch(tag.index()){ + #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG)\ + case ID:\ + Amulet::ListTag_insert(*self.tag, index, get>(tag).tag);\ + break; + case 0: + throw std::invalid_argument("Cannot append null TagNode"); + FOR_EACH_LIST_TAG(CASE) + #undef CASE + } + } + ); + ListTag.def( + "append", + [](const Amulet::ListTagWrapper& self, Amulet::WrapperNode tag){ + switch(tag.index()){ + #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG) case ID: Amulet::ListTag_append(*self.tag, get>(tag).tag); break; + case 0: + throw std::invalid_argument("Cannot append null TagNode"); + FOR_EACH_LIST_TAG(CASE) + #undef CASE + } + } + ); + ListTag.def( + "clear", + [](const Amulet::ListTagWrapper& self){ + switch(self.tag->index()){ + #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG) case ID: get(*self.tag).clear(); break; + FOR_EACH_LIST_TAG(CASE) + #undef CASE + } + } + ); + ListTag.def( + "reverse", + [](const Amulet::ListTagWrapper& self){ + switch(self.tag->index()){ + #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG) case ID: {LIST_TAG& tag = get(*self.tag); std::reverse(tag.begin(), tag.end());}; break; + FOR_EACH_LIST_TAG(CASE) + #undef CASE + } + } + ); + ListTag.def( + "extend", + [](const Amulet::ListTagWrapper& self, py::object value){ + ListTag_extend(self.tag, py::list(value)); + } + ); + ListTag.def( + "pop", + [](const Amulet::ListTagWrapper& self, std::ptrdiff_t item){ + return Amulet::wrap_node(ListTag_pop(*self.tag, item)); + } + ); + ListTag.def( + "remove", + [](const Amulet::ListTagWrapper& self, std::ptrdiff_t item){ + ListTag_remove(*self.tag, item); + } + ); + ListTag.def( + "__iadd__", + [](const Amulet::ListTagWrapper& self, py::object value){ + ListTag_extend(self.tag, py::list(value)); + return self; + } + ); + ListTag.def( + "copy", + [](const Amulet::ListTagWrapper& self){ + Amulet::ListTagPtr tag = std::make_shared(); + + return Amulet::ListTagWrapper(tag); + } + ); + #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG)\ + ListTag.def(\ + "get_"TAG_NAME,\ + [](const Amulet::ListTagWrapper& self, std::ptrdiff_t index){\ + if (self.tag->index() != variant_index>()){\ + throw pybind11::type_error("ListTag elements are not "#TAG);\ + }\ + return Amulet::wrap_node(Amulet::ListTag_get(*self.tag, index));\ + },\ + py::doc(\ + "Get the tag at index if it is a "#TAG".\n"\ + "\n"\ + ":param index: The index to get\n"\ + ":return: The "#TAG".\n"\ + ":raises: IndexError if the index is outside the list.\n"\ + ":raises: TypeError if the stored type is not a "#TAG\ + )\ + ); + FOR_EACH_LIST_TAG(CASE) + #undef CASE +} From 1476d5ca011c1fd5fdcc022d2a7cfe17e25e052c Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 28 Jun 2024 10:36:20 +0100 Subject: [PATCH 030/121] Fix ListTag_set --- src/amulet_nbt/include/amulet_nbt/tag/list.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/amulet_nbt/include/amulet_nbt/tag/list.hpp b/src/amulet_nbt/include/amulet_nbt/tag/list.hpp index 94a76268..6518ea86 100644 --- a/src/amulet_nbt/include/amulet_nbt/tag/list.hpp +++ b/src/amulet_nbt/include/amulet_nbt/tag/list.hpp @@ -80,7 +80,7 @@ namespace Amulet { } template - void ListTag_set(const Amulet::ListTag& self, indexT index, tagT tag){ + void ListTag_set(Amulet::ListTag& self, indexT index, tagT tag){ // Get the unsigned index. Also do bounds checking. size_t abs_index = ListTag_bounds_check(ListTag_size(self), index); if (self.index() == variant_index>()){ @@ -89,7 +89,7 @@ namespace Amulet { list_tag[abs_index] = tag; } else if (ListTag_size(self) == 1 && abs_index == 0){ // Overwriting the only value - self.emplace({tag}); + self.emplace>({tag}); } else { throw std::invalid_argument("NBT ListTag item mismatch."); } From 7fceafb87ab26b1db47061323f0b08d6390a21df Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 28 Jun 2024 10:36:30 +0100 Subject: [PATCH 031/121] Fix py_getter --- src/amulet_nbt/pybind/tag/list.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/amulet_nbt/pybind/tag/list.cpp b/src/amulet_nbt/pybind/tag/list.cpp index 16cbecde..dc5c0a4e 100644 --- a/src/amulet_nbt/pybind/tag/list.cpp +++ b/src/amulet_nbt/pybind/tag/list.cpp @@ -94,7 +94,7 @@ void init_list(py::module& m) { }; ListTag.def_property_readonly( "py_list", - &py_getter, + py_getter, py::doc( "A python list representation of the class.\n" "\n" @@ -104,7 +104,7 @@ void init_list(py::module& m) { ); ListTag.def_property_readonly( "py_data", - &py_getter, + py_getter, py::doc( "A python representation of the class. Note that the return type is undefined and may change in the future.\n" "\n" From e40205354f5d13d01782b98f9c7ce0a877790102 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 28 Jun 2024 16:13:37 +0100 Subject: [PATCH 032/121] Reformat --- src/amulet_nbt/pybind/tag/list.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/amulet_nbt/pybind/tag/list.cpp b/src/amulet_nbt/pybind/tag/list.cpp index dc5c0a4e..52b000f7 100644 --- a/src/amulet_nbt/pybind/tag/list.cpp +++ b/src/amulet_nbt/pybind/tag/list.cpp @@ -20,7 +20,10 @@ void ListTag_extend(Amulet::ListTagPtr tag, py::object value){ Amulet::WrapperNode node = py::cast(*it); switch(node.index()){ - #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG) case ID: Amulet::ListTag_append(*tag, get>(node).tag); break; + #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG)\ + case ID:\ + Amulet::ListTag_append(*tag, get>(node).tag);\ + break; case 0: throw std::invalid_argument("Cannot append null TagNode"); FOR_EACH_LIST_TAG(CASE) From 549719c14162ecd8b3ef2be823bea142a5e10ea6 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 28 Jun 2024 16:14:27 +0100 Subject: [PATCH 033/121] Improve repr output There is no longer a trailing ", " --- src/amulet_nbt/pybind/tag/list.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/amulet_nbt/pybind/tag/list.cpp b/src/amulet_nbt/pybind/tag/list.cpp index 52b000f7..50571ce8 100644 --- a/src/amulet_nbt/pybind/tag/list.cpp +++ b/src/amulet_nbt/pybind/tag/list.cpp @@ -128,9 +128,9 @@ void init_list(py::module& m) { case ID:\ {\ LIST_TAG& list_tag = get(*self.tag);\ - for (auto& tag: list_tag){\ - out += py::repr(py::cast(Amulet::TagWrapper(tag)));\ - out += ", ";\ + for (size_t i = 0; i < list_tag.size(); i++){\ + if (i != 0){out += ", ";}\ + out += py::repr(py::cast(Amulet::TagWrapper(list_tag[i])));\ }\ };\ break; From e067e50a0f1e263744170fc8c6da467e6b6d97f8 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 28 Jun 2024 16:15:13 +0100 Subject: [PATCH 034/121] Switch to Py_ssize_t --- src/amulet_nbt/pybind/tag/list.cpp | 38 +++++++++++++++--------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/amulet_nbt/pybind/tag/list.cpp b/src/amulet_nbt/pybind/tag/list.cpp index 50571ce8..0a1e87f4 100644 --- a/src/amulet_nbt/pybind/tag/list.cpp +++ b/src/amulet_nbt/pybind/tag/list.cpp @@ -198,20 +198,20 @@ void init_list(py::module& m) { ); ListTag.def( "__getitem__", - [](const Amulet::ListTagWrapper& self, std::ptrdiff_t item){ - return Amulet::wrap_node(Amulet::ListTag_get_node(*self.tag, item)); + [](const Amulet::ListTagWrapper& self, Py_ssize_t item){ + return Amulet::wrap_node(Amulet::ListTag_get_node(*self.tag, item)); } ); ListTag.def( "__getitem__", [](const Amulet::ListTagWrapper& self, const py::slice& slice) { py::list out; - size_t start = 0, stop = 0, step = 0, slicelength = 0; - if (!slice.compute(ListTag_size(*self.tag), &start, &stop, &step, &slicelength)) { + Py_ssize_t start = 0, stop = 0, step = 0, slice_length = 0; + if (!slice.compute(ListTag_size(*self.tag), &start, &stop, &step, &slice_length)) { throw py::error_already_set(); } - for (size_t i = 0; i < slicelength; ++i) { - out.append(Amulet::wrap_node(Amulet::ListTag_get_node(*self.tag, i))); + for (Py_ssize_t i = 0; i < slice_length; ++i) { + out.append(Amulet::wrap_node(Amulet::ListTag_get_node(*self.tag, start))); start += step; } return out; @@ -259,17 +259,17 @@ void init_list(py::module& m) { ); ListTag.def( "index", - [](const Amulet::ListTagWrapper& self, Amulet::WrapperNode tag, std::ptrdiff_t start, std::ptrdiff_t stop) -> size_t { + [](const Amulet::ListTagWrapper& self, Amulet::WrapperNode tag, Py_ssize_t start, Py_ssize_t stop) -> size_t { switch(tag.index()){ #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG)\ case ID:\ - return Amulet::ListTag_index(*self.tag, get>(tag).tag, start, stop); + return Amulet::ListTag_index(*self.tag, get>(tag).tag, start, stop); FOR_EACH_LIST_TAG(CASE) #undef CASE } throw std::invalid_argument("item is not in the ListTag"); }, - py::arg("tag"), py::arg("start") = 0, py::arg("stop") = std::numeric_limits::max() + py::arg("tag"), py::arg("start") = 0, py::arg("stop") = std::numeric_limits::max() ); ListTag.def( "count", @@ -286,11 +286,11 @@ void init_list(py::module& m) { ); ListTag.def( "__setitem__", - [](const Amulet::ListTagWrapper& self, std::ptrdiff_t index, Amulet::WrapperNode tag){ + [](const Amulet::ListTagWrapper& self, Py_ssize_t index, Amulet::WrapperNode tag){ switch(tag.index()){ #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG)\ case ID:\ - Amulet::ListTag_set(*self.tag, index, get>(tag).tag);\ + Amulet::ListTag_set(*self.tag, index, get>(tag).tag);\ break; FOR_EACH_LIST_TAG(CASE) #undef CASE @@ -313,11 +313,11 @@ void init_list(py::module& m) { // ); ListTag.def( "insert", - [](const Amulet::ListTagWrapper& self, std::ptrdiff_t index, Amulet::WrapperNode tag){ + [](const Amulet::ListTagWrapper& self, Py_ssize_t index, Amulet::WrapperNode tag){ switch(tag.index()){ #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG)\ case ID:\ - Amulet::ListTag_insert(*self.tag, index, get>(tag).tag);\ + Amulet::ListTag_insert(*self.tag, index, get>(tag).tag);\ break; case 0: throw std::invalid_argument("Cannot append null TagNode"); @@ -366,14 +366,14 @@ void init_list(py::module& m) { ); ListTag.def( "pop", - [](const Amulet::ListTagWrapper& self, std::ptrdiff_t item){ - return Amulet::wrap_node(ListTag_pop(*self.tag, item)); + [](const Amulet::ListTagWrapper& self, Py_ssize_t item){ + return Amulet::wrap_node(ListTag_pop(*self.tag, item)); } ); ListTag.def( "remove", - [](const Amulet::ListTagWrapper& self, std::ptrdiff_t item){ - ListTag_remove(*self.tag, item); + [](const Amulet::ListTagWrapper& self, Py_ssize_t item){ + ListTag_remove(*self.tag, item); } ); ListTag.def( @@ -394,11 +394,11 @@ void init_list(py::module& m) { #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG)\ ListTag.def(\ "get_"TAG_NAME,\ - [](const Amulet::ListTagWrapper& self, std::ptrdiff_t index){\ + [](const Amulet::ListTagWrapper& self, Py_ssize_t index){\ if (self.tag->index() != variant_index>()){\ throw pybind11::type_error("ListTag elements are not "#TAG);\ }\ - return Amulet::wrap_node(Amulet::ListTag_get(*self.tag, index));\ + return Amulet::wrap_node(Amulet::ListTag_get(*self.tag, index));\ },\ py::doc(\ "Get the tag at index if it is a "#TAG".\n"\ From 432926d732ecf2f32b5f939f295530b6fb56653f Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 28 Jun 2024 16:15:36 +0100 Subject: [PATCH 035/121] Added setitem and delitem --- src/amulet_nbt/pybind/tag/list.cpp | 153 ++++++++++++++++++++++++++--- 1 file changed, 141 insertions(+), 12 deletions(-) diff --git a/src/amulet_nbt/pybind/tag/list.cpp b/src/amulet_nbt/pybind/tag/list.cpp index 0a1e87f4..e64db3ff 100644 --- a/src/amulet_nbt/pybind/tag/list.cpp +++ b/src/amulet_nbt/pybind/tag/list.cpp @@ -33,6 +33,89 @@ void ListTag_extend(Amulet::ListTagPtr tag, py::object value){ } } +template +void ListTag_set_slice(Amulet::ListTagPtr self, const py::slice &slice, std::vector& vec){ + if (self->index() == variant_index>()){ + // Tag type matches + std::vector& list_tag = get>(*self); + Py_ssize_t start = 0, stop = 0, step = 0, slice_length = 0; + if (!slice.compute(list_tag.size(), &start, &stop, &step, &slice_length)) { + throw py::error_already_set(); + } + if (vec.size() == slice_length){ + // Size matches. Overwrite. + for (auto& tag: vec){ + list_tag[start] = tag; + start += step; + } + } else if (step == 1) { + // Erase the region and insert the new region + list_tag.erase( + list_tag.begin() + start, + list_tag.begin() + stop + ); + list_tag.insert( + list_tag.begin() + start, + vec.begin(), + vec.end() + ); + } else { + throw std::invalid_argument( + "attempt to assign sequence of size " + + std::to_string(vec.size()) + + " to extended slice of size " + + std::to_string(slice_length) + ); + } + } else { + // Tag type does not match + size_t size = ListTag_size(*self); + Py_ssize_t start = 0, stop = 0, step = 0, slice_length = 0; + if (!slice.compute(size, &start, &stop, &step, &slice_length)) { + throw py::error_already_set(); + } + if (size == slice_length){ + // Overwriting all values + if (step == -1){ + // Reverse the element order + std::reverse(vec.begin(), vec.end()); + } else if (step != 1){ + throw std::invalid_argument( + "When overwriting values in a ListTag the types must match or all tags must be overwritten." + ); + } + self->emplace>(vec); + } else { + throw std::invalid_argument("NBT ListTag item mismatch."); + } + } +} + +template +void ListTag_del_slice(std::vector& self, const py::slice &slice){ + Py_ssize_t start = 0, stop = 0, step = 0, slice_length = 0; + if (!slice.compute(self.size(), &start, &stop, &step, &slice_length)) { + throw py::error_already_set(); + } + if (step == 1){ + self.erase( + self.begin() + start, + self.begin() + stop + ); + } else if (step < 0) { + for (Py_ssize_t i = 0; i < slice_length; i++){ + self.erase(self.begin() + (start + step * i)); + } + } else if (step > 0) { + // erase values back to front + for (Py_ssize_t i = 0; i < slice_length; i++){ + self.erase(self.begin() + (start + step * (slice_length - 1 - i))); + } + } else { + throw std::invalid_argument("slice step cannot be zero"); + } +} + void init_list(py::module& m) { py::class_> ListTagIterator(m, "ListTagIterator"); @@ -299,18 +382,64 @@ void init_list(py::module& m) { } } ); -// ListTag.def( -// "__setitem__", -// [](const Amulet::ListTagWrapper& self, const py::slice &slice, py::object values){ -// py::list -// } -// ); -// ListTag.def( -// "__delitem__", -// [](const Amulet::ListTagWrapper& self, std::ptrdiff_t item){ -// -// } -// ); + ListTag.def( + "__setitem__", + [](const Amulet::ListTagWrapper& self, const py::slice &slice, py::object values){ + // Cast values to a list to get a consistent format + auto list = py::list(values); + if (list){ + // If the value has items in it + // Switch based on the type of the first element + Amulet::WrapperNode first = list[0].cast(); + switch(first.index()){ + #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG)\ + case ID:{\ + /* Cast to C++ objects. Also validate that they are all the same type. */\ + std::vector vec = list.cast>();\ + ListTag_set_slice(self.tag, slice, vec);\ + break;\ + } + FOR_EACH_LIST_TAG(CASE) + #undef CASE + default: + throw std::invalid_argument("Values must all be the same NBT tag."); + } + } else { + // The value is empty + // empty the slice + switch(self.tag->index()){ + #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG)\ + case ID:{\ + auto vec = std::vector();\ + ListTag_set_slice(self.tag, slice, vec);\ + break;\ + } + FOR_EACH_LIST_TAG(CASE) + #undef CASE + } + } + } + ); + ListTag.def( + "__delitem__", + [](const Amulet::ListTagWrapper& self, Py_ssize_t item){ + Amulet::ListTag_remove(*self.tag, item); + } + ); + ListTag.def( + "__delitem__", + [](const Amulet::ListTagWrapper& self, const py::slice &slice){ + switch(self.tag->index()){ + #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG)\ + case ID:{\ + ListTag_del_slice(get>(*self.tag), slice);\ + break;\ + } + FOR_EACH_LIST_TAG(CASE) + #undef CASE + } + } + ); ListTag.def( "insert", [](const Amulet::ListTagWrapper& self, Py_ssize_t index, Amulet::WrapperNode tag){ From 707f608b23d460bc7227a314ba36718f942705f5 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 28 Jun 2024 16:40:56 +0100 Subject: [PATCH 036/121] Refactor abstract method --- src/amulet_nbt/pybind/tag/abc.cpp | 34 +++++++++++++++---------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/amulet_nbt/pybind/tag/abc.cpp b/src/amulet_nbt/pybind/tag/abc.cpp index fa96b743..1903851d 100644 --- a/src/amulet_nbt/pybind/tag/abc.cpp +++ b/src/amulet_nbt/pybind/tag/abc.cpp @@ -7,7 +7,7 @@ namespace py = pybind11; template -void abstract_method(const T& self){ +void abstract_method(T self){ PyErr_SetString(PyExc_NotImplementedError, ""); throw py::error_already_set(); } @@ -19,7 +19,7 @@ void init_abc(py::module& m) { ); AbstractBaseTag.def_property_readonly( "py_data", - abstract_method, + abstract_method, "A python representation of the class. Note that the return type is undefined and may change in the future.\n"\ "\n"\ "You would be better off using the py_{type} or np_array properties if you require a fixed type.\n"\ @@ -27,46 +27,46 @@ void init_abc(py::module& m) { ); AbstractBaseTag.def( "to_nbt", - abstract_method + abstract_method ); AbstractBaseTag.def( "save_to", - abstract_method + abstract_method ); AbstractBaseTag.def( "to_snbt", - abstract_method + abstract_method ); AbstractBaseTag.def( "__eq__", - abstract_method, + abstract_method, "Check if the instance is equal to another instance.\n" "\n" "This will only return True if the tag type is the same and the data contained is the same." ); AbstractBaseTag.def( "__repr__", - abstract_method, + abstract_method, "A string representation of the object to show how it can be constructed." ); AbstractBaseTag.def( "__str__", - abstract_method, + abstract_method, "A string representation of the object." ); AbstractBaseTag.def( "__reduce__", - abstract_method, + abstract_method, "A string representation of the object." ); AbstractBaseTag.def( "__copy__", - abstract_method, + abstract_method, "A string representation of the object." ); AbstractBaseTag.def( "__deepcopy__", - abstract_method, + abstract_method, "A string representation of the object." ); @@ -75,7 +75,7 @@ void init_abc(py::module& m) { ); AbstractBaseImmutableTag.def( "__hash__", - abstract_method, + abstract_method, "A hash of the data in the class." ); @@ -84,17 +84,17 @@ void init_abc(py::module& m) { ); AbstractBaseNumericTag.def( "__int__", - abstract_method, + abstract_method, "Get a python int representation of the class." ); AbstractBaseNumericTag.def( "__float__", - abstract_method, + abstract_method, "Get a python float representation of the class." ); AbstractBaseNumericTag.def( "__bool__", - abstract_method, + abstract_method, "Get a python bool representation of the class." ); @@ -103,7 +103,7 @@ void init_abc(py::module& m) { ); AbstractBaseIntTag.def_property_readonly( "py_int", - abstract_method, + abstract_method, "A python int representation of the class.\n" "\n" "The returned data is immutable so changes will not mirror the instance." @@ -114,7 +114,7 @@ void init_abc(py::module& m) { ); AbstractBaseFloatTag.def_property_readonly( "py_float", - abstract_method, + abstract_method, "A python float representation of the class.\n" "\n" "The returned data is immutable so changes will not mirror the instance." From 47487e1c6f6b5bf8222f298b96c32a21c064668a Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 28 Jun 2024 16:41:23 +0100 Subject: [PATCH 037/121] Fix array constructor --- src/amulet_nbt/pybind/tag/array.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/amulet_nbt/pybind/tag/array.cpp b/src/amulet_nbt/pybind/tag/array.cpp index 6744b7d8..adbf24ae 100644 --- a/src/amulet_nbt/pybind/tag/array.cpp +++ b/src/amulet_nbt/pybind/tag/array.cpp @@ -21,8 +21,8 @@ namespace py = pybind11; std::shared_ptr tag_ptr = std::make_shared(tag);\ return Amulet::CLSNAME##Wrapper(tag_ptr);\ }),\ - py::arg("value"),\ - py::doc("__init__(self: amulet_nbt."#CLSNAME", value: collections.abc.Iterable[typing.SupportsInt]) -> None")\ + py::arg("value") = py::tuple(),\ + py::doc("__init__(self: amulet_nbt."#CLSNAME", value: collections.abc.Iterable[typing.SupportsInt] = ()) -> None")\ );\ CLSNAME.def_buffer(\ [](Amulet::CLSNAME##Wrapper& self) -> py::buffer_info {\ From af271c6b76dc045e450003284ad9def4f41134c9 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 28 Jun 2024 16:42:46 +0100 Subject: [PATCH 038/121] Add tag_id value --- src/amulet_nbt/pybind/tag/abc.cpp | 4 ++++ src/amulet_nbt/pybind/tag/array.cpp | 1 + src/amulet_nbt/pybind/tag/compound.cpp | 1 + src/amulet_nbt/pybind/tag/float.cpp | 1 + src/amulet_nbt/pybind/tag/int.cpp | 1 + src/amulet_nbt/pybind/tag/list.cpp | 1 + src/amulet_nbt/pybind/tag/string.cpp | 1 + 7 files changed, 10 insertions(+) diff --git a/src/amulet_nbt/pybind/tag/abc.cpp b/src/amulet_nbt/pybind/tag/abc.cpp index 1903851d..cfdd8fec 100644 --- a/src/amulet_nbt/pybind/tag/abc.cpp +++ b/src/amulet_nbt/pybind/tag/abc.cpp @@ -17,6 +17,10 @@ void init_abc(py::module& m) { py::class_ AbstractBaseTag(m, "AbstractBaseTag", "Abstract Base Class for all tag classes" ); + AbstractBaseTag.def_property_readonly_static( + "tag_id", + abstract_method + ); AbstractBaseTag.def_property_readonly( "py_data", abstract_method, diff --git a/src/amulet_nbt/pybind/tag/array.cpp b/src/amulet_nbt/pybind/tag/array.cpp index adbf24ae..ec83bd70 100644 --- a/src/amulet_nbt/pybind/tag/array.cpp +++ b/src/amulet_nbt/pybind/tag/array.cpp @@ -13,6 +13,7 @@ namespace py = pybind11; py::class_ CLSNAME(m, #CLSNAME, py::buffer_protocol(),\ "This class stores a fixed size signed "#BITCOUNT" bit vector."\ );\ + CLSNAME.def_property_readonly_static("tag_id", [](py::object) {return TAGID;});\ CLSNAME.def(\ py::init([](py::object value) {\ /* Is there a better way to do this? */\ diff --git a/src/amulet_nbt/pybind/tag/compound.cpp b/src/amulet_nbt/pybind/tag/compound.cpp index 1d74419e..6dc28480 100644 --- a/src/amulet_nbt/pybind/tag/compound.cpp +++ b/src/amulet_nbt/pybind/tag/compound.cpp @@ -8,4 +8,5 @@ namespace py = pybind11; void init_compound(py::module& m) { py::class_ CompoundTag(m, "CompoundTag"); + CompoundTag.def_property_readonly_static("tag_id", [](py::object) {return 10;}); } diff --git a/src/amulet_nbt/pybind/tag/float.cpp b/src/amulet_nbt/pybind/tag/float.cpp index 4ce61a7c..22943edd 100644 --- a/src/amulet_nbt/pybind/tag/float.cpp +++ b/src/amulet_nbt/pybind/tag/float.cpp @@ -11,6 +11,7 @@ namespace py = pybind11; py::class_ CLSNAME(m, #CLSNAME,\ "A "#PRECISION" precision float class."\ );\ + CLSNAME.def_property_readonly_static("tag_id", [](py::object) {return TAGID;});\ CLSNAME.def(\ py::init([](py::object value) {\ return Amulet::CLSNAME##Wrapper(value.cast());\ diff --git a/src/amulet_nbt/pybind/tag/int.cpp b/src/amulet_nbt/pybind/tag/int.cpp index d9a8db96..680a3969 100644 --- a/src/amulet_nbt/pybind/tag/int.cpp +++ b/src/amulet_nbt/pybind/tag/int.cpp @@ -13,6 +13,7 @@ namespace py = pybind11; "\n"\ "Can Store numbers between -(2^"#BITPOW") and (2^"#BITPOW" - 1)"\ );\ + CLSNAME.def_property_readonly_static("tag_id", [](py::object) {return TAGID;});\ CLSNAME.def(\ py::init([](py::object value) {\ return Amulet::CLSNAME##Wrapper(value.cast());\ diff --git a/src/amulet_nbt/pybind/tag/list.cpp b/src/amulet_nbt/pybind/tag/list.cpp index e64db3ff..bf874385 100644 --- a/src/amulet_nbt/pybind/tag/list.cpp +++ b/src/amulet_nbt/pybind/tag/list.cpp @@ -140,6 +140,7 @@ void init_list(py::module& m) { "\n" "All contained data must be of the same NBT data type." ); + ListTag.def_property_readonly_static("tag_id", [](py::object) {return 9;}); ListTag.def( py::init([](py::object value, std::uint8_t element_tag_id) { Amulet::ListTagPtr tag = std::make_shared(); diff --git a/src/amulet_nbt/pybind/tag/string.cpp b/src/amulet_nbt/pybind/tag/string.cpp index 82e0d64c..785d6cb3 100644 --- a/src/amulet_nbt/pybind/tag/string.cpp +++ b/src/amulet_nbt/pybind/tag/string.cpp @@ -10,6 +10,7 @@ void init_string(py::module& m) { py::class_ StringTag(m, "StringTag", "A class that behaves like a string." ); + StringTag.def_property_readonly_static("tag_id", [](py::object) {return 8;}); StringTag.def( py::init([](py::object value) { return Amulet::StringTagWrapper(value.cast()); From a62d500318a2c49918e2102c79c2e767a54a644b Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 28 Jun 2024 16:43:03 +0100 Subject: [PATCH 039/121] Reformat --- src/amulet_nbt/pybind/tag/list.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/amulet_nbt/pybind/tag/list.cpp b/src/amulet_nbt/pybind/tag/list.cpp index bf874385..f09f14cc 100644 --- a/src/amulet_nbt/pybind/tag/list.cpp +++ b/src/amulet_nbt/pybind/tag/list.cpp @@ -155,7 +155,7 @@ void init_list(py::module& m) { return Amulet::ListTagWrapper(tag); }), py::arg("value") = py::tuple(), py::arg("element_tag_id") = 1, - py::doc("__init__(self: amulet_nbt.ListTag, value: typing.Iterable[amulet_nbt.ByteTag] | typing.Iterable[amulet_nbt.ShortTag] | typing.Iterable[amulet_nbt.IntTag] | typing.Iterable[amulet_nbt.LongTag] | typing.Iterable[amulet_nbt.FloatTag] | typing.Iterable[amulet_nbt.DoubleTag] | typing.Iterable[amulet_nbt.ByteArrayTag] | typing.Iterable[amulet_nbt.StringTag] | typing.Iterable[amulet_nbt.ListTag] | typing.Iterable[amulet_nbt.CompoundTag] | typing.Iterable[amulet_nbt.IntArrayTag] | typing.Iterable[amulet_nbt.LongArrayTag] = (), element_tag_id=1) -> None") + py::doc("__init__(self: amulet_nbt.ListTag, value: typing.Iterable[amulet_nbt.ByteTag] | typing.Iterable[amulet_nbt.ShortTag] | typing.Iterable[amulet_nbt.IntTag] | typing.Iterable[amulet_nbt.LongTag] | typing.Iterable[amulet_nbt.FloatTag] | typing.Iterable[amulet_nbt.DoubleTag] | typing.Iterable[amulet_nbt.ByteArrayTag] | typing.Iterable[amulet_nbt.StringTag] | typing.Iterable[amulet_nbt.ListTag] | typing.Iterable[amulet_nbt.CompoundTag] | typing.Iterable[amulet_nbt.IntArrayTag] | typing.Iterable[amulet_nbt.LongArrayTag] = (), element_tag_id = 1) -> None") ); ListTag.attr("__class_getitem__") = PyClassMethod_New( py::cpp_function([](const py::type &cls, const py::args &args){return cls;}).ptr() From ac873c5db65ce92a633facddd39df113c28d1557 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Tue, 2 Jul 2024 09:32:49 +0100 Subject: [PATCH 040/121] Extended __init__.py --- src/amulet_nbt/__init__.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/amulet_nbt/__init__.py b/src/amulet_nbt/__init__.py index 8d61962c..a4ed7888 100644 --- a/src/amulet_nbt/__init__.py +++ b/src/amulet_nbt/__init__.py @@ -1,3 +1,14 @@ +import re +from typing import TypeAlias +from . import _version + +__version__ = _version.get_versions()["version"] +__major__ = int(re.match(r"\d+", __version__)[0]) # type: ignore + +del re +del _version + + def get_include() -> str: import os return os.path.join(__path__[0], "include") @@ -66,7 +77,18 @@ def get_include() -> str: # bedrock_encoding, ) +SNBTType: TypeAlias = str +IntType: TypeAlias = ByteTag | ShortTag | IntTag | LongTag +FloatType: TypeAlias = FloatTag | DoubleTag +NumberType: TypeAlias = ByteTag | ShortTag | IntTag | LongTag | FloatTag | DoubleTag +ArrayType: TypeAlias = ByteArrayTag | IntArrayTag | LongArrayTag +AnyNBT: TypeAlias = ByteTag | ShortTag | IntTag | LongTag | FloatTag | DoubleTag | ByteArrayTag | StringTag | ListTag | CompoundTag | IntArrayTag | LongArrayTag + + __all__ = [ + "__version__", + "__major__", + "get_include", "AbstractBaseTag", "AbstractBaseImmutableTag", "AbstractBaseMutableTag", From 16654db989ee50e9c920b9a55f72a6e96d69c602 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Tue, 2 Jul 2024 09:55:28 +0100 Subject: [PATCH 041/121] Added string encoding and presets --- src/amulet_nbt/__init__.py | 14 +-- .../amulet_nbt/cpp/string_encoding}/mutf8.cpp | 37 ++++---- .../amulet_nbt/cpp/string_encoding}/notes.txt | 0 .../amulet_nbt/cpp/string_encoding}/utf8.cpp | 51 ++++++----- .../include/amulet_nbt/string_encoding.hpp | 12 +++ src/amulet_nbt/pybind/amulet_nbt.cpp | 6 ++ src/amulet_nbt/pybind/bnbt.cpp | 89 +++++++++++++++++++ .../_string_encoding/_cpp/__init__.pxd | 4 - .../_string_encoding/_cpp/mutf8.hpp | 10 --- .../_string_encoding/_cpp/mutf8.pxd | 7 -- .../amulet_nbt/_string_encoding/_cpp/utf8.hpp | 17 ---- .../amulet_nbt/_string_encoding/_cpp/utf8.pxd | 8 -- 12 files changed, 163 insertions(+), 92 deletions(-) rename {src_/amulet_nbt/_string_encoding/_cpp => src/amulet_nbt/cpp/string_encoding}/mutf8.cpp (88%) rename {src_/amulet_nbt/_string_encoding/_cpp => src/amulet_nbt/cpp/string_encoding}/notes.txt (100%) rename {src_/amulet_nbt/_string_encoding/_cpp => src/amulet_nbt/cpp/string_encoding}/utf8.cpp (89%) create mode 100644 src/amulet_nbt/include/amulet_nbt/string_encoding.hpp create mode 100644 src/amulet_nbt/pybind/bnbt.cpp delete mode 100644 src_/amulet_nbt/_string_encoding/_cpp/__init__.pxd delete mode 100644 src_/amulet_nbt/_string_encoding/_cpp/mutf8.hpp delete mode 100644 src_/amulet_nbt/_string_encoding/_cpp/mutf8.pxd delete mode 100644 src_/amulet_nbt/_string_encoding/_cpp/utf8.hpp delete mode 100644 src_/amulet_nbt/_string_encoding/_cpp/utf8.pxd diff --git a/src/amulet_nbt/__init__.py b/src/amulet_nbt/__init__.py index a4ed7888..c2cc8941 100644 --- a/src/amulet_nbt/__init__.py +++ b/src/amulet_nbt/__init__.py @@ -68,13 +68,13 @@ def get_include() -> str: # NumberType, # ArrayType, # AnyNBT, - # StringEncoding, - # mutf8_encoding, - # utf8_encoding, - # utf8_escape_encoding, - # EncodingPreset, - # java_encoding, - # bedrock_encoding, + StringEncoding, + mutf8_encoding, + utf8_encoding, + utf8_escape_encoding, + EncodingPreset, + java_encoding, + bedrock_encoding, ) SNBTType: TypeAlias = str diff --git a/src_/amulet_nbt/_string_encoding/_cpp/mutf8.cpp b/src/amulet_nbt/cpp/string_encoding/mutf8.cpp similarity index 88% rename from src_/amulet_nbt/_string_encoding/_cpp/mutf8.cpp rename to src/amulet_nbt/cpp/string_encoding/mutf8.cpp index 1a4d55e3..2c365e50 100644 --- a/src_/amulet_nbt/_string_encoding/_cpp/mutf8.cpp +++ b/src/amulet_nbt/cpp/string_encoding/mutf8.cpp @@ -5,11 +5,12 @@ #include #include #include -#include "utf8.hpp" +#include +typedef std::vector CodePointVector; -std::vector read_mutf8(const std::string &src) { - std::vector dst; +CodePointVector read_mutf8(const std::string &src) { + CodePointVector dst; for (size_t index = 0; index < src.size(); index++) { uint8_t b1 = src[index]; @@ -98,7 +99,7 @@ std::vector read_mutf8(const std::string &src) { } -void write_mutf8(std::string& dst, const std::vector& src) { +void write_mutf8(std::string& dst, const CodePointVector& src) { for (size_t index = 0; index < src.size(); index++) { const size_t& c = src[index]; if (c == 0) { @@ -135,17 +136,23 @@ void write_mutf8(std::string& dst, const std::vector& src) { } -// Decode a modified utf-8 byte sequence to a regular utf-8 byte sequence -std::string mutf8_to_utf8(const std::string& src) { - std::string dst; - write_utf8(dst, read_mutf8(src)); - return dst; -} +CodePointVector read_utf8(const std::string& src); +void write_utf8(std::string &dst, const CodePointVector& src); -// Encode a regular utf-8 byte sequence to a modified utf-8 byte sequence -std::string utf8_to_mutf8(const std::string& src) { - std::string dst; - write_mutf8(dst, read_utf8(src)); - return dst; +namespace Amulet { + // Decode a modified utf-8 byte sequence to a regular utf-8 byte sequence + std::string mutf8_to_utf8(const std::string& src) { + std::string dst; + write_utf8(dst, read_mutf8(src)); + return dst; + } + + + // Encode a regular utf-8 byte sequence to a modified utf-8 byte sequence + std::string utf8_to_mutf8(const std::string& src) { + std::string dst; + write_mutf8(dst, read_utf8(src)); + return dst; + } } diff --git a/src_/amulet_nbt/_string_encoding/_cpp/notes.txt b/src/amulet_nbt/cpp/string_encoding/notes.txt similarity index 100% rename from src_/amulet_nbt/_string_encoding/_cpp/notes.txt rename to src/amulet_nbt/cpp/string_encoding/notes.txt diff --git a/src_/amulet_nbt/_string_encoding/_cpp/utf8.cpp b/src/amulet_nbt/cpp/string_encoding/utf8.cpp similarity index 89% rename from src_/amulet_nbt/_string_encoding/_cpp/utf8.cpp rename to src/amulet_nbt/cpp/string_encoding/utf8.cpp index 0c81177e..7b0975af 100644 --- a/src_/amulet_nbt/_string_encoding/_cpp/utf8.cpp +++ b/src/amulet_nbt/cpp/string_encoding/utf8.cpp @@ -5,8 +5,9 @@ #include #include #include -#include "utf8.hpp" +#include +typedef std::vector CodePointVector; const size_t HexChars[16] = {48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102}; @@ -233,35 +234,37 @@ void write_utf8(std::string &dst, const CodePointVector& src) { } -// Validate a utf-8 byte sequence and convert to itself. -std::string utf8_to_utf8(const std::string& src) { - std::string dst; - write_utf8(dst, read_utf8(src)); - return dst; -} +namespace Amulet{ + // Validate a utf-8 byte sequence and convert to itself. + std::string utf8_to_utf8(const std::string& src) { + std::string dst; + write_utf8(dst, read_utf8(src)); + return dst; + } -CodePointVector read_utf8_escape(const std::string& src) { - return _read_utf8(src); -} + CodePointVector read_utf8_escape(const std::string& src) { + return _read_utf8(src); + } -void write_utf8_escape(std::string &dst, const CodePointVector& src) { - return _write_utf8(dst, src); -} + void write_utf8_escape(std::string &dst, const CodePointVector& src) { + return _write_utf8(dst, src); + } -// Decode a utf-8 escape byte sequence to a regular utf-8 byte sequence -std::string utf8_escape_to_utf8(const std::string& src) { - std::string dst; - write_utf8(dst, read_utf8_escape(src)); - return dst; -} + // Decode a utf-8 escape byte sequence to a regular utf-8 byte sequence + std::string utf8_escape_to_utf8(const std::string& src) { + std::string dst; + write_utf8(dst, read_utf8_escape(src)); + return dst; + } -// Encode a regular utf-8 byte sequence to a utf-8 escape byte sequence -std::string utf8_to_utf8_escape(const std::string& src) { - std::string dst; - write_utf8_escape(dst, read_utf8(src)); - return dst; + // Encode a regular utf-8 byte sequence to a utf-8 escape byte sequence + std::string utf8_to_utf8_escape(const std::string& src) { + std::string dst; + write_utf8_escape(dst, read_utf8(src)); + return dst; + } } diff --git a/src/amulet_nbt/include/amulet_nbt/string_encoding.hpp b/src/amulet_nbt/include/amulet_nbt/string_encoding.hpp new file mode 100644 index 00000000..3eaaf595 --- /dev/null +++ b/src/amulet_nbt/include/amulet_nbt/string_encoding.hpp @@ -0,0 +1,12 @@ +#pragma once + +#include +#include + +namespace Amulet { + std::string utf8_to_utf8(const std::string& src); + std::string utf8_escape_to_utf8(const std::string& src); + std::string utf8_to_utf8_escape(const std::string& src); + std::string mutf8_to_utf8(const std::string& src); + std::string utf8_to_mutf8(const std::string& src); +} diff --git a/src/amulet_nbt/pybind/amulet_nbt.cpp b/src/amulet_nbt/pybind/amulet_nbt.cpp index c920c6ff..7165035b 100644 --- a/src/amulet_nbt/pybind/amulet_nbt.cpp +++ b/src/amulet_nbt/pybind/amulet_nbt.cpp @@ -8,8 +8,11 @@ void init_string(py::module&); void init_array(py::module&); void init_list(py::module&); void init_compound(py::module&); + void init_named_tag(py::module&); +void init_bnbt(py::module& m); + PYBIND11_MODULE(_nbt, m) { init_abc(m); @@ -19,5 +22,8 @@ PYBIND11_MODULE(_nbt, m) { init_array(m); init_compound(m); init_list(m); + init_named_tag(m); + + init_bnbt(m); } diff --git a/src/amulet_nbt/pybind/bnbt.cpp b/src/amulet_nbt/pybind/bnbt.cpp new file mode 100644 index 00000000..3986990e --- /dev/null +++ b/src/amulet_nbt/pybind/bnbt.cpp @@ -0,0 +1,89 @@ +#include + +#include +#include +#include + +#include +#include + +namespace py = pybind11; + + +namespace Amulet { + class StringEncoding { + public: + Amulet::StringEncode encode; + Amulet::StringDecode decode; + StringEncoding( + Amulet::StringEncode encode, + Amulet::StringDecode decode + ): encode(encode), decode(decode) {}; + }; + + class EncodingPreset { + public: + bool compressed; + std::endian endianness; + Amulet::StringEncoding string_encoding; + EncodingPreset( + bool compressed, + std::endian endianness, + Amulet::StringEncoding string_encoding + ): compressed(compressed), endianness(endianness), string_encoding(string_encoding) {}; + }; + + class ReadOffset { + public: + size_t offset; + ReadOffset(): offset(0) {}; + ReadOffset(size_t offset): offset(offset) {}; + }; +} + + +void init_bnbt(py::module& m) { + py::class_ StringEncoding(m, "StringEncoding"); + StringEncoding.def( + "encode", + [](const Amulet::StringEncoding& self, py::bytes data) -> py::bytes { + return self.encode(data); + } + ); + StringEncoding.def( + "decode", + [](const Amulet::StringEncoding& self, py::bytes data) -> py::bytes { + return self.decode(data); + } + ); + + Amulet::StringEncoding utf8_encoding = Amulet::StringEncoding(Amulet::utf8_to_utf8, Amulet::utf8_to_utf8); + Amulet::StringEncoding utf8_escape_encoding = Amulet::StringEncoding(Amulet::utf8_to_utf8_escape, Amulet::utf8_escape_to_utf8); + Amulet::StringEncoding mutf8_encoding = Amulet::StringEncoding(Amulet::utf8_to_mutf8, Amulet::mutf8_to_utf8); + + m.attr("utf8_encoding") = utf8_encoding; + m.attr("utf8_escape_encoding") = utf8_escape_encoding; + m.attr("mutf8_encoding") = mutf8_encoding; + + py::class_ EncodingPreset(m, "EncodingPreset"); + EncodingPreset.def_readonly( + "compressed", + &Amulet::EncodingPreset::compressed + ); + EncodingPreset.def_property_readonly( + "little_endian", + [](const Amulet::EncodingPreset& self) { + return self.endianness == std::endian::little; + } + ); + EncodingPreset.def_readonly( + "string_encoding", + &Amulet::EncodingPreset::string_encoding + ); + + Amulet::EncodingPreset java_encoding = Amulet::EncodingPreset(true, std::endian::big, mutf8_encoding); + Amulet::EncodingPreset bedrock_encoding = Amulet::EncodingPreset(false, std::endian::little, utf8_escape_encoding); + + m.attr("java_encoding") = java_encoding; + m.attr("bedrock_encoding") = bedrock_encoding; +} diff --git a/src_/amulet_nbt/_string_encoding/_cpp/__init__.pxd b/src_/amulet_nbt/_string_encoding/_cpp/__init__.pxd deleted file mode 100644 index aa777608..00000000 --- a/src_/amulet_nbt/_string_encoding/_cpp/__init__.pxd +++ /dev/null @@ -1,4 +0,0 @@ -from libcpp.string cimport string - -ctypedef string (*CStringEncode)(const string&) -ctypedef string (*CStringDecode)(const string&) diff --git a/src_/amulet_nbt/_string_encoding/_cpp/mutf8.hpp b/src_/amulet_nbt/_string_encoding/_cpp/mutf8.hpp deleted file mode 100644 index a9a497e1..00000000 --- a/src_/amulet_nbt/_string_encoding/_cpp/mutf8.hpp +++ /dev/null @@ -1,10 +0,0 @@ -#pragma once - -#include -#include - -std::vector read_mutf8(const std::string& src); -void write_mutf8(std::string& dst, const std::vector& src); - -std::string mutf8_to_utf8(const std::string& src); -std::string utf8_to_mutf8(const std::string& src); diff --git a/src_/amulet_nbt/_string_encoding/_cpp/mutf8.pxd b/src_/amulet_nbt/_string_encoding/_cpp/mutf8.pxd deleted file mode 100644 index 14b7c025..00000000 --- a/src_/amulet_nbt/_string_encoding/_cpp/mutf8.pxd +++ /dev/null @@ -1,7 +0,0 @@ -# distutils: language = c++ - -from libcpp.string cimport string - -cdef extern from "mutf8.hpp" nogil: - string mutf8_to_utf8(const string&) - string utf8_to_mutf8(const string&) diff --git a/src_/amulet_nbt/_string_encoding/_cpp/utf8.hpp b/src_/amulet_nbt/_string_encoding/_cpp/utf8.hpp deleted file mode 100644 index 8a23aa1c..00000000 --- a/src_/amulet_nbt/_string_encoding/_cpp/utf8.hpp +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -#include -#include - -typedef std::vector CodePointVector; - -CodePointVector read_utf8(const std::string& src); -void write_utf8(std::string &dst, const CodePointVector& src); - -std::string utf8_to_utf8(const std::string& src); - -CodePointVector read_utf8_escape(const std::string& src); -void write_utf8_escape(std::string &dst, const CodePointVector& src); - -std::string utf8_escape_to_utf8(const std::string& src); -std::string utf8_to_utf8_escape(const std::string& src); diff --git a/src_/amulet_nbt/_string_encoding/_cpp/utf8.pxd b/src_/amulet_nbt/_string_encoding/_cpp/utf8.pxd deleted file mode 100644 index deaf53a2..00000000 --- a/src_/amulet_nbt/_string_encoding/_cpp/utf8.pxd +++ /dev/null @@ -1,8 +0,0 @@ -# distutils: language = c++ - -from libcpp.string cimport string - -cdef extern from "utf8.hpp" nogil: - string utf8_to_utf8(const string&) - string utf8_escape_to_utf8(const string&) - string utf8_to_utf8_escape(const string&) From 5ed7b2d4bf29f9a7d277313b64bc8d66b3b4f621 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Wed, 3 Jul 2024 13:09:50 +0100 Subject: [PATCH 042/121] Move is_shared_ptr into common --- src/amulet_nbt/cpp/tag/eq.cpp | 6 +----- src/amulet_nbt/include/amulet_nbt/common.hpp | 7 +++++++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/amulet_nbt/cpp/tag/eq.cpp b/src/amulet_nbt/cpp/tag/eq.cpp index 7d4330b5..8330d02c 100644 --- a/src/amulet_nbt/cpp/tag/eq.cpp +++ b/src/amulet_nbt/cpp/tag/eq.cpp @@ -1,14 +1,10 @@ #include #include +#include #include #include -template -struct is_shared_ptr : std::false_type {}; - -template -struct is_shared_ptr> : std::true_type {}; namespace Amulet{ bool NBTTag_eq(const Amulet::ByteTag a, const Amulet::ByteTag b){return a == b;}; diff --git a/src/amulet_nbt/include/amulet_nbt/common.hpp b/src/amulet_nbt/include/amulet_nbt/common.hpp index 5bc17c3c..37225472 100644 --- a/src/amulet_nbt/include/amulet_nbt/common.hpp +++ b/src/amulet_nbt/include/amulet_nbt/common.hpp @@ -2,6 +2,7 @@ #include #include +#include template constexpr size_t variant_index() { @@ -12,3 +13,9 @@ constexpr size_t variant_index() { return (variant_index()); } } + +template +struct is_shared_ptr : std::false_type {}; + +template +struct is_shared_ptr> : std::true_type {}; From 41e4deccb1dc680edb31d9797ac0e6e281c07d36 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Wed, 3 Jul 2024 13:10:34 +0100 Subject: [PATCH 043/121] Rename module_ --- src/amulet_nbt/pybind/tag/array.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/amulet_nbt/pybind/tag/array.cpp b/src/amulet_nbt/pybind/tag/array.cpp index ec83bd70..0bd973b5 100644 --- a/src/amulet_nbt/pybind/tag/array.cpp +++ b/src/amulet_nbt/pybind/tag/array.cpp @@ -130,7 +130,7 @@ namespace py = pybind11; void init_array(py::module& m) { - py::object asarray = py::module_::import("numpy").attr("asarray"); + py::object asarray = py::module::import("numpy").attr("asarray"); PyArray(ByteArrayTag, ByteTag, 8, 7) PyArray(IntArrayTag, IntTag, 32, 11) PyArray(LongArrayTag, LongTag, 64, 12) From b52a1e620f4237c1b280136a82ef07ddf2ab67a9 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Wed, 3 Jul 2024 13:12:46 +0100 Subject: [PATCH 044/121] Fix numerical constructors --- src/amulet_nbt/pybind/tag/int.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/amulet_nbt/pybind/tag/int.cpp b/src/amulet_nbt/pybind/tag/int.cpp index 680a3969..16601aa4 100644 --- a/src/amulet_nbt/pybind/tag/int.cpp +++ b/src/amulet_nbt/pybind/tag/int.cpp @@ -16,7 +16,7 @@ namespace py = pybind11; CLSNAME.def_property_readonly_static("tag_id", [](py::object) {return TAGID;});\ CLSNAME.def(\ py::init([](py::object value) {\ - return Amulet::CLSNAME##Wrapper(value.cast());\ + return Amulet::CLSNAME##Wrapper(py::int_(value).cast());\ }),\ py::arg("value") = 0,\ py::doc("__init__(self: amulet_nbt."#CLSNAME", value: typing.SupportsInt) -> None")\ From 7592da823a43a2a3a75885870c765e764c296e33 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Wed, 3 Jul 2024 13:13:15 +0100 Subject: [PATCH 045/121] Fix macro --- src/amulet_nbt/include/amulet_nbt/tag/nbt.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/amulet_nbt/include/amulet_nbt/tag/nbt.hpp b/src/amulet_nbt/include/amulet_nbt/tag/nbt.hpp index e9ca9f41..0ce42ac6 100644 --- a/src/amulet_nbt/include/amulet_nbt/tag/nbt.hpp +++ b/src/amulet_nbt/include/amulet_nbt/tag/nbt.hpp @@ -97,10 +97,10 @@ namespace Amulet { MACRO(4, "long", LongTag, Amulet::LongTag, Amulet::LongListTag)\ MACRO(5, "float", FloatTag, Amulet::FloatTag, Amulet::FloatListTag)\ MACRO(6, "double", DoubleTag, Amulet::DoubleTag, Amulet::DoubleListTag)\ - MACRO(7, "string", ByteArrayTag, Amulet::ByteArrayTagPtr, Amulet::ByteArrayListTag)\ - MACRO(8, "list", StringTag, Amulet::StringTag, Amulet::StringListTag)\ - MACRO(9, "compound", ListTag, Amulet::ListTagPtr, Amulet::ListListTag)\ - MACRO(10, "byte_array", CompoundTag, Amulet::CompoundTagPtr, Amulet::CompoundListTag)\ + MACRO(7, "byte_array", ByteArrayTag, Amulet::ByteArrayTagPtr, Amulet::ByteArrayListTag)\ + MACRO(8, "string", StringTag, Amulet::StringTag, Amulet::StringListTag)\ + MACRO(9, "list", ListTag, Amulet::ListTagPtr, Amulet::ListListTag)\ + MACRO(10, "compound", CompoundTag, Amulet::CompoundTagPtr, Amulet::CompoundListTag)\ MACRO(11, "int_array", IntArrayTag, Amulet::IntArrayTagPtr, Amulet::IntArrayListTag)\ MACRO(12, "long_array", LongArrayTag, Amulet::LongArrayTagPtr, Amulet::LongArrayListTag) From cbcfef06efff75ab9bb3245e48a69dfa4673589a Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Wed, 3 Jul 2024 13:13:38 +0100 Subject: [PATCH 046/121] Added function to unwrap node --- src/amulet_nbt/cpp/tag/wrapper.cpp | 11 ++++++++++- src/amulet_nbt/include/amulet_nbt/tag/wrapper.hpp | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/amulet_nbt/cpp/tag/wrapper.cpp b/src/amulet_nbt/cpp/tag/wrapper.cpp index 8b1d2a82..26347276 100644 --- a/src/amulet_nbt/cpp/tag/wrapper.cpp +++ b/src/amulet_nbt/cpp/tag/wrapper.cpp @@ -1,7 +1,7 @@ #include namespace Amulet { - WrapperNode wrap_node(Amulet::TagNode node){ + Amulet::WrapperNode wrap_node(Amulet::TagNode node){ switch(node.index()){ #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG) case ID: return Amulet::WrapperNode(TagWrapper(get(node))); FOR_EACH_LIST_TAG(CASE) @@ -10,4 +10,13 @@ namespace Amulet { #undef CASE } } + Amulet::TagNode unwrap_node(Amulet::WrapperNode node){ + switch(node.index()){ + #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG) case ID: return Amulet::TagNode(get>(node).tag); + FOR_EACH_LIST_TAG(CASE) + default: + return Amulet::TagNode(); + #undef CASE + } + } } diff --git a/src/amulet_nbt/include/amulet_nbt/tag/wrapper.hpp b/src/amulet_nbt/include/amulet_nbt/tag/wrapper.hpp index 40a53f42..389ef93b 100644 --- a/src/amulet_nbt/include/amulet_nbt/tag/wrapper.hpp +++ b/src/amulet_nbt/include/amulet_nbt/tag/wrapper.hpp @@ -66,4 +66,5 @@ namespace Amulet { > WrapperNode; WrapperNode wrap_node(Amulet::TagNode node); + Amulet::TagNode unwrap_node(WrapperNode node); } From 5c9a101504ab57967359df5a92e35d91fbf4f4ea Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Wed, 3 Jul 2024 13:29:24 +0100 Subject: [PATCH 047/121] Added compound tag Added python CompoundTag class. Added CompoundTagIterator to handle some some of the C++ gotchas. --- src/amulet_nbt/cpp/tag/compound.cpp | 25 + .../include/amulet_nbt/tag/compound.hpp | 21 + src/amulet_nbt/pybind/tag/compound.cpp | 436 +++++++++++++++++- 3 files changed, 480 insertions(+), 2 deletions(-) create mode 100644 src/amulet_nbt/cpp/tag/compound.cpp create mode 100644 src/amulet_nbt/include/amulet_nbt/tag/compound.hpp diff --git a/src/amulet_nbt/cpp/tag/compound.cpp b/src/amulet_nbt/cpp/tag/compound.cpp new file mode 100644 index 00000000..c3b67fa9 --- /dev/null +++ b/src/amulet_nbt/cpp/tag/compound.cpp @@ -0,0 +1,25 @@ +#include + +namespace Amulet { + CompoundTagIterator::CompoundTagIterator( + Amulet::CompoundTagPtr tag + ): tag(tag), begin(tag->begin()), end(tag->end()), pos(tag->begin()), size(tag->size()) {}; + + std::string CompoundTagIterator::next(){ + if (!is_valid()){ + throw std::exception("CompoundTag changed size during iteration."); + } + return (pos++)->first; + }; + + bool CompoundTagIterator::has_next(){ + return pos != end; + }; + + bool CompoundTagIterator::is_valid(){ + // This is not fool proof. + // There are cases where this is true but the iterator is invalid. + // The programmer should write good code and this will catch some of the bad cases. + return size == tag->size() && begin == tag->begin() && end == tag->end(); + }; +} diff --git a/src/amulet_nbt/include/amulet_nbt/tag/compound.hpp b/src/amulet_nbt/include/amulet_nbt/tag/compound.hpp new file mode 100644 index 00000000..c6b18372 --- /dev/null +++ b/src/amulet_nbt/include/amulet_nbt/tag/compound.hpp @@ -0,0 +1,21 @@ +// Utility functions for the CompoundTag + +#pragma once + +#include + +namespace Amulet { + class CompoundTagIterator { + private: + Amulet::CompoundTagPtr tag; + const Amulet::CompoundTag::iterator begin; + const Amulet::CompoundTag::iterator end; + Amulet::CompoundTag::iterator pos; + size_t size; + public: + CompoundTagIterator(Amulet::CompoundTagPtr tag); + std::string next(); + bool has_next(); + bool is_valid(); + }; +} diff --git a/src/amulet_nbt/pybind/tag/compound.cpp b/src/amulet_nbt/pybind/tag/compound.cpp index 6dc28480..fbab115c 100644 --- a/src/amulet_nbt/pybind/tag/compound.cpp +++ b/src/amulet_nbt/pybind/tag/compound.cpp @@ -1,12 +1,444 @@ -#include +#include #include #include #include +#include +#include +#include +#include + namespace py = pybind11; + +void CompoundTag_update(Amulet::CompoundTag& self, py::dict other){ + auto map = other.cast>(); + for (auto it = map.begin(); it != map.end(); it++){ + if (it->second.index() == 0){ + throw std::invalid_argument("Value cannot be None"); + } + self[it->first] = unwrap_node(it->second); + } +} + + void init_compound(py::module& m) { - py::class_ CompoundTag(m, "CompoundTag"); + py::class_ CompoundTagIterator(m, "CompoundTagIterator"); + CompoundTagIterator.def( + "__next__", + [](Amulet::CompoundTagIterator& self) -> py::object { + if (self.has_next()){ + std::string key = self.next(); + try { + return py::str(key); + } catch (py::error_already_set&){ + return py::bytes(key); + } + } + throw py::stop_iteration(""); + } + ); + CompoundTagIterator.def( + "__iter__", + [](Amulet::CompoundTagIterator& self){ + return self; + } + ); + + py::object AbstractBaseTag = m.attr("AbstractBaseTag"); + py::object isinstance = py::module::import("builtins").attr("isinstance"); + + py::class_ CompoundTag(m, "CompoundTag", + "A Python wrapper around a C++ unordered map.\n" + "\n" + "Note that this class is not thread safe and inherits all the limitations of a C++ unordered_map." + ); CompoundTag.def_property_readonly_static("tag_id", [](py::object) {return 10;}); + CompoundTag.def( + py::init([](py::object value, const py::kwargs& kwargs) { + Amulet::CompoundTagPtr tag = std::make_shared(); + CompoundTag_update(*tag, py::dict(value)); + CompoundTag_update(*tag, kwargs); + return Amulet::CompoundTagWrapper(tag); + }), + py::arg("value") = py::tuple() + ); + auto py_getter = [](const Amulet::CompoundTagWrapper& self){ + py::dict out; + for (auto it = self.tag->begin(); it != self.tag->end(); it++){ + py::object value = py::cast(Amulet::wrap_node(it->second)); + try { + py::str key = py::str(it->first); + out[key] = value; + } catch (py::error_already_set&){ + py::bytes key = py::bytes(it->first); + out[key] = value; + } + } + }; + CompoundTag.def_property_readonly( + "py_dict", + py_getter, + py::doc("A shallow copy of the CompoundTag as a python dictionary.") + ); + CompoundTag.def_property_readonly( + "py_data", + py_getter, + py::doc( + "A python representation of the class. Note that the return type is undefined and may change in the future.\n" + "\n" + "You would be better off using the py_{type} or np_array properties if you require a fixed type.\n" + "This is here for convenience to get a python representation under the same property name.\n" + ) + ); + CompoundTag.def( + "__repr__", + [](const Amulet::CompoundTagWrapper& self){ + std::string out; + out += "CompoundTag({"; + for (auto it = self.tag->begin(); it != self.tag->end(); it++){ + if (it != self.tag->begin()){out += ", ";} + try { + out += py::repr(py::str(it->first)); + } catch (py::error_already_set&){ + out += py::repr(py::bytes(it->first)); + } + out += ": "; + out += py::repr(py::cast(Amulet::wrap_node(it->second))); + } + out += "})"; + return out; + } + ); + CompoundTag.def( + "__str__", + [](const Amulet::CompoundTagWrapper& self){ + return py::str(py::dict(py::cast(self))); + } + ); + CompoundTag.def( + "__eq__", + [](const Amulet::CompoundTagWrapper& self, const Amulet::CompoundTagWrapper& other){ + return Amulet::NBTTag_eq(self.tag, other.tag); + }, + py::is_operator() + ); + CompoundTag.def( + "__len__", + [](const Amulet::CompoundTagWrapper& self){ + return self.tag->size(); + } + ); + CompoundTag.def( + "__bool__", + [](const Amulet::CompoundTagWrapper& self){ + return !self.tag->empty(); + } + ); + CompoundTag.def( + "__iter__", + [](const Amulet::CompoundTagWrapper& self){ + return Amulet::CompoundTagIterator(self.tag); + } + ); + CompoundTag.def( + "__getitem__", + [](const Amulet::CompoundTagWrapper& self, std::string key){ + auto it = self.tag->find(key); + if (it == self.tag->end()){ + throw py::key_error(key); + } + return Amulet::wrap_node(it->second); + } + ); + CompoundTag.def( + "get", + [isinstance](const Amulet::CompoundTagWrapper& self, std::string key, py::object default_, py::object cls) -> py::object { + auto it = self.tag->find(key); + if (it == self.tag->end()){ + return default_; + } + py::object tag = py::cast(Amulet::wrap_node(it->second)); + if (isinstance(tag, cls)){ + return tag; + } else { + return default_; + } + }, + py::arg("key"), py::arg("default") = py::none(), py::arg("cls") = AbstractBaseTag, + py::doc( + "Get an item from the CompoundTag.\n" + "\n" + ":param key: The key to get\n" + ":param default: The value to return if the key does not exist or the type is wrong.\n" + ":param cls: The class that the stored tag must inherit from. If the type is incorrect default is returned.\n" + ":return: The tag stored in the CompoundTag if the type is correct else default.\n" + ":raises: KeyError if the key does not exist.\n" + ":raises: TypeError if the stored type is not a subclass of cls." + ) + ); + CompoundTag.def( + "__contains__", + [](const Amulet::CompoundTagWrapper& self, std::string key){ + auto it = self.tag->find(key); + return it != self.tag->end(); + } + ); + py::object KeysView = py::module::import("collections.abc").attr("KeysView"); + CompoundTag.def( + "keys", + [KeysView](const Amulet::CompoundTagWrapper& self){ + return KeysView(py::cast(self)); + } + ); + py::object ItemsView = py::module::import("collections.abc").attr("ItemsView"); + CompoundTag.def( + "items", + [ItemsView](const Amulet::CompoundTagWrapper& self){ + return ItemsView(py::cast(self)); + } + ); + py::object ValuesView = py::module::import("collections.abc").attr("ValuesView"); + CompoundTag.def( + "values", + [ValuesView](const Amulet::CompoundTagWrapper& self){ + return ValuesView(py::cast(self)); + } + ); + CompoundTag.def( + "__setitem__", + [](const Amulet::CompoundTagWrapper& self, std::string key, Amulet::WrapperNode value){ + if (value.index() == 0){ + throw std::invalid_argument("Value cannot be None"); + } + (*self.tag)[key] = Amulet::unwrap_node(value); + } + ); + CompoundTag.def( + "__delitem__", + [](const Amulet::CompoundTagWrapper& self, std::string key){ + auto it = self.tag->find(key); + if (it == self.tag->end()){ + throw py::key_error(key); + } + self.tag->erase(it); + } + ); + py::object marker = py::module::import("builtins").attr("object")(); + CompoundTag.def( + "pop", + [marker](const Amulet::CompoundTagWrapper& self, std::string key, py::object default_) -> py::object { + auto it = self.tag->find(key); + if (it == self.tag->end()){ + if (default_.is(marker)){ + throw py::key_error(key); + } else { + return default_; + } + } + Amulet::WrapperNode tag = Amulet::wrap_node(it->second); + self.tag->erase(it); + return py::cast(tag); + }, + py::arg("key"), py::arg("default") = marker + ); + CompoundTag.def( + "popitem", + [](const Amulet::CompoundTagWrapper& self) -> std::pair, Amulet::WrapperNode>{ + auto it = self.tag->begin(); + if (it == self.tag->end()){ + throw py::key_error("CompoundTag is empty."); + } + std::string key = it->first; + Amulet::WrapperNode value = Amulet::wrap_node(it->second); + self.tag->erase(it); + try { + py::str py_key = py::str(key); + return std::make_pair(py_key, value); + } catch (py::error_already_set&){ + py::bytes py_key = py::bytes(key); + return std::make_pair(py_key, value); + } + } + ); + CompoundTag.def( + "clear", + [](const Amulet::CompoundTagWrapper& self){ + self.tag->clear(); + } + ); + CompoundTag.def( + "update", + [](const Amulet::CompoundTagWrapper& self, py::object other, const py::kwargs& kwargs){ + CompoundTag_update(*self.tag, py::dict(other)); + CompoundTag_update(*self.tag, kwargs); + }, + py::arg("other") = py::tuple(), py::pos_only() + ); + CompoundTag.def( + "setdefault", + [isinstance](const Amulet::CompoundTagWrapper& self, std::string key, Amulet::WrapperNode tag, py::object cls) -> py::object { + auto set_value = [self, key, tag](){ + if (tag.index() == 0){ + throw std::invalid_argument("Cannot setdefault a value of None."); + } + (*self.tag)[key] = Amulet::unwrap_node(tag); + return py::cast(tag); + }; + auto it = self.tag->find(key); + if (it == self.tag->end()){ + return set_value(); + } + py::object existing_tag = py::cast(Amulet::wrap_node(it->second)); + if (!isinstance(existing_tag, cls)){ + // if the key exists but has the wrong type then set it + return set_value(); + } + return existing_tag; + }, + py::arg("key"), py::arg("tag") = py::none(), py::arg("cls") = AbstractBaseTag + ); + CompoundTag.def_static( + "fromkeys", + [](py::object keys, Amulet::WrapperNode value){ + if (value.index() == 0){ + throw std::invalid_argument("Value cannot be None"); + } + Amulet::TagNode node = Amulet::unwrap_node(value); + Amulet::CompoundTagPtr tag = std::make_shared(); + for (std::string& key: keys.cast>()){ + (*tag)[key] = node; + } + return Amulet::CompoundTagWrapper(tag); + } + ); + + #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG)\ + CompoundTag.def(\ + "get_"TAG_NAME,\ + [](\ + const Amulet::CompoundTagWrapper& self,\ + std::string key,\ + std::variant> default_,\ + bool raise_errors\ + ) -> std::variant> {\ + auto it = self.tag->find(key);\ + if (it == self.tag->end()){\ + if (raise_errors){\ + throw pybind11::key_error(key);\ + } else {\ + return default_;\ + }\ + }\ + py::object tag = py::cast(Amulet::wrap_node(it->second));\ + if (py::isinstance>(tag)){\ + return tag.cast>();\ + } else if (raise_errors){\ + throw pybind11::type_error(key);\ + } else {\ + return default_;\ + }\ + },\ + py::arg("key"), py::arg("default") = py::none(), py::arg("raise_errors") = false,\ + py::doc(\ + "Get the tag stored in key if it is a "#TAG".\n"\ + "\n"\ + ":param key: The key to get\n"\ + ":param default: The value to return if the key does not exist or the type is wrong.\n"\ + ":param raise_errors: If True, KeyError and TypeError are raise on error. If False, default is returned on error.\n"\ + ":return: The "#TAG".\n"\ + ":raises: KeyError if the key does not exist and raise_errors is True.\n"\ + ":raises: TypeError if the stored type is not a "#TAG" and raise_errors is True."\ + )\ + );\ + CompoundTag.def(\ + "setdefault_"TAG_NAME,\ + [isinstance](\ + const Amulet::CompoundTagWrapper& self,\ + std::string key,\ + std::variant> default_\ + ) -> std::variant> {\ + auto set_and_return = [self, key](TAG_STORAGE tag){\ + Amulet::TagNode node(tag);\ + (*self.tag)[key] = node;\ + return Amulet::TagWrapper(tag);\ + };\ + auto create_set_return = [set_and_return, default_](){\ + if (default_.index() == 0){\ + if constexpr (is_shared_ptr::value){\ + return set_and_return(std::make_shared());\ + } else {\ + return set_and_return(TAG_STORAGE());\ + }\ + } else {\ + return set_and_return(std::get>(default_).tag);\ + }\ + };\ + auto it = self.tag->find(key);\ + if (it == self.tag->end()){\ + return create_set_return();\ + }\ + py::object existing_tag = py::cast(Amulet::wrap_node(it->second));\ + if (py::isinstance>(existing_tag)){\ + return existing_tag.cast>();\ + } else {\ + /* if the key exists but has the wrong type then set it */\ + return create_set_return();\ + }\ + },\ + py::arg("key"), py::arg("default") = py::none(),\ + py::doc(\ + "Populate key if not defined or value is not "#TAG". Return the value stored\n."\ + "\n"\ + "If default is a "#TAG" then it will be stored under key else a default instance will be created.\n"\ + "\n"\ + ":param key: The key to populate and get\n"\ + ":param default: The default value to use. If None, the default "#TAG" is used.\n"\ + ":return: The "#TAG" stored in key"\ + )\ + );\ + CompoundTag.def(\ + "pop_"TAG_NAME,\ + [marker](\ + const Amulet::CompoundTagWrapper& self,\ + std::string key,\ + std::variant> default_,\ + bool raise_errors\ + ) -> std::variant> {\ + auto it = self.tag->find(key);\ + if (it == self.tag->end()){\ + if (raise_errors){\ + throw py::key_error(key);\ + } else {\ + return default_;\ + }\ + }\ + py::object existing_tag = py::cast(Amulet::wrap_node(it->second));\ + if (py::isinstance>(existing_tag)){\ + self.tag->erase(it);\ + return existing_tag.cast>();\ + } else if (raise_errors){\ + throw pybind11::type_error(key);\ + } else {\ + return default_;\ + }\ + },\ + py::arg("key"), py::arg("default") = py::none(), py::arg("raise_errors") = false,\ + py::doc(\ + "Remove the specified key and return the corresponding value if it is a "#TAG".\n"\ + "\n"\ + "If the key exists but the type is incorrect, the value will not be removed.\n"\ + "\n"\ + ":param key: The key to get and remove\n"\ + ":param default: The value to return if the key does not exist or the type is wrong.\n"\ + ":param raise_errors: If True, KeyError and TypeError are raise on error. If False, default is returned on error.\n"\ + ":return: The "#TAG".\n"\ + ":raises: KeyError if the key does not exist and raise_errors is True.\n"\ + ":raises: TypeError if the stored type is not a "#TAG" and raise_errors is True."\ + )\ + );\ + + FOR_EACH_LIST_TAG(CASE) + #undef CASE } From 6523f67c7020be9c1d1d2fe01cd790704617d4d4 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Thu, 4 Jul 2024 10:45:13 +0100 Subject: [PATCH 048/121] Added NamedTag --- src/amulet_nbt/__init__.py | 2 +- src/amulet_nbt/pybind/tag/named_tag.cpp | 142 +++++++++++++++++++++++- 2 files changed, 141 insertions(+), 3 deletions(-) diff --git a/src/amulet_nbt/__init__.py b/src/amulet_nbt/__init__.py index c2cc8941..abc45ee9 100644 --- a/src/amulet_nbt/__init__.py +++ b/src/amulet_nbt/__init__.py @@ -52,7 +52,7 @@ def get_include() -> str: IntArrayTag as TAG_Int_Array, LongArrayTag as TAG_Long_Array, - # NamedTag, + NamedTag, # load, # load_array, diff --git a/src/amulet_nbt/pybind/tag/named_tag.cpp b/src/amulet_nbt/pybind/tag/named_tag.cpp index 05445a32..53ebc64a 100644 --- a/src/amulet_nbt/pybind/tag/named_tag.cpp +++ b/src/amulet_nbt/pybind/tag/named_tag.cpp @@ -1,11 +1,149 @@ -#include - #include #include #include +#include +#include +#include + namespace py = pybind11; + +namespace AmuletPy { + class NamedTagIterator { + private: + py::object named_tag; + size_t index; + public: + NamedTagIterator(py::object named_tag): named_tag(named_tag), index(0){} + py::object next(){ + switch(index){ + case 0: + index++; + return named_tag.attr("name"); + case 1: + index++; + return named_tag.attr("tag"); + default: + throw pybind11::stop_iteration(""); + } + } + }; +} + + void init_named_tag(py::module& m) { + py::class_ NamedTagIterator(m, "NamedTagIterator"); + NamedTagIterator.def( + "__next__", + &AmuletPy::NamedTagIterator::next + ); + NamedTagIterator.def( + "__iter__", + [](AmuletPy::NamedTagIterator& self){ + return self; + } + ); + + py::class_ NamedTag(m, "NamedTag"); + NamedTag.def( + py::init([](Amulet::WrapperNode tag, std::string name) { + if (tag.index() == 0){ + return Amulet::NamedTag(name, std::make_shared()); + } else { + return Amulet::NamedTag(name, Amulet::unwrap_node(tag)); + } + }), + py::arg("tag") = py::none(), py::arg("name") = "" + ); + NamedTag.def_property( + "name", + [](const Amulet::NamedTag& self) -> py::object { + try { + return py::str(self.name); + } catch (py::error_already_set&){ + return py::bytes(self.name); + } + }, + [](Amulet::NamedTag& self, std::string name){ + self.name = name; + } + ); + NamedTag.def_property( + "tag", + [](const Amulet::NamedTag& self){ + return Amulet::wrap_node(self.tag_node); + }, + [](Amulet::NamedTag& self, Amulet::WrapperNode tag){ + if (tag.index() == 0){ + throw std::invalid_argument("tag cannot be None"); + } + self.tag_node = Amulet::unwrap_node(tag); + } + ); + NamedTag.def( + "__repr__", + [](const Amulet::NamedTag& self){ + std::string out; + out += "NamedTag("; + try { + out += py::repr(py::str(self.name)); + } catch (py::error_already_set&){ + out += py::repr(py::bytes(self.name)); + } + out += ", "; + out += py::repr(py::cast(Amulet::wrap_node(self.tag_node))); + out += ")"; + return out; + } + ); + NamedTag.def( + "__eq__", + [](const Amulet::NamedTag& self, const Amulet::NamedTag& other){ + return self.name == other.name && Amulet::NBTTag_eq(self.tag_node, other.tag_node); + }, + py::is_operator() + ); + NamedTag.def( + "__getitem__", + [](const Amulet::NamedTag& self, Py_ssize_t item) -> py::object { + if (item < 0){ + item += 2; + } + switch (item){ + case 0: + return py::cast(self).attr("name"); + case 1: + return py::cast(self).attr("tag"); + default: + throw std::out_of_range("Index out of range"); + } + } + ); + NamedTag.def( + "__iter__", + [](const Amulet::NamedTag& self){ + return AmuletPy::NamedTagIterator(py::cast(self)); + } + ); + + #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG)\ + NamedTag.def_property_readonly(\ + TAG_NAME,\ + [](const Amulet::NamedTag& self){\ + if (self.tag_node.index() != ID){\ + throw pybind11::type_error("tag_node is not a "#TAG);\ + }\ + return Amulet::TagWrapper(std::get(self.tag_node));\ + },\ + py::doc(\ + "Get the tag if it is a "#TAG".\n"\ + "\n"\ + ":return: The "#TAG".\n"\ + ":raises: TypeError if the stored type is not a "#TAG\ + )\ + );\ + FOR_EACH_LIST_TAG(CASE) + #undef CASE } From 537793ef04ad4e26e14288d8fc662cad07d7df98 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Thu, 4 Jul 2024 11:18:09 +0100 Subject: [PATCH 049/121] Added binary load functions --- src/amulet_nbt/__init__.py | 12 +- .../cpp/nbt_encoding/binary/read.cpp | 187 ++++++++++++ .../include/amulet_nbt/io/binary_reader.hpp | 90 ++++++ .../amulet_nbt/nbt_encoding/binary.hpp | 16 ++ src/amulet_nbt/pybind/bnbt.cpp | 271 ++++++++++++++++++ 5 files changed, 567 insertions(+), 9 deletions(-) create mode 100644 src/amulet_nbt/cpp/nbt_encoding/binary/read.cpp create mode 100644 src/amulet_nbt/include/amulet_nbt/io/binary_reader.hpp create mode 100644 src/amulet_nbt/include/amulet_nbt/nbt_encoding/binary.hpp diff --git a/src/amulet_nbt/__init__.py b/src/amulet_nbt/__init__.py index abc45ee9..2577b6ce 100644 --- a/src/amulet_nbt/__init__.py +++ b/src/amulet_nbt/__init__.py @@ -54,20 +54,14 @@ def get_include() -> str: NamedTag, - # load, - # load_array, - # ReadOffset, + load, + load_array, + ReadOffset, # from_snbt, # NBTError, # NBTLoadError, # NBTFormatError, # SNBTParseError, - # SNBTType, - # IntType, - # FloatType, - # NumberType, - # ArrayType, - # AnyNBT, StringEncoding, mutf8_encoding, utf8_encoding, diff --git a/src/amulet_nbt/cpp/nbt_encoding/binary/read.cpp b/src/amulet_nbt/cpp/nbt_encoding/binary/read.cpp new file mode 100644 index 00000000..e6adf16a --- /dev/null +++ b/src/amulet_nbt/cpp/nbt_encoding/binary/read.cpp @@ -0,0 +1,187 @@ +#include + +Amulet::StringTag read_string_tag(Amulet::BinaryReader& reader){ + std::uint16_t length = reader.readNumeric(); + return reader.readString(length); +}; + + +Amulet::TagNode read_node(Amulet::BinaryReader& reader, std::uint8_t tag_id); + + +Amulet::CompoundTagPtr read_compound_tag(Amulet::BinaryReader& reader){ + Amulet::CompoundTagPtr tag = std::make_shared(); + while (true){ + std::uint8_t tag_id = reader.readNumeric(); + if (tag_id == 0){ + break; + } + Amulet::StringTag name = read_string_tag(reader); + Amulet::TagNode node = read_node(reader, tag_id); + (*tag)[name] = node; + } + return tag; +}; + + +template +std::shared_ptr> read_array_tag(Amulet::BinaryReader& reader){ + std::int32_t length = reader.readNumeric(); + if (length < 0){length = 0;} + std::shared_ptr> tag = std::make_shared>(length); + for (std::int32_t i = 0; i < length; i++){ + reader.readNumericInto((*tag)[i]); + } + return tag; +} + + +template +Amulet::ListTagPtr read_numeric_list_tag(Amulet::BinaryReader& reader){ + std::int32_t length = reader.readNumeric(); + if (length < 0){length = 0;} + Amulet::ListTagPtr tag = std::make_shared(std::vector(length)); + std::vector& list = std::get>(*tag); + for (std::int32_t i = 0; i < length; i++){ + reader.readNumericInto(list[i]); + } + return tag; +} + + +template +Amulet::ListTagPtr read_template_list_tag(Amulet::BinaryReader& reader){ + std::int32_t length = reader.readNumeric(); + if (length < 0){length = 0;} + Amulet::ListTagPtr tag = std::make_shared(std::vector(length)); + std::vector& list = std::get>(*tag); + for (std::int32_t i = 0; i < length; i++){ + list[i] = readTag(reader); + } + return tag; +} + + +Amulet::ListTagPtr read_void_list_tag(Amulet::BinaryReader& reader){ + std::int32_t length = reader.readNumeric(); + if (length < 0){length = 0;} + if (length != 0){throw std::runtime_error("Void list tag must have a length of 0");} + return std::make_shared(); +} + + +Amulet::ListTagPtr read_list_tag(Amulet::BinaryReader& reader){ + std::uint8_t tag_type = reader.readNumeric(); + switch(tag_type){ + case 0: + return read_void_list_tag(reader); + case 1: + return read_numeric_list_tag(reader); + case 2: + return read_numeric_list_tag(reader); + case 3: + return read_numeric_list_tag(reader); + case 4: + return read_numeric_list_tag(reader); + case 5: + return read_numeric_list_tag(reader); + case 6: + return read_numeric_list_tag(reader); + case 7: + return read_template_list_tag>(reader); + case 8: + return read_template_list_tag(reader); + case 9: + return read_template_list_tag(reader); + case 10: + return read_template_list_tag(reader); + case 11: + return read_template_list_tag>(reader); + case 12: + return read_template_list_tag>(reader); + default: + throw std::runtime_error("This shouldn't happen"); + } +}; + + +Amulet::TagNode read_node(Amulet::BinaryReader& reader, std::uint8_t tag_id){ + Amulet::TagNode node; + switch(tag_id){ + case 1: + node = reader.readNumeric(); + break; + case 2: + node = reader.readNumeric(); + break; + case 3: + node = reader.readNumeric(); + break; + case 4: + node = reader.readNumeric(); + break; + case 5: + node = reader.readNumeric(); + break; + case 6: + node = reader.readNumeric(); + break; + case 8: + node = read_string_tag(reader); + break; + case 9: + node = read_list_tag(reader); + break; + case 10: + node = read_compound_tag(reader); + break; + case 7: + node = read_array_tag(reader); + break; + case 11: + node = read_array_tag(reader); + break; + case 12: + node = read_array_tag(reader); + break; + default: + throw std::runtime_error("Unsupported tag type"); + } + return node; +}; + + +namespace Amulet { + Amulet::NamedTag read_named_tag(Amulet::BinaryReader& reader){ + std::uint8_t tag_id = reader.readNumeric(); + std::string name = read_string_tag(reader); + Amulet::TagNode node = read_node(reader, tag_id); + return Amulet::NamedTag(name, node); + } + + // Read one named tag from the string at position offset. + Amulet::NamedTag read_named_tag(const std::string& raw, std::endian endianness, Amulet::StringDecode stringDecode, size_t& offset){ + Amulet::BinaryReader reader(raw, offset, endianness, stringDecode); + return read_named_tag(reader); + } + + // Read count named tags from the string at position offset. + std::vector read_named_tags(const std::string& raw, std::endian endianness, Amulet::StringDecode stringDecode, size_t& offset, size_t count){ + Amulet::BinaryReader reader(raw, offset, endianness, stringDecode); + std::vector out; + for (size_t i = 0; i < count; i++){ + out.push_back(read_named_tag(reader)); + } + return out; + } + + // Read all named tags from the string at position offset. + std::vector read_named_tags(const std::string& raw, std::endian endianness, Amulet::StringDecode stringDecode, size_t& offset){ + Amulet::BinaryReader reader(raw, offset, endianness, stringDecode); + std::vector out; + while (reader.has_more_data()){ + out.push_back(read_named_tag(reader)); + } + return out; + } +} diff --git a/src/amulet_nbt/include/amulet_nbt/io/binary_reader.hpp b/src/amulet_nbt/include/amulet_nbt/io/binary_reader.hpp new file mode 100644 index 00000000..03e63bd8 --- /dev/null +++ b/src/amulet_nbt/include/amulet_nbt/io/binary_reader.hpp @@ -0,0 +1,90 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include + + +namespace Amulet { + typedef std::function StringDecode; + + + class BinaryReader { + private: + const std::string& data; + size_t& position; + std::endian endianness; + StringDecode stringDecode; + + public: + BinaryReader( + const std::string& input, + size_t& position, + std::endian endianness, + StringDecode stringDecode + ) + : data(input), position(position), endianness(endianness), stringDecode(stringDecode) {} + + /** + * Read a numeric type from the buffer into the given value and fix its endianness. + */ + template inline void readNumericInto(T& value) { + // Ensure the buffer is long enough + if (position + sizeof(T) > data.size()) { + throw std::out_of_range(std::string("Cannot read ") + typeid(T).name() + " at position " + std::to_string(position)); + } + + // Create + const char* src = &data[position]; + char* dst = (char*)&value; + + // Copy + if (endianness == std::endian::native){ + for (size_t i = 0; i < sizeof(T); i++){ + dst[i] = src[i]; + } + } else { + for (size_t i = 0; i < sizeof(T); i++){ + dst[i] = src[sizeof(T) - i - 1]; + } + } + + // Increment position + position += sizeof(T); + } + + /** + * Read a numeric type from the buffer and fix its endianness. + * + * @return A value of the requested type. + */ + template inline T readNumeric() { + T value; + readNumericInto(value); + return value; + } + + std::string readString(size_t length) { + // Ensure the buffer is long enough + if (position + length > data.size()) { + throw std::out_of_range("Cannot read string at position " + std::to_string(position)); + } + + std::string value = data.substr(position, length); + position += length; + return stringDecode(value); + } + + size_t getPosition(){ + return position; + } + + bool has_more_data(){ + return position < data.size(); + } + }; +} diff --git a/src/amulet_nbt/include/amulet_nbt/nbt_encoding/binary.hpp b/src/amulet_nbt/include/amulet_nbt/nbt_encoding/binary.hpp new file mode 100644 index 00000000..20b7837f --- /dev/null +++ b/src/amulet_nbt/include/amulet_nbt/nbt_encoding/binary.hpp @@ -0,0 +1,16 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace Amulet { + Amulet::NamedTag read_named_tag(const std::string&, std::endian, Amulet::StringDecode, size_t& offset); + std::vector read_named_tags(const std::string&, std::endian, Amulet::StringDecode, size_t& offset); + std::vector read_named_tags(const std::string&, std::endian, Amulet::StringDecode, size_t& offset, size_t count); +} diff --git a/src/amulet_nbt/pybind/bnbt.cpp b/src/amulet_nbt/pybind/bnbt.cpp index 3986990e..0f2851f6 100644 --- a/src/amulet_nbt/pybind/bnbt.cpp +++ b/src/amulet_nbt/pybind/bnbt.cpp @@ -86,4 +86,275 @@ void init_bnbt(py::module& m) { m.attr("java_encoding") = java_encoding; m.attr("bedrock_encoding") = bedrock_encoding; + + py::class_ ReadOffset(m, "ReadOffset"); + ReadOffset.def( + py::init(), + py::arg("offset") = 0 + ); + ReadOffset.def_readonly("offset", &Amulet::ReadOffset::offset); + + py::object decompress = py::module::import("gzip").attr("decompress"); + py::object BadGzipFile = py::module::import("gzip").attr("BadGzipFile"); + py::object zlib_error = py::module::import("zlib").attr("error"); + + auto get_buffer = [decompress, BadGzipFile, zlib_error]( + py::object filepath_or_buffer, + bool compressed + ) -> std::string { + std::string data; + + if (py::isinstance(filepath_or_buffer)){ + std::string file_path = filepath_or_buffer.cast(); + std::ifstream file(file_path, std::ios::binary); + if (!file){ + throw std::invalid_argument("Could not open file: " + file_path); + } + file.seekg(0, std::ios::end); + std::streampos file_size = file.tellg(); + file.seekg(0, std::ios::beg); + data.resize(file_size); + file.read(&data[0], file_size); + } else if (py::isinstance(filepath_or_buffer)){ + data = filepath_or_buffer.cast(); + } else if (py::isinstance(filepath_or_buffer)){ + data = filepath_or_buffer.attr("tobytes")().cast(); + } else if (py::hasattr(filepath_or_buffer, "read")){ + data = filepath_or_buffer.attr("read")().cast(); + } else { + throw std::invalid_argument("filepath_or_buffer must be a path string, bytes, memory view or an object with a read method."); + } + + if (compressed){ + try { + // TODO: move this to C++ + data = decompress(py::bytes((data))).cast(); + } catch (py::error_already_set& e){ + if (!( + e.matches(BadGzipFile) || + e.matches(PyExc_EOFError) || + e.matches(zlib_error) + )){ + throw; + } + } + } + return data; + }; + + auto load = [get_buffer]( + py::object filepath_or_buffer, + bool compressed, + std::endian endianness, + Amulet::StringDecode string_decoder, + py::object read_offset_py + ){ + std::string buffer = get_buffer(filepath_or_buffer, compressed); + if (py::isinstance(read_offset_py)){ + Amulet::ReadOffset& read_offset = read_offset_py.cast(); + return Amulet::read_named_tag( + buffer, + endianness, + string_decoder, + read_offset.offset + ); + } else if (read_offset_py.is(py::none())){ + size_t offset = 0; + return Amulet::read_named_tag( + buffer, + endianness, + string_decoder, + offset + ); + } else { + throw std::invalid_argument("read_offset must be ReadOffset or None"); + } + }; + + m.def( + "load", + [load]( + py::object filepath_or_buffer, + Amulet::EncodingPreset preset, + py::object read_offset + ){ + return load( + filepath_or_buffer, + preset.compressed, + preset.endianness, + preset.string_encoding.decode, + read_offset + ); + }, + py::arg("filepath_or_buffer"), + py::kw_only(), + py::arg("preset") = java_encoding, + py::arg("read_offset") = py::none(), + py::doc( + "Load one binary NBT object.\n" + "\n" + ":param filepath_or_buffer: A string path to a file on disk, a bytes or memory view object containing the binary NBT or a file-like object to read the binary data from.\n" + ":param preset: The encoding preset. If this is defined little_endian and string_encoding have no effect.\n" + ":param read_offset: Optional ReadOffset object to get read end offset.\n" + ":raises: NBTLoadError if an error occurred when loading the data." + ) + ); + m.def( + "load", + [load]( + py::object filepath_or_buffer, + bool compressed, + bool little_endian, + Amulet::StringEncoding string_encoding, + py::object read_offset + ){ + return load( + filepath_or_buffer, + compressed, + little_endian ? std::endian::little : std::endian::big, + string_encoding.decode, + read_offset + ); + }, + py::arg("filepath_or_buffer"), + py::kw_only(), + py::arg("compressed") = true, + py::arg("little_endian") = false, + py::arg("string_encoding") = mutf8_encoding, + py::arg("read_offset") = py::none(), + py::doc( + "Load one binary NBT object.\n" + "\n" + ":param filepath_or_buffer: A string path to a file on disk, a bytes or memory view object containing the binary NBT or a file-like object to read the binary data from.\n" + ":param compressed: Is the binary data gzip compressed.\n" + ":param little_endian: Are the numerical values stored as little endian. True for Bedrock, False for Java.\n" + ":param string_encoding: The bytes decoder function to parse strings. mutf8_encoding for Java, utf8_escape_encoding for Bedrock.\n" + ":param read_offset: Optional ReadOffset object to get read end offset.\n" + ":raises: NBTLoadError if an error occurred when loading the data." + ) + ); + + auto load_array = [get_buffer]( + py::object filepath_or_buffer, + Py_ssize_t count, + bool compressed, + std::endian endianness, + Amulet::StringDecode string_decoder, + py::object read_offset_py + ){ + if (count < -1){ + throw std::invalid_argument("count must be -1 or higher"); + } + std::string buffer = get_buffer(filepath_or_buffer, compressed); + if (py::isinstance(read_offset_py)){ + Amulet::ReadOffset& read_offset = read_offset_py.cast(); + if (count == -1){ + return Amulet::read_named_tags( + buffer, + endianness, + string_decoder, + read_offset.offset + ); + } else { + return Amulet::read_named_tags( + buffer, + endianness, + string_decoder, + read_offset.offset, + count + ); + } + } else if (read_offset_py.is(py::none())){ + size_t offset = 0; + if (count == -1){ + return Amulet::read_named_tags( + buffer, + endianness, + string_decoder, + offset + ); + } else { + return Amulet::read_named_tags( + buffer, + endianness, + string_decoder, + offset, + count + ); + } + } else { + throw std::invalid_argument("read_offset must be ReadOffset or None"); + } + }; + m.def( + "load_array", + [load_array]( + py::object filepath_or_buffer, + Py_ssize_t count, + Amulet::EncodingPreset preset, + py::object read_offset + ){ + return load_array( + filepath_or_buffer, + count, + preset.compressed, + preset.endianness, + preset.string_encoding.decode, + read_offset + ); + }, + py::arg("filepath_or_buffer"), + py::kw_only(), + py::arg("count") = 1, + py::arg("preset") = java_encoding, + py::arg("read_offset") = py::none(), + py::doc( + "Load an array of binary NBT objects from a contiguous buffer.\n" + "\n" + ":param filepath_or_buffer: A string path to a file on disk, a bytes or memory view object containing the binary NBT or a file-like object to read the binary data from.\n" + ":param count: The number of binary NBT objects to read. Use -1 to exhaust the buffer.\n" + ":param preset: The encoding preset. If this is defined little_endian and string_encoding have no effect.\n" + ":param read_offset: Optional ReadOffset object to get read end offset.\n" + ":raises: NBTLoadError if an error occurred when loading the data." + ) + ); + + m.def( + "load_array", + [load_array]( + py::object filepath_or_buffer, + Py_ssize_t count, + bool compressed, + bool little_endian, + Amulet::StringEncoding string_encoding, + py::object read_offset + ){ + return load_array( + filepath_or_buffer, + count, + compressed, + little_endian ? std::endian::little : std::endian::big, + string_encoding.decode, + read_offset + ); + }, + py::arg("filepath_or_buffer"), + py::kw_only(), + py::arg("count") = 1, + py::arg("compressed") = true, + py::arg("little_endian") = false, + py::arg("string_encoding") = mutf8_encoding, + py::arg("read_offset") = py::none(), + py::doc( + "Load an array of binary NBT objects from a contiguous buffer.\n" + "\n" + ":param filepath_or_buffer: A string path to a file on disk, a bytes or memory view object containing the binary NBT or a file-like object to read the binary data from.\n" + ":param count: The number of binary NBT objects to read. Use -1 to exhaust the buffer.\n" + ":param compressed: Is the binary data gzip compressed. This only supports the whole buffer compressed as one.\n" + ":param little_endian: Are the numerical values stored as little endian. True for Bedrock, False for Java.\n" + ":param string_encoding: The bytes decoder function to parse strings. mutf8.decode_modified_utf8 for Java, amulet_nbt.utf8_escape_decoder for Bedrock.\n" + ":param read_offset: Optional ReadOffset object to get read end offset.\n" + ":raises: NBTLoadError if an error occurred when loading the data." + ) + ); } From 03b83ce1db8ad08354dce70132ea4735997ca581 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Thu, 4 Jul 2024 11:19:41 +0100 Subject: [PATCH 050/121] Added load overloads The preset argument replaces the compressed, little_endian and string_encoding arguments. --- src/amulet_nbt/__init__.pyi | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/src/amulet_nbt/__init__.pyi b/src/amulet_nbt/__init__.pyi index 7444106e..91853a64 100644 --- a/src/amulet_nbt/__init__.pyi +++ b/src/amulet_nbt/__init__.pyi @@ -1595,10 +1595,25 @@ class NamedTag(tuple[str | bytes, AnyNBT]): class ReadOffset: offset: int +@overload def load( filepath_or_buffer: str | bytes | BinaryIO | memoryview | None, *, preset: EncodingPreset | None = None, + read_offset: ReadOffset | None = None, +) -> NamedTag: + """Load one binary NBT object. + + :param filepath_or_buffer: A string path to a file on disk, a bytes or memory view object containing the binary NBT or a file-like object to read the binary data from. + :param preset: The encoding preset. If this is defined little_endian and string_encoding have no effect. + :param read_offset: Optional ReadOffset object to get read end offset. + :raises: NBTLoadError if an error occurred when loading the data. + """ + +@overload +def load( + filepath_or_buffer: str | bytes | BinaryIO | memoryview | None, + *, compressed: bool = True, little_endian: bool = False, string_encoding: StringEncoding = mutf8_encoding, @@ -1607,7 +1622,6 @@ def load( """Load one binary NBT object. :param filepath_or_buffer: A string path to a file on disk, a bytes or memory view object containing the binary NBT or a file-like object to read the binary data from. - :param preset: The encoding preset. If this is defined little_endian and string_encoding have no effect. :param compressed: Is the binary data gzip compressed. :param little_endian: Are the numerical values stored as little endian. True for Bedrock, False for Java. :param string_encoding: The bytes decoder function to parse strings. mutf8_encoding for Java, utf8_escape_encoding for Bedrock. @@ -1615,11 +1629,28 @@ def load( :raises: NBTLoadError if an error occurred when loading the data. """ +@overload def load_array( filepath_or_buffer: str | bytes | BinaryIO | memoryview | None, *, count: int = 1, preset: EncodingPreset | None = None, + read_offset: ReadOffset | None = None, +) -> list[NamedTag]: + """Load an array of binary NBT objects from a contiguous buffer. + + :param filepath_or_buffer: A string path to a file on disk, a bytes or memory view object containing the binary NBT or a file-like object to read the binary data from. + :param count: The number of binary NBT objects to read. Use -1 to exhaust the buffer. + :param preset: The encoding preset. If this is defined little_endian and string_encoding have no effect. + :param read_offset: Optional ReadOffset object to get read end offset. + :raises: NBTLoadError if an error occurred when loading the data. + """ + +@overload +def load_array( + filepath_or_buffer: str | bytes | BinaryIO | memoryview | None, + *, + count: int = 1, compressed: bool = True, little_endian: bool = False, string_encoding: StringEncoding = mutf8_encoding, @@ -1629,7 +1660,6 @@ def load_array( :param filepath_or_buffer: A string path to a file on disk, a bytes or memory view object containing the binary NBT or a file-like object to read the binary data from. :param count: The number of binary NBT objects to read. Use -1 to exhaust the buffer. - :param preset: The encoding preset. If this is defined little_endian and string_encoding have no effect. :param compressed: Is the binary data gzip compressed. This only supports the whole buffer compressed as one. :param little_endian: Are the numerical values stored as little endian. True for Bedrock, False for Java. :param string_encoding: The bytes decoder function to parse strings. mutf8.decode_modified_utf8 for Java, amulet_nbt.utf8_escape_decoder for Bedrock. From 029ce6f0729890c3f81d5c9ad641a5cf2f4a5d56 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Thu, 4 Jul 2024 16:02:03 +0100 Subject: [PATCH 051/121] Bumped to numpy 2.0 --- pyproject.toml | 2 +- setup.cfg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 79bd1706..5e458287 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ requires = [ "setuptools >= 42", "wheel", "versioneer", - "numpy ~= 1.17", + "numpy ~= 2.0", "pybind11 ~= 2.12", ] build-backend = "setuptools.build_meta" diff --git a/setup.cfg b/setup.cfg index 6d661ffa..a0e6627f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -19,7 +19,7 @@ packages = find_namespace: zip_safe = False python_requires = ~=3.11 install_requires = - numpy ~= 1.17 + numpy ~= 2.0 [options.packages.find] where=src From 7761eff3ae6428186cb834c9ea220b0b295f7e96 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Thu, 4 Jul 2024 16:07:27 +0100 Subject: [PATCH 052/121] Fix list equals There were two bugs here. The first was is_shared_ptr was taking a vector type not the vector element type. The second was a missing ! --- src/amulet_nbt/cpp/tag/eq.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/amulet_nbt/cpp/tag/eq.cpp b/src/amulet_nbt/cpp/tag/eq.cpp index 8330d02c..55685399 100644 --- a/src/amulet_nbt/cpp/tag/eq.cpp +++ b/src/amulet_nbt/cpp/tag/eq.cpp @@ -20,11 +20,11 @@ namespace Amulet{ template inline bool ListTag_eq(const Amulet::ListTagPtr a, const Amulet::ListTagPtr b){ - const SelfT& a_vec = get(*a); - if (b->index() != variant_index()){ + const std::vector& a_vec = get>(*a); + if (b->index() != variant_index>()){ return a_vec.size() == 0 && ListTag_size(*b) == 0; } - const SelfT& b_vec = get(*b); + const std::vector& b_vec = get>(*b); if constexpr (is_shared_ptr::value){ // Values are shared pointers @@ -32,7 +32,7 @@ namespace Amulet{ return false; } for (size_t i = 0; iindex()){ - #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG) case ID: return ListTag_eq(a, b); + #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG) case ID: return ListTag_eq(a, b); case 0: return ListTag_size(*b) == 0; FOR_EACH_LIST_TAG(CASE) From 7ec0ecf72d311a5b7414948496d4687b37240d5d Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Thu, 4 Jul 2024 16:09:53 +0100 Subject: [PATCH 053/121] Moved the encoding data classes --- .../include/amulet_nbt/pybind/encoding.hpp | 32 +++++++++ src/amulet_nbt/pybind/amulet_nbt.cpp | 3 + src/amulet_nbt/pybind/bnbt.cpp | 69 +------------------ src/amulet_nbt/pybind/encoding.cpp | 58 ++++++++++++++++ 4 files changed, 96 insertions(+), 66 deletions(-) create mode 100644 src/amulet_nbt/include/amulet_nbt/pybind/encoding.hpp create mode 100644 src/amulet_nbt/pybind/encoding.cpp diff --git a/src/amulet_nbt/include/amulet_nbt/pybind/encoding.hpp b/src/amulet_nbt/include/amulet_nbt/pybind/encoding.hpp new file mode 100644 index 00000000..c13ebf20 --- /dev/null +++ b/src/amulet_nbt/include/amulet_nbt/pybind/encoding.hpp @@ -0,0 +1,32 @@ +#pragma once + +#include +#include +#include + +namespace py = pybind11; + + +namespace Amulet { + class StringEncoding { + public: + Amulet::StringEncode encode; + Amulet::StringDecode decode; + StringEncoding( + Amulet::StringEncode encode, + Amulet::StringDecode decode + ): encode(encode), decode(decode) {}; + }; + + class EncodingPreset { + public: + bool compressed; + std::endian endianness; + Amulet::StringEncoding string_encoding; + EncodingPreset( + bool compressed, + std::endian endianness, + Amulet::StringEncoding string_encoding + ): compressed(compressed), endianness(endianness), string_encoding(string_encoding) {}; + }; +} diff --git a/src/amulet_nbt/pybind/amulet_nbt.cpp b/src/amulet_nbt/pybind/amulet_nbt.cpp index 7165035b..c0e402aa 100644 --- a/src/amulet_nbt/pybind/amulet_nbt.cpp +++ b/src/amulet_nbt/pybind/amulet_nbt.cpp @@ -1,6 +1,8 @@ #include namespace py = pybind11; +void init_encoding(py::module&); + void init_abc(py::module&); void init_int(py::module&); void init_float(py::module&); @@ -15,6 +17,7 @@ void init_bnbt(py::module& m); PYBIND11_MODULE(_nbt, m) { + init_encoding(m); init_abc(m); init_int(m); init_float(m); diff --git a/src/amulet_nbt/pybind/bnbt.cpp b/src/amulet_nbt/pybind/bnbt.cpp index 0f2851f6..a8e817cf 100644 --- a/src/amulet_nbt/pybind/bnbt.cpp +++ b/src/amulet_nbt/pybind/bnbt.cpp @@ -6,33 +6,12 @@ #include #include +#include namespace py = pybind11; namespace Amulet { - class StringEncoding { - public: - Amulet::StringEncode encode; - Amulet::StringDecode decode; - StringEncoding( - Amulet::StringEncode encode, - Amulet::StringDecode decode - ): encode(encode), decode(decode) {}; - }; - - class EncodingPreset { - public: - bool compressed; - std::endian endianness; - Amulet::StringEncoding string_encoding; - EncodingPreset( - bool compressed, - std::endian endianness, - Amulet::StringEncoding string_encoding - ): compressed(compressed), endianness(endianness), string_encoding(string_encoding) {}; - }; - class ReadOffset { public: size_t offset; @@ -43,50 +22,6 @@ namespace Amulet { void init_bnbt(py::module& m) { - py::class_ StringEncoding(m, "StringEncoding"); - StringEncoding.def( - "encode", - [](const Amulet::StringEncoding& self, py::bytes data) -> py::bytes { - return self.encode(data); - } - ); - StringEncoding.def( - "decode", - [](const Amulet::StringEncoding& self, py::bytes data) -> py::bytes { - return self.decode(data); - } - ); - - Amulet::StringEncoding utf8_encoding = Amulet::StringEncoding(Amulet::utf8_to_utf8, Amulet::utf8_to_utf8); - Amulet::StringEncoding utf8_escape_encoding = Amulet::StringEncoding(Amulet::utf8_to_utf8_escape, Amulet::utf8_escape_to_utf8); - Amulet::StringEncoding mutf8_encoding = Amulet::StringEncoding(Amulet::utf8_to_mutf8, Amulet::mutf8_to_utf8); - - m.attr("utf8_encoding") = utf8_encoding; - m.attr("utf8_escape_encoding") = utf8_escape_encoding; - m.attr("mutf8_encoding") = mutf8_encoding; - - py::class_ EncodingPreset(m, "EncodingPreset"); - EncodingPreset.def_readonly( - "compressed", - &Amulet::EncodingPreset::compressed - ); - EncodingPreset.def_property_readonly( - "little_endian", - [](const Amulet::EncodingPreset& self) { - return self.endianness == std::endian::little; - } - ); - EncodingPreset.def_readonly( - "string_encoding", - &Amulet::EncodingPreset::string_encoding - ); - - Amulet::EncodingPreset java_encoding = Amulet::EncodingPreset(true, std::endian::big, mutf8_encoding); - Amulet::EncodingPreset bedrock_encoding = Amulet::EncodingPreset(false, std::endian::little, utf8_escape_encoding); - - m.attr("java_encoding") = java_encoding; - m.attr("bedrock_encoding") = bedrock_encoding; - py::class_ ReadOffset(m, "ReadOffset"); ReadOffset.def( py::init(), @@ -97,6 +32,8 @@ void init_bnbt(py::module& m) { py::object decompress = py::module::import("gzip").attr("decompress"); py::object BadGzipFile = py::module::import("gzip").attr("BadGzipFile"); py::object zlib_error = py::module::import("zlib").attr("error"); + py::object mutf8_encoding = m.attr("mutf8_encoding"); + py::object java_encoding = m.attr("java_encoding"); auto get_buffer = [decompress, BadGzipFile, zlib_error]( py::object filepath_or_buffer, diff --git a/src/amulet_nbt/pybind/encoding.cpp b/src/amulet_nbt/pybind/encoding.cpp new file mode 100644 index 00000000..5074ada0 --- /dev/null +++ b/src/amulet_nbt/pybind/encoding.cpp @@ -0,0 +1,58 @@ +#include + +#include +#include +#include + +#include +#include +#include + +namespace py = pybind11; + + +void init_encoding(py::module& m) { + py::class_ StringEncoding(m, "StringEncoding"); + StringEncoding.def( + "encode", + [](const Amulet::StringEncoding& self, py::bytes data) -> py::bytes { + return self.encode(data); + } + ); + StringEncoding.def( + "decode", + [](const Amulet::StringEncoding& self, py::bytes data) -> py::bytes { + return self.decode(data); + } + ); + + Amulet::StringEncoding utf8_encoding = Amulet::StringEncoding(Amulet::utf8_to_utf8, Amulet::utf8_to_utf8); + Amulet::StringEncoding utf8_escape_encoding = Amulet::StringEncoding(Amulet::utf8_to_utf8_escape, Amulet::utf8_escape_to_utf8); + Amulet::StringEncoding mutf8_encoding = Amulet::StringEncoding(Amulet::utf8_to_mutf8, Amulet::mutf8_to_utf8); + + m.attr("utf8_encoding") = utf8_encoding; + m.attr("utf8_escape_encoding") = utf8_escape_encoding; + m.attr("mutf8_encoding") = mutf8_encoding; + + py::class_ EncodingPreset(m, "EncodingPreset"); + EncodingPreset.def_readonly( + "compressed", + &Amulet::EncodingPreset::compressed + ); + EncodingPreset.def_property_readonly( + "little_endian", + [](const Amulet::EncodingPreset& self) { + return self.endianness == std::endian::little; + } + ); + EncodingPreset.def_readonly( + "string_encoding", + &Amulet::EncodingPreset::string_encoding + ); + + Amulet::EncodingPreset java_encoding = Amulet::EncodingPreset(true, std::endian::big, mutf8_encoding); + Amulet::EncodingPreset bedrock_encoding = Amulet::EncodingPreset(false, std::endian::little, utf8_escape_encoding); + + m.attr("java_encoding") = java_encoding; + m.attr("bedrock_encoding") = bedrock_encoding; +} From c05be93d4dc1941afb571f3615ea8f7e6e5dc0a0 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Thu, 4 Jul 2024 16:10:58 +0100 Subject: [PATCH 054/121] Added binary nbt writing --- .../cpp/nbt_encoding/binary/write.cpp | 209 ++++++++++++++++++ .../include/amulet_nbt/io/binary_writer.hpp | 57 +++++ .../amulet_nbt/nbt_encoding/binary.hpp | 5 + .../include/amulet_nbt/tag/wrapper.hpp | 12 +- src/amulet_nbt/pybind/tag/abc.cpp | 62 +++++- 5 files changed, 341 insertions(+), 4 deletions(-) create mode 100644 src/amulet_nbt/cpp/nbt_encoding/binary/write.cpp create mode 100644 src/amulet_nbt/include/amulet_nbt/io/binary_writer.hpp diff --git a/src/amulet_nbt/cpp/nbt_encoding/binary/write.cpp b/src/amulet_nbt/cpp/nbt_encoding/binary/write.cpp new file mode 100644 index 00000000..ae47a9df --- /dev/null +++ b/src/amulet_nbt/cpp/nbt_encoding/binary/write.cpp @@ -0,0 +1,209 @@ +#pragma once + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +// I wanted to use templates to reduce code duplication but I can't get this to work +// The template version compiled and passed all tests on my computer but it just wasn't working on the remote servers + + +template +void write_numeric_payload(Amulet::BinaryWriter& writer, const T& value){ + writer.writeNumeric(value); +}; + +void write_string_payload(Amulet::BinaryWriter& writer, const Amulet::StringTag& value){ + std::string encoded_string = writer.encodeString(value); + if (encoded_string.size() > static_cast(std::numeric_limits::max())){ + throw std::overflow_error("String of length " + std::to_string(encoded_string.size()) + " is too long."); + } + std::uint16_t length = static_cast(encoded_string.size()); + writer.writeNumeric(length); + writer.writeString(encoded_string); +} + + +template +void write_array_payload(Amulet::BinaryWriter& writer, const std::shared_ptr> value){ + if (value->size() > static_cast(std::numeric_limits::max())){ + throw std::overflow_error("Array of length " + std::to_string(value->size()) + " is too long."); + } + std::int32_t length = static_cast(value->size()); + writer.writeNumeric(length); + for (const T& element: *value){ + writer.writeNumeric(element); + } +} + + +void write_list_payload(Amulet::BinaryWriter& writer, const Amulet::ListTagPtr& value); +void write_compound_payload(Amulet::BinaryWriter& writer, const Amulet::CompoundTagPtr& value); + + +template < + typename T, + std::enable_if_t< + std::is_same_v || + std::is_same_v || + std::is_same_v || + std::is_same_v || + std::is_same_v || + std::is_same_v || + std::is_same_v || + std::is_same_v || + std::is_same_v || + std::is_same_v || + std::is_same_v || + std::is_same_v, + bool + > = true +> +void write_list_tag_payload(Amulet::BinaryWriter& writer, const Amulet::ListTagPtr& value){ + const std::vector& list = std::get>(*value); + if (list.size() > static_cast(std::numeric_limits::max())){ + throw std::overflow_error("List of length " + std::to_string(list.size()) + " is too long."); + } + writer.writeNumeric(variant_index()); + std::int32_t length = static_cast(list.size()); + writer.writeNumeric(length); + for (const T& element: list){ + if constexpr (std::is_same_v){write_numeric_payload(writer, element);} else + if constexpr (std::is_same_v){write_numeric_payload(writer, element);} else + if constexpr (std::is_same_v){write_numeric_payload(writer, element);} else + if constexpr (std::is_same_v){write_numeric_payload(writer, element);} else + if constexpr (std::is_same_v){write_numeric_payload(writer, element);} else + if constexpr (std::is_same_v){write_numeric_payload(writer, element);} else + if constexpr (std::is_same_v){write_array_payload(writer, element);} else + if constexpr (std::is_same_v){write_string_payload(writer, element);} else + if constexpr (std::is_same_v){write_list_payload(writer, element);} else + if constexpr (std::is_same_v){write_compound_payload(writer, element);} else + if constexpr (std::is_same_v){write_array_payload(writer, element);} else + if constexpr (std::is_same_v){write_array_payload(writer, element);} + } +} + + +void write_list_payload(Amulet::BinaryWriter& writer, const Amulet::ListTagPtr& value){ + switch (value->index()){ + case 0: + writer.writeNumeric(0); + writer.writeNumeric(0); + break; + case 1: write_list_tag_payload(writer, value); break; + case 2: write_list_tag_payload(writer, value); break; + case 3: write_list_tag_payload(writer, value); break; + case 4: write_list_tag_payload(writer, value); break; + case 5: write_list_tag_payload(writer, value); break; + case 6: write_list_tag_payload(writer, value); break; + case 7: write_list_tag_payload(writer, value); break; + case 8: write_list_tag_payload(writer, value); break; + case 9: write_list_tag_payload(writer, value); break; + case 10: write_list_tag_payload(writer, value); break; + case 11: write_list_tag_payload(writer, value); break; + case 12: write_list_tag_payload(writer, value); break; + } +} + + +template < + typename T, + std::enable_if_t< + std::is_same_v || + std::is_same_v || + std::is_same_v || + std::is_same_v || + std::is_same_v || + std::is_same_v || + std::is_same_v || + std::is_same_v || + std::is_same_v || + std::is_same_v || + std::is_same_v || + std::is_same_v, + bool + > = true +> +void write_name_and_tag(Amulet::BinaryWriter& writer, const std::string& name, const T& tag){ + writer.writeNumeric(variant_index()); + write_string_payload(writer, name); + if constexpr (std::is_same_v){write_numeric_payload(writer, tag);} else + if constexpr (std::is_same_v){write_numeric_payload(writer, tag);} else + if constexpr (std::is_same_v){write_numeric_payload(writer, tag);} else + if constexpr (std::is_same_v){write_numeric_payload(writer, tag);} else + if constexpr (std::is_same_v){write_numeric_payload(writer, tag);} else + if constexpr (std::is_same_v){write_numeric_payload(writer, tag);} else + if constexpr (std::is_same_v){write_array_payload(writer, tag);} else + if constexpr (std::is_same_v){write_string_payload(writer, tag);} else + if constexpr (std::is_same_v){write_list_payload(writer, tag);} else + if constexpr (std::is_same_v){write_compound_payload(writer, tag);} else + if constexpr (std::is_same_v){write_array_payload(writer, tag);} else + if constexpr (std::is_same_v){write_array_payload(writer, tag);} +} + + +template < + typename T, + std::enable_if_t, bool> = true +> +void write_name_and_tag(Amulet::BinaryWriter& writer, const std::string& name, const Amulet::TagNode& node){ + switch (node.index()){ + case 1: write_name_and_tag(writer, name, std::get(node)); break; + case 2: write_name_and_tag(writer, name, std::get(node)); break; + case 3: write_name_and_tag(writer, name, std::get(node)); break; + case 4: write_name_and_tag(writer, name, std::get(node)); break; + case 5: write_name_and_tag(writer, name, std::get(node)); break; + case 6: write_name_and_tag(writer, name, std::get(node)); break; + case 7: write_name_and_tag(writer, name, std::get(node)); break; + case 8: write_name_and_tag(writer, name, std::get(node)); break; + case 9: write_name_and_tag(writer, name, std::get(node)); break; + case 10: write_name_and_tag(writer, name, std::get(node)); break; + case 11: write_name_and_tag(writer, name, std::get(node)); break; + case 12: write_name_and_tag(writer, name, std::get(node)); break; + default: throw std::runtime_error("TagNode cannot be in null state when writing."); + } +} + + +void write_compound_payload(Amulet::BinaryWriter& writer, const Amulet::CompoundTagPtr& value){ + for (auto it = value->begin(); it != value->end(); it++){ + write_name_and_tag(writer, it->first, it->second); + } + writer.writeNumeric(0); +}; + + +namespace Amulet { + template + std::string write_named_tag(const std::string& name, const T& tag, std::endian endianness, StringEncode string_encode){ + Amulet::BinaryWriter writer(endianness, string_encode); + write_name_and_tag(writer, name, tag); + return writer.getBuffer(); + } + + template std::string write_named_tag(const std::string&, const Amulet::ByteTag&, std::endian, Amulet::StringEncode); + template std::string write_named_tag(const std::string&, const Amulet::ShortTag&, std::endian, Amulet::StringEncode); + template std::string write_named_tag(const std::string&, const Amulet::IntTag&, std::endian, Amulet::StringEncode); + template std::string write_named_tag(const std::string&, const Amulet::LongTag&, std::endian, Amulet::StringEncode); + template std::string write_named_tag(const std::string&, const Amulet::FloatTag&, std::endian, Amulet::StringEncode); + template std::string write_named_tag(const std::string&, const Amulet::DoubleTag&, std::endian, Amulet::StringEncode); + template std::string write_named_tag(const std::string&, const Amulet::ByteArrayTagPtr&, std::endian, Amulet::StringEncode); + template std::string write_named_tag(const std::string&, const Amulet::StringTag&, std::endian, Amulet::StringEncode); + template std::string write_named_tag(const std::string&, const Amulet::ListTagPtr&, std::endian, Amulet::StringEncode); + template std::string write_named_tag(const std::string&, const Amulet::CompoundTagPtr&, std::endian, Amulet::StringEncode); + template std::string write_named_tag(const std::string&, const Amulet::IntArrayTagPtr&, std::endian, Amulet::StringEncode); + template std::string write_named_tag(const std::string&, const Amulet::LongArrayTagPtr&, std::endian, Amulet::StringEncode); + template std::string write_named_tag(const std::string&, const Amulet::TagNode&, std::endian, Amulet::StringEncode); + + std::string write_named_tag(const Amulet::NamedTag& named_tag, std::endian endianness, StringEncode string_encode){ + return write_named_tag(named_tag.name, named_tag.tag_node, endianness, string_encode); + } +} diff --git a/src/amulet_nbt/include/amulet_nbt/io/binary_writer.hpp b/src/amulet_nbt/include/amulet_nbt/io/binary_writer.hpp new file mode 100644 index 00000000..7b66e3a0 --- /dev/null +++ b/src/amulet_nbt/include/amulet_nbt/io/binary_writer.hpp @@ -0,0 +1,57 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include + + +namespace Amulet { + typedef std::function StringEncode; + + + class BinaryWriter { + private: + std::string data; + std::endian endianness; + StringEncode stringEncode; + + public: + BinaryWriter( + std::endian endianness, + StringEncode stringEncode + ) : endianness(endianness), stringEncode(stringEncode) {} + + /** + * Fix the endianness of the numeric value and write it to the buffer. + */ + template inline void writeNumeric(const T& value) { + // Create + char* src = (char*)&value; + + // Copy + if (endianness == std::endian::native){ + data.append(src, sizeof(T)); + } else { + for (size_t i = 0; i < sizeof(T); i++){ + data.push_back(src[sizeof(T) - i - 1]); + } + } + } + + std::string encodeString(const std::string& value) { + return stringEncode(value); + } + + void writeString(const std::string& value) { + data.append(value); + } + + std::string getBuffer(){ + return data; + } + }; +} diff --git a/src/amulet_nbt/include/amulet_nbt/nbt_encoding/binary.hpp b/src/amulet_nbt/include/amulet_nbt/nbt_encoding/binary.hpp index 20b7837f..f0425459 100644 --- a/src/amulet_nbt/include/amulet_nbt/nbt_encoding/binary.hpp +++ b/src/amulet_nbt/include/amulet_nbt/nbt_encoding/binary.hpp @@ -13,4 +13,9 @@ namespace Amulet { Amulet::NamedTag read_named_tag(const std::string&, std::endian, Amulet::StringDecode, size_t& offset); std::vector read_named_tags(const std::string&, std::endian, Amulet::StringDecode, size_t& offset); std::vector read_named_tags(const std::string&, std::endian, Amulet::StringDecode, size_t& offset, size_t count); + + template + std::string write_named_tag(const std::string&, const T&, std::endian, Amulet::StringEncode); + + std::string write_named_tag(const Amulet::NamedTag&, std::endian, Amulet::StringEncode); } diff --git a/src/amulet_nbt/include/amulet_nbt/tag/wrapper.hpp b/src/amulet_nbt/include/amulet_nbt/tag/wrapper.hpp index 389ef93b..fd3b67d5 100644 --- a/src/amulet_nbt/include/amulet_nbt/tag/wrapper.hpp +++ b/src/amulet_nbt/include/amulet_nbt/tag/wrapper.hpp @@ -1,10 +1,17 @@ #pragma once -#include "nbt.hpp" +#include +#include + +#include +#include +#include namespace Amulet { class AbstractBaseTag { + public: + virtual std::string write_bnbt(std::string, std::endian, Amulet::StringEncode) const = 0; }; class AbstractBaseImmutableTag: public AbstractBaseTag {}; @@ -35,6 +42,9 @@ namespace Amulet { public: T tag; TagWrapper(T tag): tag(tag) {}; + virtual std::string write_bnbt(std::string name, std::endian endianness, Amulet::StringEncode string_encode) const { + return Amulet::write_named_tag(name, tag, endianness, string_encode); + } }; typedef TagWrapper ByteTagWrapper; typedef TagWrapper ShortTagWrapper; diff --git a/src/amulet_nbt/pybind/tag/abc.cpp b/src/amulet_nbt/pybind/tag/abc.cpp index cfdd8fec..2e15cc11 100644 --- a/src/amulet_nbt/pybind/tag/abc.cpp +++ b/src/amulet_nbt/pybind/tag/abc.cpp @@ -1,9 +1,10 @@ -#include - #include #include #include +#include +#include + namespace py = pybind11; template @@ -14,6 +15,10 @@ void abstract_method(T self){ void init_abc(py::module& m) { + py::object mutf8_encoding = m.attr("mutf8_encoding"); + py::object java_encoding = m.attr("java_encoding"); + py::object compress = py::module::import("gzip").attr("compress"); + py::class_ AbstractBaseTag(m, "AbstractBaseTag", "Abstract Base Class for all tag classes" ); @@ -29,9 +34,60 @@ void init_abc(py::module& m) { "You would be better off using the py_{type} or np_array properties if you require a fixed type.\n"\ "This is here for convenience to get a python representation under the same property name."\ ); + auto to_nbt = [compress]( + const Amulet::AbstractBaseTag& self, + std::string name, + bool compressed, + std::endian endianness, + Amulet::StringEncode string_encoder + ) -> py::bytes { + py::bytes data = self.write_bnbt(name, endianness, string_encoder); + if (compressed){ + return compress(data); + } + return data; + }; AbstractBaseTag.def( "to_nbt", - abstract_method + [to_nbt]( + const Amulet::AbstractBaseTag& self, + Amulet::EncodingPreset preset, + std::string name + ){ + return to_nbt( + self, + name, + preset.compressed, + preset.endianness, + preset.string_encoding.encode + ); + }, + py::kw_only(), + py::arg("preset") = java_encoding, + py::arg("name") = "" + ); + AbstractBaseTag.def( + "to_nbt", + [to_nbt]( + const Amulet::AbstractBaseTag& self, + bool compressed, + bool little_endian, + Amulet::StringEncoding string_encoding, + std::string name + ){ + return to_nbt( + self, + name, + compressed, + little_endian ? std::endian::little : std::endian::big, + string_encoding.encode + ); + }, + py::kw_only(), + py::arg("compressed") = true, + py::arg("little_endian") = false, + py::arg("string_encoding") = mutf8_encoding, + py::arg("name") = "" ); AbstractBaseTag.def( "save_to", From 7f0cc19493604e7eff0704af9352ebb8523b5f89 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 5 Jul 2024 10:03:01 +0100 Subject: [PATCH 055/121] Improved read and write type hints --- src/amulet_nbt/__init__.pyi | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/amulet_nbt/__init__.pyi b/src/amulet_nbt/__init__.pyi index 91853a64..b8be6987 100644 --- a/src/amulet_nbt/__init__.pyi +++ b/src/amulet_nbt/__init__.pyi @@ -8,7 +8,6 @@ from typing import ( Iterable, overload, TypeVar, - BinaryIO, Self, Type, Mapping, @@ -16,6 +15,7 @@ from typing import ( Literal, TypeAlias, ClassVar, + Protocol, ) from collections.abc import MutableSequence, MutableMapping import numpy @@ -81,6 +81,14 @@ __all__ = [ "bedrock_encoding", ] +class _Readable(Protocol): + def read(self) -> bytes: + ... + +class _Writeable(Protocol): + def write(self, s: bytes) -> Any: + ... + class NBTError(Exception): """Some error in the NBT library.""" @@ -144,7 +152,7 @@ class AbstractBaseTag: def save_to( self, - filepath_or_buffer: str | BinaryIO | None = None, + filepath_or_buffer: str | _Writeable | None = None, *, preset: EncodingPreset | None = None, compressed: bool = True, @@ -1536,7 +1544,7 @@ class NamedTag(tuple[str | bytes, AnyNBT]): def save_to( self, - filepath_or_buffer: str | BinaryIO | None = None, + filepath_or_buffer: str | _Writeable | None = None, *, preset: EncodingPreset | None = None, compressed: bool = True, @@ -1597,7 +1605,7 @@ class ReadOffset: @overload def load( - filepath_or_buffer: str | bytes | BinaryIO | memoryview | None, + filepath_or_buffer: str | bytes | memoryview | _Readable | None, *, preset: EncodingPreset | None = None, read_offset: ReadOffset | None = None, @@ -1612,7 +1620,7 @@ def load( @overload def load( - filepath_or_buffer: str | bytes | BinaryIO | memoryview | None, + filepath_or_buffer: str | bytes | memoryview | _Readable | None, *, compressed: bool = True, little_endian: bool = False, @@ -1631,7 +1639,7 @@ def load( @overload def load_array( - filepath_or_buffer: str | bytes | BinaryIO | memoryview | None, + filepath_or_buffer: str | bytes | memoryview | _Readable | None, *, count: int = 1, preset: EncodingPreset | None = None, @@ -1648,7 +1656,7 @@ def load_array( @overload def load_array( - filepath_or_buffer: str | bytes | BinaryIO | memoryview | None, + filepath_or_buffer: str | bytes | memoryview | _Readable | None, *, count: int = 1, compressed: bool = True, From 375e43ee9e9e081e8c68a99b6dac335c91c2da60 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Mon, 8 Jul 2024 14:06:17 +0100 Subject: [PATCH 056/121] Refactored read and write --- .../cpp/nbt_encoding/binary/read.cpp | 18 ++++-- .../cpp/nbt_encoding/binary/write.cpp | 61 +++++++++++++------ .../include/amulet_nbt/io/binary_reader.hpp | 8 +-- .../include/amulet_nbt/io/binary_writer.hpp | 8 +-- .../amulet_nbt/nbt_encoding/binary.hpp | 19 ++++-- .../include/amulet_nbt/tag/wrapper.hpp | 2 +- src/amulet_nbt/pybind/bnbt.cpp | 4 +- 7 files changed, 80 insertions(+), 40 deletions(-) diff --git a/src/amulet_nbt/cpp/nbt_encoding/binary/read.cpp b/src/amulet_nbt/cpp/nbt_encoding/binary/read.cpp index e6adf16a..92e9b271 100644 --- a/src/amulet_nbt/cpp/nbt_encoding/binary/read.cpp +++ b/src/amulet_nbt/cpp/nbt_encoding/binary/read.cpp @@ -160,14 +160,20 @@ namespace Amulet { } // Read one named tag from the string at position offset. - Amulet::NamedTag read_named_tag(const std::string& raw, std::endian endianness, Amulet::StringDecode stringDecode, size_t& offset){ - Amulet::BinaryReader reader(raw, offset, endianness, stringDecode); + Amulet::NamedTag read_named_tag(const std::string& raw, std::endian endianness, Amulet::StringDecode string_decode, size_t& offset){ + Amulet::BinaryReader reader(raw, offset, endianness, string_decode); return read_named_tag(reader); } + // Read one named tag from the string. + Amulet::NamedTag read_named_tag(const std::string& raw, std::endian endianness, Amulet::StringDecode string_decode){ + size_t offset = 0; + return read_named_tag(raw, endianness, string_decode, offset); + } + // Read count named tags from the string at position offset. - std::vector read_named_tags(const std::string& raw, std::endian endianness, Amulet::StringDecode stringDecode, size_t& offset, size_t count){ - Amulet::BinaryReader reader(raw, offset, endianness, stringDecode); + std::vector read_named_tags(const std::string& raw, std::endian endianness, Amulet::StringDecode string_decode, size_t& offset, size_t count){ + Amulet::BinaryReader reader(raw, offset, endianness, string_decode); std::vector out; for (size_t i = 0; i < count; i++){ out.push_back(read_named_tag(reader)); @@ -176,8 +182,8 @@ namespace Amulet { } // Read all named tags from the string at position offset. - std::vector read_named_tags(const std::string& raw, std::endian endianness, Amulet::StringDecode stringDecode, size_t& offset){ - Amulet::BinaryReader reader(raw, offset, endianness, stringDecode); + std::vector read_named_tags(const std::string& raw, std::endian endianness, Amulet::StringDecode string_decode, size_t& offset){ + Amulet::BinaryReader reader(raw, offset, endianness, string_decode); std::vector out; while (reader.has_more_data()){ out.push_back(read_named_tag(reader)); diff --git a/src/amulet_nbt/cpp/nbt_encoding/binary/write.cpp b/src/amulet_nbt/cpp/nbt_encoding/binary/write.cpp index ae47a9df..88127a19 100644 --- a/src/amulet_nbt/cpp/nbt_encoding/binary/write.cpp +++ b/src/amulet_nbt/cpp/nbt_encoding/binary/write.cpp @@ -181,29 +181,54 @@ void write_compound_payload(Amulet::BinaryWriter& writer, const Amulet::Compound }; -namespace Amulet { - template - std::string write_named_tag(const std::string& name, const T& tag, std::endian endianness, StringEncode string_encode){ +template + std::string _write_named_tag(const std::string& name, const T& tag, std::endian endianness, Amulet::StringEncode string_encode){ Amulet::BinaryWriter writer(endianness, string_encode); write_name_and_tag(writer, name, tag); return writer.getBuffer(); } - template std::string write_named_tag(const std::string&, const Amulet::ByteTag&, std::endian, Amulet::StringEncode); - template std::string write_named_tag(const std::string&, const Amulet::ShortTag&, std::endian, Amulet::StringEncode); - template std::string write_named_tag(const std::string&, const Amulet::IntTag&, std::endian, Amulet::StringEncode); - template std::string write_named_tag(const std::string&, const Amulet::LongTag&, std::endian, Amulet::StringEncode); - template std::string write_named_tag(const std::string&, const Amulet::FloatTag&, std::endian, Amulet::StringEncode); - template std::string write_named_tag(const std::string&, const Amulet::DoubleTag&, std::endian, Amulet::StringEncode); - template std::string write_named_tag(const std::string&, const Amulet::ByteArrayTagPtr&, std::endian, Amulet::StringEncode); - template std::string write_named_tag(const std::string&, const Amulet::StringTag&, std::endian, Amulet::StringEncode); - template std::string write_named_tag(const std::string&, const Amulet::ListTagPtr&, std::endian, Amulet::StringEncode); - template std::string write_named_tag(const std::string&, const Amulet::CompoundTagPtr&, std::endian, Amulet::StringEncode); - template std::string write_named_tag(const std::string&, const Amulet::IntArrayTagPtr&, std::endian, Amulet::StringEncode); - template std::string write_named_tag(const std::string&, const Amulet::LongArrayTagPtr&, std::endian, Amulet::StringEncode); - template std::string write_named_tag(const std::string&, const Amulet::TagNode&, std::endian, Amulet::StringEncode); - - std::string write_named_tag(const Amulet::NamedTag& named_tag, std::endian endianness, StringEncode string_encode){ +namespace Amulet { + std::string write_named_tag(const std::string& name, const Amulet::ByteTag& tag, std::endian endianness, Amulet::StringEncode string_encode){ + return _write_named_tag(name, tag, endianness, string_encode); + }; + std::string write_named_tag(const std::string& name, const Amulet::ShortTag& tag, std::endian endianness, Amulet::StringEncode string_encode){ + return _write_named_tag(name, tag, endianness, string_encode); + }; + std::string write_named_tag(const std::string& name, const Amulet::IntTag& tag, std::endian endianness, Amulet::StringEncode string_encode){ + return _write_named_tag(name, tag, endianness, string_encode); + }; + std::string write_named_tag(const std::string& name, const Amulet::LongTag& tag, std::endian endianness, Amulet::StringEncode string_encode){ + return _write_named_tag(name, tag, endianness, string_encode); + }; + std::string write_named_tag(const std::string& name, const Amulet::FloatTag& tag, std::endian endianness, Amulet::StringEncode string_encode){ + return _write_named_tag(name, tag, endianness, string_encode); + }; + std::string write_named_tag(const std::string& name, const Amulet::DoubleTag& tag, std::endian endianness, Amulet::StringEncode string_encode){ + return _write_named_tag(name, tag, endianness, string_encode); + }; + std::string write_named_tag(const std::string& name, const Amulet::ByteArrayTagPtr& tag, std::endian endianness, Amulet::StringEncode string_encode){ + return _write_named_tag(name, tag, endianness, string_encode); + }; + std::string write_named_tag(const std::string& name, const Amulet::StringTag& tag, std::endian endianness, Amulet::StringEncode string_encode){ + return _write_named_tag(name, tag, endianness, string_encode); + }; + std::string write_named_tag(const std::string& name, const Amulet::ListTagPtr& tag, std::endian endianness, Amulet::StringEncode string_encode){ + return _write_named_tag(name, tag, endianness, string_encode); + }; + std::string write_named_tag(const std::string& name, const Amulet::CompoundTagPtr& tag, std::endian endianness, Amulet::StringEncode string_encode){ + return _write_named_tag(name, tag, endianness, string_encode); + }; + std::string write_named_tag(const std::string& name, const Amulet::IntArrayTagPtr& tag, std::endian endianness, Amulet::StringEncode string_encode){ + return _write_named_tag(name, tag, endianness, string_encode); + }; + std::string write_named_tag(const std::string& name, const Amulet::LongArrayTagPtr& tag, std::endian endianness, Amulet::StringEncode string_encode){ + return _write_named_tag(name, tag, endianness, string_encode); + }; + std::string write_named_tag(const std::string& name, const Amulet::TagNode& tag, std::endian endianness, Amulet::StringEncode string_encode){ + return _write_named_tag(name, tag, endianness, string_encode); + }; + std::string write_named_tag(const Amulet::NamedTag& named_tag, std::endian endianness, Amulet::StringEncode string_encode){ return write_named_tag(named_tag.name, named_tag.tag_node, endianness, string_encode); } } diff --git a/src/amulet_nbt/include/amulet_nbt/io/binary_reader.hpp b/src/amulet_nbt/include/amulet_nbt/io/binary_reader.hpp index 03e63bd8..af95b8a1 100644 --- a/src/amulet_nbt/include/amulet_nbt/io/binary_reader.hpp +++ b/src/amulet_nbt/include/amulet_nbt/io/binary_reader.hpp @@ -18,16 +18,16 @@ namespace Amulet { const std::string& data; size_t& position; std::endian endianness; - StringDecode stringDecode; + StringDecode string_decode; public: BinaryReader( const std::string& input, size_t& position, std::endian endianness, - StringDecode stringDecode + StringDecode string_decode ) - : data(input), position(position), endianness(endianness), stringDecode(stringDecode) {} + : data(input), position(position), endianness(endianness), string_decode(string_decode) {} /** * Read a numeric type from the buffer into the given value and fix its endianness. @@ -76,7 +76,7 @@ namespace Amulet { std::string value = data.substr(position, length); position += length; - return stringDecode(value); + return string_decode(value); } size_t getPosition(){ diff --git a/src/amulet_nbt/include/amulet_nbt/io/binary_writer.hpp b/src/amulet_nbt/include/amulet_nbt/io/binary_writer.hpp index 7b66e3a0..8f0bbdae 100644 --- a/src/amulet_nbt/include/amulet_nbt/io/binary_writer.hpp +++ b/src/amulet_nbt/include/amulet_nbt/io/binary_writer.hpp @@ -17,13 +17,13 @@ namespace Amulet { private: std::string data; std::endian endianness; - StringEncode stringEncode; + StringEncode string_encode; public: BinaryWriter( std::endian endianness, - StringEncode stringEncode - ) : endianness(endianness), stringEncode(stringEncode) {} + StringEncode string_encode + ) : endianness(endianness), string_encode(string_encode) {} /** * Fix the endianness of the numeric value and write it to the buffer. @@ -43,7 +43,7 @@ namespace Amulet { } std::string encodeString(const std::string& value) { - return stringEncode(value); + return string_encode(value); } void writeString(const std::string& value) { diff --git a/src/amulet_nbt/include/amulet_nbt/nbt_encoding/binary.hpp b/src/amulet_nbt/include/amulet_nbt/nbt_encoding/binary.hpp index f0425459..ff8d6252 100644 --- a/src/amulet_nbt/include/amulet_nbt/nbt_encoding/binary.hpp +++ b/src/amulet_nbt/include/amulet_nbt/nbt_encoding/binary.hpp @@ -11,11 +11,22 @@ namespace Amulet { Amulet::NamedTag read_named_tag(const std::string&, std::endian, Amulet::StringDecode, size_t& offset); + Amulet::NamedTag read_named_tag(const std::string&, std::endian, Amulet::StringDecode); std::vector read_named_tags(const std::string&, std::endian, Amulet::StringDecode, size_t& offset); std::vector read_named_tags(const std::string&, std::endian, Amulet::StringDecode, size_t& offset, size_t count); - template - std::string write_named_tag(const std::string&, const T&, std::endian, Amulet::StringEncode); - - std::string write_named_tag(const Amulet::NamedTag&, std::endian, Amulet::StringEncode); + std::string write_named_tag(const std::string& name, const Amulet::ByteTag&, std::endian, Amulet::StringEncode); + std::string write_named_tag(const std::string& name, const Amulet::ShortTag&, std::endian, Amulet::StringEncode); + std::string write_named_tag(const std::string& name, const Amulet::IntTag&, std::endian, Amulet::StringEncode); + std::string write_named_tag(const std::string& name, const Amulet::LongTag&, std::endian, Amulet::StringEncode); + std::string write_named_tag(const std::string& name, const Amulet::FloatTag&, std::endian, Amulet::StringEncode); + std::string write_named_tag(const std::string& name, const Amulet::DoubleTag&, std::endian, Amulet::StringEncode); + std::string write_named_tag(const std::string& name, const Amulet::ByteArrayTagPtr&, std::endian, Amulet::StringEncode); + std::string write_named_tag(const std::string& name, const Amulet::StringTag&, std::endian, Amulet::StringEncode); + std::string write_named_tag(const std::string& name, const Amulet::ListTagPtr&, std::endian, Amulet::StringEncode); + std::string write_named_tag(const std::string& name, const Amulet::CompoundTagPtr&, std::endian, Amulet::StringEncode); + std::string write_named_tag(const std::string& name, const Amulet::IntArrayTagPtr&, std::endian, Amulet::StringEncode); + std::string write_named_tag(const std::string& name, const Amulet::LongArrayTagPtr&, std::endian, Amulet::StringEncode); + std::string write_named_tag(const std::string& name, const Amulet::TagNode&, std::endian, Amulet::StringEncode); + std::string write_named_tag(const Amulet::NamedTag& tag, std::endian, Amulet::StringEncode); } diff --git a/src/amulet_nbt/include/amulet_nbt/tag/wrapper.hpp b/src/amulet_nbt/include/amulet_nbt/tag/wrapper.hpp index fd3b67d5..eb588136 100644 --- a/src/amulet_nbt/include/amulet_nbt/tag/wrapper.hpp +++ b/src/amulet_nbt/include/amulet_nbt/tag/wrapper.hpp @@ -43,7 +43,7 @@ namespace Amulet { T tag; TagWrapper(T tag): tag(tag) {}; virtual std::string write_bnbt(std::string name, std::endian endianness, Amulet::StringEncode string_encode) const { - return Amulet::write_named_tag(name, tag, endianness, string_encode); + return Amulet::write_named_tag(name, tag, endianness, string_encode); } }; typedef TagWrapper ByteTagWrapper; diff --git a/src/amulet_nbt/pybind/bnbt.cpp b/src/amulet_nbt/pybind/bnbt.cpp index a8e817cf..ea8f58b8 100644 --- a/src/amulet_nbt/pybind/bnbt.cpp +++ b/src/amulet_nbt/pybind/bnbt.cpp @@ -96,12 +96,10 @@ void init_bnbt(py::module& m) { read_offset.offset ); } else if (read_offset_py.is(py::none())){ - size_t offset = 0; return Amulet::read_named_tag( buffer, endianness, - string_decoder, - offset + string_decoder ); } else { throw std::invalid_argument("read_offset must be ReadOffset or None"); From 8335180aee07ceb259da78cdbd802ec856b6c383 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Mon, 8 Jul 2024 14:06:39 +0100 Subject: [PATCH 057/121] Added error message macro --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index 8543173e..c98d796e 100644 --- a/setup.py +++ b/setup.py @@ -35,6 +35,7 @@ sources=glob.glob("src/amulet_nbt/pybind/**/*.cpp", recursive=True), include_dirs=["src/amulet_nbt/include", numpy.get_include(), pybind11.get_include()], libraries=["amulet_nbt"], + define_macros=[("PYBIND11_DETAILED_ERROR_MESSAGES", None)], extra_compile_args=CompileArgs ) ] From 7ac71ec3fa99956b446ead2b29b2496a23f7d610 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Mon, 8 Jul 2024 14:09:08 +0100 Subject: [PATCH 058/121] Added copy and deepcopy --- src/amulet_nbt/cpp/tag/copy.cpp | 84 +++++++++++++++++++ .../include/amulet_nbt/tag/copy.hpp | 19 +++++ src/amulet_nbt/pybind/tag/array.cpp | 17 +++- src/amulet_nbt/pybind/tag/compound.cpp | 14 ++++ src/amulet_nbt/pybind/tag/float.cpp | 17 +++- src/amulet_nbt/pybind/tag/int.cpp | 17 +++- src/amulet_nbt/pybind/tag/list.cpp | 22 ++++- src/amulet_nbt/pybind/tag/named_tag.cpp | 14 ++++ src/amulet_nbt/pybind/tag/string.cpp | 13 +++ 9 files changed, 208 insertions(+), 9 deletions(-) create mode 100644 src/amulet_nbt/cpp/tag/copy.cpp create mode 100644 src/amulet_nbt/include/amulet_nbt/tag/copy.hpp diff --git a/src/amulet_nbt/cpp/tag/copy.cpp b/src/amulet_nbt/cpp/tag/copy.cpp new file mode 100644 index 00000000..4501d0ad --- /dev/null +++ b/src/amulet_nbt/cpp/tag/copy.cpp @@ -0,0 +1,84 @@ +#include + +namespace Amulet { + template + Amulet::ListTagPtr NBTTag_deep_copy_list_vector(const std::vector& tag){ + Amulet::ListTagPtr new_tag = std::make_shared(std::in_place_type>); + std::vector& new_vector = std::get>(*new_tag); + for (T value: tag){ + if constexpr (std::is_same_v){ + new_vector.push_back(NBTTag_deep_copy_list(*value)); + } else if constexpr (std::is_same_v){ + new_vector.push_back(NBTTag_deep_copy_compound(*value)); + } else if constexpr (std::is_same_v){ + new_vector.push_back(NBTTag_copy(*value)); + } else if constexpr (std::is_same_v){ + new_vector.push_back(NBTTag_copy(*value)); + } else { + static_assert(std::is_same_v); + new_vector.push_back(NBTTag_copy(*value)); + } + } + return new_tag; + } + + Amulet::ListTagPtr NBTTag_deep_copy_list(const Amulet::ListTag& tag){ + switch (tag.index()){ + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 8: + return std::make_shared(tag); + case 7: + return NBTTag_deep_copy_list_vector(std::get(tag)); + case 9: + return NBTTag_deep_copy_list_vector(std::get(tag)); + case 10: + return NBTTag_deep_copy_list_vector(std::get(tag)); + case 11: + return NBTTag_deep_copy_list_vector(std::get(tag)); + case 12: + return NBTTag_deep_copy_list_vector(std::get(tag)); + default: + throw std::runtime_error(""); + } + } + + Amulet::TagNode NBTTag_deep_copy_node(const Amulet::TagNode& tag) { + switch (tag.index()){ + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 8: + return tag; + case 7: + return NBTTag_copy(*std::get(tag)); + case 9: + return NBTTag_deep_copy_list(*std::get(tag)); + case 10: + return NBTTag_deep_copy_compound(*std::get(tag)); + case 11: + return NBTTag_copy(*std::get(tag)); + case 12: + return NBTTag_copy(*std::get(tag)); + default: + throw std::runtime_error(""); + } + } + + Amulet::CompoundTagPtr NBTTag_deep_copy_compound(const Amulet::CompoundTag& tag){ + auto new_tag = std::make_shared(); + for (auto& [key, value]: tag){ + (*new_tag)[key] = NBTTag_deep_copy_node(value); + } + return new_tag; + } +} diff --git a/src/amulet_nbt/include/amulet_nbt/tag/copy.hpp b/src/amulet_nbt/include/amulet_nbt/tag/copy.hpp new file mode 100644 index 00000000..ba9756eb --- /dev/null +++ b/src/amulet_nbt/include/amulet_nbt/tag/copy.hpp @@ -0,0 +1,19 @@ +#pragma once + +#include +#include +#include + +#include +#include + +namespace Amulet { + template + std::shared_ptr NBTTag_copy(const T& tag){ + return std::make_shared(tag); + } + + Amulet::ListTagPtr NBTTag_deep_copy_list(const Amulet::ListTag& tag); + Amulet::TagNode NBTTag_deep_copy_node(const Amulet::TagNode& tag); + Amulet::CompoundTagPtr NBTTag_deep_copy_compound(const Amulet::CompoundTag& tag); +} diff --git a/src/amulet_nbt/pybind/tag/array.cpp b/src/amulet_nbt/pybind/tag/array.cpp index 0bd973b5..18cc5d56 100644 --- a/src/amulet_nbt/pybind/tag/array.cpp +++ b/src/amulet_nbt/pybind/tag/array.cpp @@ -1,11 +1,13 @@ #include -#include #include #include #include #include +#include +#include + namespace py = pybind11; @@ -88,6 +90,19 @@ namespace py = pybind11; return out;\ }\ );\ + CLSNAME.def(\ + "__copy__",\ + [](const Amulet::CLSNAME##Wrapper& self){\ + return Amulet::CLSNAME##Wrapper(NBTTag_copy(*self.tag));\ + }\ + );\ + CLSNAME.def(\ + "__deepcopy__",\ + [](const Amulet::CLSNAME##Wrapper& self, py::dict){\ + return Amulet::CLSNAME##Wrapper(Amulet::NBTTag_copy(*self.tag));\ + },\ + py::arg("memo")\ + );\ CLSNAME.def(\ "__eq__",\ [](const Amulet::CLSNAME##Wrapper& self, const Amulet::CLSNAME##Wrapper& other){\ diff --git a/src/amulet_nbt/pybind/tag/compound.cpp b/src/amulet_nbt/pybind/tag/compound.cpp index fbab115c..5af1cd52 100644 --- a/src/amulet_nbt/pybind/tag/compound.cpp +++ b/src/amulet_nbt/pybind/tag/compound.cpp @@ -8,6 +8,7 @@ #include #include #include +#include namespace py = pybind11; @@ -111,6 +112,19 @@ void init_compound(py::module& m) { return out; } ); + CompoundTag.def( + "__copy__", + [](const Amulet::CompoundTagWrapper& self){ + return Amulet::CompoundTagWrapper(NBTTag_copy(*self.tag)); + } + ); + CompoundTag.def( + "__deepcopy__", + [](const Amulet::CompoundTagWrapper& self, py::dict){ + return Amulet::CompoundTagWrapper(Amulet::NBTTag_deep_copy_compound(*self.tag)); + }, + py::arg("memo") + ); CompoundTag.def( "__str__", [](const Amulet::CompoundTagWrapper& self){ diff --git a/src/amulet_nbt/pybind/tag/float.cpp b/src/amulet_nbt/pybind/tag/float.cpp index 22943edd..359a8fc2 100644 --- a/src/amulet_nbt/pybind/tag/float.cpp +++ b/src/amulet_nbt/pybind/tag/float.cpp @@ -1,9 +1,9 @@ -#include - #include #include #include +#include + namespace py = pybind11; @@ -50,6 +50,19 @@ namespace py = pybind11; return std::to_string(self.tag);\ }\ );\ + CLSNAME.def(\ + "__copy__",\ + [](const Amulet::CLSNAME##Wrapper& self){\ + return self;\ + }\ + );\ + CLSNAME.def(\ + "__deepcopy__",\ + [](const Amulet::CLSNAME##Wrapper& self, py::dict){\ + return self;\ + },\ + py::arg("memo")\ + );\ CLSNAME.def(\ "__hash__",\ [](const Amulet::CLSNAME##Wrapper& self){\ diff --git a/src/amulet_nbt/pybind/tag/int.cpp b/src/amulet_nbt/pybind/tag/int.cpp index 16601aa4..91fafc97 100644 --- a/src/amulet_nbt/pybind/tag/int.cpp +++ b/src/amulet_nbt/pybind/tag/int.cpp @@ -1,9 +1,9 @@ -#include - #include #include #include +#include + namespace py = pybind11; @@ -52,6 +52,19 @@ namespace py = pybind11; return std::to_string(self.tag);\ }\ );\ + CLSNAME.def(\ + "__copy__",\ + [](const Amulet::CLSNAME##Wrapper& self){\ + return self;\ + }\ + );\ + CLSNAME.def(\ + "__deepcopy__",\ + [](const Amulet::CLSNAME##Wrapper& self, py::dict){\ + return self;\ + },\ + py::arg("memo")\ + );\ CLSNAME.def(\ "__hash__",\ [](const Amulet::CLSNAME##Wrapper& self){\ diff --git a/src/amulet_nbt/pybind/tag/list.cpp b/src/amulet_nbt/pybind/tag/list.cpp index f09f14cc..7607fb60 100644 --- a/src/amulet_nbt/pybind/tag/list.cpp +++ b/src/amulet_nbt/pybind/tag/list.cpp @@ -2,15 +2,16 @@ #include #include -#include -#include -#include - #include #include #include #include +#include +#include +#include +#include + namespace py = pybind11; void ListTag_extend(Amulet::ListTagPtr tag, py::object value){ @@ -234,6 +235,19 @@ void init_list(py::module& m) { return py::str(py::list(py::cast(self))); } ); + ListTag.def( + "__copy__", + [](const Amulet::ListTagWrapper& self){ + return Amulet::ListTagWrapper(NBTTag_copy(*self.tag)); + } + ); + ListTag.def( + "__deepcopy__", + [](const Amulet::ListTagWrapper& self, py::dict){ + return Amulet::ListTagWrapper(Amulet::NBTTag_deep_copy_list(*self.tag)); + }, + py::arg("memo") + ); ListTag.def( "__eq__", [](const Amulet::ListTagWrapper& self, const Amulet::ListTagWrapper& other){ diff --git a/src/amulet_nbt/pybind/tag/named_tag.cpp b/src/amulet_nbt/pybind/tag/named_tag.cpp index 53ebc64a..a3646cd0 100644 --- a/src/amulet_nbt/pybind/tag/named_tag.cpp +++ b/src/amulet_nbt/pybind/tag/named_tag.cpp @@ -5,6 +5,7 @@ #include #include #include +#include namespace py = pybind11; @@ -97,6 +98,19 @@ void init_named_tag(py::module& m) { return out; } ); + NamedTag.def( + "__copy__", + [](const Amulet::NamedTag& self){ + return self; + } + ); + NamedTag.def( + "__deepcopy__", + [](const Amulet::NamedTag& self, py::dict){ + return Amulet::NamedTag(self.name, Amulet::NBTTag_deep_copy_node(self.tag_node)); + }, + py::arg("memo") + ); NamedTag.def( "__eq__", [](const Amulet::NamedTag& self, const Amulet::NamedTag& other){ diff --git a/src/amulet_nbt/pybind/tag/string.cpp b/src/amulet_nbt/pybind/tag/string.cpp index 785d6cb3..2d2ed36e 100644 --- a/src/amulet_nbt/pybind/tag/string.cpp +++ b/src/amulet_nbt/pybind/tag/string.cpp @@ -70,6 +70,19 @@ void init_string(py::module& m) { return py::bytes(self.tag); } ); + StringTag.def( + "__copy__", + [](const Amulet::StringTagWrapper& self){ + return self; + } + ); + StringTag.def( + "__deepcopy__", + [](const Amulet::StringTagWrapper& self, py::dict){ + return self; + }, + py::arg("memo") + ); StringTag.def( "__hash__", [](const Amulet::StringTagWrapper& self){ From 3240bb0118fc914cfd4806c8f04ef43c871f9d40 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Mon, 8 Jul 2024 14:10:55 +0100 Subject: [PATCH 059/121] Implemented save_to --- src/amulet_nbt/pybind/tag/abc.cpp | 70 ++++++++++++++++++++++++++++++- 1 file changed, 69 insertions(+), 1 deletion(-) diff --git a/src/amulet_nbt/pybind/tag/abc.cpp b/src/amulet_nbt/pybind/tag/abc.cpp index 2e15cc11..5718a3df 100644 --- a/src/amulet_nbt/pybind/tag/abc.cpp +++ b/src/amulet_nbt/pybind/tag/abc.cpp @@ -1,3 +1,5 @@ +#include + #include #include #include @@ -89,9 +91,75 @@ void init_abc(py::module& m) { py::arg("string_encoding") = mutf8_encoding, py::arg("name") = "" ); + auto save_to = [to_nbt]( + const Amulet::AbstractBaseTag& self, + py::object filepath_or_writable, + std::string name, + bool compressed, + std::endian endianness, + Amulet::StringEncode string_encoder + ){ + py::bytes py_data = to_nbt(self, name, compressed, endianness, string_encoder); + if (!filepath_or_writable.is(py::none())){ + if (py::isinstance(filepath_or_writable)){ + std::string data = py_data.cast(); + std::ofstream file(filepath_or_writable.cast(), std::ios::out | std::ios::binary | std::ios::trunc); + file.write(data.c_str(), data.size()); + } else { + filepath_or_writable.attr("write")(py_data); + } + } + return py_data; + }; AbstractBaseTag.def( "save_to", - abstract_method + [save_to]( + const Amulet::AbstractBaseTag& self, + py::object filepath_or_writable, + Amulet::EncodingPreset preset, + std::string name + ){ + return save_to( + self, + filepath_or_writable, + name, + preset.compressed, + preset.endianness, + preset.string_encoding.encode + ); + }, + py::arg("filepath_or_writable"), + py::pos_only(), + py::kw_only(), + py::arg("preset") = java_encoding, + py::arg("name") = "" + ); + AbstractBaseTag.def( + "save_to", + [save_to]( + const Amulet::AbstractBaseTag& self, + py::object filepath_or_writable, + bool compressed, + bool little_endian, + Amulet::StringEncoding string_encoding, + std::string name + ){ + return save_to( + self, + filepath_or_writable, + name, + compressed, + little_endian ? std::endian::little : std::endian::big, + string_encoding.encode + ); + }, + py::arg("filepath_or_writable"), + py::pos_only(), + py::kw_only(), + py::arg("compressed") = true, + py::arg("little_endian") = false, + py::arg("string_encoding") = mutf8_encoding, + py::arg("name") = "" ); AbstractBaseTag.def( "to_snbt", From c23b5bbdde9cf71d4fed1aa92658ce89398432fc Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Mon, 8 Jul 2024 14:11:24 +0100 Subject: [PATCH 060/121] Removed old components --- src_/amulet_nbt/_libcpp/__init__.pxd | 0 src_/amulet_nbt/_libcpp/endian.pxd | 7 - src_/amulet_nbt/_libcpp/variant.pxd | 18 - src_/amulet_nbt/_nbt_encoding/__init__.pxd | 0 src_/amulet_nbt/_nbt_encoding/__init__.pyx | 0 .../_nbt_encoding/_binary/__init__.pxd | 5 - .../_nbt_encoding/_binary/__init__.py | 1 - .../_nbt_encoding/_binary/_cpp/__init__.pxd | 6 - .../_binary/_cpp/_binary/reader.hpp | 84 - .../_binary/_cpp/_binary/writer.hpp | 55 - .../_nbt_encoding/_binary/_cpp/read_nbt.cpp | 171 - .../_nbt_encoding/_binary/_cpp/read_nbt.hpp | 17 - .../_nbt_encoding/_binary/_cpp/read_nbt.pxd | 14 - .../_nbt_encoding/_binary/_cpp/write_nbt.hpp | 266 - .../_nbt_encoding/_binary/_cpp/write_nbt.pxd | 7 - .../_nbt_encoding/_binary/encoding_preset.pxd | 9 - .../_nbt_encoding/_binary/encoding_preset.pyx | 20 - .../amulet_nbt/_nbt_encoding/_binary/read.pxd | 2 - .../amulet_nbt/_nbt_encoding/_binary/read.pyx | 141 - .../_nbt_encoding/_string/__init__.pxd | 19 - .../_nbt_encoding/_string/__init__.py | 1 - .../_nbt_encoding/_string/_cpp/__init__.pxd | 19 - .../_nbt_encoding/_string/_cpp/write_snbt.hpp | 388 - .../_nbt_encoding/_string/_cpp/write_snbt.pxd | 37 - src_/amulet_nbt/_string_encoding/__init__.cpp | 4418 --------- src_/amulet_nbt/_string_encoding/__init__.pxd | 1 - src_/amulet_nbt/_string_encoding/__init__.pyx | 8 - src_/amulet_nbt/_string_encoding/encoding.cpp | 8574 ----------------- src_/amulet_nbt/_string_encoding/encoding.pxd | 6 - src_/amulet_nbt/_string_encoding/encoding.pyx | 33 - template.py | 83 - 31 files changed, 14410 deletions(-) delete mode 100644 src_/amulet_nbt/_libcpp/__init__.pxd delete mode 100644 src_/amulet_nbt/_libcpp/endian.pxd delete mode 100644 src_/amulet_nbt/_libcpp/variant.pxd delete mode 100644 src_/amulet_nbt/_nbt_encoding/__init__.pxd delete mode 100644 src_/amulet_nbt/_nbt_encoding/__init__.pyx delete mode 100644 src_/amulet_nbt/_nbt_encoding/_binary/__init__.pxd delete mode 100644 src_/amulet_nbt/_nbt_encoding/_binary/__init__.py delete mode 100644 src_/amulet_nbt/_nbt_encoding/_binary/_cpp/__init__.pxd delete mode 100644 src_/amulet_nbt/_nbt_encoding/_binary/_cpp/_binary/reader.hpp delete mode 100644 src_/amulet_nbt/_nbt_encoding/_binary/_cpp/_binary/writer.hpp delete mode 100644 src_/amulet_nbt/_nbt_encoding/_binary/_cpp/read_nbt.cpp delete mode 100644 src_/amulet_nbt/_nbt_encoding/_binary/_cpp/read_nbt.hpp delete mode 100644 src_/amulet_nbt/_nbt_encoding/_binary/_cpp/read_nbt.pxd delete mode 100644 src_/amulet_nbt/_nbt_encoding/_binary/_cpp/write_nbt.hpp delete mode 100644 src_/amulet_nbt/_nbt_encoding/_binary/_cpp/write_nbt.pxd delete mode 100644 src_/amulet_nbt/_nbt_encoding/_binary/encoding_preset.pxd delete mode 100644 src_/amulet_nbt/_nbt_encoding/_binary/encoding_preset.pyx delete mode 100644 src_/amulet_nbt/_nbt_encoding/_binary/read.pxd delete mode 100644 src_/amulet_nbt/_nbt_encoding/_binary/read.pyx delete mode 100644 src_/amulet_nbt/_nbt_encoding/_string/__init__.pxd delete mode 100644 src_/amulet_nbt/_nbt_encoding/_string/__init__.py delete mode 100644 src_/amulet_nbt/_nbt_encoding/_string/_cpp/__init__.pxd delete mode 100644 src_/amulet_nbt/_nbt_encoding/_string/_cpp/write_snbt.hpp delete mode 100644 src_/amulet_nbt/_nbt_encoding/_string/_cpp/write_snbt.pxd delete mode 100644 src_/amulet_nbt/_string_encoding/__init__.cpp delete mode 100644 src_/amulet_nbt/_string_encoding/__init__.pxd delete mode 100644 src_/amulet_nbt/_string_encoding/__init__.pyx delete mode 100644 src_/amulet_nbt/_string_encoding/encoding.cpp delete mode 100644 src_/amulet_nbt/_string_encoding/encoding.pxd delete mode 100644 src_/amulet_nbt/_string_encoding/encoding.pyx delete mode 100644 template.py diff --git a/src_/amulet_nbt/_libcpp/__init__.pxd b/src_/amulet_nbt/_libcpp/__init__.pxd deleted file mode 100644 index e69de29b..00000000 diff --git a/src_/amulet_nbt/_libcpp/endian.pxd b/src_/amulet_nbt/_libcpp/endian.pxd deleted file mode 100644 index dd543b8c..00000000 --- a/src_/amulet_nbt/_libcpp/endian.pxd +++ /dev/null @@ -1,7 +0,0 @@ -# distutils: language = c++ - -cdef extern from "" namespace "std" nogil: - cdef enum endian "std::endian": - little "std::endian::little" - big "std::endian::big" - native "std::endian::native" diff --git a/src_/amulet_nbt/_libcpp/variant.pxd b/src_/amulet_nbt/_libcpp/variant.pxd deleted file mode 100644 index ec6af2b5..00000000 --- a/src_/amulet_nbt/_libcpp/variant.pxd +++ /dev/null @@ -1,18 +0,0 @@ -# distutils: language = c++ - -cdef extern from "" namespace "std" nogil: - cdef cppclass variant: - variant& operator=(variant&) - - # Observers - size_t index() - bint valueless_by_exception() - - # Modifiers - T& emplace[T](...) - void swap(...) - - cdef struct monostate - - T* get_if[T](...) - T& get[T](...) diff --git a/src_/amulet_nbt/_nbt_encoding/__init__.pxd b/src_/amulet_nbt/_nbt_encoding/__init__.pxd deleted file mode 100644 index e69de29b..00000000 diff --git a/src_/amulet_nbt/_nbt_encoding/__init__.pyx b/src_/amulet_nbt/_nbt_encoding/__init__.pyx deleted file mode 100644 index e69de29b..00000000 diff --git a/src_/amulet_nbt/_nbt_encoding/_binary/__init__.pxd b/src_/amulet_nbt/_nbt_encoding/_binary/__init__.pxd deleted file mode 100644 index 6e88b1a5..00000000 --- a/src_/amulet_nbt/_nbt_encoding/_binary/__init__.pxd +++ /dev/null @@ -1,5 +0,0 @@ -# cython: language_level=3, boundscheck=False, wraparound=False -# distutils: language = c++ -# distutils: extra_compile_args = CPPCARGS - -from amulet_nbt._nbt_encoding._binary._cpp cimport read_named_tag, write_named_tag diff --git a/src_/amulet_nbt/_nbt_encoding/_binary/__init__.py b/src_/amulet_nbt/_nbt_encoding/_binary/__init__.py deleted file mode 100644 index 405bf56d..00000000 --- a/src_/amulet_nbt/_nbt_encoding/_binary/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from .read import load, load_array, ReadOffset diff --git a/src_/amulet_nbt/_nbt_encoding/_binary/_cpp/__init__.pxd b/src_/amulet_nbt/_nbt_encoding/_binary/_cpp/__init__.pxd deleted file mode 100644 index 16bb9226..00000000 --- a/src_/amulet_nbt/_nbt_encoding/_binary/_cpp/__init__.pxd +++ /dev/null @@ -1,6 +0,0 @@ -# cython: language_level=3, boundscheck=False, wraparound=False -# distutils: language = c++ -# distutils: extra_compile_args = CPPCARGS - -from amulet_nbt._nbt_encoding._binary._cpp.read_nbt cimport read_named_tag -from amulet_nbt._nbt_encoding._binary._cpp.write_nbt cimport write_named_tag diff --git a/src_/amulet_nbt/_nbt_encoding/_binary/_cpp/_binary/reader.hpp b/src_/amulet_nbt/_nbt_encoding/_binary/_cpp/_binary/reader.hpp deleted file mode 100644 index 790671d9..00000000 --- a/src_/amulet_nbt/_nbt_encoding/_binary/_cpp/_binary/reader.hpp +++ /dev/null @@ -1,84 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include - - -typedef std::function StringDecode; - - -class BinaryReader { -private: - const std::string& data; - size_t& position; - std::endian endianness; - StringDecode stringDecode; - -public: - BinaryReader( - const std::string& input, - size_t& position, - std::endian endianness, - StringDecode stringDecode - ) - : data(input), position(position), endianness(endianness), stringDecode(stringDecode) {} - - /** - * Read a numeric type from the buffer into the given value and fix its endianness. - */ - template inline void readNumericInto(T& value) { - // Ensure the buffer is long enough - if (position + sizeof(T) > data.size()) { - throw std::out_of_range(std::string("Cannot read ") + typeid(T).name() + " at position " + std::to_string(position)); - } - - // Create - const char* src = &data[position]; - char* dst = (char*)&value; - - // Copy - if (endianness == std::endian::native){ - for (size_t i = 0; i < sizeof(T); i++){ - dst[i] = src[i]; - } - } else { - for (size_t i = 0; i < sizeof(T); i++){ - dst[i] = src[sizeof(T) - i - 1]; - } - } - - // Increment position - position += sizeof(T); - } - - /** - * Read a numeric type from the buffer and fix its endianness. - * - * @return A value of the requested type. - */ - template inline T readNumeric() { - T value; - readNumericInto(value); - return value; - } - - std::string readString(size_t length) { - // Ensure the buffer is long enough - if (position + length > data.size()) { - throw std::out_of_range("Cannot read string at position " + std::to_string(position)); - } - - std::string value = data.substr(position, length); - position += length; - return stringDecode(value); - } - - size_t getPosition(){ - return position; - } -}; diff --git a/src_/amulet_nbt/_nbt_encoding/_binary/_cpp/_binary/writer.hpp b/src_/amulet_nbt/_nbt_encoding/_binary/_cpp/_binary/writer.hpp deleted file mode 100644 index b1b5397c..00000000 --- a/src_/amulet_nbt/_nbt_encoding/_binary/_cpp/_binary/writer.hpp +++ /dev/null @@ -1,55 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include - - -typedef std::function StringEncode; - - -class BinaryWriter { -private: - std::string data; - std::endian endianness; - StringEncode stringEncode; - -public: - BinaryWriter( - std::endian endianness, - StringEncode stringEncode - ) : endianness(endianness), stringEncode(stringEncode) {} - - /** - * Fix the endianness of the numeric value and write it to the buffer. - */ - template inline void writeNumeric(const T& value) { - // Create - char* src = (char*)&value; - - // Copy - if (endianness == std::endian::native){ - data.append(src, sizeof(T)); - } else { - for (size_t i = 0; i < sizeof(T); i++){ - data.push_back(src[sizeof(T) - i - 1]); - } - } - } - - std::string encodeString(const std::string& value) { - return stringEncode(value); - } - - void writeString(const std::string& value) { - data.append(value); - } - - std::string getBuffer(){ - return data; - } -}; diff --git a/src_/amulet_nbt/_nbt_encoding/_binary/_cpp/read_nbt.cpp b/src_/amulet_nbt/_nbt_encoding/_binary/_cpp/read_nbt.cpp deleted file mode 100644 index 19b35096..00000000 --- a/src_/amulet_nbt/_nbt_encoding/_binary/_cpp/read_nbt.cpp +++ /dev/null @@ -1,171 +0,0 @@ -#include "read_nbt.hpp" - -CStringTag read_string_tag(BinaryReader& reader){ - std::uint16_t length = reader.readNumeric(); - return reader.readString(length); -}; - - -TagNode read_node(BinaryReader& reader, std::uint8_t tag_id); - - -CCompoundTagPtr read_compound_tag(BinaryReader& reader){ - CCompoundTagPtr tag = std::make_shared(); - while (true){ - std::uint8_t tag_id = reader.readNumeric(); - if (tag_id == 0){ - break; - } - CStringTag name = read_string_tag(reader); - TagNode node = read_node(reader, tag_id); - (*tag)[name] = node; - } - return tag; -}; - - -template -std::shared_ptr> read_array_tag(BinaryReader& reader){ - std::int32_t length = reader.readNumeric(); - if (length < 0){length = 0;} - std::shared_ptr> tag = std::make_shared>(length); - for (std::int32_t i = 0; i < length; i++){ - reader.readNumericInto((*tag)[i]); - } - return tag; -} - - -template -CListTagPtr read_numeric_list_tag(BinaryReader& reader){ - std::int32_t length = reader.readNumeric(); - if (length < 0){length = 0;} - CListTagPtr tag = std::make_shared(std::vector(length)); - std::vector& list = std::get>(*tag); - for (std::int32_t i = 0; i < length; i++){ - reader.readNumericInto(list[i]); - } - return tag; -} - - -template -CListTagPtr read_template_list_tag(BinaryReader& reader){ - std::int32_t length = reader.readNumeric(); - if (length < 0){length = 0;} - CListTagPtr tag = std::make_shared(std::vector(length)); - std::vector& list = std::get>(*tag); - for (std::int32_t i = 0; i < length; i++){ - list[i] = readTag(reader); - } - return tag; -} - - -CListTagPtr read_void_list_tag(BinaryReader& reader){ - std::int32_t length = reader.readNumeric(); - if (length < 0){length = 0;} - if (length != 0){throw std::runtime_error("Void list tag must have a length of 0");} - return std::make_shared(); -} - - -CListTagPtr read_list_tag(BinaryReader& reader){ - std::uint8_t tag_type = reader.readNumeric(); - switch(tag_type){ - case 0: - return read_void_list_tag(reader); - case 1: - return read_numeric_list_tag(reader); - case 2: - return read_numeric_list_tag(reader); - case 3: - return read_numeric_list_tag(reader); - case 4: - return read_numeric_list_tag(reader); - case 5: - return read_numeric_list_tag(reader); - case 6: - return read_numeric_list_tag(reader); - case 7: - return read_template_list_tag>(reader); - case 8: - return read_template_list_tag(reader); - case 9: - return read_template_list_tag(reader); - case 10: - return read_template_list_tag(reader); - case 11: - return read_template_list_tag>(reader); - case 12: - return read_template_list_tag>(reader); - default: - throw std::runtime_error("This shouldn't happen"); - } -}; - - -TagNode read_node(BinaryReader& reader, std::uint8_t tag_id){ - TagNode node; - switch(tag_id){ - case 1: - node = reader.readNumeric(); - break; - case 2: - node = reader.readNumeric(); - break; - case 3: - node = reader.readNumeric(); - break; - case 4: - node = reader.readNumeric(); - break; - case 5: - node = reader.readNumeric(); - break; - case 6: - node = reader.readNumeric(); - break; - case 8: - node = read_string_tag(reader); - break; - case 9: - node = read_list_tag(reader); - break; - case 10: - node = read_compound_tag(reader); - break; - case 7: - node = read_array_tag(reader); - break; - case 11: - node = read_array_tag(reader); - break; - case 12: - node = read_array_tag(reader); - break; - default: - throw std::runtime_error("Unsupported tag type"); - } - return node; -}; - - -std::pair read_named_tag(BinaryReader& reader){ - std::uint8_t tag_id = reader.readNumeric(); - std::string name = read_string_tag(reader); - TagNode node = read_node(reader, tag_id); - return std::make_pair(name, node); -} - - -std::pair read_named_tag(const std::string& raw, std::endian endianness, StringDecode stringDecode, size_t& offset){ - BinaryReader reader(raw, offset, endianness, stringDecode); - return read_named_tag(reader); -} - - -std::pair read_named_tag(const std::string& raw, std::endian endianness, StringDecode stringDecode){ - size_t offset = 0; - return read_named_tag(raw, endianness, stringDecode, offset); -} diff --git a/src_/amulet_nbt/_nbt_encoding/_binary/_cpp/read_nbt.hpp b/src_/amulet_nbt/_nbt_encoding/_binary/_cpp/read_nbt.hpp deleted file mode 100644 index 723c9020..00000000 --- a/src_/amulet_nbt/_nbt_encoding/_binary/_cpp/read_nbt.hpp +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -#include "_binary/reader.hpp" -#include "../../../_tag/_cpp/nbt.hpp" -#include "../../../_tag/_cpp/array.hpp" -#include "../../../_string_encoding/_cpp/utf8.hpp" -#include "../../../_string_encoding/_cpp/mutf8.hpp" - -// Read a type byte followed by a name followed by a payload of that type -std::pair read_named_tag(BinaryReader&); -std::pair read_named_tag(const std::string&, std::endian, StringDecode, size_t&); -std::pair read_named_tag(const std::string&, std::endian, StringDecode); diff --git a/src_/amulet_nbt/_nbt_encoding/_binary/_cpp/read_nbt.pxd b/src_/amulet_nbt/_nbt_encoding/_binary/_cpp/read_nbt.pxd deleted file mode 100644 index 27f29be8..00000000 --- a/src_/amulet_nbt/_nbt_encoding/_binary/_cpp/read_nbt.pxd +++ /dev/null @@ -1,14 +0,0 @@ -# cython: language_level=3, boundscheck=False, wraparound=False -# distutils: language = c++ -# distutils: extra_compile_args = CPPCARGS - -from libcpp.string cimport string -from libcpp.pair cimport pair -from amulet_nbt._libcpp.endian cimport endian -from amulet_nbt._tag._cpp cimport TagNode -from amulet_nbt._string_encoding._cpp cimport CStringDecode - - -cdef extern from "read_nbt.hpp" nogil: - pair[string, TagNode] read_named_tag(const string&, endian, CStringDecode, size_t&) except + - pair[string, TagNode] read_named_tag(const string&, endian, CStringDecode) except + diff --git a/src_/amulet_nbt/_nbt_encoding/_binary/_cpp/write_nbt.hpp b/src_/amulet_nbt/_nbt_encoding/_binary/_cpp/write_nbt.hpp deleted file mode 100644 index 455a6df7..00000000 --- a/src_/amulet_nbt/_nbt_encoding/_binary/_cpp/write_nbt.hpp +++ /dev/null @@ -1,266 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - -#include "_binary/writer.hpp" -#include "../../../_tag/_cpp/nbt.hpp" -#include "../../../_tag/_cpp/array.hpp" - -// I wanted to use templates to reduce code duplication but I can't get this to work -// The template version compiled and passed all tests on my computer but it just wasn't working on the remote servers - - -void write_byte_payload(BinaryWriter& writer, const CByteTag& value); -void write_short_payload(BinaryWriter& writer, const CShortTag& value); -void write_int_payload(BinaryWriter& writer, const CIntTag& value); -void write_long_payload(BinaryWriter& writer, const CLongTag& value); -void write_float_payload(BinaryWriter& writer, const CFloatTag& value); -void write_double_payload(BinaryWriter& writer, const CDoubleTag& value); -void write_byte_array_payload(BinaryWriter& writer, const CByteArrayTagPtr& value); -void write_string_payload(BinaryWriter& writer, const CStringTag& value); -void write_list_payload(BinaryWriter& writer, const CListTagPtr& value); -void write_compound_payload(BinaryWriter& writer, const CCompoundTagPtr& value); -void write_int_array_payload(BinaryWriter& writer, const CIntArrayTagPtr& value); -void write_long_array_payload(BinaryWriter& writer, const CLongArrayTagPtr& value); - - -template -constexpr size_t variant_index() { - static_assert(I < std::variant_size_v, "Type T is not a member of variant V"); - if constexpr (std::is_same_v, T>) { - return (I); - } else { - return (variant_index()); - } -} - - -template < - typename T, - std::enable_if_t< - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v, - bool - > = true -> -void write_named_tag(BinaryWriter& writer, const std::string& name, const T& tag){ - writer.writeNumeric(variant_index()); - write_string_payload(writer, name); - if constexpr (std::is_same_v){write_byte_payload(writer, tag);} else - if constexpr (std::is_same_v){write_short_payload(writer, tag);} else - if constexpr (std::is_same_v){write_int_payload(writer, tag);} else - if constexpr (std::is_same_v){write_long_payload(writer, tag);} else - if constexpr (std::is_same_v){write_float_payload(writer, tag);} else - if constexpr (std::is_same_v){write_double_payload(writer, tag);} else - if constexpr (std::is_same_v){write_byte_array_payload(writer, tag);} else - if constexpr (std::is_same_v){write_string_payload(writer, tag);} else - if constexpr (std::is_same_v){write_list_payload(writer, tag);} else - if constexpr (std::is_same_v){write_compound_payload(writer, tag);} else - if constexpr (std::is_same_v){write_int_array_payload(writer, tag);} else - if constexpr (std::is_same_v){write_long_array_payload(writer, tag);} -} - - -template < - typename T, - std::enable_if_t, bool> = true -> -void write_named_tag(BinaryWriter& writer, const std::string& name, const TagNode& node){ - switch (node.index()){ - case 1: write_named_tag(writer, name, std::get(node)); break; - case 2: write_named_tag(writer, name, std::get(node)); break; - case 3: write_named_tag(writer, name, std::get(node)); break; - case 4: write_named_tag(writer, name, std::get(node)); break; - case 5: write_named_tag(writer, name, std::get(node)); break; - case 6: write_named_tag(writer, name, std::get(node)); break; - case 7: write_named_tag(writer, name, std::get(node)); break; - case 8: write_named_tag(writer, name, std::get(node)); break; - case 9: write_named_tag(writer, name, std::get(node)); break; - case 10: write_named_tag(writer, name, std::get(node)); break; - case 11: write_named_tag(writer, name, std::get(node)); break; - case 12: write_named_tag(writer, name, std::get(node)); break; - default: throw std::runtime_error("TagNode cannot be in null state when writing."); - } -} - - -template < - typename T, - std::enable_if_t< - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v, - bool - > = true -> -std::string write_named_tag(const std::string& name, const T& tag, std::endian endianness, StringEncode stringEncode){ - BinaryWriter writer(endianness, stringEncode); - write_named_tag(writer, name, tag); - return writer.getBuffer(); -} - - -void write_byte_payload(BinaryWriter& writer, const CByteTag& value){ - writer.writeNumeric(value); -} - -void write_short_payload(BinaryWriter& writer, const CShortTag& value){ - writer.writeNumeric(value); -} - -void write_int_payload(BinaryWriter& writer, const CIntTag& value){ - writer.writeNumeric(value); -} - -void write_long_payload(BinaryWriter& writer, const CLongTag& value){ - writer.writeNumeric(value); -} - -void write_float_payload(BinaryWriter& writer, const CFloatTag& value){ - writer.writeNumeric(value); -} - -void write_double_payload(BinaryWriter& writer, const CDoubleTag& value){ - writer.writeNumeric(value); -} - -void write_string_payload(BinaryWriter& writer, const CStringTag& value){ - std::string encoded_string = writer.encodeString(value); - if (encoded_string.size() > static_cast(std::numeric_limits::max())){ - throw std::overflow_error("String of length " + std::to_string(encoded_string.size()) + " is too long."); - } - std::uint16_t length = static_cast(encoded_string.size()); - writer.writeNumeric(length); - writer.writeString(encoded_string); -} - - -template < - typename T, - std::enable_if_t< - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v, - bool - > = true -> -void write_list_tag_payload(BinaryWriter& writer, const CListTagPtr& value){ - const std::vector& list = std::get>(*value); - if (list.size() > static_cast(std::numeric_limits::max())){ - throw std::overflow_error("List of length " + std::to_string(list.size()) + " is too long."); - } - writer.writeNumeric(variant_index()); - std::int32_t length = static_cast(list.size()); - writer.writeNumeric(length); - for (const T& element: list){ - if constexpr (std::is_same_v){write_byte_payload(writer, element);} else - if constexpr (std::is_same_v){write_short_payload(writer, element);} else - if constexpr (std::is_same_v){write_int_payload(writer, element);} else - if constexpr (std::is_same_v){write_long_payload(writer, element);} else - if constexpr (std::is_same_v){write_float_payload(writer, element);} else - if constexpr (std::is_same_v){write_double_payload(writer, element);} else - if constexpr (std::is_same_v){write_byte_array_payload(writer, element);} else - if constexpr (std::is_same_v){write_string_payload(writer, element);} else - if constexpr (std::is_same_v){write_list_payload(writer, element);} else - if constexpr (std::is_same_v){write_compound_payload(writer, element);} else - if constexpr (std::is_same_v){write_int_array_payload(writer, element);} else - if constexpr (std::is_same_v){write_long_array_payload(writer, element);} - } -} - - -void write_list_payload(BinaryWriter& writer, const CListTagPtr& value){ - switch (value->index()){ - case 0: - writer.writeNumeric(0); - writer.writeNumeric(0); - break; - case 1: write_list_tag_payload(writer, value); break; - case 2: write_list_tag_payload(writer, value); break; - case 3: write_list_tag_payload(writer, value); break; - case 4: write_list_tag_payload(writer, value); break; - case 5: write_list_tag_payload(writer, value); break; - case 6: write_list_tag_payload(writer, value); break; - case 7: write_list_tag_payload(writer, value); break; - case 8: write_list_tag_payload(writer, value); break; - case 9: write_list_tag_payload(writer, value); break; - case 10: write_list_tag_payload(writer, value); break; - case 11: write_list_tag_payload(writer, value); break; - case 12: write_list_tag_payload(writer, value); break; - } -} - - -void write_compound_payload(BinaryWriter& writer, const CCompoundTagPtr& value){ - for (auto it = value->begin(); it != value->end(); it++){ - write_named_tag(writer, it->first, it->second); - } - writer.writeNumeric(0); -}; - - -void write_byte_array_payload(BinaryWriter& writer, const CByteArrayTagPtr& value){ - if (value->size() > static_cast(std::numeric_limits::max())){ - throw std::overflow_error("Array of length " + std::to_string(value->size()) + " is too long."); - } - std::int32_t length = static_cast(value->size()); - writer.writeNumeric(length); - for (const CByteTag& element: *value){ - writer.writeNumeric(element); - } -} - -void write_int_array_payload(BinaryWriter& writer, const CIntArrayTagPtr& value){ - if (value->size() > static_cast(std::numeric_limits::max())){ - throw std::overflow_error("Array of length " + std::to_string(value->size()) + " is too long."); - } - std::int32_t length = static_cast(value->size()); - writer.writeNumeric(length); - for (const CIntTag& element: *value){ - writer.writeNumeric(element); - } -} - -void write_long_array_payload(BinaryWriter& writer, const CLongArrayTagPtr& value){ - if (value->size() > static_cast(std::numeric_limits::max())){ - throw std::overflow_error("Array of length " + std::to_string(value->size()) + " is too long."); - } - std::int32_t length = static_cast(value->size()); - writer.writeNumeric(length); - for (const CLongTag& element: *value){ - writer.writeNumeric(element); - } -} diff --git a/src_/amulet_nbt/_nbt_encoding/_binary/_cpp/write_nbt.pxd b/src_/amulet_nbt/_nbt_encoding/_binary/_cpp/write_nbt.pxd deleted file mode 100644 index 001cf2a6..00000000 --- a/src_/amulet_nbt/_nbt_encoding/_binary/_cpp/write_nbt.pxd +++ /dev/null @@ -1,7 +0,0 @@ -from libcpp.string cimport string -from amulet_nbt._libcpp.endian cimport endian -from amulet_nbt._string_encoding._cpp cimport CStringEncode - - -cdef extern from "write_nbt.hpp" nogil: - string write_named_tag[T](const string&, const T&, endian, CStringEncode) except + diff --git a/src_/amulet_nbt/_nbt_encoding/_binary/encoding_preset.pxd b/src_/amulet_nbt/_nbt_encoding/_binary/encoding_preset.pxd deleted file mode 100644 index a321f7f1..00000000 --- a/src_/amulet_nbt/_nbt_encoding/_binary/encoding_preset.pxd +++ /dev/null @@ -1,9 +0,0 @@ -from libcpp cimport bool -from amulet_nbt._libcpp.endian cimport endian -from amulet_nbt._string_encoding cimport StringEncoding - - -cdef class EncodingPreset: - cdef bool compressed - cdef endian endianness - cdef StringEncoding string_encoding diff --git a/src_/amulet_nbt/_nbt_encoding/_binary/encoding_preset.pyx b/src_/amulet_nbt/_nbt_encoding/_binary/encoding_preset.pyx deleted file mode 100644 index 63d581ef..00000000 --- a/src_/amulet_nbt/_nbt_encoding/_binary/encoding_preset.pyx +++ /dev/null @@ -1,20 +0,0 @@ -# cython: language_level=3, boundscheck=False, wraparound=False -# distutils: language = c++ -# distutils: extra_compile_args = CPPCARGS - -from amulet_nbt._libcpp.endian cimport endian -from amulet_nbt._string_encoding.encoding import mutf8_encoding, utf8_escape_encoding - - -cdef EncodingPreset _java_encoding = EncodingPreset() -_java_encoding.compressed = True -_java_encoding.endianness = endian.big -_java_encoding.string_encoding = mutf8_encoding -java_encoding = _java_encoding - - -cdef EncodingPreset _bedrock_encoding = EncodingPreset() -_bedrock_encoding.compressed = False -_bedrock_encoding.endianness = endian.little -_bedrock_encoding.string_encoding = utf8_escape_encoding -bedrock_encoding = _bedrock_encoding diff --git a/src_/amulet_nbt/_nbt_encoding/_binary/read.pxd b/src_/amulet_nbt/_nbt_encoding/_binary/read.pxd deleted file mode 100644 index e0beaf98..00000000 --- a/src_/amulet_nbt/_nbt_encoding/_binary/read.pxd +++ /dev/null @@ -1,2 +0,0 @@ -cdef class ReadOffset: - cdef readonly size_t offset diff --git a/src_/amulet_nbt/_nbt_encoding/_binary/read.pyx b/src_/amulet_nbt/_nbt_encoding/_binary/read.pyx deleted file mode 100644 index d23ab3f8..00000000 --- a/src_/amulet_nbt/_nbt_encoding/_binary/read.pyx +++ /dev/null @@ -1,141 +0,0 @@ -# cython: language_level=3, boundscheck=False, wraparound=False -# distutils: language = c++ -# distutils: extra_compile_args = CPPCARGS -# distutils: sources = [src/amulet_nbt/_nbt_encoding/_binary/_cpp/read_nbt.cpp] - -import gzip -import zlib -from typing import Union, BinaryIO -import os - -from libcpp cimport bool -from libcpp.pair cimport pair -from libcpp.string cimport string -from amulet_nbt._libcpp.endian cimport endian - -import amulet_nbt -from amulet_nbt._tag._cpp cimport TagNode -from amulet_nbt._nbt_encoding._binary._cpp cimport read_named_tag -from amulet_nbt._tag.compound cimport wrap_node -from amulet_nbt._tag.named_tag cimport NamedTag -from amulet_nbt._string_encoding cimport StringEncoding -from amulet_nbt._string_encoding import mutf8_encoding -from amulet_nbt._errors import NBTLoadError, NBTFormatError -from amulet_nbt._nbt_encoding._binary.encoding_preset cimport EncodingPreset - - -cdef class ReadOffset: - pass - - -cdef string get_buffer( - object filepath_or_buffer: Union[str, bytes, BinaryIO, memoryview, None], - bool compressed=True, -): - cdef string data - if isinstance(filepath_or_buffer, str): - # if a string load from the file path - if not os.path.isfile(filepath_or_buffer): - raise NBTLoadError(f"There is no file at {filepath_or_buffer}") - with open(filepath_or_buffer, "rb") as f: - data = f.read() - elif isinstance(filepath_or_buffer, bytes): - data = filepath_or_buffer - elif isinstance(filepath_or_buffer, memoryview): - data = filepath_or_buffer.tobytes() - elif hasattr(filepath_or_buffer, "read"): - buffer_data = filepath_or_buffer.read() - if not isinstance(buffer_data, bytes): - raise NBTLoadError(f"buffer.read() must return a bytes object. Got {type(buffer_data)} instead.") - data = buffer_data - else: - raise NBTLoadError("buffer did not have a read method.") - - if compressed: - try: - data = gzip.decompress(data) - except (IOError, zlib.error): - pass - return data - - -def load( - object filepath_or_buffer: Union[str, bytes, BinaryIO, memoryview, None], - *, - EncodingPreset preset: amulet_nbt.EncodingPreset = None, - bool compressed: bool = True, - bool little_endian: bool = False, - StringEncoding string_encoding not None: amulet_nbt.StringEncoding = mutf8_encoding, - ReadOffset read_offset: amulet_nbt.ReadOffset = None, -) -> amulet_nbt.NamedTag: - cdef endian endianness - - if preset is not None: - endianness = preset.endianness - compressed = preset.compressed - string_encoding = preset.string_encoding - else: - endianness = endian.little if little_endian else endian.big - - cdef string buffer = get_buffer(filepath_or_buffer, compressed) - cdef size_t offset = 0 - cdef pair[string, TagNode] named_tag - - try: - named_tag = read_named_tag(buffer, endianness, string_encoding.decode_cpp, offset) - - if read_offset is not None: - read_offset.offset = offset - - return NamedTag(wrap_node(&named_tag.second), named_tag.first) - except Exception as e: - raise NBTFormatError("Failed parsing binary NBT") from e - - -def load_array( - object filepath_or_buffer: Union[str, bytes, BinaryIO, memoryview, None], - *, - int count = 1, - EncodingPreset preset: amulet_nbt.EncodingPreset = None, - bool compressed: bool = True, - bool little_endian: bool = False, - StringEncoding string_encoding: amulet_nbt.StringEncoding = mutf8_encoding, - ReadOffset read_offset: amulet_nbt.ReadOffset = None, -) -> list[amulet_nbt.NamedTag]: - if count < -1: - raise ValueError("Count must be -1 or higher") - - cdef endian endianness - - if preset is not None: - endianness = preset.endianness - compressed = preset.compressed - string_encoding = preset.string_encoding - else: - endianness = endian.little if little_endian else endian.big - - cdef string buffer = get_buffer(filepath_or_buffer, compressed) - cdef size_t offset = 0 - cdef pair[string, TagNode] named_tag - cdef list results = [] - cdef size_t i - try: - if count == -1: - while offset < buffer.size(): - named_tag = read_named_tag(buffer, endianness, string_encoding.decode_cpp, offset) - results.append( - NamedTag(wrap_node(&named_tag.second), named_tag.first) - ) - else: - for i in range(count): - named_tag = read_named_tag(buffer, endianness, string_encoding.decode_cpp, offset) - results.append( - NamedTag(wrap_node(&named_tag.second), named_tag.first) - ) - - if read_offset is not None: - read_offset.offset = offset - - return results - except Exception as e: - raise NBTFormatError("Failed parsing binary NBT") from e diff --git a/src_/amulet_nbt/_nbt_encoding/_string/__init__.pxd b/src_/amulet_nbt/_nbt_encoding/_string/__init__.pxd deleted file mode 100644 index ee8a25c3..00000000 --- a/src_/amulet_nbt/_nbt_encoding/_string/__init__.pxd +++ /dev/null @@ -1,19 +0,0 @@ -# cython: language_level=3, boundscheck=False, wraparound=False -# distutils: language = c++ -# distutils: extra_compile_args = CPPCARGS - -from amulet_nbt._nbt_encoding._string._cpp cimport ( - write_node_snbt, - write_byte_snbt, - write_short_snbt, - write_int_snbt, - write_long_snbt, - write_float_snbt, - write_double_snbt, - write_byte_array_snbt, - write_string_snbt, - write_list_snbt, - write_compound_snbt, - write_int_array_snbt, - write_long_array_snbt, -) diff --git a/src_/amulet_nbt/_nbt_encoding/_string/__init__.py b/src_/amulet_nbt/_nbt_encoding/_string/__init__.py deleted file mode 100644 index 025ad8f0..00000000 --- a/src_/amulet_nbt/_nbt_encoding/_string/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from .read_snbt import from_snbt diff --git a/src_/amulet_nbt/_nbt_encoding/_string/_cpp/__init__.pxd b/src_/amulet_nbt/_nbt_encoding/_string/_cpp/__init__.pxd deleted file mode 100644 index 9e7bb8a2..00000000 --- a/src_/amulet_nbt/_nbt_encoding/_string/_cpp/__init__.pxd +++ /dev/null @@ -1,19 +0,0 @@ -# cython: language_level=3, boundscheck=False, wraparound=False -# distutils: language = c++ -# distutils: extra_compile_args = CPPCARGS - -from amulet_nbt._nbt_encoding._string._cpp.write_snbt cimport ( - write_node_snbt, - write_byte_snbt, - write_short_snbt, - write_int_snbt, - write_long_snbt, - write_float_snbt, - write_double_snbt, - write_byte_array_snbt, - write_string_snbt, - write_list_snbt, - write_compound_snbt, - write_int_array_snbt, - write_long_array_snbt, -) diff --git a/src_/amulet_nbt/_nbt_encoding/_string/_cpp/write_snbt.hpp b/src_/amulet_nbt/_nbt_encoding/_string/_cpp/write_snbt.hpp deleted file mode 100644 index d0724ecb..00000000 --- a/src_/amulet_nbt/_nbt_encoding/_string/_cpp/write_snbt.hpp +++ /dev/null @@ -1,388 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "../../../_string_encoding/_cpp/utf8.hpp" -#include "../../../_tag/_cpp/nbt.hpp" -#include "../../../_tag/_cpp/array.hpp" - -// I wanted to use templates to reduce code duplication but I can't get this to work -// The template version compiled and passed all tests on my computer but it just wasn't working on the remote servers - - -inline void write_indent(std::string& snbt, const std::string& indent, size_t indent_count){ - for (size_t i = 0; i < indent_count; i++){ - snbt.append(indent); - } -} - -// Forward declarations -void write_byte_snbt(std::string& snbt, const CByteTag& tag); -void write_short_snbt(std::string& snbt, const CShortTag& tag); -void write_int_snbt(std::string& snbt, const CIntTag& tag); -void write_long_snbt(std::string& snbt, const CLongTag& tag); -void write_float_snbt(std::string& snbt, const CFloatTag& tag); -void write_double_snbt(std::string& snbt, const CDoubleTag& tag); -void write_byte_array_snbt(std::string& snbt, const CByteArrayTagPtr& tag); -void write_string_snbt(std::string& snbt, const CStringTag& tag); -void write_list_snbt(std::string& snbt, const CListTagPtr& tag); -void write_compound_snbt(std::string& snbt, const CCompoundTagPtr& tag); -void write_int_array_snbt(std::string& snbt, const CIntArrayTagPtr& tag); -void write_long_array_snbt(std::string& snbt, const CLongArrayTagPtr& tag); - -// Multi-line variants -void write_list_snbt(std::string& snbt, const CListTagPtr& tag, const std::string& indent, size_t indent_count); -void write_compound_snbt(std::string& snbt, const CCompoundTagPtr& tag, const std::string& indent, size_t indent_count); - - -void write_node_snbt(std::string& snbt, const TagNode& tag){ - switch (tag.index()){ - case 1: write_byte_snbt(snbt, std::get(tag)); break; - case 2: write_short_snbt(snbt, std::get(tag)); break; - case 3: write_int_snbt(snbt, std::get(tag)); break; - case 4: write_long_snbt(snbt, std::get(tag)); break; - case 5: write_float_snbt(snbt, std::get(tag)); break; - case 6: write_double_snbt(snbt, std::get(tag)); break; - case 7: write_byte_array_snbt(snbt, std::get(tag)); break; - case 8: write_string_snbt(snbt, std::get(tag)); break; - case 9: write_list_snbt(snbt, std::get(tag)); break; - case 10: write_compound_snbt(snbt, std::get(tag)); break; - case 11: write_int_array_snbt(snbt, std::get(tag)); break; - case 12: write_long_array_snbt(snbt, std::get(tag)); break; - default: throw std::runtime_error("TagNode cannot be in null state when writing."); - } -} - - -void write_node_snbt(std::string& snbt, const TagNode& tag, const std::string& indent, size_t indent_count){ - switch (tag.index()){ - case 1: write_byte_snbt(snbt, std::get(tag)); break; - case 2: write_short_snbt(snbt, std::get(tag)); break; - case 3: write_int_snbt(snbt, std::get(tag)); break; - case 4: write_long_snbt(snbt, std::get(tag)); break; - case 5: write_float_snbt(snbt, std::get(tag)); break; - case 6: write_double_snbt(snbt, std::get(tag)); break; - case 7: write_byte_array_snbt(snbt, std::get(tag)); break; - case 8: write_string_snbt(snbt, std::get(tag)); break; - case 9: write_list_snbt(snbt, std::get(tag), indent, indent_count); break; - case 10: write_compound_snbt(snbt, std::get(tag), indent, indent_count); break; - case 11: write_int_array_snbt(snbt, std::get(tag)); break; - case 12: write_long_array_snbt(snbt, std::get(tag)); break; - default: throw std::runtime_error("TagNode cannot be in null state when writing."); - } -} - - -void write_byte_snbt(std::string& snbt, const CByteTag& tag){ - snbt.append(std::to_string(tag)); - snbt.push_back('b'); -} - -void write_short_snbt(std::string& snbt, const CShortTag& tag){ - snbt.append(std::to_string(tag)); - snbt.push_back('s'); -} - -void write_int_snbt(std::string& snbt, const CIntTag& tag){ - snbt.append(std::to_string(tag)); -} - -void write_long_snbt(std::string& snbt, const CLongTag& tag){ - snbt.append(std::to_string(tag)); - snbt.push_back('L'); -} - -template -inline std::string encode_float(const T& num){ - std::ostringstream oss; - oss << std::setprecision(std::numeric_limits::max_digits10) << std::noshowpoint << num; - return oss.str(); -} - -void write_float_snbt(std::string& snbt, const CFloatTag& tag){ - if (std::isfinite(tag)){ - snbt.append(encode_float(tag)); - snbt.push_back('f'); - } else if (tag == std::numeric_limits::infinity()){ - snbt.append("Infinityf"); - } else if (tag == -std::numeric_limits::infinity()){ - snbt.append("-Infinityf"); - } else { - snbt.append("NaNf"); - } -} - -void write_double_snbt(std::string& snbt, const CDoubleTag& tag){ - if (std::isfinite(tag)){ - snbt.append(encode_float(tag)); - snbt.push_back('d'); - } else if (tag == std::numeric_limits::infinity()){ - snbt.append("Infinityd"); - } else if (tag == -std::numeric_limits::infinity()){ - snbt.append("-Infinityd"); - } else { - snbt.append("NaNd"); - } -} - - -void write_string_snbt(std::string& snbt, const CStringTag& tag){ - std::string result = tag; - - size_t pos = 0; - while ((pos = result.find('\\', pos)) != std::string::npos) { - result.replace(pos, 1, "\\\\"); - pos += 2; - } - - pos = 0; - while ((pos = result.find('"', pos)) != std::string::npos) { - result.replace(pos, 1, "\\\""); - pos += 2; - } - - snbt.append("\""); - snbt.append(result); - snbt.append("\""); -} - - -template < - typename T, - std::enable_if_t< - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v, - bool - > = true -> -void write_snbt_list(std::string& snbt, const CListTagPtr& tag){ - const std::vector& list = std::get>(*tag); - snbt.append("["); - for (size_t i = 0; i < list.size(); i++){ - if constexpr (std::is_same_v){write_byte_snbt(snbt, list[i]);} else - if constexpr (std::is_same_v){write_short_snbt(snbt, list[i]);} else - if constexpr (std::is_same_v){write_int_snbt(snbt, list[i]);} else - if constexpr (std::is_same_v){write_long_snbt(snbt, list[i]);} else - if constexpr (std::is_same_v){write_float_snbt(snbt, list[i]);} else - if constexpr (std::is_same_v){write_double_snbt(snbt, list[i]);} else - if constexpr (std::is_same_v){write_byte_array_snbt(snbt, list[i]);} else - if constexpr (std::is_same_v){write_string_snbt(snbt, list[i]);} else - if constexpr (std::is_same_v){write_list_snbt(snbt, list[i]);} else - if constexpr (std::is_same_v){write_compound_snbt(snbt, list[i]);} else - if constexpr (std::is_same_v){write_int_array_snbt(snbt, list[i]);} else - if constexpr (std::is_same_v){write_long_array_snbt(snbt, list[i]);} - if (i + 1 != list.size()){ - snbt.append(", "); - } - } - snbt.append("]"); -} - - -template < - typename T, - std::enable_if_t< - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v || - std::is_same_v, - bool - > = true -> -void write_snbt_list(std::string& snbt, const CListTagPtr& tag, const std::string& indent, size_t indent_count){ - const std::vector& list = std::get>(*tag); - snbt.append("["); - for (size_t i = 0; i < list.size(); i++){ - snbt.append("\n"); - write_indent(snbt, indent, indent_count + 1); - if constexpr (std::is_same_v){write_byte_snbt(snbt, list[i]);} else - if constexpr (std::is_same_v){write_short_snbt(snbt, list[i]);} else - if constexpr (std::is_same_v){write_int_snbt(snbt, list[i]);} else - if constexpr (std::is_same_v){write_long_snbt(snbt, list[i]);} else - if constexpr (std::is_same_v){write_float_snbt(snbt, list[i]);} else - if constexpr (std::is_same_v){write_double_snbt(snbt, list[i]);} else - if constexpr (std::is_same_v){write_byte_array_snbt(snbt, list[i]);} else - if constexpr (std::is_same_v){write_string_snbt(snbt, list[i]);} else - if constexpr (std::is_same_v){write_list_snbt(snbt, list[i], indent, indent_count + 1);} else - if constexpr (std::is_same_v){write_compound_snbt(snbt, list[i], indent, indent_count + 1);} else - if constexpr (std::is_same_v){write_int_array_snbt(snbt, list[i]);} else - if constexpr (std::is_same_v){write_long_array_snbt(snbt, list[i]);} - if (i + 1 == list.size()){ - snbt.append("\n"); - write_indent(snbt, indent, indent_count); - } else { - snbt.append(","); - } - } - snbt.append("]"); -} - - -void write_list_snbt(std::string& snbt, const CListTagPtr& tag){ - switch (tag->index()){ - case 0: snbt.append("[]"); break; - case 1: write_snbt_list(snbt, tag); break; - case 2: write_snbt_list(snbt, tag); break; - case 3: write_snbt_list(snbt, tag); break; - case 4: write_snbt_list(snbt, tag); break; - case 5: write_snbt_list(snbt, tag); break; - case 6: write_snbt_list(snbt, tag); break; - case 7: write_snbt_list(snbt, tag); break; - case 8: write_snbt_list(snbt, tag); break; - case 9: write_snbt_list(snbt, tag); break; - case 10: write_snbt_list(snbt, tag); break; - case 11: write_snbt_list(snbt, tag); break; - case 12: write_snbt_list(snbt, tag); break; - } -} - - -void write_list_snbt(std::string& snbt, const CListTagPtr& tag, const std::string& indent, size_t indent_count){ - switch (tag->index()){ - case 0: snbt.append("[]"); break; - case 1: write_snbt_list(snbt, tag, indent, indent_count); break; - case 2: write_snbt_list(snbt, tag, indent, indent_count); break; - case 3: write_snbt_list(snbt, tag, indent, indent_count); break; - case 4: write_snbt_list(snbt, tag, indent, indent_count); break; - case 5: write_snbt_list(snbt, tag, indent, indent_count); break; - case 6: write_snbt_list(snbt, tag, indent, indent_count); break; - case 7: write_snbt_list(snbt, tag, indent, indent_count); break; - case 8: write_snbt_list(snbt, tag, indent, indent_count); break; - case 9: write_snbt_list(snbt, tag, indent, indent_count); break; - case 10: write_snbt_list(snbt, tag, indent, indent_count); break; - case 11: write_snbt_list(snbt, tag, indent, indent_count); break; - case 12: write_snbt_list(snbt, tag, indent, indent_count); break; - } -} - - -void write_key(std::string& snbt, const CStringTag& key){ - if (std::all_of(key.begin(), key.end(), [](char c) { - return std::isalnum(c) || c == '.' || c == '_' || c == '+' || c == '-'; - })){ - snbt.append(key); - } else { - write_string_snbt(snbt, key); - } -} - - -std::vector> sort_compound(const CCompoundTagPtr& tag){ - std::vector> keys(tag->begin(), tag->end()); - std::locale locale; - try { - locale = std::locale("en_US.UTF-8"); - } catch (const std::runtime_error&) { - locale = std::locale(""); - } - std::sort(keys.begin(), keys.end(), [&locale]( - const std::pair& a, - const std::pair& b - ){ - return locale(a.first, b.first); - }); - return keys; -} - - -void write_compound_snbt(std::string& snbt, const CCompoundTagPtr& tag){ - auto sorted = sort_compound(tag); - snbt.append("{"); - for (auto it = sorted.begin(); it != sorted.end(); it++){ - write_key(snbt, it->first); - snbt.append(": "); - write_node_snbt(snbt, it->second); - if (std::next(it) != sorted.end()){ - snbt.append(", "); - } - } - snbt.append("}"); -} - - -void write_compound_snbt(std::string& snbt, const CCompoundTagPtr& tag, const std::string& indent, size_t indent_count){ - auto sorted = sort_compound(tag); - snbt.append("{"); - for (auto it = sorted.begin(); it != sorted.end(); it++){ - snbt.append("\n"); - write_indent(snbt, indent, indent_count + 1); - write_key(snbt, it->first); - snbt.append(": "); - write_node_snbt(snbt, it->second, indent, indent_count + 1); - if (std::next(it) == sorted.end()){ - snbt.append("\n"); - write_indent(snbt, indent, indent_count); - } else { - snbt.append(","); - } - } - snbt.append("}"); -} - - -void write_byte_array_snbt(std::string& snbt, const CByteArrayTagPtr& tag){ - auto array = *tag; - snbt.append("[B;"); - for (size_t i = 0; i < array.size(); i++){ - snbt.append(std::to_string(array[i])); - snbt.push_back('B'); - if (i + 1 != array.size()){ - snbt.append(", "); - } - } - snbt.append("]"); -} - - -void write_int_array_snbt(std::string& snbt, const CIntArrayTagPtr& tag){ - auto array = *tag; - snbt.append("[I;"); - for (size_t i = 0; i < array.size(); i++){ - snbt.append(std::to_string(array[i])); - if (i + 1 != array.size()){ - snbt.append(", "); - } - } - snbt.append("]"); -} - - -void write_long_array_snbt(std::string& snbt, const CLongArrayTagPtr& tag){ - auto array = *tag; - snbt.append("[L;"); - for (size_t i = 0; i < array.size(); i++){ - snbt.append(std::to_string(array[i])); - snbt.push_back('L'); - if (i + 1 != array.size()){ - snbt.append(", "); - } - } - snbt.append("]"); -} diff --git a/src_/amulet_nbt/_nbt_encoding/_string/_cpp/write_snbt.pxd b/src_/amulet_nbt/_nbt_encoding/_string/_cpp/write_snbt.pxd deleted file mode 100644 index 4da891bf..00000000 --- a/src_/amulet_nbt/_nbt_encoding/_string/_cpp/write_snbt.pxd +++ /dev/null @@ -1,37 +0,0 @@ -from libcpp.string cimport string -from amulet_nbt._tag._cpp cimport ( - TagNode, - CByteTag, - CShortTag, - CIntTag, - CLongTag, - CFloatTag, - CDoubleTag, - CStringTag, - CListTagPtr, - CCompoundTagPtr, - CByteArrayTagPtr, - CIntArrayTagPtr, - CLongArrayTagPtr, -) - - -cdef extern from "write_snbt.hpp" nogil: - void write_node_snbt(string&, const TagNode&) except + - void write_byte_snbt(string&, const CByteTag&) except + - void write_short_snbt(string&, const CShortTag&) except + - void write_int_snbt(string&, const CIntTag&) except + - void write_long_snbt(string&, const CLongTag&) except + - void write_float_snbt(string&, const CFloatTag&) except + - void write_double_snbt(string&, const CDoubleTag&) except + - void write_byte_array_snbt(string&, const CByteArrayTagPtr&) except + - void write_string_snbt(string&, const CStringTag&) except + - void write_list_snbt(string&, const CListTagPtr&) except + - void write_compound_snbt(string&, const CCompoundTagPtr&) except + - void write_int_array_snbt(string&, const CIntArrayTagPtr&) except + - void write_long_array_snbt(string&, const CLongArrayTagPtr&) except + - - # Multi-line variants - void write_node_snbt(string&, const TagNode&, const string&, size_t) except + - void write_list_snbt(string&, const CListTagPtr&, const string&, size_t) except + - void write_compound_snbt(string&, const CCompoundTagPtr&, const string&, size_t) except + diff --git a/src_/amulet_nbt/_string_encoding/__init__.cpp b/src_/amulet_nbt/_string_encoding/__init__.cpp deleted file mode 100644 index 84e3aed4..00000000 --- a/src_/amulet_nbt/_string_encoding/__init__.cpp +++ /dev/null @@ -1,4418 +0,0 @@ -/* Generated by Cython 3.0.8 */ - -/* BEGIN: Cython Metadata -{ - "distutils": { - "depends": [], - "extra_compile_args": [ - "/std:c++20" - ], - "language": "c++", - "name": "amulet_nbt._string_encoding.__init__", - "sources": [ - "src\\amulet_nbt\\_string_encoding\\__init__.pyx" - ] - }, - "module_name": "amulet_nbt._string_encoding.__init__" -} -END: Cython Metadata */ - -#ifndef PY_SSIZE_T_CLEAN -#define PY_SSIZE_T_CLEAN -#endif /* PY_SSIZE_T_CLEAN */ -#if defined(CYTHON_LIMITED_API) && 0 - #ifndef Py_LIMITED_API - #if CYTHON_LIMITED_API+0 > 0x03030000 - #define Py_LIMITED_API CYTHON_LIMITED_API - #else - #define Py_LIMITED_API 0x03030000 - #endif - #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 < 0x02070000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) - #error Cython requires Python 2.7+ or Python 3.3+. -#else -#if defined(CYTHON_LIMITED_API) && CYTHON_LIMITED_API -#define __PYX_EXTRA_ABI_MODULE_NAME "limited" -#else -#define __PYX_EXTRA_ABI_MODULE_NAME "" -#endif -#define CYTHON_ABI "3_0_8" __PYX_EXTRA_ABI_MODULE_NAME -#define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI -#define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." -#define CYTHON_HEX_VERSION 0x030008F0 -#define CYTHON_FUTURE_DIVISION 1 -#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 HAVE_LONG_LONG - #define HAVE_LONG_LONG -#endif -#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_NOGIL 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 - #if PY_VERSION_HEX < 0x03050000 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #elif !defined(CYTHON_USE_ASYNC_SLOTS) - #define CYTHON_USE_ASYNC_SLOTS 1 - #endif - #undef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 0 - #undef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 0 - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #undef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 1 - #undef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 0 - #undef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 0 - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #undef CYTHON_FAST_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 (PY_MAJOR_VERSION >= 3) - #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_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE 0 - #undef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS 0 - #undef CYTHON_USE_EXC_INFO_STACK - #define CYTHON_USE_EXC_INFO_STACK 0 - #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC - #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 - #endif -#elif defined(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_NOGIL 0 - #undef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 0 - #ifndef CYTHON_USE_TYPE_SPECS - #define CYTHON_USE_TYPE_SPECS 0 - #endif - #undef CYTHON_USE_PYTYPE_LOOKUP - #define CYTHON_USE_PYTYPE_LOOKUP 0 - #if PY_VERSION_HEX < 0x03050000 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #elif !defined(CYTHON_USE_ASYNC_SLOTS) - #define CYTHON_USE_ASYNC_SLOTS 1 - #endif - #undef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 0 - #undef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 0 - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #undef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 1 - #undef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 0 - #undef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 0 - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #undef CYTHON_FAST_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 (PY_MAJOR_VERSION >= 3) - #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_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1 && PYPY_VERSION_NUM >= 0x07030C00) - #undef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS 0 - #undef CYTHON_USE_EXC_INFO_STACK - #define CYTHON_USE_EXC_INFO_STACK 0 - #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC - #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 - #endif -#elif defined(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_NOGIL 0 - #undef CYTHON_CLINE_IN_TRACEBACK - #define CYTHON_CLINE_IN_TRACEBACK 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_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #undef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 0 - #undef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 0 - #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 - #undef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 0 - #undef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 0 - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #undef CYTHON_FAST_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 0 - #undef CYTHON_USE_MODULE_STATE - #define CYTHON_USE_MODULE_STATE 1 - #ifndef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE 0 - #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 -#elif defined(Py_GIL_DISABLED) || defined(Py_NOGIL) - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_CPYTHON 0 - #define CYTHON_COMPILING_IN_LIMITED_API 0 - #define CYTHON_COMPILING_IN_GRAAL 0 - #define CYTHON_COMPILING_IN_NOGIL 1 - #ifndef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 1 - #endif - #undef CYTHON_USE_PYTYPE_LOOKUP - #define CYTHON_USE_PYTYPE_LOOKUP 0 - #ifndef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 1 - #endif - #undef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 0 - #ifndef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 1 - #endif - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #ifndef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 0 - #endif - #ifndef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 1 - #endif - #ifndef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 1 - #endif - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #undef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 0 - #ifndef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT 1 - #endif - #ifndef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE 1 - #endif - #undef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS 0 - #undef CYTHON_USE_EXC_INFO_STACK - #define CYTHON_USE_EXC_INFO_STACK 0 -#else - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_CPYTHON 1 - #define CYTHON_COMPILING_IN_LIMITED_API 0 - #define CYTHON_COMPILING_IN_GRAAL 0 - #define CYTHON_COMPILING_IN_NOGIL 0 - #ifndef 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 - #if PY_MAJOR_VERSION < 3 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #elif !defined(CYTHON_USE_ASYNC_SLOTS) - #define CYTHON_USE_ASYNC_SLOTS 1 - #endif - #ifndef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 1 - #endif - #ifndef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 1 - #endif - #ifndef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 1 - #endif - #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2 - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #elif !defined(CYTHON_USE_UNICODE_WRITER) - #define CYTHON_USE_UNICODE_WRITER 1 - #endif - #ifndef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 0 - #endif - #ifndef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 1 - #endif - #ifndef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 1 - #endif - #ifndef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 1 - #endif - #ifndef CYTHON_FAST_GIL - #define CYTHON_FAST_GIL (PY_MAJOR_VERSION < 3 || PY_VERSION_HEX >= 0x03060000 && PY_VERSION_HEX < 0x030C00A6) - #endif - #ifndef CYTHON_METH_FASTCALL - #define CYTHON_METH_FASTCALL (PY_VERSION_HEX >= 0x030700A1) - #endif - #ifndef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 1 - #endif - #ifndef CYTHON_PEP487_INIT_SUBCLASS - #define CYTHON_PEP487_INIT_SUBCLASS 1 - #endif - #if PY_VERSION_HEX < 0x03050000 - #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 - #ifndef CYTHON_USE_MODULE_STATE - #define CYTHON_USE_MODULE_STATE 0 - #endif - #if PY_VERSION_HEX < 0x030400a1 - #undef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE 0 - #elif !defined(CYTHON_USE_TP_FINALIZE) - #define CYTHON_USE_TP_FINALIZE 1 - #endif - #if PY_VERSION_HEX < 0x030600B1 - #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) - #endif - #if PY_VERSION_HEX < 0x030700A3 - #undef CYTHON_USE_EXC_INFO_STACK - #define CYTHON_USE_EXC_INFO_STACK 0 - #elif !defined(CYTHON_USE_EXC_INFO_STACK) - #define CYTHON_USE_EXC_INFO_STACK 1 - #endif - #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC - #define CYTHON_UPDATE_DESCRIPTOR_DOC 1 - #endif -#endif -#if !defined(CYTHON_FAST_PYCCALL) -#define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) -#endif -#if !defined(CYTHON_VECTORCALL) -#define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL && PY_VERSION_HEX >= 0x030800B1) -#endif -#define CYTHON_BACKPORT_VECTORCALL (CYTHON_METH_FASTCALL && PY_VERSION_HEX < 0x030800B1) -#if CYTHON_USE_PYLONG_INTERNALS - #if PY_MAJOR_VERSION < 3 - #include "longintrepr.h" - #endif - #undef SHIFT - #undef BASE - #undef MASK - #ifdef SIZEOF_VOID_P - enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) }; - #endif -#endif -#ifndef __has_attribute - #define __has_attribute(x) 0 -#endif -#ifndef __has_cpp_attribute - #define __has_cpp_attribute(x) 0 -#endif -#ifndef CYTHON_RESTRICT - #if defined(__GNUC__) - #define CYTHON_RESTRICT __restrict__ - #elif defined(_MSC_VER) && _MSC_VER >= 1400 - #define CYTHON_RESTRICT __restrict - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define CYTHON_RESTRICT restrict - #else - #define CYTHON_RESTRICT - #endif -#endif -#ifndef CYTHON_UNUSED - #if defined(__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 -# 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) -#ifdef _MSC_VER - #ifndef _MSC_STDINT_H_ - #if _MSC_VER < 1300 - typedef unsigned char uint8_t; - typedef unsigned short uint16_t; - typedef unsigned int uint32_t; - #else - typedef unsigned __int8 uint8_t; - typedef unsigned __int16 uint16_t; - typedef unsigned __int32 uint32_t; - #endif - #endif - #if _MSC_VER < 1300 - #ifdef _WIN64 - typedef unsigned long long __pyx_uintptr_t; - #else - typedef unsigned int __pyx_uintptr_t; - #endif - #else - #ifdef _WIN64 - typedef unsigned __int64 __pyx_uintptr_t; - #else - typedef unsigned __int32 __pyx_uintptr_t; - #endif - #endif -#else - #include - typedef uintptr_t __pyx_uintptr_t; -#endif -#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 -#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 >= 0x030800b4 && PY_VERSION_HEX < 0x030A0000) -#else - #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000) -#endif -#define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer)) - -#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; -}; - -#define __PYX_BUILD_PY_SSIZE_T "n" -#define CYTHON_FORMAT_SSIZE_T "z" -#if PY_MAJOR_VERSION < 3 - #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" - #define __Pyx_DefaultClassType PyClass_Type - #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) -#else - #define __Pyx_BUILTIN_MODULE_NAME "builtins" - #define __Pyx_DefaultClassType PyType_Type -#if CYTHON_COMPILING_IN_LIMITED_API - static CYTHON_INLINE 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, "iiiiiOOOOOOiOO", 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, "iiiiiiOOOOOOiOO", 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, "iiiiiiOOOOOOOiOO", 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; - } - #ifndef CO_OPTIMIZED - #define CO_OPTIMIZED 0x0001 - #endif - #ifndef CO_NEWLOCALS - #define CO_NEWLOCALS 0x0002 - #endif - #ifndef CO_VARARGS - #define CO_VARARGS 0x0004 - #endif - #ifndef CO_VARKEYWORDS - #define CO_VARKEYWORDS 0x0008 - #endif - #ifndef CO_ASYNC_GENERATOR - #define CO_ASYNC_GENERATOR 0x0200 - #endif - #ifndef CO_GENERATOR - #define CO_GENERATOR 0x0020 - #endif - #ifndef CO_COROUTINE - #define CO_COROUTINE 0x0080 - #endif -#elif PY_VERSION_HEX >= 0x030B0000 - static CYTHON_INLINE 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; - PyObject *empty_bytes = PyBytes_FromStringAndSize("", 0); - if (!empty_bytes) return NULL; - 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, empty_bytes); - Py_DECREF(empty_bytes); - return result; - } -#elif PY_VERSION_HEX >= 0x030800B2 && !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 -#endif -#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 CO_COROUTINE - #define CO_COROUTINE 0x80 -#endif -#ifndef CO_ASYNC_GENERATOR - #define CO_ASYNC_GENERATOR 0x200 -#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 METH_STACKLESS - #define METH_STACKLESS 0 -#endif -#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL) - #ifndef METH_FASTCALL - #define METH_FASTCALL 0x80 - #endif - typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs); - typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args, - Py_ssize_t nargs, PyObject *kwnames); -#else - #define __Pyx_PyCFunctionFast _PyCFunctionFast - #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords -#endif -#if CYTHON_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)) -#elif CYTHON_BACKPORT_VECTORCALL - typedef PyObject *(*__pyx_vectorcallfunc)(PyObject *callable, PyObject *const *args, - size_t nargsf, PyObject *kwnames); - #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET ((size_t)1 << (8 * sizeof(size_t) - 1)) - #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(((size_t)(n)) & ~__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)) -#else - #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0 - #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n)) -#endif -#if PY_MAJOR_VERSION >= 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) { -#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 __PYX_LIMITED_VERSION_HEX < 0x030900B1 - #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_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) - #define __Pyx_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() -#elif PY_VERSION_HEX >= 0x03060000 - #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() -#elif PY_VERSION_HEX >= 0x03000000 - #define __Pyx_PyThreadState_Current PyThreadState_GET() -#else - #define __Pyx_PyThreadState_Current _PyThreadState_Current -#endif -#if CYTHON_COMPILING_IN_LIMITED_API -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; -} -#endif -#define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE(obj), name, func_ctype) -#if CYTHON_COMPILING_IN_LIMITED_API - #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name)) -#else - #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name) -#endif -#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT) -#include "pythread.h" -#define Py_tss_NEEDS_INIT 0 -typedef int Py_tss_t; -static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) { - *key = PyThread_create_key(); - return 0; -} -static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) { - Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t)); - *key = Py_tss_NEEDS_INIT; - return key; -} -static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) { - PyObject_Free(key); -} -static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) { - return *key != Py_tss_NEEDS_INIT; -} -static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) { - PyThread_delete_key(*key); - *key = Py_tss_NEEDS_INIT; -} -static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) { - return PyThread_set_key_value(*key, value); -} -static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { - return PyThread_get_key_value(*key); -} -#endif -#if PY_MAJOR_VERSION < 3 - #if CYTHON_COMPILING_IN_PYPY - #if PYPY_VERSION_NUM < 0x07030600 - #if defined(__cplusplus) && __cplusplus >= 201402L - [[deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")]] - #elif defined(__GNUC__) || defined(__clang__) - __attribute__ ((__deprecated__("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6"))) - #elif defined(_MSC_VER) - __declspec(deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")) - #endif - static CYTHON_INLINE int PyGILState_Check(void) { - return 0; - } - #else // PYPY_VERSION_NUM < 0x07030600 - #endif // PYPY_VERSION_NUM < 0x07030600 - #else - static CYTHON_INLINE int PyGILState_Check(void) { - PyThreadState * tstate = _PyThreadState_Current; - return tstate && (tstate == PyGILState_GetThisThreadState()); - } - #endif -#endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000 || defined(_PyDict_NewPresized) -#define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) -#else -#define __Pyx_PyDict_NewPresized(n) PyDict_New() -#endif -#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION - #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) -#else - #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) -#endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030600B4 && PY_VERSION_HEX < 0x030d0000 && 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 PY_MAJOR_VERSION >= 3 && (!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) - #define __Pyx_PyObject_GetIterNextFunc(obj) (Py_TYPE(obj)->tp_iternext) -#else - #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp)) - #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature) - #define __Pyx_PyObject_GetIterNextFunc(obj) PyIter_Next -#endif -#if CYTHON_COMPILING_IN_LIMITED_API - #define __Pyx_SetItemOnTypeDict(tp, k, v) PyObject_GenericSetAttr((PyObject*)tp, k, v) -#else - #define __Pyx_SetItemOnTypeDict(tp, k, v) PyDict_SetItem(tp->tp_dict, k, v) -#endif -#if CYTHON_USE_TYPE_SPECS && PY_VERSION_HEX >= 0x03080000 -#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 CYTHON_PEP393_ENABLED 1 - #define __Pyx_PyUnicode_READY(op) (0) - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GetLength(u) - #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)) -#elif PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) - #define CYTHON_PEP393_ENABLED 1 - #if PY_VERSION_HEX >= 0x030C0000 - #define __Pyx_PyUnicode_READY(op) (0) - #else - #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ - 0 : _PyUnicode_Ready((PyObject *)(op))) - #endif - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) - #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) - #define __Pyx_PyUnicode_KIND(u) ((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 -#else - #define CYTHON_PEP393_ENABLED 0 - #define PyUnicode_1BYTE_KIND 1 - #define PyUnicode_2BYTE_KIND 2 - #define PyUnicode_4BYTE_KIND 4 - #define __Pyx_PyUnicode_READY(op) (0) - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) - #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535U : 1114111U) - #define __Pyx_PyUnicode_KIND(u) ((int)sizeof(Py_UNICODE)) - #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) - #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = (Py_UNICODE) ch) - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) -#endif -#if CYTHON_COMPILING_IN_PYPY - #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) - #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) -#else - #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) - #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ - PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) -#endif -#if CYTHON_COMPILING_IN_PYPY - #if !defined(PyUnicode_DecodeUnicodeEscape) - #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors) - #endif - #if !defined(PyUnicode_Contains) || (PY_MAJOR_VERSION == 2 && PYPY_VERSION_NUM < 0x07030500) - #undef 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_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) -#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) -#else - #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) -#endif -#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII) - #define PyObject_ASCII(o) PyObject_Repr(o) -#endif -#if PY_MAJOR_VERSION >= 3 - #define PyBaseString_Type PyUnicode_Type - #define PyStringObject PyUnicodeObject - #define PyString_Type PyUnicode_Type - #define PyString_Check PyUnicode_Check - #define PyString_CheckExact PyUnicode_CheckExact -#ifndef PyObject_Unicode - #define PyObject_Unicode PyObject_Str -#endif -#endif -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) - #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) -#else - #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) - #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) -#endif -#if 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 -#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_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0)) - #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) -#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_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v) - #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) -#endif -#if PY_VERSION_HEX >= 0x030d00A1 - #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name) -#else - static CYTHON_INLINE PyObject *__Pyx_PyImport_AddModuleRef(const char *name) { - PyObject *module = PyImport_AddModule(name); - Py_XINCREF(module); - return module; - } -#endif -#if PY_MAJOR_VERSION >= 3 - #define PyIntObject PyLongObject - #define PyInt_Type PyLong_Type - #define PyInt_Check(op) PyLong_Check(op) - #define PyInt_CheckExact(op) PyLong_CheckExact(op) - #define __Pyx_Py3Int_Check(op) PyLong_Check(op) - #define __Pyx_Py3Int_CheckExact(op) PyLong_CheckExact(op) - #define PyInt_FromString PyLong_FromString - #define PyInt_FromUnicode PyLong_FromUnicode - #define PyInt_FromLong PyLong_FromLong - #define PyInt_FromSize_t PyLong_FromSize_t - #define PyInt_FromSsize_t PyLong_FromSsize_t - #define PyInt_AsLong PyLong_AsLong - #define PyInt_AS_LONG PyLong_AS_LONG - #define PyInt_AsSsize_t PyLong_AsSsize_t - #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask - #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask - #define PyNumber_Int PyNumber_Long -#else - #define __Pyx_Py3Int_Check(op) (PyLong_Check(op) || PyInt_Check(op)) - #define __Pyx_Py3Int_CheckExact(op) (PyLong_CheckExact(op) || PyInt_CheckExact(op)) -#endif -#if PY_MAJOR_VERSION >= 3 - #define PyBoolObject PyLongObject -#endif -#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY - #ifndef PyUnicode_InternFromString - #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) - #endif -#endif -#if PY_VERSION_HEX < 0x030200A4 - typedef long Py_hash_t; - #define __Pyx_PyInt_FromHash_t PyInt_FromLong - #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t -#else - #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t - #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t -#endif -#if CYTHON_USE_ASYNC_SLOTS - #if PY_VERSION_HEX >= 0x030500B1 - #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods - #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) - #else - #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) - #endif -#else - #define __Pyx_PyType_AsAsync(obj) NULL -#endif -#ifndef __Pyx_PyAsyncMethodsStruct - typedef struct { - unaryfunc am_await; - unaryfunc am_aiter; - unaryfunc am_anext; - } __Pyx_PyAsyncMethodsStruct; -#endif - -#if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS) - #if !defined(_USE_MATH_DEFINES) - #define _USE_MATH_DEFINES - #endif -#endif -#include -#ifdef NAN -#define __PYX_NAN() ((float) NAN) -#else -static CYTHON_INLINE float __PYX_NAN() { - float value; - memset(&value, 0xFF, sizeof(value)); - return value; -} -#endif -#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) -#define __Pyx_truncl trunc -#else -#define __Pyx_truncl truncl -#endif - -#define __PYX_MARK_ERR_POS(f_index, lineno) \ - { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; } -#define __PYX_ERR(f_index, lineno, Ln_error) \ - { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; } - -#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__amulet_nbt___string_encoding -#define __PYX_HAVE_API__amulet_nbt___string_encoding -/* Early includes */ -#include -#include -#include "ios" -#include "new" -#include "stdexcept" -#include "typeinfo" -#ifdef _OPENMP -#include -#endif /* _OPENMP */ - -#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS) -#define CYTHON_WITHOUT_ASSERTIONS -#endif - -typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding; - const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; - -#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 -#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0 -#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8) -#define __PYX_DEFAULT_STRING_ENCODING "" -#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString -#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize -#define __Pyx_uchar_cast(c) ((unsigned char)c) -#define __Pyx_long_cast(x) ((long)x) -#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ - (sizeof(type) < sizeof(Py_ssize_t)) ||\ - (sizeof(type) > sizeof(Py_ssize_t) &&\ - likely(v < (type)PY_SSIZE_T_MAX ||\ - v == (type)PY_SSIZE_T_MAX) &&\ - (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ - v == (type)PY_SSIZE_T_MIN))) ||\ - (sizeof(type) == sizeof(Py_ssize_t) &&\ - (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ - v == (type)PY_SSIZE_T_MAX))) ) -static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) { - return (size_t) i < (size_t) limit; -} -#if defined (__cplusplus) && __cplusplus >= 201103L - #include - #define __Pyx_sst_abs(value) std::abs(value) -#elif SIZEOF_INT >= SIZEOF_SIZE_T - #define __Pyx_sst_abs(value) abs(value) -#elif SIZEOF_LONG >= SIZEOF_SIZE_T - #define __Pyx_sst_abs(value) labs(value) -#elif defined (_MSC_VER) - #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value)) -#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define __Pyx_sst_abs(value) llabs(value) -#elif defined (__GNUC__) - #define __Pyx_sst_abs(value) __builtin_llabs(value) -#else - #define __Pyx_sst_abs(value) ((value<0) ? -value : value) -#endif -static CYTHON_INLINE 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 PY_MAJOR_VERSION < 3 - #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString - #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize -#else - #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString - #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize -#endif -#define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_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_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) -#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) -#if CYTHON_COMPILING_IN_LIMITED_API -static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const wchar_t *u) -{ - const wchar_t *u_end = u; - while (*u_end++) ; - return (size_t)(u_end - u - 1); -} -#else -static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) -{ - const Py_UNICODE *u_end = u; - while (*u_end++) ; - return (size_t)(u_end - u - 1); -} -#endif -#define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o) -#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) -#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode -#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode -#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) -#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) -static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b); -static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); -static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*); -static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); -#define __Pyx_PySequence_Tuple(obj)\ - (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); -static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); -static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); -#if CYTHON_ASSUME_SAFE_MACROS -#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) -#else -#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) -#endif -#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) -#if PY_MAJOR_VERSION >= 3 -#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) -#else -#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) -#endif -#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 PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII -#include -static int __Pyx_sys_getdefaultencoding_not_ascii; -static int __Pyx_init_sys_getdefaultencoding_params(void) { - PyObject* sys; - PyObject* default_encoding = NULL; - PyObject* ascii_chars_u = NULL; - PyObject* ascii_chars_b = NULL; - const char* default_encoding_c; - sys = PyImport_ImportModule("sys"); - if (!sys) goto bad; - default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL); - Py_DECREF(sys); - if (!default_encoding) goto bad; - default_encoding_c = PyBytes_AsString(default_encoding); - if (!default_encoding_c) goto bad; - if (strcmp(default_encoding_c, "ascii") == 0) { - __Pyx_sys_getdefaultencoding_not_ascii = 0; - } else { - char ascii_chars[128]; - int c; - for (c = 0; c < 128; c++) { - ascii_chars[c] = (char) c; - } - __Pyx_sys_getdefaultencoding_not_ascii = 1; - ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); - if (!ascii_chars_u) goto bad; - ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); - if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { - PyErr_Format( - PyExc_ValueError, - "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.", - default_encoding_c); - goto bad; - } - Py_DECREF(ascii_chars_u); - Py_DECREF(ascii_chars_b); - } - Py_DECREF(default_encoding); - return 0; -bad: - Py_XDECREF(default_encoding); - Py_XDECREF(ascii_chars_u); - Py_XDECREF(ascii_chars_b); - return -1; -} -#endif -#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 -#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) -#else -#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) -#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT -#include -static char* __PYX_DEFAULT_STRING_ENCODING; -static int __Pyx_init_sys_getdefaultencoding_params(void) { - PyObject* sys; - PyObject* default_encoding = NULL; - char* default_encoding_c; - sys = PyImport_ImportModule("sys"); - if (!sys) goto bad; - default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); - Py_DECREF(sys); - if (!default_encoding) goto bad; - default_encoding_c = PyBytes_AsString(default_encoding); - if (!default_encoding_c) goto bad; - __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1); - if (!__PYX_DEFAULT_STRING_ENCODING) goto bad; - strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); - Py_DECREF(default_encoding); - return 0; -bad: - Py_XDECREF(default_encoding); - return -1; -} -#endif -#endif - - -/* Test for GCC > 2.95 */ -#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) -#else /* !__GNUC__ or GCC < 2.95 */ - #define likely(x) (x) - #define unlikely(x) (x) -#endif /* __GNUC__ */ -static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } - -#if !CYTHON_USE_MODULE_STATE -static PyObject *__pyx_m = NULL; -#endif -static int __pyx_lineno; -static int __pyx_clineno = 0; -static const char * __pyx_cfilenm = __FILE__; -static const char *__pyx_filename; - -/* #### Code section: filename_table ### */ - -static const char *__pyx_f[] = { - "src\\\\amulet_nbt\\\\_string_encoding\\\\__init__.pyx", - "src\\\\amulet_nbt\\\\_string_encoding\\\\encoding.pxd", -}; -/* #### Code section: utility_code_proto_before_types ### */ -/* #### Code section: numeric_typedefs ### */ -/* #### Code section: complex_type_declarations ### */ -/* #### Code section: type_declarations ### */ - -/*--- Type declarations ---*/ -struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding; - -/* "src/amulet_nbt/_string_encoding/_cpp/__init__.pxd":3 - * from libcpp.string cimport string - * - * ctypedef string (*CStringEncode)(const string&) # <<<<<<<<<<<<<< - * ctypedef string (*CStringDecode)(const string&) - */ -typedef std::string (*__pyx_t_10amulet_nbt_16_string_encoding_4_cpp_CStringEncode)(std::string const &); - -/* "src/amulet_nbt/_string_encoding/_cpp/__init__.pxd":4 - * - * ctypedef string (*CStringEncode)(const string&) - * ctypedef string (*CStringDecode)(const string&) # <<<<<<<<<<<<<< - */ -typedef std::string (*__pyx_t_10amulet_nbt_16_string_encoding_4_cpp_CStringDecode)(std::string const &); - -/* "amulet_nbt/_string_encoding/encoding.pxd":4 - * - * - * cdef class StringEncoding: # <<<<<<<<<<<<<< - * cdef CStringEncode encode_cpp - * cdef CStringDecode decode_cpp - */ -struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding { - PyObject_HEAD - __pyx_t_10amulet_nbt_16_string_encoding_4_cpp_CStringEncode encode_cpp; - __pyx_t_10amulet_nbt_16_string_encoding_4_cpp_CStringDecode decode_cpp; -}; - -/* #### 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; -#ifdef WITH_THREAD - #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - if (acquire_gil) {\ - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ - PyGILState_Release(__pyx_gilstate_save);\ - } else {\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ - } - #define __Pyx_RefNannyFinishContextNogil() {\ - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ - __Pyx_RefNannyFinishContext();\ - PyGILState_Release(__pyx_gilstate_save);\ - } -#else - #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__)) - #define __Pyx_RefNannyFinishContextNogil() __Pyx_RefNannyFinishContext() -#endif - #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) - -/* SetPackagePathFromImportLib.proto */ -#if PY_MAJOR_VERSION >= 3 && !CYTHON_PEP489_MULTI_PHASE_INIT -static int __Pyx_SetPackagePathFromImportLib(PyObject *module_name); -#else -#define __Pyx_SetPackagePathFromImportLib(a) 0 -#endif - -/* TypeImport.proto */ -#ifndef __PYX_HAVE_RT_ImportType_proto_3_0_8 -#define __PYX_HAVE_RT_ImportType_proto_3_0_8 -#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L -#include -#endif -#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || __cplusplus >= 201103L -#define __PYX_GET_STRUCT_ALIGNMENT_3_0_8(s) alignof(s) -#else -#define __PYX_GET_STRUCT_ALIGNMENT_3_0_8(s) sizeof(void*) -#endif -enum __Pyx_ImportType_CheckSize_3_0_8 { - __Pyx_ImportType_CheckSize_Error_3_0_8 = 0, - __Pyx_ImportType_CheckSize_Warn_3_0_8 = 1, - __Pyx_ImportType_CheckSize_Ignore_3_0_8 = 2 -}; -static PyTypeObject *__Pyx_ImportType_3_0_8(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_8 check_size); -#endif - -/* PyObjectGetAttrStr.proto */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); -#else -#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) -#endif - -/* IncludeStringH.proto */ -#include - -/* Import.proto */ -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); - -/* ImportFrom.proto */ -static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); - -/* PyDictVersioning.proto */ -#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS -#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) -#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) -#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ - (version_var) = __PYX_GET_DICT_VERSION(dict);\ - (cache_var) = (value); -#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ - static PY_UINT64_T __pyx_dict_version = 0;\ - static PyObject *__pyx_dict_cached_value = NULL;\ - if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ - (VAR) = __pyx_dict_cached_value;\ - } else {\ - (VAR) = __pyx_dict_cached_value = (LOOKUP);\ - __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ - }\ -} -static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); -static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); -static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); -#else -#define __PYX_GET_DICT_VERSION(dict) (0) -#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) -#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); -#endif - -/* 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 - -/* PyThreadStateGet.proto */ -#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 */ -#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 */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); - -/* CLineInTraceback.proto */ -#ifdef CYTHON_CLINE_IN_TRACEBACK -#define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) -#else -static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); -#endif - -/* CodeObjectCache.proto */ -#if !CYTHON_COMPILING_IN_LIMITED_API -typedef struct { - PyCodeObject* code_object; - int code_line; -} __Pyx_CodeObjectCacheEntry; -struct __Pyx_CodeObjectCache { - int count; - int max_count; - __Pyx_CodeObjectCacheEntry* entries; -}; -static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; -static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); -static PyCodeObject *__pyx_find_code_object(int code_line); -static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); -#endif - -/* AddTraceback.proto */ -static void __Pyx_AddTraceback(const char *funcname, int c_line, - int py_line, const char *filename); - -/* FormatTypeName.proto */ -#if CYTHON_COMPILING_IN_LIMITED_API -typedef PyObject *__Pyx_TypeName; -#define __Pyx_FMT_TYPENAME "%U" -static __Pyx_TypeName __Pyx_PyType_GetName(PyTypeObject* tp); -#define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj) -#else -typedef const char *__Pyx_TypeName; -#define __Pyx_FMT_TYPENAME "%.200s" -#define __Pyx_PyType_GetName(tp) ((tp)->tp_name) -#define __Pyx_DECREF_TypeName(obj) -#endif - -/* GCCDiagnostics.proto */ -#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) -#define __Pyx_HAS_GCC_DIAGNOSTIC -#endif - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); - -/* CIntFromPy.proto */ -static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); - -/* CIntFromPy.proto */ -static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); - -/* 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) -#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (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) - -/* CheckBinaryVersion.proto */ -static unsigned long __Pyx_get_runtime_version(void); -static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer); - -/* InitStrings.proto */ -static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); - -/* #### Code section: module_declarations ### */ - -/* Module declarations from "libc.string" */ - -/* Module declarations from "libcpp.string" */ - -/* Module declarations from "amulet_nbt._string_encoding._cpp" */ - -/* Module declarations from "amulet_nbt._string_encoding.encoding" */ - -/* Module declarations from "amulet_nbt._string_encoding" */ -/* #### Code section: typeinfo ### */ -/* #### Code section: before_global_var ### */ -#define __Pyx_MODULE_NAME "amulet_nbt._string_encoding.__init__" -extern int __pyx_module_is_main_amulet_nbt___string_encoding____init__; -int __pyx_module_is_main_amulet_nbt___string_encoding____init__ = 0; - -/* Implementation of "amulet_nbt._string_encoding" */ -/* #### Code section: global_var ### */ -/* #### Code section: string_decls ### */ -static const char __pyx_k_[] = "."; -static const char __pyx_k__2[] = "?"; -static const char __pyx_k_main[] = "__main__"; -static const char __pyx_k_name[] = "__name__"; -static const char __pyx_k_test[] = "__test__"; -static const char __pyx_k_import[] = "__import__"; -static const char __pyx_k_utf8_encoding[] = "utf8_encoding"; -static const char __pyx_k_mutf8_encoding[] = "mutf8_encoding"; -static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; -static const char __pyx_k_utf8_escape_encoding[] = "utf8_escape_encoding"; -static const char __pyx_k_amulet_nbt__string_encoding___in[] = "amulet_nbt._string_encoding.__init__"; -static const char __pyx_k_amulet_nbt__string_encoding_enco[] = "amulet_nbt._string_encoding.encoding"; -/* #### Code section: decls ### */ -/* #### Code section: late_includes ### */ -/* #### Code section: module_state ### */ -typedef struct { - PyObject *__pyx_d; - PyObject *__pyx_b; - PyObject *__pyx_cython_runtime; - PyObject *__pyx_empty_tuple; - PyObject *__pyx_empty_bytes; - PyObject *__pyx_empty_unicode; - #ifdef __Pyx_CyFunction_USED - PyTypeObject *__pyx_CyFunctionType; - #endif - #ifdef __Pyx_FusedFunction_USED - PyTypeObject *__pyx_FusedFunctionType; - #endif - #ifdef __Pyx_Generator_USED - PyTypeObject *__pyx_GeneratorType; - #endif - #ifdef __Pyx_IterableCoroutine_USED - PyTypeObject *__pyx_IterableCoroutineType; - #endif - #ifdef __Pyx_Coroutine_USED - PyTypeObject *__pyx_CoroutineAwaitType; - #endif - #ifdef __Pyx_Coroutine_USED - PyTypeObject *__pyx_CoroutineType; - #endif - #if CYTHON_USE_MODULE_STATE - #endif - #if CYTHON_USE_MODULE_STATE - #endif - #if CYTHON_USE_MODULE_STATE - #endif - #if CYTHON_USE_MODULE_STATE - #endif - PyTypeObject *__pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding; - #if CYTHON_USE_MODULE_STATE - #endif - PyObject *__pyx_kp_u_; - PyObject *__pyx_n_s__2; - PyObject *__pyx_kp_u_amulet_nbt__string_encoding___in; - PyObject *__pyx_n_s_amulet_nbt__string_encoding_enco; - PyObject *__pyx_n_s_cline_in_traceback; - PyObject *__pyx_n_s_import; - PyObject *__pyx_n_s_main; - PyObject *__pyx_n_s_mutf8_encoding; - PyObject *__pyx_n_s_name; - PyObject *__pyx_n_s_test; - PyObject *__pyx_n_s_utf8_encoding; - PyObject *__pyx_n_s_utf8_escape_encoding; -} __pyx_mstate; - -#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(o) ((__pyx_mstate *)__Pyx_PyModule_GetState(o)) - -#define __pyx_mstate_global (__pyx_mstate(PyState_FindModule(&__pyx_moduledef))) - -#define __pyx_m (PyState_FindModule(&__pyx_moduledef)) -#else -static __pyx_mstate __pyx_mstate_global_static = -#ifdef __cplusplus - {}; -#else - {0}; -#endif -static __pyx_mstate *__pyx_mstate_global = &__pyx_mstate_global_static; -#endif -/* #### Code section: module_state_clear ### */ -#if CYTHON_USE_MODULE_STATE -static int __pyx_m_clear(PyObject *m) { - __pyx_mstate *clear_module_state = __pyx_mstate(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); - #ifdef __Pyx_CyFunction_USED - Py_CLEAR(clear_module_state->__pyx_CyFunctionType); - #endif - #ifdef __Pyx_FusedFunction_USED - Py_CLEAR(clear_module_state->__pyx_FusedFunctionType); - #endif - Py_CLEAR(clear_module_state->__pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding); - Py_CLEAR(clear_module_state->__pyx_kp_u_); - Py_CLEAR(clear_module_state->__pyx_n_s__2); - Py_CLEAR(clear_module_state->__pyx_kp_u_amulet_nbt__string_encoding___in); - Py_CLEAR(clear_module_state->__pyx_n_s_amulet_nbt__string_encoding_enco); - Py_CLEAR(clear_module_state->__pyx_n_s_cline_in_traceback); - Py_CLEAR(clear_module_state->__pyx_n_s_import); - Py_CLEAR(clear_module_state->__pyx_n_s_main); - Py_CLEAR(clear_module_state->__pyx_n_s_mutf8_encoding); - Py_CLEAR(clear_module_state->__pyx_n_s_name); - Py_CLEAR(clear_module_state->__pyx_n_s_test); - Py_CLEAR(clear_module_state->__pyx_n_s_utf8_encoding); - Py_CLEAR(clear_module_state->__pyx_n_s_utf8_escape_encoding); - return 0; -} -#endif -/* #### Code section: module_state_traverse ### */ -#if CYTHON_USE_MODULE_STATE -static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { - __pyx_mstate *traverse_module_state = __pyx_mstate(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); - Py_VISIT(traverse_module_state->__pyx_empty_tuple); - Py_VISIT(traverse_module_state->__pyx_empty_bytes); - Py_VISIT(traverse_module_state->__pyx_empty_unicode); - #ifdef __Pyx_CyFunction_USED - Py_VISIT(traverse_module_state->__pyx_CyFunctionType); - #endif - #ifdef __Pyx_FusedFunction_USED - Py_VISIT(traverse_module_state->__pyx_FusedFunctionType); - #endif - Py_VISIT(traverse_module_state->__pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding); - Py_VISIT(traverse_module_state->__pyx_kp_u_); - Py_VISIT(traverse_module_state->__pyx_n_s__2); - Py_VISIT(traverse_module_state->__pyx_kp_u_amulet_nbt__string_encoding___in); - Py_VISIT(traverse_module_state->__pyx_n_s_amulet_nbt__string_encoding_enco); - Py_VISIT(traverse_module_state->__pyx_n_s_cline_in_traceback); - Py_VISIT(traverse_module_state->__pyx_n_s_import); - Py_VISIT(traverse_module_state->__pyx_n_s_main); - Py_VISIT(traverse_module_state->__pyx_n_s_mutf8_encoding); - Py_VISIT(traverse_module_state->__pyx_n_s_name); - Py_VISIT(traverse_module_state->__pyx_n_s_test); - Py_VISIT(traverse_module_state->__pyx_n_s_utf8_encoding); - Py_VISIT(traverse_module_state->__pyx_n_s_utf8_escape_encoding); - return 0; -} -#endif -/* #### Code section: module_state_defines ### */ -#define __pyx_d __pyx_mstate_global->__pyx_d -#define __pyx_b __pyx_mstate_global->__pyx_b -#define __pyx_cython_runtime __pyx_mstate_global->__pyx_cython_runtime -#define __pyx_empty_tuple __pyx_mstate_global->__pyx_empty_tuple -#define __pyx_empty_bytes __pyx_mstate_global->__pyx_empty_bytes -#define __pyx_empty_unicode __pyx_mstate_global->__pyx_empty_unicode -#ifdef __Pyx_CyFunction_USED -#define __pyx_CyFunctionType __pyx_mstate_global->__pyx_CyFunctionType -#endif -#ifdef __Pyx_FusedFunction_USED -#define __pyx_FusedFunctionType __pyx_mstate_global->__pyx_FusedFunctionType -#endif -#ifdef __Pyx_Generator_USED -#define __pyx_GeneratorType __pyx_mstate_global->__pyx_GeneratorType -#endif -#ifdef __Pyx_IterableCoroutine_USED -#define __pyx_IterableCoroutineType __pyx_mstate_global->__pyx_IterableCoroutineType -#endif -#ifdef __Pyx_Coroutine_USED -#define __pyx_CoroutineAwaitType __pyx_mstate_global->__pyx_CoroutineAwaitType -#endif -#ifdef __Pyx_Coroutine_USED -#define __pyx_CoroutineType __pyx_mstate_global->__pyx_CoroutineType -#endif -#if CYTHON_USE_MODULE_STATE -#endif -#if CYTHON_USE_MODULE_STATE -#endif -#if CYTHON_USE_MODULE_STATE -#endif -#if CYTHON_USE_MODULE_STATE -#endif -#define __pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding __pyx_mstate_global->__pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding -#if CYTHON_USE_MODULE_STATE -#endif -#define __pyx_kp_u_ __pyx_mstate_global->__pyx_kp_u_ -#define __pyx_n_s__2 __pyx_mstate_global->__pyx_n_s__2 -#define __pyx_kp_u_amulet_nbt__string_encoding___in __pyx_mstate_global->__pyx_kp_u_amulet_nbt__string_encoding___in -#define __pyx_n_s_amulet_nbt__string_encoding_enco __pyx_mstate_global->__pyx_n_s_amulet_nbt__string_encoding_enco -#define __pyx_n_s_cline_in_traceback __pyx_mstate_global->__pyx_n_s_cline_in_traceback -#define __pyx_n_s_import __pyx_mstate_global->__pyx_n_s_import -#define __pyx_n_s_main __pyx_mstate_global->__pyx_n_s_main -#define __pyx_n_s_mutf8_encoding __pyx_mstate_global->__pyx_n_s_mutf8_encoding -#define __pyx_n_s_name __pyx_mstate_global->__pyx_n_s_name -#define __pyx_n_s_test __pyx_mstate_global->__pyx_n_s_test -#define __pyx_n_s_utf8_encoding __pyx_mstate_global->__pyx_n_s_utf8_encoding -#define __pyx_n_s_utf8_escape_encoding __pyx_mstate_global->__pyx_n_s_utf8_escape_encoding -/* #### Code section: module_code ### */ - -static PyMethodDef __pyx_methods[] = { - {0, 0, 0, 0} -}; -#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 -/* #### Code section: pystring_table ### */ - -static int __Pyx_CreateStringTabAndInitStrings(void) { - __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_kp_u_, __pyx_k_, sizeof(__pyx_k_), 0, 1, 0, 0}, - {&__pyx_n_s__2, __pyx_k__2, sizeof(__pyx_k__2), 0, 0, 1, 1}, - {&__pyx_kp_u_amulet_nbt__string_encoding___in, __pyx_k_amulet_nbt__string_encoding___in, sizeof(__pyx_k_amulet_nbt__string_encoding___in), 0, 1, 0, 0}, - {&__pyx_n_s_amulet_nbt__string_encoding_enco, __pyx_k_amulet_nbt__string_encoding_enco, sizeof(__pyx_k_amulet_nbt__string_encoding_enco), 0, 0, 1, 1}, - {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, - {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, - {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, - {&__pyx_n_s_mutf8_encoding, __pyx_k_mutf8_encoding, sizeof(__pyx_k_mutf8_encoding), 0, 0, 1, 1}, - {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, - {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, - {&__pyx_n_s_utf8_encoding, __pyx_k_utf8_encoding, sizeof(__pyx_k_utf8_encoding), 0, 0, 1, 1}, - {&__pyx_n_s_utf8_escape_encoding, __pyx_k_utf8_escape_encoding, sizeof(__pyx_k_utf8_escape_encoding), 0, 0, 1, 1}, - {0, 0, 0, 0, 0, 0, 0} - }; - return __Pyx_InitStrings(__pyx_string_tab); -} -/* #### Code section: cached_builtins ### */ -static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { - return 0; -} -/* #### Code section: cached_constants ### */ - -static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - __Pyx_RefNannyFinishContext(); - return 0; -} -/* #### Code section: init_constants ### */ - -static CYTHON_SMALL_CODE int __Pyx_InitConstants(void) { - if (__Pyx_CreateStringTabAndInitStrings() < 0) __PYX_ERR(0, 1, __pyx_L1_error); - return 0; - __pyx_L1_error:; - return -1; -} -/* #### Code section: init_globals ### */ - -static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { - return 0; -} -/* #### Code section: init_module ### */ - -static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/ - -static int __Pyx_modinit_global_init_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); - /*--- Global init code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_variable_export_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); - /*--- Variable export code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_function_export_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); - /*--- Function export code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_type_init_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); - /*--- Type init code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_type_import_code(void) { - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); - /*--- Type import code ---*/ - __pyx_t_1 = PyImport_ImportModule("amulet_nbt._string_encoding.encoding"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding = __Pyx_ImportType_3_0_8(__pyx_t_1, "amulet_nbt._string_encoding.encoding", "StringEncoding", sizeof(struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding), __PYX_GET_STRUCT_ALIGNMENT_3_0_8(struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding),__Pyx_ImportType_CheckSize_Warn_3_0_8); if (!__pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding) __PYX_ERR(1, 4, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_RefNannyFinishContext(); - return 0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_RefNannyFinishContext(); - return -1; -} - -static int __Pyx_modinit_variable_import_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); - /*--- Variable import code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_function_import_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); - /*--- Function import code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - - -#if PY_MAJOR_VERSION >= 3 -#if CYTHON_PEP489_MULTI_PHASE_INIT -static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ -static int __pyx_pymod_exec__string_encoding(PyObject* module); /*proto*/ -static PyModuleDef_Slot __pyx_moduledef_slots[] = { - {Py_mod_create, (void*)__pyx_pymod_create}, - {Py_mod_exec, (void*)__pyx_pymod_exec__string_encoding}, - {0, NULL} -}; -#endif - -#ifdef __cplusplus -namespace { - struct PyModuleDef __pyx_moduledef = - #else - static struct PyModuleDef __pyx_moduledef = - #endif - { - PyModuleDef_HEAD_INIT, - "_string_encoding", - 0, /* m_doc */ - #if CYTHON_PEP489_MULTI_PHASE_INIT - 0, /* m_size */ - #elif CYTHON_USE_MODULE_STATE - sizeof(__pyx_mstate), /* m_size */ - #else - -1, /* m_size */ - #endif - __pyx_methods /* m_methods */, - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_moduledef_slots, /* m_slots */ - #else - NULL, /* m_reload */ - #endif - #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 -#endif - -#ifndef CYTHON_NO_PYINIT_EXPORT -#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC -#elif PY_MAJOR_VERSION < 3 -#ifdef __cplusplus -#define __Pyx_PyMODINIT_FUNC extern "C" void -#else -#define __Pyx_PyMODINIT_FUNC void -#endif -#else -#ifdef __cplusplus -#define __Pyx_PyMODINIT_FUNC extern "C" PyObject * -#else -#define __Pyx_PyMODINIT_FUNC PyObject * -#endif -#endif - - -#if PY_MAJOR_VERSION < 3 -__Pyx_PyMODINIT_FUNC init_string_encoding(void) CYTHON_SMALL_CODE; /*proto*/ -#if !defined(CYTHON_NO_PYINIT_EXPORT) && (defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) -__Pyx_PyMODINIT_FUNC init__init__(void) { init_string_encoding(); } -#endif -__Pyx_PyMODINIT_FUNC init_string_encoding(void) -#else -__Pyx_PyMODINIT_FUNC PyInit__string_encoding(void) CYTHON_SMALL_CODE; /*proto*/ -#if !defined(CYTHON_NO_PYINIT_EXPORT) && (defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)) -__Pyx_PyMODINIT_FUNC PyInit___init__(void) { return PyInit__string_encoding(); } -#endif -__Pyx_PyMODINIT_FUNC PyInit__string_encoding(void) -#if CYTHON_PEP489_MULTI_PHASE_INIT -{ - return PyModuleDef_Init(&__pyx_moduledef); -} -static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { - #if PY_VERSION_HEX >= 0x030700A1 - static PY_INT64_T main_interpreter_id = -1; - PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); - if (main_interpreter_id == -1) { - main_interpreter_id = current_id; - return (unlikely(current_id == -1)) ? -1 : 0; - } else if (unlikely(main_interpreter_id != current_id)) - #else - static PyInterpreterState *main_interpreter = NULL; - PyInterpreterState *current_interpreter = PyThreadState_Get()->interp; - if (!main_interpreter) { - main_interpreter = current_interpreter; - } else if (unlikely(main_interpreter != current_interpreter)) - #endif - { - PyErr_SetString( - PyExc_ImportError, - "Interpreter change detected - this module can only be loaded into one interpreter per process."); - return -1; - } - return 0; -} -#if CYTHON_COMPILING_IN_LIMITED_API -static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *module, const char* from_name, const char* to_name, int allow_none) -#else -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) -#endif -{ - PyObject *value = PyObject_GetAttrString(spec, from_name); - int result = 0; - if (likely(value)) { - if (allow_none || value != Py_None) { -#if CYTHON_COMPILING_IN_LIMITED_API - result = PyModule_AddObject(module, to_name, value); -#else - result = PyDict_SetItemString(moddict, to_name, value); -#endif - } - 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 (__Pyx_check_single_interpreter()) - return NULL; - if (__pyx_m) - return __Pyx_NewRef(__pyx_m); - modname = PyObject_GetAttrString(spec, "name"); - if (unlikely(!modname)) goto bad; - module = PyModule_NewObject(modname); - Py_DECREF(modname); - if (unlikely(!module)) goto bad; -#if CYTHON_COMPILING_IN_LIMITED_API - moddict = module; -#else - moddict = PyModule_GetDict(module); - if (unlikely(!moddict)) goto bad; -#endif - 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__string_encoding(PyObject *__pyx_pyinit_module) -#endif -#endif -{ - int stringtab_initialized = 0; - #if CYTHON_USE_MODULE_STATE - int pystate_addmodule_run = 0; - #endif - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannyDeclarations - #if CYTHON_PEP489_MULTI_PHASE_INIT - if (__pyx_m) { - if (__pyx_m == __pyx_pyinit_module) return 0; - PyErr_SetString(PyExc_RuntimeError, "Module '_string_encoding' has already been imported. Re-initialisation is not supported."); - return -1; - } - #elif PY_MAJOR_VERSION >= 3 - if (__pyx_m) return __Pyx_NewRef(__pyx_m); - #endif - /*--- Module creation code ---*/ - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_m = __pyx_pyinit_module; - Py_INCREF(__pyx_m); - #else - #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4("_string_encoding", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); - if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) - #elif CYTHON_USE_MODULE_STATE - __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) - { - int add_module_result = PyState_AddModule(__pyx_t_1, &__pyx_moduledef); - __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to "_string_encoding" pseudovariable */ - if (unlikely((add_module_result < 0))) __PYX_ERR(0, 1, __pyx_L1_error) - pystate_addmodule_run = 1; - } - #else - __pyx_m = PyModule_Create(&__pyx_moduledef); - if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #endif - CYTHON_UNUSED_VAR(__pyx_t_1); - __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_d); - __pyx_b = __Pyx_PyImport_AddModuleRef(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_cython_runtime = __Pyx_PyImport_AddModuleRef((const char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) - if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #if CYTHON_REFNANNY -__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); -if (!__Pyx_RefNanny) { - PyErr_Clear(); - __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); - if (!__Pyx_RefNanny) - Py_FatalError("failed to import 'refnanny' module"); -} -#endif - __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit__string_encoding(void)", 0); - 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) - #ifdef __Pxy_PyFrame_Initialize_Offsets - __Pxy_PyFrame_Initialize_Offsets(); - #endif - __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) - #ifdef __Pyx_CyFunction_USED - if (__pyx_CyFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_FusedFunction_USED - if (__pyx_FusedFunction_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Coroutine_USED - if (__pyx_Coroutine_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Generator_USED - if (__pyx_Generator_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_AsyncGen_USED - if (__pyx_AsyncGen_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_StopAsyncIteration_USED - if (__pyx_StopAsyncIteration_init(__pyx_m) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - /*--- Library function declarations ---*/ - /*--- Threads initialization code ---*/ - #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS - PyEval_InitThreads(); - #endif - /*--- Initialize various global constants etc. ---*/ - if (__Pyx_InitConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - stringtab_initialized = 1; - if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) - if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - if (__pyx_module_is_main_amulet_nbt___string_encoding____init__) { - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - } - if (!CYTHON_PEP489_MULTI_PHASE_INIT) { - if (unlikely((__Pyx_SetPackagePathFromImportLib(__pyx_kp_u_amulet_nbt__string_encoding___in) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) - } - #if PY_MAJOR_VERSION >= 3 - { - PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) - if (!PyDict_GetItemString(modules, "amulet_nbt._string_encoding")) { - if (unlikely((PyDict_SetItemString(modules, "amulet_nbt._string_encoding", __pyx_m) < 0))) __PYX_ERR(0, 1, __pyx_L1_error) - } - } - #endif - /*--- Builtin init code ---*/ - if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Constants init code ---*/ - if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Global type/function init code ---*/ - (void)__Pyx_modinit_global_init_code(); - (void)__Pyx_modinit_variable_export_code(); - (void)__Pyx_modinit_function_export_code(); - (void)__Pyx_modinit_type_init_code(); - if (unlikely((__Pyx_modinit_type_import_code() < 0))) __PYX_ERR(0, 1, __pyx_L1_error) - (void)__Pyx_modinit_variable_import_code(); - (void)__Pyx_modinit_function_import_code(); - /*--- Execution code ---*/ - #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) - if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - - /* "amulet_nbt/_string_encoding/__init__.pyx":5 - * - * from amulet_nbt._string_encoding.encoding import ( - * mutf8_encoding, # <<<<<<<<<<<<<< - * utf8_encoding, - * utf8_escape_encoding - */ - __pyx_t_2 = PyList_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_n_s_mutf8_encoding); - __Pyx_GIVEREF(__pyx_n_s_mutf8_encoding); - if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_mutf8_encoding)) __PYX_ERR(0, 5, __pyx_L1_error); - __Pyx_INCREF(__pyx_n_s_utf8_encoding); - __Pyx_GIVEREF(__pyx_n_s_utf8_encoding); - if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_utf8_encoding)) __PYX_ERR(0, 5, __pyx_L1_error); - __Pyx_INCREF(__pyx_n_s_utf8_escape_encoding); - __Pyx_GIVEREF(__pyx_n_s_utf8_escape_encoding); - if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_s_utf8_escape_encoding)) __PYX_ERR(0, 5, __pyx_L1_error); - - /* "amulet_nbt/_string_encoding/__init__.pyx":4 - * # distutils: extra_compile_args = CPPCARGS - * - * from amulet_nbt._string_encoding.encoding import ( # <<<<<<<<<<<<<< - * mutf8_encoding, - * utf8_encoding, - */ - __pyx_t_3 = __Pyx_Import(__pyx_n_s_amulet_nbt__string_encoding_enco, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_mutf8_encoding); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_mutf8_encoding, __pyx_t_2) < 0) __PYX_ERR(0, 5, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_utf8_encoding); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_utf8_encoding, __pyx_t_2) < 0) __PYX_ERR(0, 6, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_utf8_escape_encoding); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_utf8_escape_encoding, __pyx_t_2) < 0) __PYX_ERR(0, 7, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "amulet_nbt/_string_encoding/__init__.pyx":1 - * # distutils: language = c++ # <<<<<<<<<<<<<< - * # distutils: extra_compile_args = CPPCARGS - * - */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_3) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /*--- Wrapped vars code ---*/ - - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - if (__pyx_m) { - if (__pyx_d && stringtab_initialized) { - __Pyx_AddTraceback("init amulet_nbt._string_encoding", __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 amulet_nbt._string_encoding"); - } - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - #if CYTHON_PEP489_MULTI_PHASE_INIT - return (__pyx_m != NULL) ? 0 : -1; - #elif PY_MAJOR_VERSION >= 3 - return __pyx_m; - #else - return; - #endif -} -/* #### 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 - -/* SetPackagePathFromImportLib */ -#if PY_MAJOR_VERSION >= 3 && !CYTHON_PEP489_MULTI_PHASE_INIT -static int __Pyx_SetPackagePathFromImportLib(PyObject *module_name) { - PyObject *importlib, *osmod, *ossep, *parts, *package_path; - PyObject *file_path = NULL; - int result; - PyObject *spec; - importlib = PyImport_ImportModule("importlib.util"); - if (unlikely(!importlib)) - goto bad; - spec = PyObject_CallMethod(importlib, "find_spec", "(O)", module_name); - Py_DECREF(importlib); - if (unlikely(!spec)) - goto bad; - file_path = PyObject_GetAttrString(spec, "origin"); - Py_DECREF(spec); - if (unlikely(!file_path)) - goto bad; - if (unlikely(PyObject_SetAttrString(__pyx_m, "__file__", file_path) < 0)) - goto bad; - osmod = PyImport_ImportModule("os"); - if (unlikely(!osmod)) - goto bad; - ossep = PyObject_GetAttrString(osmod, "sep"); - Py_DECREF(osmod); - if (unlikely(!ossep)) - goto bad; - parts = PyObject_CallMethod(file_path, "rsplit", "(Oi)", ossep, 1); - Py_DECREF(file_path); file_path = NULL; - Py_DECREF(ossep); - if (unlikely(!parts)) - goto bad; - package_path = Py_BuildValue("[O]", PyList_GET_ITEM(parts, 0)); - Py_DECREF(parts); - if (unlikely(!package_path)) - goto bad; - goto set_path; -bad: - PyErr_WriteUnraisable(module_name); - Py_XDECREF(file_path); - PyErr_Clear(); - package_path = PyList_New(0); - if (unlikely(!package_path)) - return -1; -set_path: - result = PyObject_SetAttrString(__pyx_m, "__path__", package_path); - Py_DECREF(package_path); - return result; -} -#endif - -/* TypeImport */ -#ifndef __PYX_HAVE_RT_ImportType_3_0_8 -#define __PYX_HAVE_RT_ImportType_3_0_8 -static PyTypeObject *__Pyx_ImportType_3_0_8(PyObject *module, const char *module_name, const char *class_name, - size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_8 check_size) -{ - PyObject *result = 0; - char warning[200]; - Py_ssize_t basicsize; - Py_ssize_t itemsize; -#if 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 !CYTHON_COMPILING_IN_LIMITED_API - basicsize = ((PyTypeObject *)result)->tp_basicsize; - itemsize = ((PyTypeObject *)result)->tp_itemsize; -#else - py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); - if (!py_basicsize) - goto bad; - basicsize = PyLong_AsSsize_t(py_basicsize); - Py_DECREF(py_basicsize); - py_basicsize = 0; - if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) - goto bad; - py_itemsize = PyObject_GetAttrString(result, "__itemsize__"); - if (!py_itemsize) - goto bad; - itemsize = PyLong_AsSsize_t(py_itemsize); - Py_DECREF(py_itemsize); - py_itemsize = 0; - if (itemsize == (Py_ssize_t)-1 && PyErr_Occurred()) - goto bad; -#endif - if (itemsize) { - if (size % alignment) { - alignment = size % alignment; - } - if (itemsize < (Py_ssize_t)alignment) - itemsize = (Py_ssize_t)alignment; - } - if ((size_t)(basicsize + itemsize) < size) { - PyErr_Format(PyExc_ValueError, - "%.200s.%.200s size changed, may indicate binary incompatibility. " - "Expected %zd from C header, got %zd from PyObject", - module_name, class_name, size, basicsize+itemsize); - goto bad; - } - if (check_size == __Pyx_ImportType_CheckSize_Error_3_0_8 && - ((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_0_8 && (size_t)basicsize > size) { - PyOS_snprintf(warning, sizeof(warning), - "%s.%s size changed, may indicate binary incompatibility. " - "Expected %zd from C header, got %zd from PyObject", - module_name, class_name, size, basicsize); - if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; - } - return (PyTypeObject *)result; -bad: - Py_XDECREF(result); - return NULL; -} -#endif - -/* PyObjectGetAttrStr */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro)) - return tp->tp_getattro(obj, attr_name); -#if PY_MAJOR_VERSION < 3 - if (likely(tp->tp_getattr)) - return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); -#endif - return PyObject_GetAttr(obj, attr_name); -} -#endif - -/* Import */ -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { - PyObject *module = 0; - PyObject *empty_dict = 0; - PyObject *empty_list = 0; - #if PY_MAJOR_VERSION < 3 - PyObject *py_import; - py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); - if (unlikely(!py_import)) - goto bad; - if (!from_list) { - empty_list = PyList_New(0); - if (unlikely(!empty_list)) - goto bad; - from_list = empty_list; - } - #endif - empty_dict = PyDict_New(); - if (unlikely(!empty_dict)) - goto bad; - { - #if PY_MAJOR_VERSION >= 3 - if (level == -1) { - if (strchr(__Pyx_MODULE_NAME, '.') != NULL) { - module = PyImport_ImportModuleLevelObject( - name, __pyx_d, empty_dict, from_list, 1); - if (unlikely(!module)) { - if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError))) - goto bad; - PyErr_Clear(); - } - } - level = 0; - } - #endif - if (!module) { - #if PY_MAJOR_VERSION < 3 - PyObject *py_level = PyInt_FromLong(level); - if (unlikely(!py_level)) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, __pyx_d, empty_dict, from_list, py_level, (PyObject *)NULL); - Py_DECREF(py_level); - #else - module = PyImport_ImportModuleLevelObject( - name, __pyx_d, empty_dict, from_list, level); - #endif - } - } -bad: - Py_XDECREF(empty_dict); - Py_XDECREF(empty_list); - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(py_import); - #endif - return module; -} - -/* ImportFrom */ -static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { - PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); - if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { - 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_kp_u_); - if (unlikely(!module_dot)) { goto modbad; } - full_name = PyUnicode_Concat(module_dot, name); - if (unlikely(!full_name)) { goto modbad; } - #if PY_VERSION_HEX < 0x030700A1 || (CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM < 0x07030400) - { - 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, - #if PY_MAJOR_VERSION < 3 - "cannot import name %.230s", PyString_AS_STRING(name)); - #else - "cannot import name %S", name); - #endif - } - return value; -} - -/* 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 - -/* PyErrExceptionMatches */ -#if CYTHON_FAST_THREAD_STATE -static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { - Py_ssize_t i, n; - n = PyTuple_GET_SIZE(tuple); -#if PY_MAJOR_VERSION >= 3 - for (i=0; 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 */ -#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 */ -#if __PYX_LIMITED_VERSION_HEX < 0x030d00A1 -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 >= 0x030d00A1 - (void) PyObject_GetOptionalAttr(obj, attr_name, &result); - return result; -#else -#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1 - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { - return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); - } -#endif - result = __Pyx_PyObject_GetAttrStr(obj, attr_name); - if (unlikely(!result)) { - __Pyx_PyObject_GetAttrStr_ClearAttributeError(); - } - return result; -#endif -} - -/* CLineInTraceback */ -#ifndef CYTHON_CLINE_IN_TRACEBACK -static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { - PyObject *use_cline; - PyObject *ptype, *pvalue, *ptraceback; -#if CYTHON_COMPILING_IN_CPYTHON - PyObject **cython_runtime_dict; -#endif - CYTHON_MAYBE_UNUSED_VAR(tstate); - if (unlikely(!__pyx_cython_runtime)) { - return c_line; - } - __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); -#if CYTHON_COMPILING_IN_CPYTHON - cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime); - if (likely(cython_runtime_dict)) { - __PYX_PY_DICT_LOOKUP_IF_MODIFIED( - use_cline, *cython_runtime_dict, - __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback)) - } else -#endif - { - PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStrNoError(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); - if (use_cline_obj) { - use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True; - Py_DECREF(use_cline_obj); - } else { - PyErr_Clear(); - use_cline = NULL; - } - } - if (!use_cline) { - c_line = 0; - (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); - } - else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { - c_line = 0; - } - __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); - return c_line; -} -#endif - -/* CodeObjectCache */ -#if !CYTHON_COMPILING_IN_LIMITED_API -static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { - int start = 0, mid = 0, end = count - 1; - if (end >= 0 && code_line > entries[end].code_line) { - return count; - } - while (start < end) { - mid = start + (end - start) / 2; - if (code_line < entries[mid].code_line) { - end = mid; - } else if (code_line > entries[mid].code_line) { - start = mid + 1; - } else { - return mid; - } - } - if (code_line <= entries[mid].code_line) { - return mid; - } else { - return mid + 1; - } -} -static PyCodeObject *__pyx_find_code_object(int code_line) { - PyCodeObject* code_object; - int pos; - if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { - return NULL; - } - pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); - if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { - return NULL; - } - code_object = __pyx_code_cache.entries[pos].code_object; - Py_INCREF(code_object); - return code_object; -} -static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { - int pos, i; - __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; - if (unlikely(!code_line)) { - return; - } - if (unlikely(!entries)) { - entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); - if (likely(entries)) { - __pyx_code_cache.entries = entries; - __pyx_code_cache.max_count = 64; - __pyx_code_cache.count = 1; - entries[0].code_line = code_line; - entries[0].code_object = code_object; - Py_INCREF(code_object); - } - return; - } - pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); - if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { - PyCodeObject* tmp = entries[pos].code_object; - entries[pos].code_object = code_object; - Py_DECREF(tmp); - return; - } - if (__pyx_code_cache.count == __pyx_code_cache.max_count) { - int new_max = __pyx_code_cache.max_count + 64; - entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( - __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry)); - if (unlikely(!entries)) { - return; - } - __pyx_code_cache.entries = entries; - __pyx_code_cache.max_count = new_max; - } - for (i=__pyx_code_cache.count; i>pos; i--) { - entries[i] = entries[i-1]; - } - entries[pos].code_line = code_line; - entries[pos].code_object = code_object; - __pyx_code_cache.count++; - Py_INCREF(code_object); -} -#endif - -/* AddTraceback */ -#include "compile.h" -#include "frameobject.h" -#include "traceback.h" -#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API - #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; - result = PyObject_Call(replace, __pyx_empty_tuple, scratch_dict); - Py_DECREF(replace); - return result; - } - PyErr_Clear(); - #if __PYX_LIMITED_VERSION_HEX < 0x030780000 - { - PyObject *compiled = NULL, *result = NULL; - if (unlikely(PyDict_SetItemString(scratch_dict, "code", code))) return NULL; - if (unlikely(PyDict_SetItemString(scratch_dict, "type", (PyObject*)(&PyType_Type)))) return NULL; - compiled = Py_CompileString( - "out = type(code)(\n" - " code.co_argcount, code.co_kwonlyargcount, code.co_nlocals, code.co_stacksize,\n" - " code.co_flags, code.co_code, code.co_consts, code.co_names,\n" - " code.co_varnames, code.co_filename, co_name, co_firstlineno,\n" - " code.co_lnotab)\n", "", Py_file_input); - if (!compiled) return NULL; - result = PyEval_EvalCode(compiled, scratch_dict, scratch_dict); - Py_DECREF(compiled); - if (!result) PyErr_Print(); - Py_DECREF(result); - result = PyDict_GetItemString(scratch_dict, "out"); - if (result) Py_INCREF(result); - return result; - } - #else - return NULL; - #endif -} -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) { - (void) __pyx_cfilenm; - (void) __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line); - } - PyErr_Fetch(&exc_type, &exc_value, &exc_traceback); - 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; - 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; - 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 PY_MAJOR_VERSION < 3 - PyObject *py_srcfile = NULL; - py_srcfile = PyString_FromString(filename); - if (!py_srcfile) goto bad; - #endif - if (c_line) { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); - if (!py_funcname) goto bad; - #else - py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); - if (!py_funcname) goto bad; - funcname = PyUnicode_AsUTF8(py_funcname); - if (!funcname) goto bad; - #endif - } - else { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromString(funcname); - if (!py_funcname) goto bad; - #endif - } - #if PY_MAJOR_VERSION < 3 - py_code = __Pyx_PyCode_New( - 0, - 0, - 0, - 0, - 0, - 0, - __pyx_empty_bytes, /*PyObject *code,*/ - __pyx_empty_tuple, /*PyObject *consts,*/ - __pyx_empty_tuple, /*PyObject *names,*/ - __pyx_empty_tuple, /*PyObject *varnames,*/ - __pyx_empty_tuple, /*PyObject *freevars,*/ - __pyx_empty_tuple, /*PyObject *cellvars,*/ - py_srcfile, /*PyObject *filename,*/ - py_funcname, /*PyObject *name,*/ - py_line, - __pyx_empty_bytes /*PyObject *lnotab*/ - ); - Py_DECREF(py_srcfile); - #else - py_code = PyCode_NewEmpty(filename, funcname, py_line); - #endif - Py_XDECREF(py_funcname); - return py_code; -bad: - Py_XDECREF(py_funcname); - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(py_srcfile); - #endif - return NULL; -} -static void __Pyx_AddTraceback(const char *funcname, int c_line, - int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyFrameObject *py_frame = 0; - PyThreadState *tstate = __Pyx_PyThreadState_Current; - PyObject *ptype, *pvalue, *ptraceback; - if (c_line) { - c_line = __Pyx_CLineForTraceback(tstate, c_line); - } - py_code = __pyx_find_code_object(c_line ? -c_line : py_line); - if (!py_code) { - __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); - py_code = __Pyx_CreateCodeObjectForTraceback( - funcname, c_line, py_line, filename); - if (!py_code) { - /* If the code object creation fails, then we should clear the - fetched exception references and propagate the new exception */ - Py_XDECREF(ptype); - Py_XDECREF(pvalue); - Py_XDECREF(ptraceback); - goto bad; - } - __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); - __pyx_insert_code_object(c_line ? -c_line : py_line, py_code); - } - py_frame = PyFrame_New( - tstate, /*PyThreadState *tstate,*/ - py_code, /*PyCodeObject *code,*/ - __pyx_d, /*PyObject *globals,*/ - 0 /*PyObject *locals*/ - ); - if (!py_frame) goto bad; - __Pyx_PyFrame_SetLineNumber(py_frame, py_line); - PyTraceBack_Here(py_frame); -bad: - Py_XDECREF(py_code); - Py_XDECREF(py_frame); -} -#endif - -/* FormatTypeName */ -#if CYTHON_COMPILING_IN_LIMITED_API -static __Pyx_TypeName -__Pyx_PyType_GetName(PyTypeObject* tp) -{ - PyObject *name = __Pyx_PyObject_GetAttrStr((PyObject *)tp, - __pyx_n_s_name); - if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) { - PyErr_Clear(); - Py_XDECREF(name); - name = __Pyx_NewRef(__pyx_n_s__2); - } - return name; -} -#endif - -/* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - const long neg_one = (long) -1, const_zero = (long) 0; -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic pop -#endif - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(long) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(long) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(long) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; -#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 - return _PyLong_FromByteArray(bytes, sizeof(long), - little, !is_unsigned); -#else - PyObject *from_bytes, *result = NULL; - PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = 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; - arg_tuple = PyTuple_Pack(2, py_bytes, order_str); - if (!arg_tuple) goto limited_bad; - if (!is_unsigned) { - kwds = PyDict_New(); - if (!kwds) goto limited_bad; - if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad; - } - result = PyObject_Call(from_bytes, arg_tuple, kwds); - limited_bad: - Py_XDECREF(kwds); - Py_XDECREF(arg_tuple); - Py_XDECREF(order_str); - Py_XDECREF(py_bytes); - Py_XDECREF(from_bytes); - return result; -#endif - } -} - -/* CIntFromPyVerify */ -#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ - __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) -#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ - __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) -#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ - {\ - func_type value = func_value;\ - if (sizeof(target_type) < sizeof(func_type)) {\ - if (unlikely(value != (func_type) (target_type) value)) {\ - func_type zero = 0;\ - if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ - return (target_type) -1;\ - if (is_unsigned && unlikely(value < zero))\ - goto raise_neg_overflow;\ - else\ - goto raise_overflow;\ - }\ - }\ - return (target_type) value;\ - } - -/* CIntFromPy */ -static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - const long neg_one = (long) -1, const_zero = (long) 0; -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic pop -#endif - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if ((sizeof(long) < sizeof(long))) { - __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (long) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - 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)) -#ifdef HAVE_LONG_LONG - } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) { - __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) -#endif - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - 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)) -#ifdef HAVE_LONG_LONG - } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) { - __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) -#endif - } - } - { - long val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); -#if PY_MAJOR_VERSION < 3 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } -#endif - if (likely(v)) { - int ret = -1; -#if 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 *)v, - bytes, sizeof(val), - is_little, !is_unsigned); -#else - PyObject *stepval = NULL, *mask = NULL, *shift = NULL; - int bits, remaining_bits, is_negative = 0; - long idigit; - int chunk_size = (sizeof(long) < 8) ? 30 : 62; - if (unlikely(!PyLong_CheckExact(v))) { - PyObject *tmp = v; - v = PyNumber_Long(v); - assert(PyLong_CheckExact(v)); - Py_DECREF(tmp); - if (unlikely(!v)) return (long) -1; - } -#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 - if (Py_SIZE(x) == 0) - return (long) 0; - is_negative = Py_SIZE(x) < 0; -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (long) -1; - is_negative = result == 1; - } -#endif - if (is_unsigned && unlikely(is_negative)) { - goto raise_neg_overflow; - } else if (is_negative) { - stepval = PyNumber_Invert(v); - if (unlikely(!stepval)) - return (long) -1; - } else { - stepval = __Pyx_NewRef(v); - } - 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; - digit = PyNumber_And(stepval, mask); - if (unlikely(!digit)) goto done; - idigit = PyLong_AsLong(digit); - Py_DECREF(digit); - if (unlikely(idigit < 0)) goto done; - tmp = PyNumber_Rshift(stepval, shift); - if (unlikely(!tmp)) goto done; - Py_DECREF(stepval); stepval = tmp; - val |= ((long) idigit) << bits; - #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 - if (Py_SIZE(stepval) == 0) - goto unpacking_done; - #endif - } - 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 CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 - unpacking_done: - #endif - 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 - Py_DECREF(v); - if (likely(!ret)) - return val; - } - return (long) -1; - } - } else { - long val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (long) -1; - val = __Pyx_PyInt_As_long(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to long"); - return (long) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to long"); - return (long) -1; -} - -/* CIntFromPy */ -static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - const int neg_one = (int) -1, const_zero = (int) 0; -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic pop -#endif - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if ((sizeof(int) < sizeof(long))) { - __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (int) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - 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)) -#ifdef HAVE_LONG_LONG - } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) { - __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) -#endif - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - 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)) -#ifdef HAVE_LONG_LONG - } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) { - __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) -#endif - } - } - { - int val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); -#if PY_MAJOR_VERSION < 3 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } -#endif - if (likely(v)) { - int ret = -1; -#if 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 *)v, - bytes, sizeof(val), - is_little, !is_unsigned); -#else - PyObject *stepval = NULL, *mask = NULL, *shift = NULL; - int bits, remaining_bits, is_negative = 0; - long idigit; - int chunk_size = (sizeof(long) < 8) ? 30 : 62; - if (unlikely(!PyLong_CheckExact(v))) { - PyObject *tmp = v; - v = PyNumber_Long(v); - assert(PyLong_CheckExact(v)); - Py_DECREF(tmp); - if (unlikely(!v)) return (int) -1; - } -#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 - if (Py_SIZE(x) == 0) - return (int) 0; - is_negative = Py_SIZE(x) < 0; -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (int) -1; - is_negative = result == 1; - } -#endif - if (is_unsigned && unlikely(is_negative)) { - goto raise_neg_overflow; - } else if (is_negative) { - stepval = PyNumber_Invert(v); - if (unlikely(!stepval)) - return (int) -1; - } else { - stepval = __Pyx_NewRef(v); - } - 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; - digit = PyNumber_And(stepval, mask); - if (unlikely(!digit)) goto done; - idigit = PyLong_AsLong(digit); - Py_DECREF(digit); - if (unlikely(idigit < 0)) goto done; - tmp = PyNumber_Rshift(stepval, shift); - if (unlikely(!tmp)) goto done; - Py_DECREF(stepval); stepval = tmp; - val |= ((int) idigit) << bits; - #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 - if (Py_SIZE(stepval) == 0) - goto unpacking_done; - #endif - } - 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 CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 - unpacking_done: - #endif - 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 - Py_DECREF(v); - if (likely(!ret)) - return val; - } - return (int) -1; - } - } else { - int val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (int) -1; - val = __Pyx_PyInt_As_int(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to int"); - return (int) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to int"); - return (int) -1; -} - -/* 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); -} -#if PY_MAJOR_VERSION == 2 -static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { - PyObject *exception, *value, *tb; - int res; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&exception, &value, &tb); - res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0; - if (unlikely(res == -1)) { - PyErr_WriteUnraisable(err); - res = 0; - } - if (!res) { - res = PyObject_IsSubclass(err, exc_type2); - if (unlikely(res == -1)) { - PyErr_WriteUnraisable(err); - res = 0; - } - } - __Pyx_ErrRestore(exception, value, tb); - return res; -} -#else -static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { - if (exc_type1) { - return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2); - } else { - return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); - } -} -#endif -static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { - Py_ssize_t i, n; - assert(PyExceptionClass_Check(exc_type)); - n = PyTuple_GET_SIZE(tuple); -#if PY_MAJOR_VERSION >= 3 - for (i=0; i= 0x030B00A4 - return Py_Version & ~0xFFUL; -#else - 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; - } - return version; -#endif -} -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); - } -} - -/* InitStrings */ -#if PY_MAJOR_VERSION >= 3 -static int __Pyx_InitString(__Pyx_StringTabEntry t, PyObject **str) { - if (t.is_unicode | t.is_str) { - if (t.intern) { - *str = PyUnicode_InternFromString(t.s); - } else if (t.encoding) { - *str = PyUnicode_Decode(t.s, t.n - 1, t.encoding, NULL); - } else { - *str = PyUnicode_FromStringAndSize(t.s, t.n - 1); - } - } else { - *str = PyBytes_FromStringAndSize(t.s, t.n - 1); - } - if (!*str) - return -1; - if (PyObject_Hash(*str) == -1) - return -1; - return 0; -} -#endif -static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { - while (t->p) { - #if PY_MAJOR_VERSION >= 3 - __Pyx_InitString(*t, t->p); - #else - if (t->is_unicode) { - *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); - } else if (t->intern) { - *t->p = PyString_InternFromString(t->s); - } else { - *t->p = PyString_FromStringAndSize(t->s, t->n - 1); - } - if (!*t->p) - return -1; - if (PyObject_Hash(*t->p) == -1) - return -1; - #endif - ++t; - } - return 0; -} - -#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_DEFAULT -#if !CYTHON_PEP393_ENABLED -static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { - char* defenc_c; - PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); - if (!defenc) return NULL; - defenc_c = PyBytes_AS_STRING(defenc); -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - { - char* end = defenc_c + PyBytes_GET_SIZE(defenc); - char* c; - for (c = defenc_c; c < end; c++) { - if ((unsigned char) (*c) >= 128) { - PyUnicode_AsASCIIString(o); - return NULL; - } - } - } -#endif - *length = PyBytes_GET_SIZE(defenc); - return defenc_c; -} -#else -static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { - if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL; -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - if (likely(PyUnicode_IS_ASCII(o))) { - *length = PyUnicode_GET_LENGTH(o); - return PyUnicode_AsUTF8(o); - } else { - PyUnicode_AsASCIIString(o); - return NULL; - } -#else - return PyUnicode_AsUTF8AndSize(o, length); -#endif -} -#endif -#endif -static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT - if ( -#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - __Pyx_sys_getdefaultencoding_not_ascii && -#endif - PyUnicode_Check(o)) { - return __Pyx_PyUnicode_AsStringAndSize(o, length); - } else -#endif -#if (!CYTHON_COMPILING_IN_PYPY && !CYTHON_COMPILING_IN_LIMITED_API) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) - if (PyByteArray_Check(o)) { - *length = PyByteArray_GET_SIZE(o); - return PyByteArray_AS_STRING(o); - } else -#endif - { - char* result; - int r = PyBytes_AsStringAndSize(o, &result, length); - if (unlikely(r < 0)) { - return NULL; - } else { - return result; - } - } -} -static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { - int is_true = x == Py_True; - if (is_true | (x == Py_False) | (x == Py_None)) return is_true; - else return PyObject_IsTrue(x); -} -static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { - int retval; - if (unlikely(!x)) return -1; - retval = __Pyx_PyObject_IsTrue(x); - Py_DECREF(x); - return retval; -} -static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) { - __Pyx_TypeName result_type_name = __Pyx_PyType_GetName(Py_TYPE(result)); -#if PY_MAJOR_VERSION >= 3 - 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; - } -#endif - PyErr_Format(PyExc_TypeError, - "__%.4s__ returned non-%.4s (type " __Pyx_FMT_TYPENAME ")", - type_name, type_name, result_type_name); - __Pyx_DECREF_TypeName(result_type_name); - Py_DECREF(result); - return NULL; -} -static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) { -#if CYTHON_USE_TYPE_SLOTS - PyNumberMethods *m; -#endif - const char *name = NULL; - PyObject *res = NULL; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x) || PyLong_Check(x))) -#else - if (likely(PyLong_Check(x))) -#endif - return __Pyx_NewRef(x); -#if CYTHON_USE_TYPE_SLOTS - m = Py_TYPE(x)->tp_as_number; - #if PY_MAJOR_VERSION < 3 - if (m && m->nb_int) { - name = "int"; - res = m->nb_int(x); - } - else if (m && m->nb_long) { - name = "long"; - res = m->nb_long(x); - } - #else - if (likely(m && m->nb_int)) { - name = "int"; - res = m->nb_int(x); - } - #endif -#else - if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) { - res = PyNumber_Int(x); - } -#endif - if (likely(res)) { -#if PY_MAJOR_VERSION < 3 - if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) { -#else - if (unlikely(!PyLong_CheckExact(res))) { -#endif - return __Pyx_PyNumber_IntOrLongWrongResultType(res, name); - } - } - else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_TypeError, - "an integer is required"); - } - return res; -} -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { - Py_ssize_t ival; - PyObject *x; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(b))) { - if (sizeof(Py_ssize_t) >= sizeof(long)) - return PyInt_AS_LONG(b); - else - return PyInt_AsSsize_t(b); - } -#endif - if (likely(PyLong_CheckExact(b))) { - #if CYTHON_USE_PYLONG_INTERNALS - 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 = PyInt_AsSsize_t(x); - Py_DECREF(x); - return ival; -} -static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) { - if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) { - return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o); -#if PY_MAJOR_VERSION < 3 - } else if (likely(PyInt_CheckExact(o))) { - return PyInt_AS_LONG(o); -#endif - } else { - Py_ssize_t ival; - PyObject *x; - x = PyNumber_Index(o); - if (!x) return -1; - ival = PyInt_AsLong(x); - Py_DECREF(x); - return ival; - } -} -static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { - return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False); -} -static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { - return PyInt_FromSize_t(ival); -} - - -/* #### Code section: utility_code_pragmas_end ### */ -#ifdef _MSC_VER -#pragma warning( pop ) -#endif - - - -/* #### Code section: end ### */ -#endif /* Py_PYTHON_H */ diff --git a/src_/amulet_nbt/_string_encoding/__init__.pxd b/src_/amulet_nbt/_string_encoding/__init__.pxd deleted file mode 100644 index 631c2281..00000000 --- a/src_/amulet_nbt/_string_encoding/__init__.pxd +++ /dev/null @@ -1 +0,0 @@ -from amulet_nbt._string_encoding.encoding cimport StringEncoding diff --git a/src_/amulet_nbt/_string_encoding/__init__.pyx b/src_/amulet_nbt/_string_encoding/__init__.pyx deleted file mode 100644 index 8f67264f..00000000 --- a/src_/amulet_nbt/_string_encoding/__init__.pyx +++ /dev/null @@ -1,8 +0,0 @@ -# distutils: language = c++ -# distutils: extra_compile_args = CPPCARGS - -from amulet_nbt._string_encoding.encoding import ( - mutf8_encoding, - utf8_encoding, - utf8_escape_encoding -) diff --git a/src_/amulet_nbt/_string_encoding/encoding.cpp b/src_/amulet_nbt/_string_encoding/encoding.cpp deleted file mode 100644 index 361d13bd..00000000 --- a/src_/amulet_nbt/_string_encoding/encoding.cpp +++ /dev/null @@ -1,8574 +0,0 @@ -/* Generated by Cython 3.0.8 */ - -/* BEGIN: Cython Metadata -{ - "distutils": { - "depends": [ - "src\\amulet_nbt\\_string_encoding\\_cpp\\mutf8.hpp", - "src\\amulet_nbt\\_string_encoding\\_cpp\\utf8.hpp" - ], - "extra_compile_args": [ - "/std:c++20" - ], - "include_dirs": [ - "src\\amulet_nbt\\_string_encoding\\_cpp" - ], - "language": "c++", - "name": "amulet_nbt._string_encoding.encoding", - "sources": [ - "src\\amulet_nbt\\_string_encoding\\encoding.pyx", - "src/amulet_nbt/_string_encoding/_cpp/mutf8.cpp", - "src/amulet_nbt/_string_encoding/_cpp/utf8.cpp" - ] - }, - "module_name": "amulet_nbt._string_encoding.encoding" -} -END: Cython Metadata */ - -#ifndef PY_SSIZE_T_CLEAN -#define PY_SSIZE_T_CLEAN -#endif /* PY_SSIZE_T_CLEAN */ -#if defined(CYTHON_LIMITED_API) && 0 - #ifndef Py_LIMITED_API - #if CYTHON_LIMITED_API+0 > 0x03030000 - #define Py_LIMITED_API CYTHON_LIMITED_API - #else - #define Py_LIMITED_API 0x03030000 - #endif - #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 < 0x02070000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) - #error Cython requires Python 2.7+ or Python 3.3+. -#else -#if defined(CYTHON_LIMITED_API) && CYTHON_LIMITED_API -#define __PYX_EXTRA_ABI_MODULE_NAME "limited" -#else -#define __PYX_EXTRA_ABI_MODULE_NAME "" -#endif -#define CYTHON_ABI "3_0_8" __PYX_EXTRA_ABI_MODULE_NAME -#define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI -#define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "." -#define CYTHON_HEX_VERSION 0x030008F0 -#define CYTHON_FUTURE_DIVISION 1 -#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 HAVE_LONG_LONG - #define HAVE_LONG_LONG -#endif -#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_NOGIL 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 - #if PY_VERSION_HEX < 0x03050000 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #elif !defined(CYTHON_USE_ASYNC_SLOTS) - #define CYTHON_USE_ASYNC_SLOTS 1 - #endif - #undef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 0 - #undef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 0 - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #undef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 1 - #undef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 0 - #undef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 0 - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #undef CYTHON_FAST_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 (PY_MAJOR_VERSION >= 3) - #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_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE 0 - #undef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS 0 - #undef CYTHON_USE_EXC_INFO_STACK - #define CYTHON_USE_EXC_INFO_STACK 0 - #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC - #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 - #endif -#elif defined(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_NOGIL 0 - #undef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 0 - #ifndef CYTHON_USE_TYPE_SPECS - #define CYTHON_USE_TYPE_SPECS 0 - #endif - #undef CYTHON_USE_PYTYPE_LOOKUP - #define CYTHON_USE_PYTYPE_LOOKUP 0 - #if PY_VERSION_HEX < 0x03050000 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #elif !defined(CYTHON_USE_ASYNC_SLOTS) - #define CYTHON_USE_ASYNC_SLOTS 1 - #endif - #undef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 0 - #undef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 0 - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #undef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 1 - #undef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 0 - #undef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 0 - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #undef CYTHON_FAST_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 (PY_MAJOR_VERSION >= 3) - #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_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1 && PYPY_VERSION_NUM >= 0x07030C00) - #undef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS 0 - #undef CYTHON_USE_EXC_INFO_STACK - #define CYTHON_USE_EXC_INFO_STACK 0 - #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC - #define CYTHON_UPDATE_DESCRIPTOR_DOC 0 - #endif -#elif defined(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_NOGIL 0 - #undef CYTHON_CLINE_IN_TRACEBACK - #define CYTHON_CLINE_IN_TRACEBACK 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_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #undef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 0 - #undef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 0 - #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 - #undef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 0 - #undef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 0 - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #undef CYTHON_FAST_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 0 - #undef CYTHON_USE_MODULE_STATE - #define CYTHON_USE_MODULE_STATE 1 - #ifndef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE 0 - #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 -#elif defined(Py_GIL_DISABLED) || defined(Py_NOGIL) - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_CPYTHON 0 - #define CYTHON_COMPILING_IN_LIMITED_API 0 - #define CYTHON_COMPILING_IN_GRAAL 0 - #define CYTHON_COMPILING_IN_NOGIL 1 - #ifndef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 1 - #endif - #undef CYTHON_USE_PYTYPE_LOOKUP - #define CYTHON_USE_PYTYPE_LOOKUP 0 - #ifndef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 1 - #endif - #undef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 0 - #ifndef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 1 - #endif - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #ifndef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 0 - #endif - #ifndef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 1 - #endif - #ifndef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 1 - #endif - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #undef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 0 - #ifndef CYTHON_PEP489_MULTI_PHASE_INIT - #define CYTHON_PEP489_MULTI_PHASE_INIT 1 - #endif - #ifndef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE 1 - #endif - #undef CYTHON_USE_DICT_VERSIONS - #define CYTHON_USE_DICT_VERSIONS 0 - #undef CYTHON_USE_EXC_INFO_STACK - #define CYTHON_USE_EXC_INFO_STACK 0 -#else - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_CPYTHON 1 - #define CYTHON_COMPILING_IN_LIMITED_API 0 - #define CYTHON_COMPILING_IN_GRAAL 0 - #define CYTHON_COMPILING_IN_NOGIL 0 - #ifndef 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 - #if PY_MAJOR_VERSION < 3 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #elif !defined(CYTHON_USE_ASYNC_SLOTS) - #define CYTHON_USE_ASYNC_SLOTS 1 - #endif - #ifndef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 1 - #endif - #ifndef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 1 - #endif - #ifndef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 1 - #endif - #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2 - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #elif !defined(CYTHON_USE_UNICODE_WRITER) - #define CYTHON_USE_UNICODE_WRITER 1 - #endif - #ifndef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 0 - #endif - #ifndef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 1 - #endif - #ifndef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 1 - #endif - #ifndef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 1 - #endif - #ifndef CYTHON_FAST_GIL - #define CYTHON_FAST_GIL (PY_MAJOR_VERSION < 3 || PY_VERSION_HEX >= 0x03060000 && PY_VERSION_HEX < 0x030C00A6) - #endif - #ifndef CYTHON_METH_FASTCALL - #define CYTHON_METH_FASTCALL (PY_VERSION_HEX >= 0x030700A1) - #endif - #ifndef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 1 - #endif - #ifndef CYTHON_PEP487_INIT_SUBCLASS - #define CYTHON_PEP487_INIT_SUBCLASS 1 - #endif - #if PY_VERSION_HEX < 0x03050000 - #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 - #ifndef CYTHON_USE_MODULE_STATE - #define CYTHON_USE_MODULE_STATE 0 - #endif - #if PY_VERSION_HEX < 0x030400a1 - #undef CYTHON_USE_TP_FINALIZE - #define CYTHON_USE_TP_FINALIZE 0 - #elif !defined(CYTHON_USE_TP_FINALIZE) - #define CYTHON_USE_TP_FINALIZE 1 - #endif - #if PY_VERSION_HEX < 0x030600B1 - #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) - #endif - #if PY_VERSION_HEX < 0x030700A3 - #undef CYTHON_USE_EXC_INFO_STACK - #define CYTHON_USE_EXC_INFO_STACK 0 - #elif !defined(CYTHON_USE_EXC_INFO_STACK) - #define CYTHON_USE_EXC_INFO_STACK 1 - #endif - #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC - #define CYTHON_UPDATE_DESCRIPTOR_DOC 1 - #endif -#endif -#if !defined(CYTHON_FAST_PYCCALL) -#define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) -#endif -#if !defined(CYTHON_VECTORCALL) -#define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL && PY_VERSION_HEX >= 0x030800B1) -#endif -#define CYTHON_BACKPORT_VECTORCALL (CYTHON_METH_FASTCALL && PY_VERSION_HEX < 0x030800B1) -#if CYTHON_USE_PYLONG_INTERNALS - #if PY_MAJOR_VERSION < 3 - #include "longintrepr.h" - #endif - #undef SHIFT - #undef BASE - #undef MASK - #ifdef SIZEOF_VOID_P - enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) }; - #endif -#endif -#ifndef __has_attribute - #define __has_attribute(x) 0 -#endif -#ifndef __has_cpp_attribute - #define __has_cpp_attribute(x) 0 -#endif -#ifndef CYTHON_RESTRICT - #if defined(__GNUC__) - #define CYTHON_RESTRICT __restrict__ - #elif defined(_MSC_VER) && _MSC_VER >= 1400 - #define CYTHON_RESTRICT __restrict - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define CYTHON_RESTRICT restrict - #else - #define CYTHON_RESTRICT - #endif -#endif -#ifndef CYTHON_UNUSED - #if defined(__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 -# 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) -#ifdef _MSC_VER - #ifndef _MSC_STDINT_H_ - #if _MSC_VER < 1300 - typedef unsigned char uint8_t; - typedef unsigned short uint16_t; - typedef unsigned int uint32_t; - #else - typedef unsigned __int8 uint8_t; - typedef unsigned __int16 uint16_t; - typedef unsigned __int32 uint32_t; - #endif - #endif - #if _MSC_VER < 1300 - #ifdef _WIN64 - typedef unsigned long long __pyx_uintptr_t; - #else - typedef unsigned int __pyx_uintptr_t; - #endif - #else - #ifdef _WIN64 - typedef unsigned __int64 __pyx_uintptr_t; - #else - typedef unsigned __int32 __pyx_uintptr_t; - #endif - #endif -#else - #include - typedef uintptr_t __pyx_uintptr_t; -#endif -#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 -#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 >= 0x030800b4 && PY_VERSION_HEX < 0x030A0000) -#else - #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000) -#endif -#define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer)) - -#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; -}; - -#define __PYX_BUILD_PY_SSIZE_T "n" -#define CYTHON_FORMAT_SSIZE_T "z" -#if PY_MAJOR_VERSION < 3 - #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" - #define __Pyx_DefaultClassType PyClass_Type - #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) -#else - #define __Pyx_BUILTIN_MODULE_NAME "builtins" - #define __Pyx_DefaultClassType PyType_Type -#if CYTHON_COMPILING_IN_LIMITED_API - static CYTHON_INLINE 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, "iiiiiOOOOOOiOO", 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, "iiiiiiOOOOOOiOO", 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, "iiiiiiOOOOOOOiOO", 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; - } - #ifndef CO_OPTIMIZED - #define CO_OPTIMIZED 0x0001 - #endif - #ifndef CO_NEWLOCALS - #define CO_NEWLOCALS 0x0002 - #endif - #ifndef CO_VARARGS - #define CO_VARARGS 0x0004 - #endif - #ifndef CO_VARKEYWORDS - #define CO_VARKEYWORDS 0x0008 - #endif - #ifndef CO_ASYNC_GENERATOR - #define CO_ASYNC_GENERATOR 0x0200 - #endif - #ifndef CO_GENERATOR - #define CO_GENERATOR 0x0020 - #endif - #ifndef CO_COROUTINE - #define CO_COROUTINE 0x0080 - #endif -#elif PY_VERSION_HEX >= 0x030B0000 - static CYTHON_INLINE 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; - PyObject *empty_bytes = PyBytes_FromStringAndSize("", 0); - if (!empty_bytes) return NULL; - 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, empty_bytes); - Py_DECREF(empty_bytes); - return result; - } -#elif PY_VERSION_HEX >= 0x030800B2 && !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 -#endif -#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 CO_COROUTINE - #define CO_COROUTINE 0x80 -#endif -#ifndef CO_ASYNC_GENERATOR - #define CO_ASYNC_GENERATOR 0x200 -#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 METH_STACKLESS - #define METH_STACKLESS 0 -#endif -#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL) - #ifndef METH_FASTCALL - #define METH_FASTCALL 0x80 - #endif - typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs); - typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args, - Py_ssize_t nargs, PyObject *kwnames); -#else - #define __Pyx_PyCFunctionFast _PyCFunctionFast - #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords -#endif -#if CYTHON_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)) -#elif CYTHON_BACKPORT_VECTORCALL - typedef PyObject *(*__pyx_vectorcallfunc)(PyObject *callable, PyObject *const *args, - size_t nargsf, PyObject *kwnames); - #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET ((size_t)1 << (8 * sizeof(size_t) - 1)) - #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(((size_t)(n)) & ~__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET)) -#else - #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0 - #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n)) -#endif -#if PY_MAJOR_VERSION >= 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) { -#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 __PYX_LIMITED_VERSION_HEX < 0x030900B1 - #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_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) - #define __Pyx_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() -#elif PY_VERSION_HEX >= 0x03060000 - #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() -#elif PY_VERSION_HEX >= 0x03000000 - #define __Pyx_PyThreadState_Current PyThreadState_GET() -#else - #define __Pyx_PyThreadState_Current _PyThreadState_Current -#endif -#if CYTHON_COMPILING_IN_LIMITED_API -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; -} -#endif -#define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE(obj), name, func_ctype) -#if CYTHON_COMPILING_IN_LIMITED_API - #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name)) -#else - #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name) -#endif -#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT) -#include "pythread.h" -#define Py_tss_NEEDS_INIT 0 -typedef int Py_tss_t; -static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) { - *key = PyThread_create_key(); - return 0; -} -static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) { - Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t)); - *key = Py_tss_NEEDS_INIT; - return key; -} -static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) { - PyObject_Free(key); -} -static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) { - return *key != Py_tss_NEEDS_INIT; -} -static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) { - PyThread_delete_key(*key); - *key = Py_tss_NEEDS_INIT; -} -static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) { - return PyThread_set_key_value(*key, value); -} -static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { - return PyThread_get_key_value(*key); -} -#endif -#if PY_MAJOR_VERSION < 3 - #if CYTHON_COMPILING_IN_PYPY - #if PYPY_VERSION_NUM < 0x07030600 - #if defined(__cplusplus) && __cplusplus >= 201402L - [[deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")]] - #elif defined(__GNUC__) || defined(__clang__) - __attribute__ ((__deprecated__("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6"))) - #elif defined(_MSC_VER) - __declspec(deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")) - #endif - static CYTHON_INLINE int PyGILState_Check(void) { - return 0; - } - #else // PYPY_VERSION_NUM < 0x07030600 - #endif // PYPY_VERSION_NUM < 0x07030600 - #else - static CYTHON_INLINE int PyGILState_Check(void) { - PyThreadState * tstate = _PyThreadState_Current; - return tstate && (tstate == PyGILState_GetThisThreadState()); - } - #endif -#endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000 || defined(_PyDict_NewPresized) -#define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) -#else -#define __Pyx_PyDict_NewPresized(n) PyDict_New() -#endif -#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION - #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) -#else - #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) -#endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030600B4 && PY_VERSION_HEX < 0x030d0000 && 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 PY_MAJOR_VERSION >= 3 && (!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) - #define __Pyx_PyObject_GetIterNextFunc(obj) (Py_TYPE(obj)->tp_iternext) -#else - #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp)) - #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature) - #define __Pyx_PyObject_GetIterNextFunc(obj) PyIter_Next -#endif -#if CYTHON_COMPILING_IN_LIMITED_API - #define __Pyx_SetItemOnTypeDict(tp, k, v) PyObject_GenericSetAttr((PyObject*)tp, k, v) -#else - #define __Pyx_SetItemOnTypeDict(tp, k, v) PyDict_SetItem(tp->tp_dict, k, v) -#endif -#if CYTHON_USE_TYPE_SPECS && PY_VERSION_HEX >= 0x03080000 -#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 CYTHON_PEP393_ENABLED 1 - #define __Pyx_PyUnicode_READY(op) (0) - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GetLength(u) - #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)) -#elif PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) - #define CYTHON_PEP393_ENABLED 1 - #if PY_VERSION_HEX >= 0x030C0000 - #define __Pyx_PyUnicode_READY(op) (0) - #else - #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ - 0 : _PyUnicode_Ready((PyObject *)(op))) - #endif - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) - #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) - #define __Pyx_PyUnicode_KIND(u) ((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 -#else - #define CYTHON_PEP393_ENABLED 0 - #define PyUnicode_1BYTE_KIND 1 - #define PyUnicode_2BYTE_KIND 2 - #define PyUnicode_4BYTE_KIND 4 - #define __Pyx_PyUnicode_READY(op) (0) - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) - #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535U : 1114111U) - #define __Pyx_PyUnicode_KIND(u) ((int)sizeof(Py_UNICODE)) - #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) - #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = (Py_UNICODE) ch) - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) -#endif -#if CYTHON_COMPILING_IN_PYPY - #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) - #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) -#else - #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) - #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ - PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) -#endif -#if CYTHON_COMPILING_IN_PYPY - #if !defined(PyUnicode_DecodeUnicodeEscape) - #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors) - #endif - #if !defined(PyUnicode_Contains) || (PY_MAJOR_VERSION == 2 && PYPY_VERSION_NUM < 0x07030500) - #undef 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_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) -#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) -#else - #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) -#endif -#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII) - #define PyObject_ASCII(o) PyObject_Repr(o) -#endif -#if PY_MAJOR_VERSION >= 3 - #define PyBaseString_Type PyUnicode_Type - #define PyStringObject PyUnicodeObject - #define PyString_Type PyUnicode_Type - #define PyString_Check PyUnicode_Check - #define PyString_CheckExact PyUnicode_CheckExact -#ifndef PyObject_Unicode - #define PyObject_Unicode PyObject_Str -#endif -#endif -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) - #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) -#else - #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) - #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) -#endif -#if 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 -#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_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0)) - #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) -#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_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v) - #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) -#endif -#if PY_VERSION_HEX >= 0x030d00A1 - #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name) -#else - static CYTHON_INLINE PyObject *__Pyx_PyImport_AddModuleRef(const char *name) { - PyObject *module = PyImport_AddModule(name); - Py_XINCREF(module); - return module; - } -#endif -#if PY_MAJOR_VERSION >= 3 - #define PyIntObject PyLongObject - #define PyInt_Type PyLong_Type - #define PyInt_Check(op) PyLong_Check(op) - #define PyInt_CheckExact(op) PyLong_CheckExact(op) - #define __Pyx_Py3Int_Check(op) PyLong_Check(op) - #define __Pyx_Py3Int_CheckExact(op) PyLong_CheckExact(op) - #define PyInt_FromString PyLong_FromString - #define PyInt_FromUnicode PyLong_FromUnicode - #define PyInt_FromLong PyLong_FromLong - #define PyInt_FromSize_t PyLong_FromSize_t - #define PyInt_FromSsize_t PyLong_FromSsize_t - #define PyInt_AsLong PyLong_AsLong - #define PyInt_AS_LONG PyLong_AS_LONG - #define PyInt_AsSsize_t PyLong_AsSsize_t - #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask - #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask - #define PyNumber_Int PyNumber_Long -#else - #define __Pyx_Py3Int_Check(op) (PyLong_Check(op) || PyInt_Check(op)) - #define __Pyx_Py3Int_CheckExact(op) (PyLong_CheckExact(op) || PyInt_CheckExact(op)) -#endif -#if PY_MAJOR_VERSION >= 3 - #define PyBoolObject PyLongObject -#endif -#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY - #ifndef PyUnicode_InternFromString - #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) - #endif -#endif -#if PY_VERSION_HEX < 0x030200A4 - typedef long Py_hash_t; - #define __Pyx_PyInt_FromHash_t PyInt_FromLong - #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t -#else - #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t - #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t -#endif -#if CYTHON_USE_ASYNC_SLOTS - #if PY_VERSION_HEX >= 0x030500B1 - #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods - #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) - #else - #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) - #endif -#else - #define __Pyx_PyType_AsAsync(obj) NULL -#endif -#ifndef __Pyx_PyAsyncMethodsStruct - typedef struct { - unaryfunc am_await; - unaryfunc am_aiter; - unaryfunc am_anext; - } __Pyx_PyAsyncMethodsStruct; -#endif - -#if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS) - #if !defined(_USE_MATH_DEFINES) - #define _USE_MATH_DEFINES - #endif -#endif -#include -#ifdef NAN -#define __PYX_NAN() ((float) NAN) -#else -static CYTHON_INLINE float __PYX_NAN() { - float value; - memset(&value, 0xFF, sizeof(value)); - return value; -} -#endif -#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) -#define __Pyx_truncl trunc -#else -#define __Pyx_truncl truncl -#endif - -#define __PYX_MARK_ERR_POS(f_index, lineno) \ - { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; } -#define __PYX_ERR(f_index, lineno, Ln_error) \ - { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; } - -#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__amulet_nbt___string_encoding__encoding -#define __PYX_HAVE_API__amulet_nbt___string_encoding__encoding -/* Early includes */ -#include -#include -#include "ios" -#include "new" -#include "stdexcept" -#include "typeinfo" -#include "utf8.hpp" -#include "mutf8.hpp" -#ifdef _OPENMP -#include -#endif /* _OPENMP */ - -#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS) -#define CYTHON_WITHOUT_ASSERTIONS -#endif - -typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding; - const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; - -#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 -#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0 -#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8) -#define __PYX_DEFAULT_STRING_ENCODING "" -#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString -#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize -#define __Pyx_uchar_cast(c) ((unsigned char)c) -#define __Pyx_long_cast(x) ((long)x) -#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ - (sizeof(type) < sizeof(Py_ssize_t)) ||\ - (sizeof(type) > sizeof(Py_ssize_t) &&\ - likely(v < (type)PY_SSIZE_T_MAX ||\ - v == (type)PY_SSIZE_T_MAX) &&\ - (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ - v == (type)PY_SSIZE_T_MIN))) ||\ - (sizeof(type) == sizeof(Py_ssize_t) &&\ - (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ - v == (type)PY_SSIZE_T_MAX))) ) -static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) { - return (size_t) i < (size_t) limit; -} -#if defined (__cplusplus) && __cplusplus >= 201103L - #include - #define __Pyx_sst_abs(value) std::abs(value) -#elif SIZEOF_INT >= SIZEOF_SIZE_T - #define __Pyx_sst_abs(value) abs(value) -#elif SIZEOF_LONG >= SIZEOF_SIZE_T - #define __Pyx_sst_abs(value) labs(value) -#elif defined (_MSC_VER) - #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value)) -#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define __Pyx_sst_abs(value) llabs(value) -#elif defined (__GNUC__) - #define __Pyx_sst_abs(value) __builtin_llabs(value) -#else - #define __Pyx_sst_abs(value) ((value<0) ? -value : value) -#endif -static CYTHON_INLINE 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 PY_MAJOR_VERSION < 3 - #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString - #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize -#else - #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString - #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize -#endif -#define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) -#define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_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_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) -#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) -#if CYTHON_COMPILING_IN_LIMITED_API -static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const wchar_t *u) -{ - const wchar_t *u_end = u; - while (*u_end++) ; - return (size_t)(u_end - u - 1); -} -#else -static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) -{ - const Py_UNICODE *u_end = u; - while (*u_end++) ; - return (size_t)(u_end - u - 1); -} -#endif -#define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o) -#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) -#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode -#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode -#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) -#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) -static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b); -static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); -static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*); -static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); -#define __Pyx_PySequence_Tuple(obj)\ - (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); -static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); -static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); -#if CYTHON_ASSUME_SAFE_MACROS -#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) -#else -#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) -#endif -#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) -#if PY_MAJOR_VERSION >= 3 -#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) -#else -#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) -#endif -#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 PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII -#include -static int __Pyx_sys_getdefaultencoding_not_ascii; -static int __Pyx_init_sys_getdefaultencoding_params(void) { - PyObject* sys; - PyObject* default_encoding = NULL; - PyObject* ascii_chars_u = NULL; - PyObject* ascii_chars_b = NULL; - const char* default_encoding_c; - sys = PyImport_ImportModule("sys"); - if (!sys) goto bad; - default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL); - Py_DECREF(sys); - if (!default_encoding) goto bad; - default_encoding_c = PyBytes_AsString(default_encoding); - if (!default_encoding_c) goto bad; - if (strcmp(default_encoding_c, "ascii") == 0) { - __Pyx_sys_getdefaultencoding_not_ascii = 0; - } else { - char ascii_chars[128]; - int c; - for (c = 0; c < 128; c++) { - ascii_chars[c] = (char) c; - } - __Pyx_sys_getdefaultencoding_not_ascii = 1; - ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); - if (!ascii_chars_u) goto bad; - ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); - if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { - PyErr_Format( - PyExc_ValueError, - "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.", - default_encoding_c); - goto bad; - } - Py_DECREF(ascii_chars_u); - Py_DECREF(ascii_chars_b); - } - Py_DECREF(default_encoding); - return 0; -bad: - Py_XDECREF(default_encoding); - Py_XDECREF(ascii_chars_u); - Py_XDECREF(ascii_chars_b); - return -1; -} -#endif -#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 -#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) -#else -#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) -#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT -#include -static char* __PYX_DEFAULT_STRING_ENCODING; -static int __Pyx_init_sys_getdefaultencoding_params(void) { - PyObject* sys; - PyObject* default_encoding = NULL; - char* default_encoding_c; - sys = PyImport_ImportModule("sys"); - if (!sys) goto bad; - default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); - Py_DECREF(sys); - if (!default_encoding) goto bad; - default_encoding_c = PyBytes_AsString(default_encoding); - if (!default_encoding_c) goto bad; - __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1); - if (!__PYX_DEFAULT_STRING_ENCODING) goto bad; - strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); - Py_DECREF(default_encoding); - return 0; -bad: - Py_XDECREF(default_encoding); - return -1; -} -#endif -#endif - - -/* Test for GCC > 2.95 */ -#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) -#else /* !__GNUC__ or GCC < 2.95 */ - #define likely(x) (x) - #define unlikely(x) (x) -#endif /* __GNUC__ */ -static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } - -#if !CYTHON_USE_MODULE_STATE -static PyObject *__pyx_m = NULL; -#endif -static int __pyx_lineno; -static int __pyx_clineno = 0; -static const char * __pyx_cfilenm = __FILE__; -static const char *__pyx_filename; - -/* #### Code section: filename_table ### */ - -static const char *__pyx_f[] = { - "", - "src\\\\amulet_nbt\\\\_string_encoding\\\\encoding.pyx", -}; -/* #### Code section: utility_code_proto_before_types ### */ -/* ForceInitThreads.proto */ -#ifndef __PYX_FORCE_INIT_THREADS - #define __PYX_FORCE_INIT_THREADS 0 -#endif - -/* #### Code section: numeric_typedefs ### */ -/* #### Code section: complex_type_declarations ### */ -/* #### Code section: type_declarations ### */ - -/*--- Type declarations ---*/ -struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding; - -/* "src/amulet_nbt/_string_encoding/_cpp/__init__.pxd":3 - * from libcpp.string cimport string - * - * ctypedef string (*CStringEncode)(const string&) # <<<<<<<<<<<<<< - * ctypedef string (*CStringDecode)(const string&) - */ -typedef std::string (*__pyx_t_10amulet_nbt_16_string_encoding_4_cpp_CStringEncode)(std::string const &); - -/* "src/amulet_nbt/_string_encoding/_cpp/__init__.pxd":4 - * - * ctypedef string (*CStringEncode)(const string&) - * ctypedef string (*CStringDecode)(const string&) # <<<<<<<<<<<<<< - */ -typedef std::string (*__pyx_t_10amulet_nbt_16_string_encoding_4_cpp_CStringDecode)(std::string const &); - -/* "amulet_nbt/_string_encoding/encoding.pxd":4 - * - * - * cdef class StringEncoding: # <<<<<<<<<<<<<< - * cdef CStringEncode encode_cpp - * cdef CStringDecode decode_cpp - */ -struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding { - PyObject_HEAD - __pyx_t_10amulet_nbt_16_string_encoding_4_cpp_CStringEncode encode_cpp; - __pyx_t_10amulet_nbt_16_string_encoding_4_cpp_CStringDecode decode_cpp; -}; - -/* #### 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; -#ifdef WITH_THREAD - #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - if (acquire_gil) {\ - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ - PyGILState_Release(__pyx_gilstate_save);\ - } else {\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\ - } - #define __Pyx_RefNannyFinishContextNogil() {\ - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ - __Pyx_RefNannyFinishContext();\ - PyGILState_Release(__pyx_gilstate_save);\ - } -#else - #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__)) - #define __Pyx_RefNannyFinishContextNogil() __Pyx_RefNannyFinishContext() -#endif - #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 */ -#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 */ -#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 */ -#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 */ -#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 */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); - -/* GetBuiltinName.proto */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name); - -/* TupleAndListFromArray.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n); -static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n); -#endif - -/* IncludeStringH.proto */ -#include - -/* BytesEquals.proto */ -static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); - -/* UnicodeEquals.proto */ -static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); - -/* fastcall.proto */ -#if CYTHON_AVOID_BORROWED_REFS - #define __Pyx_Arg_VARARGS(args, i) PySequence_GetItem(args, i) -#elif CYTHON_ASSUME_SAFE_MACROS - #define __Pyx_Arg_VARARGS(args, i) PyTuple_GET_ITEM(args, i) -#else - #define __Pyx_Arg_VARARGS(args, i) PyTuple_GetItem(args, i) -#endif -#if CYTHON_AVOID_BORROWED_REFS - #define __Pyx_Arg_NewRef_VARARGS(arg) __Pyx_NewRef(arg) - #define __Pyx_Arg_XDECREF_VARARGS(arg) Py_XDECREF(arg) -#else - #define __Pyx_Arg_NewRef_VARARGS(arg) arg - #define __Pyx_Arg_XDECREF_VARARGS(arg) -#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_Arg_FASTCALL(args, i) args[i] - #define __Pyx_NumKwargs_FASTCALL(kwds) 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_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues); - #else - #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw) - #endif - #define __Pyx_Arg_NewRef_FASTCALL(arg) arg /* no-op, __Pyx_Arg_FASTCALL is direct and this needs - to have the same reference counting */ - #define __Pyx_Arg_XDECREF_FASTCALL(arg) -#else - #define __Pyx_Arg_FASTCALL __Pyx_Arg_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 - #define __Pyx_Arg_NewRef_FASTCALL(arg) __Pyx_Arg_NewRef_VARARGS(arg) - #define __Pyx_Arg_XDECREF_FASTCALL(arg) __Pyx_Arg_XDECREF_VARARGS(arg) -#endif -#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS -#define __Pyx_ArgsSlice_VARARGS(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_VARARGS(args, start), stop - start) -#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_FASTCALL(args, start), stop - start) -#else -#define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop) -#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop) -#endif - -/* RaiseDoubleKeywords.proto */ -static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); - -/* ParseKeywords.proto */ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject *const *kwvalues, - PyObject **argnames[], - PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, - const char* function_name); - -/* RaiseArgTupleInvalid.proto */ -static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, - Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); - -/* 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)) -static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact); - -/* KeywordStringCheck.proto */ -static int __Pyx_CheckKeywordStrings(PyObject *kw, const char* function_name, int kw_allowed); - -/* RaiseException.proto */ -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); - -/* IncludeStructmemberH.proto */ -#include - -/* FixUpExtensionType.proto */ -#if CYTHON_USE_TYPE_SPECS -static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type); -#endif - -/* PyFunctionFastCall.proto */ -#if CYTHON_FAST_PYCALL -#if !CYTHON_VECTORCALL -#define __Pyx_PyFunction_FastCall(func, args, nargs)\ - __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) -static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs); -#endif -#define __Pyx_BUILD_ASSERT_EXPR(cond)\ - (sizeof(char [1 - 2*!(cond)]) - 1) -#ifndef Py_MEMBER_SIZE -#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) -#endif -#if !CYTHON_VECTORCALL -#if PY_VERSION_HEX >= 0x03080000 - #include "frameobject.h" -#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API - #ifndef Py_BUILD_CORE - #define Py_BUILD_CORE 1 - #endif - #include "internal/pycore_frame.h" -#endif - #define __Pxy_PyFrame_Initialize_Offsets() - #define __Pyx_PyFrame_GetLocalsplus(frame) ((frame)->f_localsplus) -#else - static size_t __pyx_pyframe_localsplus_offset = 0; - #include "frameobject.h" - #define __Pxy_PyFrame_Initialize_Offsets()\ - ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\ - (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus))) - #define __Pyx_PyFrame_GetLocalsplus(frame)\ - (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset)) -#endif -#endif -#endif - -/* PyObjectCall.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); -#else -#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) -#endif - -/* PyObjectCallMethO.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); -#endif - -/* 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 **args, size_t nargs, PyObject *kwargs); - -/* PyObjectCallNoArg.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); - -/* PyObjectCallOneArg.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); - -/* PyObjectGetMethod.proto */ -static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method); - -/* PyObjectCallMethod0.proto */ -static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name); - -/* ValidateBasesTuple.proto */ -#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); - -/* PyObject_GenericGetAttrNoDict.proto */ -#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 -static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name); -#else -#define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr -#endif - -/* PyObject_GenericGetAttr.proto */ -#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 -static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name); -#else -#define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr -#endif - -/* SetupReduce.proto */ -#if !CYTHON_COMPILING_IN_LIMITED_API -static int __Pyx_setup_reduce(PyObject* type_obj); -#endif - -/* FetchSharedCythonModule.proto */ -static PyObject *__Pyx_FetchSharedCythonABIModule(void); - -/* FetchCommonType.proto */ -#if !CYTHON_USE_TYPE_SPECS -static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); -#else -static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases); -#endif - -/* PyMethodNew.proto */ -#if CYTHON_COMPILING_IN_LIMITED_API -static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) { - PyObject *typesModule=NULL, *methodType=NULL, *result=NULL; - CYTHON_UNUSED_VAR(typ); - if (!self) - return __Pyx_NewRef(func); - typesModule = PyImport_ImportModule("types"); - if (!typesModule) return NULL; - methodType = PyObject_GetAttrString(typesModule, "MethodType"); - Py_DECREF(typesModule); - if (!methodType) return NULL; - result = PyObject_CallFunctionObjArgs(methodType, func, self, NULL); - Py_DECREF(methodType); - return result; -} -#elif PY_MAJOR_VERSION >= 3 -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); -} -#else - #define __Pyx_PyMethod_New PyMethod_New -#endif - -/* PyVectorcallFastCallDict.proto */ -#if CYTHON_METH_FASTCALL -static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw); -#endif - -/* CythonFunctionShared.proto */ -#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_BACKPORT_VECTORCALL - __pyx_vectorcallfunc func_vectorcall; -#endif -#if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API - PyObject *func_weakreflist; -#endif - PyObject *func_dict; - PyObject *func_name; - PyObject *func_qualname; - PyObject *func_doc; - PyObject *func_globals; - PyObject *func_code; - PyObject *func_closure; -#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API - PyObject *func_classobj; -#endif - void *defaults; - int defaults_pyobjects; - size_t defaults_size; - 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_CyFunctionType) -#define __Pyx_CyOrPyCFunction_Check(obj) __Pyx_TypeCheck2(obj, __pyx_CyFunctionType, &PyCFunction_Type) -#define __Pyx_CyFunction_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_CyFunctionType) -static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void *cfunc); -#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 void *__Pyx_CyFunction_InitDefaults(PyObject *m, - size_t size, - int pyobjects); -static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m, - PyObject *tuple); -static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, - PyObject *dict); -static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, - PyObject *dict); -static int __pyx_CyFunction_init(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_BACKPORT_VECTORCALL -#define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall) -#else -#define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall) -#endif -#endif - -/* CythonFunction.proto */ -static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, - int flags, PyObject* qualname, - PyObject *closure, - PyObject *module, PyObject *globals, - PyObject* code); - -/* PyDictVersioning.proto */ -#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS -#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) -#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) -#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ - (version_var) = __PYX_GET_DICT_VERSION(dict);\ - (cache_var) = (value); -#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ - static PY_UINT64_T __pyx_dict_version = 0;\ - static PyObject *__pyx_dict_cached_value = NULL;\ - if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ - (VAR) = __pyx_dict_cached_value;\ - } else {\ - (VAR) = __pyx_dict_cached_value = (LOOKUP);\ - __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ - }\ -} -static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); -static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); -static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); -#else -#define __PYX_GET_DICT_VERSION(dict) (0) -#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) -#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); -#endif - -/* CLineInTraceback.proto */ -#ifdef CYTHON_CLINE_IN_TRACEBACK -#define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) -#else -static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); -#endif - -/* CodeObjectCache.proto */ -#if !CYTHON_COMPILING_IN_LIMITED_API -typedef struct { - PyCodeObject* code_object; - int code_line; -} __Pyx_CodeObjectCacheEntry; -struct __Pyx_CodeObjectCache { - int count; - int max_count; - __Pyx_CodeObjectCacheEntry* entries; -}; -static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; -static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); -static PyCodeObject *__pyx_find_code_object(int code_line); -static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); -#endif - -/* 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 - -/* FormatTypeName.proto */ -#if CYTHON_COMPILING_IN_LIMITED_API -typedef PyObject *__Pyx_TypeName; -#define __Pyx_FMT_TYPENAME "%U" -static __Pyx_TypeName __Pyx_PyType_GetName(PyTypeObject* tp); -#define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj) -#else -typedef const char *__Pyx_TypeName; -#define __Pyx_FMT_TYPENAME "%.200s" -#define __Pyx_PyType_GetName(tp) ((tp)->tp_name) -#define __Pyx_DECREF_TypeName(obj) -#endif - -/* GCCDiagnostics.proto */ -#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) -#define __Pyx_HAS_GCC_DIAGNOSTIC -#endif - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); - -/* CIntFromPy.proto */ -static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); - -/* CIntFromPy.proto */ -static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); - -/* 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) -#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (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) - -/* CheckBinaryVersion.proto */ -static unsigned long __Pyx_get_runtime_version(void); -static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer); - -/* InitStrings.proto */ -static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); - -/* #### Code section: module_declarations ### */ - -/* Module declarations from "libc.string" */ - -/* Module declarations from "libcpp.string" */ - -/* Module declarations from "amulet_nbt._string_encoding._cpp" */ - -/* Module declarations from "amulet_nbt._string_encoding._cpp.utf8" */ - -/* Module declarations from "amulet_nbt._string_encoding._cpp.mutf8" */ - -/* Module declarations from "amulet_nbt._string_encoding.encoding" */ -static struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding *__pyx_v_10amulet_nbt_16_string_encoding_8encoding__mutf8_encoding = 0; -static struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding *__pyx_v_10amulet_nbt_16_string_encoding_8encoding__utf8_encoding = 0; -static struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding *__pyx_v_10amulet_nbt_16_string_encoding_8encoding__utf8_escape_encoding = 0; -static std::string __pyx_convert_string_from_py_std__in_string(PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_convert_PyObject_string_to_py_std__in_string(std::string const &); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_convert_PyUnicode_string_to_py_std__in_string(std::string const &); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_convert_PyStr_string_to_py_std__in_string(std::string const &); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_convert_PyBytes_string_to_py_std__in_string(std::string const &); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_std__in_string(std::string const &); /*proto*/ -/* #### Code section: typeinfo ### */ -/* #### Code section: before_global_var ### */ -#define __Pyx_MODULE_NAME "amulet_nbt._string_encoding.encoding" -extern int __pyx_module_is_main_amulet_nbt___string_encoding__encoding; -int __pyx_module_is_main_amulet_nbt___string_encoding__encoding = 0; - -/* Implementation of "amulet_nbt._string_encoding.encoding" */ -/* #### Code section: global_var ### */ -static PyObject *__pyx_builtin_TypeError; -/* #### Code section: string_decls ### */ -static const char __pyx_k__8[] = "?"; -static const char __pyx_k_gc[] = "gc"; -static const char __pyx_k_data[] = "data"; -static const char __pyx_k_main[] = "__main__"; -static const char __pyx_k_name[] = "__name__"; -static const char __pyx_k_self[] = "self"; -static const char __pyx_k_test[] = "__test__"; -static const char __pyx_k_bytes[] = "bytes"; -static const char __pyx_k_decode[] = "decode"; -static const char __pyx_k_enable[] = "enable"; -static const char __pyx_k_encode[] = "encode"; -static const char __pyx_k_reduce[] = "__reduce__"; -static const char __pyx_k_return[] = "return"; -static const char __pyx_k_disable[] = "disable"; -static const char __pyx_k_getstate[] = "__getstate__"; -static const char __pyx_k_setstate[] = "__setstate__"; -static const char __pyx_k_TypeError[] = "TypeError"; -static const char __pyx_k_isenabled[] = "isenabled"; -static const char __pyx_k_pyx_state[] = "__pyx_state"; -static const char __pyx_k_reduce_ex[] = "__reduce_ex__"; -static const char __pyx_k_is_coroutine[] = "_is_coroutine"; -static const char __pyx_k_stringsource[] = ""; -static const char __pyx_k_reduce_cython[] = "__reduce_cython__"; -static const char __pyx_k_utf8_encoding[] = "utf8_encoding"; -static const char __pyx_k_StringEncoding[] = "StringEncoding"; -static const char __pyx_k_mutf8_encoding[] = "mutf8_encoding"; -static const char __pyx_k_setstate_cython[] = "__setstate_cython__"; -static const char __pyx_k_asyncio_coroutines[] = "asyncio.coroutines"; -static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; -static const char __pyx_k_utf8_escape_encoding[] = "utf8_escape_encoding"; -static const char __pyx_k_StringEncoding_decode[] = "StringEncoding.decode"; -static const char __pyx_k_StringEncoding_encode[] = "StringEncoding.encode"; -static const char __pyx_k_StringEncoding___reduce_cython[] = "StringEncoding.__reduce_cython__"; -static const char __pyx_k_self_decode_cpp_self_encode_cpp[] = "self.decode_cpp,self.encode_cpp cannot be converted to a Python object for pickling"; -static const char __pyx_k_src_amulet_nbt__string_encoding[] = "src\\amulet_nbt\\_string_encoding\\encoding.pyx"; -static const char __pyx_k_StringEncoding___setstate_cython[] = "StringEncoding.__setstate_cython__"; -static const char __pyx_k_amulet_nbt__string_encoding_enco[] = "amulet_nbt._string_encoding.encoding"; -/* #### Code section: decls ### */ -static PyObject *__pyx_pf_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_encode(struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding *__pyx_v_self, PyObject *__pyx_v_data); /* proto */ -static PyObject *__pyx_pf_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_2decode(struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding *__pyx_v_self, PyObject *__pyx_v_data); /* proto */ -static PyObject *__pyx_pf_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ -static PyObject *__pyx_tp_new_10amulet_nbt_16_string_encoding_8encoding_StringEncoding(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -/* #### Code section: late_includes ### */ -/* #### Code section: module_state ### */ -typedef struct { - PyObject *__pyx_d; - PyObject *__pyx_b; - PyObject *__pyx_cython_runtime; - PyObject *__pyx_empty_tuple; - PyObject *__pyx_empty_bytes; - PyObject *__pyx_empty_unicode; - #ifdef __Pyx_CyFunction_USED - PyTypeObject *__pyx_CyFunctionType; - #endif - #ifdef __Pyx_FusedFunction_USED - PyTypeObject *__pyx_FusedFunctionType; - #endif - #ifdef __Pyx_Generator_USED - PyTypeObject *__pyx_GeneratorType; - #endif - #ifdef __Pyx_IterableCoroutine_USED - PyTypeObject *__pyx_IterableCoroutineType; - #endif - #ifdef __Pyx_Coroutine_USED - PyTypeObject *__pyx_CoroutineAwaitType; - #endif - #ifdef __Pyx_Coroutine_USED - PyTypeObject *__pyx_CoroutineType; - #endif - #if CYTHON_USE_MODULE_STATE - #endif - #if CYTHON_USE_MODULE_STATE - #endif - #if CYTHON_USE_MODULE_STATE - #endif - #if CYTHON_USE_MODULE_STATE - #endif - #if CYTHON_USE_MODULE_STATE - #endif - #if CYTHON_USE_MODULE_STATE - PyObject *__pyx_type_10amulet_nbt_16_string_encoding_8encoding_StringEncoding; - #endif - PyTypeObject *__pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding; - PyObject *__pyx_n_s_StringEncoding; - PyObject *__pyx_n_s_StringEncoding___reduce_cython; - PyObject *__pyx_n_s_StringEncoding___setstate_cython; - PyObject *__pyx_n_s_StringEncoding_decode; - PyObject *__pyx_n_s_StringEncoding_encode; - PyObject *__pyx_n_s_TypeError; - PyObject *__pyx_n_s__8; - PyObject *__pyx_n_s_amulet_nbt__string_encoding_enco; - PyObject *__pyx_n_s_asyncio_coroutines; - PyObject *__pyx_n_s_bytes; - PyObject *__pyx_n_s_cline_in_traceback; - PyObject *__pyx_n_s_data; - PyObject *__pyx_n_s_decode; - PyObject *__pyx_kp_u_disable; - PyObject *__pyx_kp_u_enable; - PyObject *__pyx_n_s_encode; - PyObject *__pyx_kp_u_gc; - PyObject *__pyx_n_s_getstate; - PyObject *__pyx_n_s_is_coroutine; - PyObject *__pyx_kp_u_isenabled; - PyObject *__pyx_n_s_main; - PyObject *__pyx_n_s_mutf8_encoding; - PyObject *__pyx_n_s_name; - PyObject *__pyx_n_s_pyx_state; - PyObject *__pyx_n_s_reduce; - PyObject *__pyx_n_s_reduce_cython; - PyObject *__pyx_n_s_reduce_ex; - PyObject *__pyx_n_s_return; - PyObject *__pyx_n_s_self; - PyObject *__pyx_kp_s_self_decode_cpp_self_encode_cpp; - PyObject *__pyx_n_s_setstate; - PyObject *__pyx_n_s_setstate_cython; - PyObject *__pyx_kp_s_src_amulet_nbt__string_encoding; - PyObject *__pyx_kp_s_stringsource; - PyObject *__pyx_n_s_test; - PyObject *__pyx_n_s_utf8_encoding; - PyObject *__pyx_n_s_utf8_escape_encoding; - PyObject *__pyx_tuple_; - PyObject *__pyx_tuple__4; - PyObject *__pyx_tuple__6; - PyObject *__pyx_codeobj__2; - PyObject *__pyx_codeobj__3; - PyObject *__pyx_codeobj__5; - PyObject *__pyx_codeobj__7; -} __pyx_mstate; - -#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(o) ((__pyx_mstate *)__Pyx_PyModule_GetState(o)) - -#define __pyx_mstate_global (__pyx_mstate(PyState_FindModule(&__pyx_moduledef))) - -#define __pyx_m (PyState_FindModule(&__pyx_moduledef)) -#else -static __pyx_mstate __pyx_mstate_global_static = -#ifdef __cplusplus - {}; -#else - {0}; -#endif -static __pyx_mstate *__pyx_mstate_global = &__pyx_mstate_global_static; -#endif -/* #### Code section: module_state_clear ### */ -#if CYTHON_USE_MODULE_STATE -static int __pyx_m_clear(PyObject *m) { - __pyx_mstate *clear_module_state = __pyx_mstate(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); - #ifdef __Pyx_CyFunction_USED - Py_CLEAR(clear_module_state->__pyx_CyFunctionType); - #endif - #ifdef __Pyx_FusedFunction_USED - Py_CLEAR(clear_module_state->__pyx_FusedFunctionType); - #endif - Py_CLEAR(clear_module_state->__pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding); - Py_CLEAR(clear_module_state->__pyx_type_10amulet_nbt_16_string_encoding_8encoding_StringEncoding); - Py_CLEAR(clear_module_state->__pyx_n_s_StringEncoding); - Py_CLEAR(clear_module_state->__pyx_n_s_StringEncoding___reduce_cython); - Py_CLEAR(clear_module_state->__pyx_n_s_StringEncoding___setstate_cython); - Py_CLEAR(clear_module_state->__pyx_n_s_StringEncoding_decode); - Py_CLEAR(clear_module_state->__pyx_n_s_StringEncoding_encode); - Py_CLEAR(clear_module_state->__pyx_n_s_TypeError); - Py_CLEAR(clear_module_state->__pyx_n_s__8); - Py_CLEAR(clear_module_state->__pyx_n_s_amulet_nbt__string_encoding_enco); - Py_CLEAR(clear_module_state->__pyx_n_s_asyncio_coroutines); - Py_CLEAR(clear_module_state->__pyx_n_s_bytes); - Py_CLEAR(clear_module_state->__pyx_n_s_cline_in_traceback); - Py_CLEAR(clear_module_state->__pyx_n_s_data); - Py_CLEAR(clear_module_state->__pyx_n_s_decode); - Py_CLEAR(clear_module_state->__pyx_kp_u_disable); - Py_CLEAR(clear_module_state->__pyx_kp_u_enable); - Py_CLEAR(clear_module_state->__pyx_n_s_encode); - Py_CLEAR(clear_module_state->__pyx_kp_u_gc); - Py_CLEAR(clear_module_state->__pyx_n_s_getstate); - Py_CLEAR(clear_module_state->__pyx_n_s_is_coroutine); - Py_CLEAR(clear_module_state->__pyx_kp_u_isenabled); - Py_CLEAR(clear_module_state->__pyx_n_s_main); - Py_CLEAR(clear_module_state->__pyx_n_s_mutf8_encoding); - Py_CLEAR(clear_module_state->__pyx_n_s_name); - Py_CLEAR(clear_module_state->__pyx_n_s_pyx_state); - Py_CLEAR(clear_module_state->__pyx_n_s_reduce); - Py_CLEAR(clear_module_state->__pyx_n_s_reduce_cython); - Py_CLEAR(clear_module_state->__pyx_n_s_reduce_ex); - Py_CLEAR(clear_module_state->__pyx_n_s_return); - Py_CLEAR(clear_module_state->__pyx_n_s_self); - Py_CLEAR(clear_module_state->__pyx_kp_s_self_decode_cpp_self_encode_cpp); - Py_CLEAR(clear_module_state->__pyx_n_s_setstate); - Py_CLEAR(clear_module_state->__pyx_n_s_setstate_cython); - Py_CLEAR(clear_module_state->__pyx_kp_s_src_amulet_nbt__string_encoding); - Py_CLEAR(clear_module_state->__pyx_kp_s_stringsource); - Py_CLEAR(clear_module_state->__pyx_n_s_test); - Py_CLEAR(clear_module_state->__pyx_n_s_utf8_encoding); - Py_CLEAR(clear_module_state->__pyx_n_s_utf8_escape_encoding); - Py_CLEAR(clear_module_state->__pyx_tuple_); - Py_CLEAR(clear_module_state->__pyx_tuple__4); - Py_CLEAR(clear_module_state->__pyx_tuple__6); - Py_CLEAR(clear_module_state->__pyx_codeobj__2); - Py_CLEAR(clear_module_state->__pyx_codeobj__3); - Py_CLEAR(clear_module_state->__pyx_codeobj__5); - Py_CLEAR(clear_module_state->__pyx_codeobj__7); - return 0; -} -#endif -/* #### Code section: module_state_traverse ### */ -#if CYTHON_USE_MODULE_STATE -static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { - __pyx_mstate *traverse_module_state = __pyx_mstate(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); - Py_VISIT(traverse_module_state->__pyx_empty_tuple); - Py_VISIT(traverse_module_state->__pyx_empty_bytes); - Py_VISIT(traverse_module_state->__pyx_empty_unicode); - #ifdef __Pyx_CyFunction_USED - Py_VISIT(traverse_module_state->__pyx_CyFunctionType); - #endif - #ifdef __Pyx_FusedFunction_USED - Py_VISIT(traverse_module_state->__pyx_FusedFunctionType); - #endif - Py_VISIT(traverse_module_state->__pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding); - Py_VISIT(traverse_module_state->__pyx_type_10amulet_nbt_16_string_encoding_8encoding_StringEncoding); - Py_VISIT(traverse_module_state->__pyx_n_s_StringEncoding); - Py_VISIT(traverse_module_state->__pyx_n_s_StringEncoding___reduce_cython); - Py_VISIT(traverse_module_state->__pyx_n_s_StringEncoding___setstate_cython); - Py_VISIT(traverse_module_state->__pyx_n_s_StringEncoding_decode); - Py_VISIT(traverse_module_state->__pyx_n_s_StringEncoding_encode); - Py_VISIT(traverse_module_state->__pyx_n_s_TypeError); - Py_VISIT(traverse_module_state->__pyx_n_s__8); - Py_VISIT(traverse_module_state->__pyx_n_s_amulet_nbt__string_encoding_enco); - Py_VISIT(traverse_module_state->__pyx_n_s_asyncio_coroutines); - Py_VISIT(traverse_module_state->__pyx_n_s_bytes); - Py_VISIT(traverse_module_state->__pyx_n_s_cline_in_traceback); - Py_VISIT(traverse_module_state->__pyx_n_s_data); - Py_VISIT(traverse_module_state->__pyx_n_s_decode); - Py_VISIT(traverse_module_state->__pyx_kp_u_disable); - Py_VISIT(traverse_module_state->__pyx_kp_u_enable); - Py_VISIT(traverse_module_state->__pyx_n_s_encode); - Py_VISIT(traverse_module_state->__pyx_kp_u_gc); - Py_VISIT(traverse_module_state->__pyx_n_s_getstate); - Py_VISIT(traverse_module_state->__pyx_n_s_is_coroutine); - Py_VISIT(traverse_module_state->__pyx_kp_u_isenabled); - Py_VISIT(traverse_module_state->__pyx_n_s_main); - Py_VISIT(traverse_module_state->__pyx_n_s_mutf8_encoding); - Py_VISIT(traverse_module_state->__pyx_n_s_name); - Py_VISIT(traverse_module_state->__pyx_n_s_pyx_state); - Py_VISIT(traverse_module_state->__pyx_n_s_reduce); - Py_VISIT(traverse_module_state->__pyx_n_s_reduce_cython); - Py_VISIT(traverse_module_state->__pyx_n_s_reduce_ex); - Py_VISIT(traverse_module_state->__pyx_n_s_return); - Py_VISIT(traverse_module_state->__pyx_n_s_self); - Py_VISIT(traverse_module_state->__pyx_kp_s_self_decode_cpp_self_encode_cpp); - Py_VISIT(traverse_module_state->__pyx_n_s_setstate); - Py_VISIT(traverse_module_state->__pyx_n_s_setstate_cython); - Py_VISIT(traverse_module_state->__pyx_kp_s_src_amulet_nbt__string_encoding); - Py_VISIT(traverse_module_state->__pyx_kp_s_stringsource); - Py_VISIT(traverse_module_state->__pyx_n_s_test); - Py_VISIT(traverse_module_state->__pyx_n_s_utf8_encoding); - Py_VISIT(traverse_module_state->__pyx_n_s_utf8_escape_encoding); - Py_VISIT(traverse_module_state->__pyx_tuple_); - Py_VISIT(traverse_module_state->__pyx_tuple__4); - Py_VISIT(traverse_module_state->__pyx_tuple__6); - Py_VISIT(traverse_module_state->__pyx_codeobj__2); - Py_VISIT(traverse_module_state->__pyx_codeobj__3); - Py_VISIT(traverse_module_state->__pyx_codeobj__5); - Py_VISIT(traverse_module_state->__pyx_codeobj__7); - return 0; -} -#endif -/* #### Code section: module_state_defines ### */ -#define __pyx_d __pyx_mstate_global->__pyx_d -#define __pyx_b __pyx_mstate_global->__pyx_b -#define __pyx_cython_runtime __pyx_mstate_global->__pyx_cython_runtime -#define __pyx_empty_tuple __pyx_mstate_global->__pyx_empty_tuple -#define __pyx_empty_bytes __pyx_mstate_global->__pyx_empty_bytes -#define __pyx_empty_unicode __pyx_mstate_global->__pyx_empty_unicode -#ifdef __Pyx_CyFunction_USED -#define __pyx_CyFunctionType __pyx_mstate_global->__pyx_CyFunctionType -#endif -#ifdef __Pyx_FusedFunction_USED -#define __pyx_FusedFunctionType __pyx_mstate_global->__pyx_FusedFunctionType -#endif -#ifdef __Pyx_Generator_USED -#define __pyx_GeneratorType __pyx_mstate_global->__pyx_GeneratorType -#endif -#ifdef __Pyx_IterableCoroutine_USED -#define __pyx_IterableCoroutineType __pyx_mstate_global->__pyx_IterableCoroutineType -#endif -#ifdef __Pyx_Coroutine_USED -#define __pyx_CoroutineAwaitType __pyx_mstate_global->__pyx_CoroutineAwaitType -#endif -#ifdef __Pyx_Coroutine_USED -#define __pyx_CoroutineType __pyx_mstate_global->__pyx_CoroutineType -#endif -#if CYTHON_USE_MODULE_STATE -#endif -#if CYTHON_USE_MODULE_STATE -#endif -#if CYTHON_USE_MODULE_STATE -#endif -#if CYTHON_USE_MODULE_STATE -#endif -#if CYTHON_USE_MODULE_STATE -#endif -#if CYTHON_USE_MODULE_STATE -#define __pyx_type_10amulet_nbt_16_string_encoding_8encoding_StringEncoding __pyx_mstate_global->__pyx_type_10amulet_nbt_16_string_encoding_8encoding_StringEncoding -#endif -#define __pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding __pyx_mstate_global->__pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding -#define __pyx_n_s_StringEncoding __pyx_mstate_global->__pyx_n_s_StringEncoding -#define __pyx_n_s_StringEncoding___reduce_cython __pyx_mstate_global->__pyx_n_s_StringEncoding___reduce_cython -#define __pyx_n_s_StringEncoding___setstate_cython __pyx_mstate_global->__pyx_n_s_StringEncoding___setstate_cython -#define __pyx_n_s_StringEncoding_decode __pyx_mstate_global->__pyx_n_s_StringEncoding_decode -#define __pyx_n_s_StringEncoding_encode __pyx_mstate_global->__pyx_n_s_StringEncoding_encode -#define __pyx_n_s_TypeError __pyx_mstate_global->__pyx_n_s_TypeError -#define __pyx_n_s__8 __pyx_mstate_global->__pyx_n_s__8 -#define __pyx_n_s_amulet_nbt__string_encoding_enco __pyx_mstate_global->__pyx_n_s_amulet_nbt__string_encoding_enco -#define __pyx_n_s_asyncio_coroutines __pyx_mstate_global->__pyx_n_s_asyncio_coroutines -#define __pyx_n_s_bytes __pyx_mstate_global->__pyx_n_s_bytes -#define __pyx_n_s_cline_in_traceback __pyx_mstate_global->__pyx_n_s_cline_in_traceback -#define __pyx_n_s_data __pyx_mstate_global->__pyx_n_s_data -#define __pyx_n_s_decode __pyx_mstate_global->__pyx_n_s_decode -#define __pyx_kp_u_disable __pyx_mstate_global->__pyx_kp_u_disable -#define __pyx_kp_u_enable __pyx_mstate_global->__pyx_kp_u_enable -#define __pyx_n_s_encode __pyx_mstate_global->__pyx_n_s_encode -#define __pyx_kp_u_gc __pyx_mstate_global->__pyx_kp_u_gc -#define __pyx_n_s_getstate __pyx_mstate_global->__pyx_n_s_getstate -#define __pyx_n_s_is_coroutine __pyx_mstate_global->__pyx_n_s_is_coroutine -#define __pyx_kp_u_isenabled __pyx_mstate_global->__pyx_kp_u_isenabled -#define __pyx_n_s_main __pyx_mstate_global->__pyx_n_s_main -#define __pyx_n_s_mutf8_encoding __pyx_mstate_global->__pyx_n_s_mutf8_encoding -#define __pyx_n_s_name __pyx_mstate_global->__pyx_n_s_name -#define __pyx_n_s_pyx_state __pyx_mstate_global->__pyx_n_s_pyx_state -#define __pyx_n_s_reduce __pyx_mstate_global->__pyx_n_s_reduce -#define __pyx_n_s_reduce_cython __pyx_mstate_global->__pyx_n_s_reduce_cython -#define __pyx_n_s_reduce_ex __pyx_mstate_global->__pyx_n_s_reduce_ex -#define __pyx_n_s_return __pyx_mstate_global->__pyx_n_s_return -#define __pyx_n_s_self __pyx_mstate_global->__pyx_n_s_self -#define __pyx_kp_s_self_decode_cpp_self_encode_cpp __pyx_mstate_global->__pyx_kp_s_self_decode_cpp_self_encode_cpp -#define __pyx_n_s_setstate __pyx_mstate_global->__pyx_n_s_setstate -#define __pyx_n_s_setstate_cython __pyx_mstate_global->__pyx_n_s_setstate_cython -#define __pyx_kp_s_src_amulet_nbt__string_encoding __pyx_mstate_global->__pyx_kp_s_src_amulet_nbt__string_encoding -#define __pyx_kp_s_stringsource __pyx_mstate_global->__pyx_kp_s_stringsource -#define __pyx_n_s_test __pyx_mstate_global->__pyx_n_s_test -#define __pyx_n_s_utf8_encoding __pyx_mstate_global->__pyx_n_s_utf8_encoding -#define __pyx_n_s_utf8_escape_encoding __pyx_mstate_global->__pyx_n_s_utf8_escape_encoding -#define __pyx_tuple_ __pyx_mstate_global->__pyx_tuple_ -#define __pyx_tuple__4 __pyx_mstate_global->__pyx_tuple__4 -#define __pyx_tuple__6 __pyx_mstate_global->__pyx_tuple__6 -#define __pyx_codeobj__2 __pyx_mstate_global->__pyx_codeobj__2 -#define __pyx_codeobj__3 __pyx_mstate_global->__pyx_codeobj__3 -#define __pyx_codeobj__5 __pyx_mstate_global->__pyx_codeobj__5 -#define __pyx_codeobj__7 __pyx_mstate_global->__pyx_codeobj__7 -/* #### Code section: module_code ### */ - -/* "string.from_py":13 - * - * @cname("__pyx_convert_string_from_py_std__in_string") - * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *: # <<<<<<<<<<<<<< - * cdef Py_ssize_t length = 0 - * cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length) - */ - -static std::string __pyx_convert_string_from_py_std__in_string(PyObject *__pyx_v_o) { - Py_ssize_t __pyx_v_length; - char const *__pyx_v_data; - std::string __pyx_r; - char const *__pyx_t_1; - std::string __pyx_t_2; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - - /* "string.from_py":14 - * @cname("__pyx_convert_string_from_py_std__in_string") - * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *: - * cdef Py_ssize_t length = 0 # <<<<<<<<<<<<<< - * cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length) - * return string(data, length) - */ - __pyx_v_length = 0; - - /* "string.from_py":15 - * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *: - * cdef Py_ssize_t length = 0 - * cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length) # <<<<<<<<<<<<<< - * return string(data, length) - * - */ - __pyx_t_1 = __Pyx_PyObject_AsStringAndSize(__pyx_v_o, (&__pyx_v_length)); if (unlikely(__pyx_t_1 == ((char const *)NULL))) __PYX_ERR(0, 15, __pyx_L1_error) - __pyx_v_data = __pyx_t_1; - - /* "string.from_py":16 - * cdef Py_ssize_t length = 0 - * cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length) - * return string(data, length) # <<<<<<<<<<<<<< - * - * - */ - try { - __pyx_t_2 = std::string(__pyx_v_data, __pyx_v_length); - } catch(...) { - __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 16, __pyx_L1_error) - } - __pyx_r = __pyx_t_2; - goto __pyx_L0; - - /* "string.from_py":13 - * - * @cname("__pyx_convert_string_from_py_std__in_string") - * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *: # <<<<<<<<<<<<<< - * cdef Py_ssize_t length = 0 - * cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_AddTraceback("string.from_py.__pyx_convert_string_from_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_pretend_to_initialize(&__pyx_r); - __pyx_L0:; - return __pyx_r; -} - -/* "string.to_py":31 - * - * @cname("__pyx_convert_PyObject_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyObject_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< - * return __Pyx_PyObject_FromStringAndSize(s.data(), s.size()) - * cdef extern from *: - */ - -static CYTHON_INLINE PyObject *__pyx_convert_PyObject_string_to_py_std__in_string(std::string const &__pyx_v_s) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_convert_PyObject_string_to_py_std__in_string", 1); - - /* "string.to_py":32 - * @cname("__pyx_convert_PyObject_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyObject_string_to_py_std__in_string(const string& s): - * return __Pyx_PyObject_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< - * cdef extern from *: - * cdef object __Pyx_PyUnicode_FromStringAndSize(const char*, size_t) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 32, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "string.to_py":31 - * - * @cname("__pyx_convert_PyObject_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyObject_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< - * return __Pyx_PyObject_FromStringAndSize(s.data(), s.size()) - * cdef extern from *: - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("string.to_py.__pyx_convert_PyObject_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "string.to_py":37 - * - * @cname("__pyx_convert_PyUnicode_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyUnicode_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< - * return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size()) - * cdef extern from *: - */ - -static CYTHON_INLINE PyObject *__pyx_convert_PyUnicode_string_to_py_std__in_string(std::string const &__pyx_v_s) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_convert_PyUnicode_string_to_py_std__in_string", 1); - - /* "string.to_py":38 - * @cname("__pyx_convert_PyUnicode_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyUnicode_string_to_py_std__in_string(const string& s): - * return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< - * cdef extern from *: - * cdef object __Pyx_PyStr_FromStringAndSize(const char*, size_t) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyUnicode_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "string.to_py":37 - * - * @cname("__pyx_convert_PyUnicode_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyUnicode_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< - * return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size()) - * cdef extern from *: - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("string.to_py.__pyx_convert_PyUnicode_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "string.to_py":43 - * - * @cname("__pyx_convert_PyStr_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyStr_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< - * return __Pyx_PyStr_FromStringAndSize(s.data(), s.size()) - * cdef extern from *: - */ - -static CYTHON_INLINE PyObject *__pyx_convert_PyStr_string_to_py_std__in_string(std::string const &__pyx_v_s) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_convert_PyStr_string_to_py_std__in_string", 1); - - /* "string.to_py":44 - * @cname("__pyx_convert_PyStr_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyStr_string_to_py_std__in_string(const string& s): - * return __Pyx_PyStr_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< - * cdef extern from *: - * cdef object __Pyx_PyBytes_FromStringAndSize(const char*, size_t) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyStr_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "string.to_py":43 - * - * @cname("__pyx_convert_PyStr_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyStr_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< - * return __Pyx_PyStr_FromStringAndSize(s.data(), s.size()) - * cdef extern from *: - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("string.to_py.__pyx_convert_PyStr_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "string.to_py":49 - * - * @cname("__pyx_convert_PyBytes_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyBytes_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< - * return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size()) - * cdef extern from *: - */ - -static CYTHON_INLINE PyObject *__pyx_convert_PyBytes_string_to_py_std__in_string(std::string const &__pyx_v_s) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_convert_PyBytes_string_to_py_std__in_string", 1); - - /* "string.to_py":50 - * @cname("__pyx_convert_PyBytes_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyBytes_string_to_py_std__in_string(const string& s): - * return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< - * cdef extern from *: - * cdef object __Pyx_PyByteArray_FromStringAndSize(const char*, size_t) - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 50, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "string.to_py":49 - * - * @cname("__pyx_convert_PyBytes_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyBytes_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< - * return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size()) - * cdef extern from *: - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("string.to_py.__pyx_convert_PyBytes_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "string.to_py":55 - * - * @cname("__pyx_convert_PyByteArray_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyByteArray_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< - * return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size()) - * - */ - -static CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_std__in_string(std::string const &__pyx_v_s) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_convert_PyByteArray_string_to_py_std__in_string", 1); - - /* "string.to_py":56 - * @cname("__pyx_convert_PyByteArray_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyByteArray_string_to_py_std__in_string(const string& s): - * return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyByteArray_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "string.to_py":55 - * - * @cname("__pyx_convert_PyByteArray_string_to_py_std__in_string") - * cdef inline object __pyx_convert_PyByteArray_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< - * return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size()) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("string.to_py.__pyx_convert_PyByteArray_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "amulet_nbt/_string_encoding/encoding.pyx":13 - * - * cdef class StringEncoding: - * def encode(self, bytes data: bytes) -> bytes: # <<<<<<<<<<<<<< - * return self.encode_cpp(data) - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_1encode(PyObject *__pyx_v_self, -#if 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_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_1encode = {"encode", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_1encode, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_1encode(PyObject *__pyx_v_self, -#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_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("encode (wrapper)", 0); - #if !CYTHON_METH_FASTCALL - #if CYTHON_ASSUME_SAFE_MACROS - __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); - #else - __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 **__pyx_pyargnames[] = {&__pyx_n_s_data,0}; - if (__pyx_kwds) { - Py_ssize_t kw_args; - switch (__pyx_nargs) { - case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); - switch (__pyx_nargs) { - case 0: - if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_data)) != 0)) { - (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); - kw_args--; - } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 13, __pyx_L3_error) - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "encode") < 0)) __PYX_ERR(1, 13, __pyx_L3_error) - } - } else if (unlikely(__pyx_nargs != 1)) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - } - __pyx_v_data = ((PyObject*)values[0]); - } - goto __pyx_L6_skip; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("encode", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 13, __pyx_L3_error) - __pyx_L6_skip:; - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - { - Py_ssize_t __pyx_temp; - for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { - __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); - } - } - __Pyx_AddTraceback("amulet_nbt._string_encoding.encoding.StringEncoding.encode", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), (&PyBytes_Type), 0, "data", 1))) __PYX_ERR(1, 13, __pyx_L1_error) - __pyx_r = __pyx_pf_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_encode(((struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding *)__pyx_v_self), __pyx_v_data); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - { - Py_ssize_t __pyx_temp; - for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { - __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); - } - } - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_encode(struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding *__pyx_v_self, PyObject *__pyx_v_data) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - std::string __pyx_t_1; - std::string __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("encode", 1); - - /* "amulet_nbt/_string_encoding/encoding.pyx":14 - * cdef class StringEncoding: - * def encode(self, bytes data: bytes) -> bytes: - * return self.encode_cpp(data) # <<<<<<<<<<<<<< - * - * def decode(self, bytes data: bytes) -> bytes: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_convert_string_from_py_std__in_string(__pyx_v_data); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 14, __pyx_L1_error) - __pyx_t_2 = __pyx_v_self->encode_cpp(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 14, __pyx_L1_error) - __pyx_t_3 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; - goto __pyx_L0; - - /* "amulet_nbt/_string_encoding/encoding.pyx":13 - * - * cdef class StringEncoding: - * def encode(self, bytes data: bytes) -> bytes: # <<<<<<<<<<<<<< - * return self.encode_cpp(data) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("amulet_nbt._string_encoding.encoding.StringEncoding.encode", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "amulet_nbt/_string_encoding/encoding.pyx":16 - * return self.encode_cpp(data) - * - * def decode(self, bytes data: bytes) -> bytes: # <<<<<<<<<<<<<< - * return self.decode_cpp(data) - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_3decode(PyObject *__pyx_v_self, -#if 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_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_3decode = {"decode", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_3decode, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_3decode(PyObject *__pyx_v_self, -#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_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("decode (wrapper)", 0); - #if !CYTHON_METH_FASTCALL - #if CYTHON_ASSUME_SAFE_MACROS - __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); - #else - __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 **__pyx_pyargnames[] = {&__pyx_n_s_data,0}; - if (__pyx_kwds) { - Py_ssize_t kw_args; - switch (__pyx_nargs) { - case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); - switch (__pyx_nargs) { - case 0: - if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_data)) != 0)) { - (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); - kw_args--; - } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 16, __pyx_L3_error) - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "decode") < 0)) __PYX_ERR(1, 16, __pyx_L3_error) - } - } else if (unlikely(__pyx_nargs != 1)) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - } - __pyx_v_data = ((PyObject*)values[0]); - } - goto __pyx_L6_skip; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("decode", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 16, __pyx_L3_error) - __pyx_L6_skip:; - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - { - Py_ssize_t __pyx_temp; - for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { - __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); - } - } - __Pyx_AddTraceback("amulet_nbt._string_encoding.encoding.StringEncoding.decode", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), (&PyBytes_Type), 0, "data", 1))) __PYX_ERR(1, 16, __pyx_L1_error) - __pyx_r = __pyx_pf_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_2decode(((struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding *)__pyx_v_self), __pyx_v_data); - - /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; - { - Py_ssize_t __pyx_temp; - for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { - __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); - } - } - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_2decode(struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding *__pyx_v_self, PyObject *__pyx_v_data) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - std::string __pyx_t_1; - std::string __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("decode", 1); - - /* "amulet_nbt/_string_encoding/encoding.pyx":17 - * - * def decode(self, bytes data: bytes) -> bytes: - * return self.decode_cpp(data) # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_convert_string_from_py_std__in_string(__pyx_v_data); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 17, __pyx_L1_error) - __pyx_t_2 = __pyx_v_self->decode_cpp(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 17, __pyx_L1_error) - __pyx_t_3 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 17, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; - goto __pyx_L0; - - /* "amulet_nbt/_string_encoding/encoding.pyx":16 - * return self.encode_cpp(data) - * - * def decode(self, bytes data: bytes) -> bytes: # <<<<<<<<<<<<<< - * return self.decode_cpp(data) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("amulet_nbt._string_encoding.encoding.StringEncoding.decode", __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.decode_cpp,self.encode_cpp cannot be converted to a Python object for pickling" - * def __setstate_cython__(self, __pyx_state): - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_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*/ -static PyMethodDef __pyx_mdef_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_5__reduce_cython__ = {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_5__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_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_MACROS - __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); - #else - __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;} - if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL; - __pyx_r = __pyx_pf_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_4__reduce_cython__(((struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding *__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__", 1); - - /* "(tree fragment)":2 - * def __reduce_cython__(self): - * raise TypeError, "self.decode_cpp,self.encode_cpp cannot be converted to a Python object for pickling" # <<<<<<<<<<<<<< - * def __setstate_cython__(self, __pyx_state): - * raise TypeError, "self.decode_cpp,self.encode_cpp cannot be converted to a Python object for pickling" - */ - __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_self_decode_cpp_self_encode_cpp, 0, 0); - __PYX_ERR(0, 2, __pyx_L1_error) - - /* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError, "self.decode_cpp,self.encode_cpp cannot be converted to a Python object for pickling" - * def __setstate_cython__(self, __pyx_state): - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_AddTraceback("amulet_nbt._string_encoding.encoding.StringEncoding.__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.decode_cpp,self.encode_cpp cannot be converted to a Python object for pickling" - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError, "self.decode_cpp,self.encode_cpp cannot be converted to a Python object for pickling" - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_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*/ -static PyMethodDef __pyx_mdef_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_7__setstate_cython__ = {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_7__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_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_MACROS - __pyx_nargs = PyTuple_GET_SIZE(__pyx_args); - #else - __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 **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0}; - if (__pyx_kwds) { - Py_ssize_t kw_args; - switch (__pyx_nargs) { - case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds); - switch (__pyx_nargs) { - case 0: - if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) { - (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); - kw_args--; - } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3, __pyx_L3_error) - else goto __pyx_L5_argtuple_error; - } - if (unlikely(kw_args > 0)) { - const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(0, 3, __pyx_L3_error) - } - } else if (unlikely(__pyx_nargs != 1)) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); - } - __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(0, 3, __pyx_L3_error) - __pyx_L6_skip:; - goto __pyx_L4_argument_unpacking_done; - __pyx_L3_error:; - { - Py_ssize_t __pyx_temp; - for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { - __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); - } - } - __Pyx_AddTraceback("amulet_nbt._string_encoding.encoding.StringEncoding.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_6__setstate_cython__(((struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding *)__pyx_v_self), __pyx_v___pyx_state); - - /* function exit code */ - { - Py_ssize_t __pyx_temp; - for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) { - __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]); - } - } - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding *__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__", 1); - - /* "(tree fragment)":4 - * raise TypeError, "self.decode_cpp,self.encode_cpp cannot be converted to a Python object for pickling" - * def __setstate_cython__(self, __pyx_state): - * raise TypeError, "self.decode_cpp,self.encode_cpp cannot be converted to a Python object for pickling" # <<<<<<<<<<<<<< - */ - __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_self_decode_cpp_self_encode_cpp, 0, 0); - __PYX_ERR(0, 4, __pyx_L1_error) - - /* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError, "self.decode_cpp,self.encode_cpp cannot be converted to a Python object for pickling" - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError, "self.decode_cpp,self.encode_cpp cannot be converted to a Python object for pickling" - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_AddTraceback("amulet_nbt._string_encoding.encoding.StringEncoding.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_tp_new_10amulet_nbt_16_string_encoding_8encoding_StringEncoding(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - PyObject *o; - #if CYTHON_COMPILING_IN_LIMITED_API - allocfunc alloc_func = (allocfunc)PyType_GetSlot(t, Py_tp_alloc); - o = alloc_func(t, 0); - #else - if (likely(!__Pyx_PyType_HasFeature(t, Py_TPFLAGS_IS_ABSTRACT))) { - o = (*t->tp_alloc)(t, 0); - } else { - o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); - } - if (unlikely(!o)) return 0; - #endif - return o; -} - -static void __pyx_tp_dealloc_10amulet_nbt_16_string_encoding_8encoding_StringEncoding(PyObject *o) { - #if CYTHON_USE_TP_FINALIZE - if (unlikely((PY_VERSION_HEX >= 0x03080000 || __Pyx_PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE)) && __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_10amulet_nbt_16_string_encoding_8encoding_StringEncoding) { - if (PyObject_CallFinalizerFromDealloc(o)) return; - } - } - #endif - #if CYTHON_USE_TYPE_SLOTS || CYTHON_COMPILING_IN_PYPY - (*Py_TYPE(o)->tp_free)(o); - #else - { - freefunc tp_free = (freefunc)PyType_GetSlot(Py_TYPE(o), Py_tp_free); - if (tp_free) tp_free(o); - } - #endif -} - -static PyMethodDef __pyx_methods_10amulet_nbt_16_string_encoding_8encoding_StringEncoding[] = { - {"encode", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_1encode, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {"decode", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_3decode, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {"__reduce_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_5__reduce_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {"__setstate_cython__", (PyCFunction)(void*)(__Pyx_PyCFunction_FastCallWithKeywords)__pyx_pw_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_7__setstate_cython__, __Pyx_METH_FASTCALL|METH_KEYWORDS, 0}, - {0, 0, 0, 0} -}; -#if CYTHON_USE_TYPE_SPECS -static PyType_Slot __pyx_type_10amulet_nbt_16_string_encoding_8encoding_StringEncoding_slots[] = { - {Py_tp_dealloc, (void *)__pyx_tp_dealloc_10amulet_nbt_16_string_encoding_8encoding_StringEncoding}, - {Py_tp_methods, (void *)__pyx_methods_10amulet_nbt_16_string_encoding_8encoding_StringEncoding}, - {Py_tp_new, (void *)__pyx_tp_new_10amulet_nbt_16_string_encoding_8encoding_StringEncoding}, - {0, 0}, -}; -static PyType_Spec __pyx_type_10amulet_nbt_16_string_encoding_8encoding_StringEncoding_spec = { - "amulet_nbt._string_encoding.encoding.StringEncoding", - sizeof(struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding), - 0, - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, - __pyx_type_10amulet_nbt_16_string_encoding_8encoding_StringEncoding_slots, -}; -#else - -static PyTypeObject __pyx_type_10amulet_nbt_16_string_encoding_8encoding_StringEncoding = { - PyVarObject_HEAD_INIT(0, 0) - "amulet_nbt._string_encoding.encoding.""StringEncoding", /*tp_name*/ - sizeof(struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_10amulet_nbt_16_string_encoding_8encoding_StringEncoding, /*tp_dealloc*/ - #if PY_VERSION_HEX < 0x030800b4 - 0, /*tp_print*/ - #endif - #if PY_VERSION_HEX >= 0x030800b4 - 0, /*tp_vectorcall_offset*/ - #endif - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #endif - #if PY_MAJOR_VERSION >= 3 - 0, /*tp_as_async*/ - #endif - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ - 0, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_10amulet_nbt_16_string_encoding_8encoding_StringEncoding, /*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_10amulet_nbt_16_string_encoding_8encoding_StringEncoding, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - 0, /*tp_version_tag*/ - #if PY_VERSION_HEX >= 0x030400a1 - #if CYTHON_USE_TP_FINALIZE - 0, /*tp_finalize*/ - #else - NULL, /*tp_finalize*/ - #endif - #endif - #if PY_VERSION_HEX >= 0x030800b1 && (!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 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} -}; -#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 -/* #### Code section: pystring_table ### */ - -static int __Pyx_CreateStringTabAndInitStrings(void) { - __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_n_s_StringEncoding, __pyx_k_StringEncoding, sizeof(__pyx_k_StringEncoding), 0, 0, 1, 1}, - {&__pyx_n_s_StringEncoding___reduce_cython, __pyx_k_StringEncoding___reduce_cython, sizeof(__pyx_k_StringEncoding___reduce_cython), 0, 0, 1, 1}, - {&__pyx_n_s_StringEncoding___setstate_cython, __pyx_k_StringEncoding___setstate_cython, sizeof(__pyx_k_StringEncoding___setstate_cython), 0, 0, 1, 1}, - {&__pyx_n_s_StringEncoding_decode, __pyx_k_StringEncoding_decode, sizeof(__pyx_k_StringEncoding_decode), 0, 0, 1, 1}, - {&__pyx_n_s_StringEncoding_encode, __pyx_k_StringEncoding_encode, sizeof(__pyx_k_StringEncoding_encode), 0, 0, 1, 1}, - {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1}, - {&__pyx_n_s__8, __pyx_k__8, sizeof(__pyx_k__8), 0, 0, 1, 1}, - {&__pyx_n_s_amulet_nbt__string_encoding_enco, __pyx_k_amulet_nbt__string_encoding_enco, sizeof(__pyx_k_amulet_nbt__string_encoding_enco), 0, 0, 1, 1}, - {&__pyx_n_s_asyncio_coroutines, __pyx_k_asyncio_coroutines, sizeof(__pyx_k_asyncio_coroutines), 0, 0, 1, 1}, - {&__pyx_n_s_bytes, __pyx_k_bytes, sizeof(__pyx_k_bytes), 0, 0, 1, 1}, - {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, - {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1}, - {&__pyx_n_s_decode, __pyx_k_decode, sizeof(__pyx_k_decode), 0, 0, 1, 1}, - {&__pyx_kp_u_disable, __pyx_k_disable, sizeof(__pyx_k_disable), 0, 1, 0, 0}, - {&__pyx_kp_u_enable, __pyx_k_enable, sizeof(__pyx_k_enable), 0, 1, 0, 0}, - {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1}, - {&__pyx_kp_u_gc, __pyx_k_gc, sizeof(__pyx_k_gc), 0, 1, 0, 0}, - {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1}, - {&__pyx_n_s_is_coroutine, __pyx_k_is_coroutine, sizeof(__pyx_k_is_coroutine), 0, 0, 1, 1}, - {&__pyx_kp_u_isenabled, __pyx_k_isenabled, sizeof(__pyx_k_isenabled), 0, 1, 0, 0}, - {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, - {&__pyx_n_s_mutf8_encoding, __pyx_k_mutf8_encoding, sizeof(__pyx_k_mutf8_encoding), 0, 0, 1, 1}, - {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, - {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1}, - {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1}, - {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1}, - {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1}, - {&__pyx_n_s_return, __pyx_k_return, sizeof(__pyx_k_return), 0, 0, 1, 1}, - {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1}, - {&__pyx_kp_s_self_decode_cpp_self_encode_cpp, __pyx_k_self_decode_cpp_self_encode_cpp, sizeof(__pyx_k_self_decode_cpp_self_encode_cpp), 0, 0, 1, 0}, - {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1}, - {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1}, - {&__pyx_kp_s_src_amulet_nbt__string_encoding, __pyx_k_src_amulet_nbt__string_encoding, sizeof(__pyx_k_src_amulet_nbt__string_encoding), 0, 0, 1, 0}, - {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0}, - {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, - {&__pyx_n_s_utf8_encoding, __pyx_k_utf8_encoding, sizeof(__pyx_k_utf8_encoding), 0, 0, 1, 1}, - {&__pyx_n_s_utf8_escape_encoding, __pyx_k_utf8_escape_encoding, sizeof(__pyx_k_utf8_escape_encoding), 0, 0, 1, 1}, - {0, 0, 0, 0, 0, 0, 0} - }; - return __Pyx_InitStrings(__pyx_string_tab); -} -/* #### Code section: cached_builtins ### */ -static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 2, __pyx_L1_error) - return 0; - __pyx_L1_error:; - return -1; -} -/* #### Code section: cached_constants ### */ - -static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - - /* "amulet_nbt/_string_encoding/encoding.pyx":13 - * - * cdef class StringEncoding: - * def encode(self, bytes data: bytes) -> bytes: # <<<<<<<<<<<<<< - * return self.encode_cpp(data) - * - */ - __pyx_tuple_ = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_data); if (unlikely(!__pyx_tuple_)) __PYX_ERR(1, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple_); - __Pyx_GIVEREF(__pyx_tuple_); - __pyx_codeobj__2 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple_, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_amulet_nbt__string_encoding, __pyx_n_s_encode, 13, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__2)) __PYX_ERR(1, 13, __pyx_L1_error) - - /* "amulet_nbt/_string_encoding/encoding.pyx":16 - * return self.encode_cpp(data) - * - * def decode(self, bytes data: bytes) -> bytes: # <<<<<<<<<<<<<< - * return self.decode_cpp(data) - * - */ - __pyx_codeobj__3 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple_, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_amulet_nbt__string_encoding, __pyx_n_s_decode, 16, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__3)) __PYX_ERR(1, 16, __pyx_L1_error) - - /* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError, "self.decode_cpp,self.encode_cpp cannot be converted to a Python object for pickling" - * def __setstate_cython__(self, __pyx_state): - */ - __pyx_tuple__4 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__4); - __Pyx_GIVEREF(__pyx_tuple__4); - __pyx_codeobj__5 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__4, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_reduce_cython, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__5)) __PYX_ERR(0, 1, __pyx_L1_error) - - /* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError, "self.decode_cpp,self.encode_cpp cannot be converted to a Python object for pickling" - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError, "self.decode_cpp,self.encode_cpp cannot be converted to a Python object for pickling" - */ - __pyx_tuple__6 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_pyx_state); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 3, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__6); - __Pyx_GIVEREF(__pyx_tuple__6); - __pyx_codeobj__7 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__6, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_setstate_cython, 3, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__7)) __PYX_ERR(0, 3, __pyx_L1_error) - __Pyx_RefNannyFinishContext(); - return 0; - __pyx_L1_error:; - __Pyx_RefNannyFinishContext(); - return -1; -} -/* #### Code section: init_constants ### */ - -static CYTHON_SMALL_CODE int __Pyx_InitConstants(void) { - if (__Pyx_CreateStringTabAndInitStrings() < 0) __PYX_ERR(1, 1, __pyx_L1_error); - return 0; - __pyx_L1_error:; - return -1; -} -/* #### Code section: init_globals ### */ - -static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { - return 0; -} -/* #### Code section: init_module ### */ - -static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/ - -static int __Pyx_modinit_global_init_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); - /*--- Global init code ---*/ - __pyx_v_10amulet_nbt_16_string_encoding_8encoding__mutf8_encoding = ((struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding *)Py_None); Py_INCREF(Py_None); - __pyx_v_10amulet_nbt_16_string_encoding_8encoding__utf8_encoding = ((struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding *)Py_None); Py_INCREF(Py_None); - __pyx_v_10amulet_nbt_16_string_encoding_8encoding__utf8_escape_encoding = ((struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding *)Py_None); Py_INCREF(Py_None); - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_variable_export_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); - /*--- Variable export code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_function_export_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); - /*--- Function export code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_type_init_code(void) { - __Pyx_RefNannyDeclarations - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); - /*--- Type init code ---*/ - #if CYTHON_USE_TYPE_SPECS - __pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_10amulet_nbt_16_string_encoding_8encoding_StringEncoding_spec, NULL); if (unlikely(!__pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding)) __PYX_ERR(1, 12, __pyx_L1_error) - if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_10amulet_nbt_16_string_encoding_8encoding_StringEncoding_spec, __pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding) < 0) __PYX_ERR(1, 12, __pyx_L1_error) - #else - __pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding = &__pyx_type_10amulet_nbt_16_string_encoding_8encoding_StringEncoding; - #endif - #if !CYTHON_COMPILING_IN_LIMITED_API - #endif - #if !CYTHON_USE_TYPE_SPECS - if (__Pyx_PyType_Ready(__pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding) < 0) __PYX_ERR(1, 12, __pyx_L1_error) - #endif - #if PY_MAJOR_VERSION < 3 - __pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding->tp_print = 0; - #endif - #if !CYTHON_COMPILING_IN_LIMITED_API - if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding->tp_dictoffset && __pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding->tp_getattro == PyObject_GenericGetAttr)) { - __pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding->tp_getattro = __Pyx_PyObject_GenericGetAttr; - } - #endif - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_StringEncoding, (PyObject *) __pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding) < 0) __PYX_ERR(1, 12, __pyx_L1_error) - #if !CYTHON_COMPILING_IN_LIMITED_API - if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding) < 0) __PYX_ERR(1, 12, __pyx_L1_error) - #endif - __Pyx_RefNannyFinishContext(); - return 0; - __pyx_L1_error:; - __Pyx_RefNannyFinishContext(); - return -1; -} - -static int __Pyx_modinit_type_import_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); - /*--- Type import code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_variable_import_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); - /*--- Variable import code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_function_import_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); - /*--- Function import code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - - -#if PY_MAJOR_VERSION >= 3 -#if CYTHON_PEP489_MULTI_PHASE_INIT -static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ -static int __pyx_pymod_exec_encoding(PyObject* module); /*proto*/ -static PyModuleDef_Slot __pyx_moduledef_slots[] = { - {Py_mod_create, (void*)__pyx_pymod_create}, - {Py_mod_exec, (void*)__pyx_pymod_exec_encoding}, - {0, NULL} -}; -#endif - -#ifdef __cplusplus -namespace { - struct PyModuleDef __pyx_moduledef = - #else - static struct PyModuleDef __pyx_moduledef = - #endif - { - PyModuleDef_HEAD_INIT, - "encoding", - 0, /* m_doc */ - #if CYTHON_PEP489_MULTI_PHASE_INIT - 0, /* m_size */ - #elif CYTHON_USE_MODULE_STATE - sizeof(__pyx_mstate), /* m_size */ - #else - -1, /* m_size */ - #endif - __pyx_methods /* m_methods */, - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_moduledef_slots, /* m_slots */ - #else - NULL, /* m_reload */ - #endif - #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 -#endif - -#ifndef CYTHON_NO_PYINIT_EXPORT -#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC -#elif PY_MAJOR_VERSION < 3 -#ifdef __cplusplus -#define __Pyx_PyMODINIT_FUNC extern "C" void -#else -#define __Pyx_PyMODINIT_FUNC void -#endif -#else -#ifdef __cplusplus -#define __Pyx_PyMODINIT_FUNC extern "C" PyObject * -#else -#define __Pyx_PyMODINIT_FUNC PyObject * -#endif -#endif - - -#if PY_MAJOR_VERSION < 3 -__Pyx_PyMODINIT_FUNC initencoding(void) CYTHON_SMALL_CODE; /*proto*/ -__Pyx_PyMODINIT_FUNC initencoding(void) -#else -__Pyx_PyMODINIT_FUNC PyInit_encoding(void) CYTHON_SMALL_CODE; /*proto*/ -__Pyx_PyMODINIT_FUNC PyInit_encoding(void) -#if CYTHON_PEP489_MULTI_PHASE_INIT -{ - return PyModuleDef_Init(&__pyx_moduledef); -} -static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { - #if PY_VERSION_HEX >= 0x030700A1 - static PY_INT64_T main_interpreter_id = -1; - PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); - if (main_interpreter_id == -1) { - main_interpreter_id = current_id; - return (unlikely(current_id == -1)) ? -1 : 0; - } else if (unlikely(main_interpreter_id != current_id)) - #else - static PyInterpreterState *main_interpreter = NULL; - PyInterpreterState *current_interpreter = PyThreadState_Get()->interp; - if (!main_interpreter) { - main_interpreter = current_interpreter; - } else if (unlikely(main_interpreter != current_interpreter)) - #endif - { - PyErr_SetString( - PyExc_ImportError, - "Interpreter change detected - this module can only be loaded into one interpreter per process."); - return -1; - } - return 0; -} -#if CYTHON_COMPILING_IN_LIMITED_API -static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *module, const char* from_name, const char* to_name, int allow_none) -#else -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) -#endif -{ - PyObject *value = PyObject_GetAttrString(spec, from_name); - int result = 0; - if (likely(value)) { - if (allow_none || value != Py_None) { -#if CYTHON_COMPILING_IN_LIMITED_API - result = PyModule_AddObject(module, to_name, value); -#else - result = PyDict_SetItemString(moddict, to_name, value); -#endif - } - 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 (__Pyx_check_single_interpreter()) - return NULL; - if (__pyx_m) - return __Pyx_NewRef(__pyx_m); - modname = PyObject_GetAttrString(spec, "name"); - if (unlikely(!modname)) goto bad; - module = PyModule_NewObject(modname); - Py_DECREF(modname); - if (unlikely(!module)) goto bad; -#if CYTHON_COMPILING_IN_LIMITED_API - moddict = module; -#else - moddict = PyModule_GetDict(module); - if (unlikely(!moddict)) goto bad; -#endif - 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_encoding(PyObject *__pyx_pyinit_module) -#endif -#endif -{ - int stringtab_initialized = 0; - #if CYTHON_USE_MODULE_STATE - int pystate_addmodule_run = 0; - #endif - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannyDeclarations - #if CYTHON_PEP489_MULTI_PHASE_INIT - if (__pyx_m) { - if (__pyx_m == __pyx_pyinit_module) return 0; - PyErr_SetString(PyExc_RuntimeError, "Module 'encoding' has already been imported. Re-initialisation is not supported."); - return -1; - } - #elif PY_MAJOR_VERSION >= 3 - if (__pyx_m) return __Pyx_NewRef(__pyx_m); - #endif - /*--- Module creation code ---*/ - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_m = __pyx_pyinit_module; - Py_INCREF(__pyx_m); - #else - #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4("encoding", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); - if (unlikely(!__pyx_m)) __PYX_ERR(1, 1, __pyx_L1_error) - #elif CYTHON_USE_MODULE_STATE - __pyx_t_1 = PyModule_Create(&__pyx_moduledef); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error) - { - int add_module_result = PyState_AddModule(__pyx_t_1, &__pyx_moduledef); - __pyx_t_1 = 0; /* transfer ownership from __pyx_t_1 to "encoding" pseudovariable */ - if (unlikely((add_module_result < 0))) __PYX_ERR(1, 1, __pyx_L1_error) - pystate_addmodule_run = 1; - } - #else - __pyx_m = PyModule_Create(&__pyx_moduledef); - if (unlikely(!__pyx_m)) __PYX_ERR(1, 1, __pyx_L1_error) - #endif - #endif - CYTHON_UNUSED_VAR(__pyx_t_1); - __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(1, 1, __pyx_L1_error) - Py_INCREF(__pyx_d); - __pyx_b = __Pyx_PyImport_AddModuleRef(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(1, 1, __pyx_L1_error) - __pyx_cython_runtime = __Pyx_PyImport_AddModuleRef((const char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(1, 1, __pyx_L1_error) - if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(1, 1, __pyx_L1_error) - #if CYTHON_REFNANNY -__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); -if (!__Pyx_RefNanny) { - PyErr_Clear(); - __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); - if (!__Pyx_RefNanny) - Py_FatalError("failed to import 'refnanny' module"); -} -#endif - __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_encoding(void)", 0); - if (__Pyx_check_binary_version(__PYX_LIMITED_VERSION_HEX, __Pyx_get_runtime_version(), CYTHON_COMPILING_IN_LIMITED_API) < 0) __PYX_ERR(1, 1, __pyx_L1_error) - #ifdef __Pxy_PyFrame_Initialize_Offsets - __Pxy_PyFrame_Initialize_Offsets(); - #endif - __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(1, 1, __pyx_L1_error) - __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(1, 1, __pyx_L1_error) - __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(1, 1, __pyx_L1_error) - #ifdef __Pyx_CyFunction_USED - if (__pyx_CyFunction_init(__pyx_m) < 0) __PYX_ERR(1, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_FusedFunction_USED - if (__pyx_FusedFunction_init(__pyx_m) < 0) __PYX_ERR(1, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Coroutine_USED - if (__pyx_Coroutine_init(__pyx_m) < 0) __PYX_ERR(1, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Generator_USED - if (__pyx_Generator_init(__pyx_m) < 0) __PYX_ERR(1, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_AsyncGen_USED - if (__pyx_AsyncGen_init(__pyx_m) < 0) __PYX_ERR(1, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_StopAsyncIteration_USED - if (__pyx_StopAsyncIteration_init(__pyx_m) < 0) __PYX_ERR(1, 1, __pyx_L1_error) - #endif - /*--- Library function declarations ---*/ - /*--- Threads initialization code ---*/ - #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS - PyEval_InitThreads(); - #endif - /*--- Initialize various global constants etc. ---*/ - if (__Pyx_InitConstants() < 0) __PYX_ERR(1, 1, __pyx_L1_error) - stringtab_initialized = 1; - if (__Pyx_InitGlobals() < 0) __PYX_ERR(1, 1, __pyx_L1_error) - #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) - if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(1, 1, __pyx_L1_error) - #endif - if (__pyx_module_is_main_amulet_nbt___string_encoding__encoding) { - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(1, 1, __pyx_L1_error) - } - #if PY_MAJOR_VERSION >= 3 - { - PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(1, 1, __pyx_L1_error) - if (!PyDict_GetItemString(modules, "amulet_nbt._string_encoding.encoding")) { - if (unlikely((PyDict_SetItemString(modules, "amulet_nbt._string_encoding.encoding", __pyx_m) < 0))) __PYX_ERR(1, 1, __pyx_L1_error) - } - } - #endif - /*--- Builtin init code ---*/ - if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(1, 1, __pyx_L1_error) - /*--- Constants init code ---*/ - if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(1, 1, __pyx_L1_error) - /*--- Global type/function init code ---*/ - (void)__Pyx_modinit_global_init_code(); - (void)__Pyx_modinit_variable_export_code(); - (void)__Pyx_modinit_function_export_code(); - if (unlikely((__Pyx_modinit_type_init_code() < 0))) __PYX_ERR(1, 1, __pyx_L1_error) - (void)__Pyx_modinit_type_import_code(); - (void)__Pyx_modinit_variable_import_code(); - (void)__Pyx_modinit_function_import_code(); - /*--- Execution code ---*/ - #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) - if (__Pyx_patch_abc() < 0) __PYX_ERR(1, 1, __pyx_L1_error) - #endif - - /* "amulet_nbt/_string_encoding/encoding.pyx":13 - * - * cdef class StringEncoding: - * def encode(self, bytes data: bytes) -> bytes: # <<<<<<<<<<<<<< - * return self.encode_cpp(data) - * - */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_data, __pyx_n_s_bytes) < 0) __PYX_ERR(1, 13, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, __pyx_n_s_bytes) < 0) __PYX_ERR(1, 13, __pyx_L1_error) - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_1encode, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_StringEncoding_encode, NULL, __pyx_n_s_amulet_nbt__string_encoding_enco, __pyx_d, ((PyObject *)__pyx_codeobj__2)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding, __pyx_n_s_encode, __pyx_t_3) < 0) __PYX_ERR(1, 13, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - PyType_Modified(__pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding); - - /* "amulet_nbt/_string_encoding/encoding.pyx":16 - * return self.encode_cpp(data) - * - * def decode(self, bytes data: bytes) -> bytes: # <<<<<<<<<<<<<< - * return self.decode_cpp(data) - * - */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 16, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_data, __pyx_n_s_bytes) < 0) __PYX_ERR(1, 16, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_n_s_bytes) < 0) __PYX_ERR(1, 16, __pyx_L1_error) - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_3decode, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_StringEncoding_decode, NULL, __pyx_n_s_amulet_nbt__string_encoding_enco, __pyx_d, ((PyObject *)__pyx_codeobj__3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 16, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_2, __pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding, __pyx_n_s_decode, __pyx_t_2) < 0) __PYX_ERR(1, 16, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - PyType_Modified(__pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding); - - /* "(tree fragment)":1 - * def __reduce_cython__(self): # <<<<<<<<<<<<<< - * raise TypeError, "self.decode_cpp,self.encode_cpp cannot be converted to a Python object for pickling" - * def __setstate_cython__(self, __pyx_state): - */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_5__reduce_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_StringEncoding___reduce_cython, NULL, __pyx_n_s_amulet_nbt__string_encoding_enco, __pyx_d, ((PyObject *)__pyx_codeobj__5)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_reduce_cython, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "(tree fragment)":3 - * def __reduce_cython__(self): - * raise TypeError, "self.decode_cpp,self.encode_cpp cannot be converted to a Python object for pickling" - * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< - * raise TypeError, "self.decode_cpp,self.encode_cpp cannot be converted to a Python object for pickling" - */ - __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_10amulet_nbt_16_string_encoding_8encoding_14StringEncoding_7__setstate_cython__, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_StringEncoding___setstate_cython, NULL, __pyx_n_s_amulet_nbt__string_encoding_enco, __pyx_d, ((PyObject *)__pyx_codeobj__7)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_setstate_cython, __pyx_t_2) < 0) __PYX_ERR(0, 3, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "amulet_nbt/_string_encoding/encoding.pyx":20 - * - * - * cdef StringEncoding _mutf8_encoding = StringEncoding() # <<<<<<<<<<<<<< - * _mutf8_encoding.decode_cpp = mutf8_to_utf8 - * _mutf8_encoding.encode_cpp = utf8_to_mutf8 - */ - __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 20, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_XGOTREF((PyObject *)__pyx_v_10amulet_nbt_16_string_encoding_8encoding__mutf8_encoding); - __Pyx_DECREF_SET(__pyx_v_10amulet_nbt_16_string_encoding_8encoding__mutf8_encoding, ((struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding *)__pyx_t_2)); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - - /* "amulet_nbt/_string_encoding/encoding.pyx":21 - * - * cdef StringEncoding _mutf8_encoding = StringEncoding() - * _mutf8_encoding.decode_cpp = mutf8_to_utf8 # <<<<<<<<<<<<<< - * _mutf8_encoding.encode_cpp = utf8_to_mutf8 - * mutf8_encoding = _mutf8_encoding - */ - __pyx_v_10amulet_nbt_16_string_encoding_8encoding__mutf8_encoding->decode_cpp = mutf8_to_utf8; - - /* "amulet_nbt/_string_encoding/encoding.pyx":22 - * cdef StringEncoding _mutf8_encoding = StringEncoding() - * _mutf8_encoding.decode_cpp = mutf8_to_utf8 - * _mutf8_encoding.encode_cpp = utf8_to_mutf8 # <<<<<<<<<<<<<< - * mutf8_encoding = _mutf8_encoding - * - */ - __pyx_v_10amulet_nbt_16_string_encoding_8encoding__mutf8_encoding->encode_cpp = utf8_to_mutf8; - - /* "amulet_nbt/_string_encoding/encoding.pyx":23 - * _mutf8_encoding.decode_cpp = mutf8_to_utf8 - * _mutf8_encoding.encode_cpp = utf8_to_mutf8 - * mutf8_encoding = _mutf8_encoding # <<<<<<<<<<<<<< - * - * cdef StringEncoding _utf8_encoding = StringEncoding() - */ - if (PyDict_SetItem(__pyx_d, __pyx_n_s_mutf8_encoding, ((PyObject *)__pyx_v_10amulet_nbt_16_string_encoding_8encoding__mutf8_encoding)) < 0) __PYX_ERR(1, 23, __pyx_L1_error) - - /* "amulet_nbt/_string_encoding/encoding.pyx":25 - * mutf8_encoding = _mutf8_encoding - * - * cdef StringEncoding _utf8_encoding = StringEncoding() # <<<<<<<<<<<<<< - * _utf8_encoding.decode_cpp = utf8_to_utf8 - * _utf8_encoding.encode_cpp = utf8_to_utf8 - */ - __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 25, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_XGOTREF((PyObject *)__pyx_v_10amulet_nbt_16_string_encoding_8encoding__utf8_encoding); - __Pyx_DECREF_SET(__pyx_v_10amulet_nbt_16_string_encoding_8encoding__utf8_encoding, ((struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding *)__pyx_t_2)); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - - /* "amulet_nbt/_string_encoding/encoding.pyx":26 - * - * cdef StringEncoding _utf8_encoding = StringEncoding() - * _utf8_encoding.decode_cpp = utf8_to_utf8 # <<<<<<<<<<<<<< - * _utf8_encoding.encode_cpp = utf8_to_utf8 - * utf8_encoding = _utf8_encoding - */ - __pyx_v_10amulet_nbt_16_string_encoding_8encoding__utf8_encoding->decode_cpp = utf8_to_utf8; - - /* "amulet_nbt/_string_encoding/encoding.pyx":27 - * cdef StringEncoding _utf8_encoding = StringEncoding() - * _utf8_encoding.decode_cpp = utf8_to_utf8 - * _utf8_encoding.encode_cpp = utf8_to_utf8 # <<<<<<<<<<<<<< - * utf8_encoding = _utf8_encoding - * - */ - __pyx_v_10amulet_nbt_16_string_encoding_8encoding__utf8_encoding->encode_cpp = utf8_to_utf8; - - /* "amulet_nbt/_string_encoding/encoding.pyx":28 - * _utf8_encoding.decode_cpp = utf8_to_utf8 - * _utf8_encoding.encode_cpp = utf8_to_utf8 - * utf8_encoding = _utf8_encoding # <<<<<<<<<<<<<< - * - * cdef StringEncoding _utf8_escape_encoding = StringEncoding() - */ - if (PyDict_SetItem(__pyx_d, __pyx_n_s_utf8_encoding, ((PyObject *)__pyx_v_10amulet_nbt_16_string_encoding_8encoding__utf8_encoding)) < 0) __PYX_ERR(1, 28, __pyx_L1_error) - - /* "amulet_nbt/_string_encoding/encoding.pyx":30 - * utf8_encoding = _utf8_encoding - * - * cdef StringEncoding _utf8_escape_encoding = StringEncoding() # <<<<<<<<<<<<<< - * _utf8_escape_encoding.decode_cpp = utf8_escape_to_utf8 - * _utf8_escape_encoding.encode_cpp = utf8_to_utf8_escape - */ - __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_10amulet_nbt_16_string_encoding_8encoding_StringEncoding)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 30, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_XGOTREF((PyObject *)__pyx_v_10amulet_nbt_16_string_encoding_8encoding__utf8_escape_encoding); - __Pyx_DECREF_SET(__pyx_v_10amulet_nbt_16_string_encoding_8encoding__utf8_escape_encoding, ((struct __pyx_obj_10amulet_nbt_16_string_encoding_8encoding_StringEncoding *)__pyx_t_2)); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - - /* "amulet_nbt/_string_encoding/encoding.pyx":31 - * - * cdef StringEncoding _utf8_escape_encoding = StringEncoding() - * _utf8_escape_encoding.decode_cpp = utf8_escape_to_utf8 # <<<<<<<<<<<<<< - * _utf8_escape_encoding.encode_cpp = utf8_to_utf8_escape - * utf8_escape_encoding = _utf8_escape_encoding - */ - __pyx_v_10amulet_nbt_16_string_encoding_8encoding__utf8_escape_encoding->decode_cpp = utf8_escape_to_utf8; - - /* "amulet_nbt/_string_encoding/encoding.pyx":32 - * cdef StringEncoding _utf8_escape_encoding = StringEncoding() - * _utf8_escape_encoding.decode_cpp = utf8_escape_to_utf8 - * _utf8_escape_encoding.encode_cpp = utf8_to_utf8_escape # <<<<<<<<<<<<<< - * utf8_escape_encoding = _utf8_escape_encoding - */ - __pyx_v_10amulet_nbt_16_string_encoding_8encoding__utf8_escape_encoding->encode_cpp = utf8_to_utf8_escape; - - /* "amulet_nbt/_string_encoding/encoding.pyx":33 - * _utf8_escape_encoding.decode_cpp = utf8_escape_to_utf8 - * _utf8_escape_encoding.encode_cpp = utf8_to_utf8_escape - * utf8_escape_encoding = _utf8_escape_encoding # <<<<<<<<<<<<<< - */ - if (PyDict_SetItem(__pyx_d, __pyx_n_s_utf8_escape_encoding, ((PyObject *)__pyx_v_10amulet_nbt_16_string_encoding_8encoding__utf8_escape_encoding)) < 0) __PYX_ERR(1, 33, __pyx_L1_error) - - /* "amulet_nbt/_string_encoding/encoding.pyx":1 - * # distutils: language = c++ # <<<<<<<<<<<<<< - * # distutils: extra_compile_args = CPPCARGS - * # distutils: sources = [src/amulet_nbt/_string_encoding/_cpp/mutf8.cpp, src/amulet_nbt/_string_encoding/_cpp/utf8.cpp] - */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(1, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /*--- Wrapped vars code ---*/ - - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - if (__pyx_m) { - if (__pyx_d && stringtab_initialized) { - __Pyx_AddTraceback("init amulet_nbt._string_encoding.encoding", __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 amulet_nbt._string_encoding.encoding"); - } - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - #if CYTHON_PEP489_MULTI_PHASE_INIT - return (__pyx_m != NULL) ? 0 : -1; - #elif PY_MAJOR_VERSION >= 3 - return __pyx_m; - #else - return; - #endif -} -/* #### 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 */ -#if CYTHON_FAST_THREAD_STATE -static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { - Py_ssize_t i, n; - n = PyTuple_GET_SIZE(tuple); -#if PY_MAJOR_VERSION >= 3 - for (i=0; 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 */ -#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 */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro)) - return tp->tp_getattro(obj, attr_name); -#if PY_MAJOR_VERSION < 3 - if (likely(tp->tp_getattr)) - return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); -#endif - return PyObject_GetAttr(obj, attr_name); -} -#endif - -/* PyObjectGetAttrStrNoError */ -#if __PYX_LIMITED_VERSION_HEX < 0x030d00A1 -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 >= 0x030d00A1 - (void) PyObject_GetOptionalAttr(obj, attr_name, &result); - return result; -#else -#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1 - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { - return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); - } -#endif - result = __Pyx_PyObject_GetAttrStr(obj, attr_name); - if (unlikely(!result)) { - __Pyx_PyObject_GetAttrStr_ClearAttributeError(); - } - return result; -#endif -} - -/* GetBuiltinName */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name) { - PyObject* result = __Pyx_PyObject_GetAttrStrNoError(__pyx_b, name); - if (unlikely(!result) && !PyErr_Occurred()) { - PyErr_Format(PyExc_NameError, -#if PY_MAJOR_VERSION >= 3 - "name '%U' is not defined", name); -#else - "name '%.200s' is not defined", PyString_AS_STRING(name)); -#endif - } - return result; -} - -/* TupleAndListFromArray */ -#if 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) { - Py_INCREF(__pyx_empty_tuple); - return __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 */ -static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { -#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API - return PyObject_RichCompareBool(s1, s2, equals); -#else - if (s1 == s2) { - return (equals == Py_EQ); - } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { - const char *ps1, *ps2; - Py_ssize_t length = PyBytes_GET_SIZE(s1); - if (length != PyBytes_GET_SIZE(s2)) - return (equals == Py_NE); - ps1 = PyBytes_AS_STRING(s1); - ps2 = PyBytes_AS_STRING(s2); - if (ps1[0] != ps2[0]) { - return (equals == Py_NE); - } else if (length == 1) { - return (equals == Py_EQ); - } else { - int result; -#if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000) - Py_hash_t hash1, hash2; - hash1 = ((PyBytesObject*)s1)->ob_shash; - hash2 = ((PyBytesObject*)s2)->ob_shash; - if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { - return (equals == Py_NE); - } -#endif - result = memcmp(ps1, ps2, (size_t)length); - return (equals == Py_EQ) ? (result == 0) : (result != 0); - } - } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { - return (equals == Py_NE); - } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { - return (equals == Py_NE); - } else { - int result; - PyObject* py_result = PyObject_RichCompare(s1, s2, equals); - if (!py_result) - return -1; - result = __Pyx_PyObject_IsTrue(py_result); - Py_DECREF(py_result); - return result; - } -#endif -} - -/* UnicodeEquals */ -static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { -#if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_LIMITED_API - return PyObject_RichCompareBool(s1, s2, equals); -#else -#if PY_MAJOR_VERSION < 3 - PyObject* owned_ref = NULL; -#endif - int s1_is_unicode, s2_is_unicode; - if (s1 == s2) { - goto return_eq; - } - s1_is_unicode = PyUnicode_CheckExact(s1); - s2_is_unicode = PyUnicode_CheckExact(s2); -#if PY_MAJOR_VERSION < 3 - if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) { - owned_ref = PyUnicode_FromObject(s2); - if (unlikely(!owned_ref)) - return -1; - s2 = owned_ref; - s2_is_unicode = 1; - } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) { - owned_ref = PyUnicode_FromObject(s1); - if (unlikely(!owned_ref)) - return -1; - s1 = owned_ref; - s1_is_unicode = 1; - } else if (((!s2_is_unicode) & (!s1_is_unicode))) { - return __Pyx_PyBytes_Equals(s1, s2, equals); - } -#endif - if (s1_is_unicode & s2_is_unicode) { - Py_ssize_t length; - int kind; - void *data1, *data2; - if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) - return -1; - length = __Pyx_PyUnicode_GET_LENGTH(s1); - if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { - goto return_ne; - } -#if CYTHON_USE_UNICODE_INTERNALS - { - Py_hash_t hash1, hash2; - #if CYTHON_PEP393_ENABLED - hash1 = ((PyASCIIObject*)s1)->hash; - hash2 = ((PyASCIIObject*)s2)->hash; - #else - hash1 = ((PyUnicodeObject*)s1)->hash; - hash2 = ((PyUnicodeObject*)s2)->hash; - #endif - if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { - goto return_ne; - } - } -#endif - kind = __Pyx_PyUnicode_KIND(s1); - if (kind != __Pyx_PyUnicode_KIND(s2)) { - goto return_ne; - } - data1 = __Pyx_PyUnicode_DATA(s1); - data2 = __Pyx_PyUnicode_DATA(s2); - if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { - goto return_ne; - } else if (length == 1) { - goto return_eq; - } else { - int result = memcmp(data1, data2, (size_t)(length * kind)); - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_EQ) ? (result == 0) : (result != 0); - } - } else if ((s1 == Py_None) & s2_is_unicode) { - goto return_ne; - } else if ((s2 == Py_None) & s1_is_unicode) { - goto return_ne; - } else { - int result; - PyObject* py_result = PyObject_RichCompare(s1, s2, equals); - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - if (!py_result) - return -1; - result = __Pyx_PyObject_IsTrue(py_result); - Py_DECREF(py_result); - return result; - } -return_eq: - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_EQ); -return_ne: - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_NE); -#endif -} - -/* fastcall */ -#if CYTHON_METH_FASTCALL -static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s) -{ - Py_ssize_t i, n = PyTuple_GET_SIZE(kwnames); - for (i = 0; i < n; i++) - { - if (s == PyTuple_GET_ITEM(kwnames, i)) return kwvalues[i]; - } - for (i = 0; i < n; i++) - { - int eq = __Pyx_PyUnicode_Equals(s, PyTuple_GET_ITEM(kwnames, i), 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_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues) { - Py_ssize_t i, nkwargs = PyTuple_GET_SIZE(kwnames); - PyObject *dict; - dict = PyDict_New(); - if (unlikely(!dict)) - return NULL; - for (i=0; i= 3 - "%s() got multiple values for keyword argument '%U'", func_name, kw_name); - #else - "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AsString(kw_name)); - #endif -} - -/* ParseKeywords */ -static int __Pyx_ParseOptionalKeywords( - PyObject *kwds, - PyObject *const *kwvalues, - PyObject **argnames[], - PyObject *kwds2, - PyObject *values[], - Py_ssize_t num_pos_args, - const char* function_name) -{ - PyObject *key = 0, *value = 0; - Py_ssize_t pos = 0; - PyObject*** name; - PyObject*** first_kw_arg = argnames + num_pos_args; - int kwds_is_tuple = CYTHON_METH_FASTCALL && likely(PyTuple_Check(kwds)); - while (1) { - Py_XDECREF(key); key = NULL; - Py_XDECREF(value); value = NULL; - if (kwds_is_tuple) { - Py_ssize_t size; -#if CYTHON_ASSUME_SAFE_MACROS - size = PyTuple_GET_SIZE(kwds); -#else - size = PyTuple_Size(kwds); - if (size < 0) goto bad; -#endif - if (pos >= size) break; -#if CYTHON_AVOID_BORROWED_REFS - key = __Pyx_PySequence_ITEM(kwds, pos); - if (!key) goto bad; -#elif CYTHON_ASSUME_SAFE_MACROS - key = PyTuple_GET_ITEM(kwds, pos); -#else - key = PyTuple_GetItem(kwds, pos); - if (!key) goto bad; -#endif - value = kwvalues[pos]; - pos++; - } - else - { - if (!PyDict_Next(kwds, &pos, &key, &value)) break; -#if CYTHON_AVOID_BORROWED_REFS - Py_INCREF(key); -#endif - } - name = first_kw_arg; - while (*name && (**name != key)) name++; - if (*name) { - values[name-argnames] = value; -#if CYTHON_AVOID_BORROWED_REFS - Py_INCREF(value); - Py_DECREF(key); -#endif - key = NULL; - value = NULL; - continue; - } -#if !CYTHON_AVOID_BORROWED_REFS - Py_INCREF(key); -#endif - Py_INCREF(value); - name = first_kw_arg; - #if PY_MAJOR_VERSION < 3 - if (likely(PyString_Check(key))) { - while (*name) { - if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) - && _PyString_Eq(**name, key)) { - values[name-argnames] = value; -#if CYTHON_AVOID_BORROWED_REFS - value = NULL; -#endif - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - if ((**argname == key) || ( - (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) - && _PyString_Eq(**argname, key))) { - goto arg_passed_twice; - } - argname++; - } - } - } else - #endif - if (likely(PyUnicode_Check(key))) { - while (*name) { - int cmp = ( - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : - #endif - PyUnicode_Compare(**name, key) - ); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) { - values[name-argnames] = value; -#if CYTHON_AVOID_BORROWED_REFS - value = NULL; -#endif - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - int cmp = (**argname == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : - #endif - PyUnicode_Compare(**argname, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) goto arg_passed_twice; - argname++; - } - } - } else - goto invalid_keyword_type; - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; - } - } - Py_XDECREF(key); - Py_XDECREF(value); - return 0; -arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, key); - goto bad; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%.200s() keywords must be strings", function_name); - goto bad; -invalid_keyword: - #if PY_MAJOR_VERSION < 3 - PyErr_Format(PyExc_TypeError, - "%.200s() got an unexpected keyword argument '%.200s'", - function_name, PyString_AsString(key)); - #else - PyErr_Format(PyExc_TypeError, - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif -bad: - Py_XDECREF(key); - Py_XDECREF(value); - return -1; -} - -/* RaiseArgTupleInvalid */ -static void __Pyx_RaiseArgtupleInvalid( - const char* func_name, - int exact, - Py_ssize_t num_min, - Py_ssize_t num_max, - Py_ssize_t num_found) -{ - Py_ssize_t num_expected; - const char *more_or_less; - if (num_found < num_min) { - num_expected = num_min; - more_or_less = "at least"; - } else { - num_expected = num_max; - more_or_less = "at most"; - } - if (exact) { - more_or_less = "exactly"; - } - PyErr_Format(PyExc_TypeError, - "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", - func_name, more_or_less, num_expected, - (num_expected == 1) ? "" : "s", num_found); -} - -/* ArgTypeTest */ -static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) -{ - __Pyx_TypeName type_name; - __Pyx_TypeName obj_type_name; - if (unlikely(!type)) { - PyErr_SetString(PyExc_SystemError, "Missing type object"); - return 0; - } - else if (exact) { - #if PY_MAJOR_VERSION == 2 - if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; - #endif - } - else { - if (likely(__Pyx_TypeCheck(obj, type))) return 1; - } - type_name = __Pyx_PyType_GetName(type); - obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); - PyErr_Format(PyExc_TypeError, - "Argument '%.200s' has incorrect type (expected " __Pyx_FMT_TYPENAME - ", got " __Pyx_FMT_TYPENAME ")", name, type_name, obj_type_name); - __Pyx_DECREF_TypeName(type_name); - __Pyx_DECREF_TypeName(obj_type_name); - return 0; -} - -/* KeywordStringCheck */ -static int __Pyx_CheckKeywordStrings( - PyObject *kw, - const char* function_name, - int kw_allowed) -{ - PyObject* key = 0; - Py_ssize_t pos = 0; -#if CYTHON_COMPILING_IN_PYPY - if (!kw_allowed && PyDict_Next(kw, &pos, &key, 0)) - goto invalid_keyword; - return 1; -#else - if (CYTHON_METH_FASTCALL && likely(PyTuple_Check(kw))) { - Py_ssize_t kwsize; -#if CYTHON_ASSUME_SAFE_MACROS - kwsize = PyTuple_GET_SIZE(kw); -#else - kwsize = PyTuple_Size(kw); - if (kwsize < 0) return 0; -#endif - if (unlikely(kwsize == 0)) - return 1; - if (!kw_allowed) { -#if CYTHON_ASSUME_SAFE_MACROS - key = PyTuple_GET_ITEM(kw, 0); -#else - key = PyTuple_GetItem(kw, pos); - if (!key) return 0; -#endif - goto invalid_keyword; - } -#if PY_VERSION_HEX < 0x03090000 - for (pos = 0; pos < kwsize; pos++) { -#if CYTHON_ASSUME_SAFE_MACROS - key = PyTuple_GET_ITEM(kw, pos); -#else - key = PyTuple_GetItem(kw, pos); - if (!key) return 0; -#endif - if (unlikely(!PyUnicode_Check(key))) - goto invalid_keyword_type; - } -#endif - return 1; - } - while (PyDict_Next(kw, &pos, &key, 0)) { - #if PY_MAJOR_VERSION < 3 - if (unlikely(!PyString_Check(key))) - #endif - if (unlikely(!PyUnicode_Check(key))) - goto invalid_keyword_type; - } - if (!kw_allowed && unlikely(key)) - goto invalid_keyword; - return 1; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%.200s() keywords must be strings", function_name); - return 0; -#endif -invalid_keyword: - #if PY_MAJOR_VERSION < 3 - PyErr_Format(PyExc_TypeError, - "%.200s() got an unexpected keyword argument '%.200s'", - function_name, PyString_AsString(key)); - #else - PyErr_Format(PyExc_TypeError, - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif - return 0; -} - -/* RaiseException */ -#if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { - __Pyx_PyThreadState_declare - CYTHON_UNUSED_VAR(cause); - Py_XINCREF(type); - if (!value || value == Py_None) - value = NULL; - else - Py_INCREF(value); - if (!tb || tb == Py_None) - tb = NULL; - else { - Py_INCREF(tb); - if (!PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; - } - } - if (PyType_Check(type)) { -#if CYTHON_COMPILING_IN_PYPY - if (!value) { - Py_INCREF(Py_None); - value = Py_None; - } -#endif - PyErr_NormalizeException(&type, &value, &tb); - } else { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto raise_error; - } - value = type; - type = (PyObject*) Py_TYPE(type); - Py_INCREF(type); - if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto raise_error; - } - } - __Pyx_PyThreadState_assign - __Pyx_ErrRestore(type, value, tb); - return; -raise_error: - Py_XDECREF(value); - Py_XDECREF(type); - Py_XDECREF(tb); - return; -} -#else -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { - PyObject* owned_instance = NULL; - if (tb == Py_None) { - tb = 0; - } else if (tb && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto bad; - } - if (value == Py_None) - value = 0; - if (PyExceptionInstance_Check(type)) { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto bad; - } - value = type; - type = (PyObject*) Py_TYPE(value); - } else if (PyExceptionClass_Check(type)) { - PyObject *instance_class = NULL; - if (value && PyExceptionInstance_Check(value)) { - instance_class = (PyObject*) Py_TYPE(value); - if (instance_class != type) { - int is_subclass = PyObject_IsSubclass(instance_class, type); - if (!is_subclass) { - instance_class = NULL; - } else if (unlikely(is_subclass == -1)) { - goto bad; - } else { - type = instance_class; - } - } - } - if (!instance_class) { - PyObject *args; - if (!value) - args = PyTuple_New(0); - else if (PyTuple_Check(value)) { - Py_INCREF(value); - args = value; - } else - args = PyTuple_Pack(1, value); - if (!args) - goto bad; - owned_instance = PyObject_Call(type, args, NULL); - Py_DECREF(args); - if (!owned_instance) - goto bad; - value = owned_instance; - if (!PyExceptionInstance_Check(value)) { - PyErr_Format(PyExc_TypeError, - "calling %R should have returned an instance of " - "BaseException, not %R", - type, Py_TYPE(value)); - goto bad; - } - } - } else { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto bad; - } - if (cause) { - PyObject *fixed_cause; - if (cause == Py_None) { - fixed_cause = NULL; - } else if (PyExceptionClass_Check(cause)) { - fixed_cause = PyObject_CallObject(cause, NULL); - if (fixed_cause == NULL) - goto bad; - } else if (PyExceptionInstance_Check(cause)) { - fixed_cause = cause; - Py_INCREF(fixed_cause); - } else { - PyErr_SetString(PyExc_TypeError, - "exception causes must derive from " - "BaseException"); - goto bad; - } - PyException_SetCause(value, fixed_cause); - } - PyErr_SetObject(type, value); - if (tb) { - #if 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; -} -#endif - -/* FixUpExtensionType */ -#if CYTHON_USE_TYPE_SPECS -static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type) { -#if PY_VERSION_HEX > 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API - CYTHON_UNUSED_VAR(spec); - CYTHON_UNUSED_VAR(type); -#else - const PyType_Slot *slot = spec->slots; - while (slot && slot->slot && slot->slot != Py_tp_members) - slot++; - if (slot && slot->slot == Py_tp_members) { - int changed = 0; -#if !(PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON) - const -#endif - PyMemberDef *memb = (PyMemberDef*) slot->pfunc; - while (memb && memb->name) { - if (memb->name[0] == '_' && memb->name[1] == '_') { -#if PY_VERSION_HEX < 0x030900b1 - 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); -#if PY_VERSION_HEX >= 0x030800b4 - type->tp_vectorcall_offset = memb->offset; -#else - type->tp_print = (printfunc) memb->offset; -#endif - changed = 1; - } -#endif -#else - if ((0)); -#endif -#if PY_VERSION_HEX <= 0x030900b1 && CYTHON_COMPILING_IN_CPYTHON - 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; - if (unlikely(PyDict_SetItem(type->tp_dict, PyDescr_NAME(descr), descr) < 0)) { - Py_DECREF(descr); - return -1; - } - Py_DECREF(descr); - changed = 1; - } -#endif - } - memb++; - } - if (changed) - PyType_Modified(type); - } -#endif - return 0; -} -#endif - -/* PyFunctionFastCall */ -#if CYTHON_FAST_PYCALL && !CYTHON_VECTORCALL -static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, - PyObject *globals) { - PyFrameObject *f; - PyThreadState *tstate = __Pyx_PyThreadState_Current; - PyObject **fastlocals; - Py_ssize_t i; - PyObject *result; - assert(globals != NULL); - /* XXX Perhaps we should create a specialized - PyFrame_New() that doesn't take locals, but does - take builtins without sanity checking them. - */ - assert(tstate != NULL); - f = PyFrame_New(tstate, co, globals, NULL); - if (f == NULL) { - return NULL; - } - fastlocals = __Pyx_PyFrame_GetLocalsplus(f); - for (i = 0; i < na; i++) { - Py_INCREF(*args); - fastlocals[i] = *args++; - } - result = PyEval_EvalFrameEx(f,0); - ++tstate->recursion_depth; - Py_DECREF(f); - --tstate->recursion_depth; - return result; -} -static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) { - PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); - PyObject *globals = PyFunction_GET_GLOBALS(func); - PyObject *argdefs = PyFunction_GET_DEFAULTS(func); - PyObject *closure; -#if PY_MAJOR_VERSION >= 3 - PyObject *kwdefs; -#endif - PyObject *kwtuple, **k; - PyObject **d; - Py_ssize_t nd; - Py_ssize_t nk; - PyObject *result; - assert(kwargs == NULL || PyDict_Check(kwargs)); - nk = kwargs ? PyDict_Size(kwargs) : 0; - #if PY_MAJOR_VERSION < 3 - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) { - return NULL; - } - #else - if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) { - return NULL; - } - #endif - if ( -#if PY_MAJOR_VERSION >= 3 - co->co_kwonlyargcount == 0 && -#endif - likely(kwargs == NULL || nk == 0) && - co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { - if (argdefs == NULL && co->co_argcount == nargs) { - result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); - goto done; - } - else if (nargs == 0 && argdefs != NULL - && co->co_argcount == Py_SIZE(argdefs)) { - /* function called with no arguments, but all parameters have - a default value: use default values as arguments .*/ - args = &PyTuple_GET_ITEM(argdefs, 0); - result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); - goto done; - } - } - if (kwargs != NULL) { - Py_ssize_t pos, i; - kwtuple = PyTuple_New(2 * nk); - if (kwtuple == NULL) { - result = NULL; - goto done; - } - k = &PyTuple_GET_ITEM(kwtuple, 0); - pos = i = 0; - while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { - Py_INCREF(k[i]); - Py_INCREF(k[i+1]); - i += 2; - } - nk = i / 2; - } - else { - kwtuple = NULL; - k = NULL; - } - closure = PyFunction_GET_CLOSURE(func); -#if PY_MAJOR_VERSION >= 3 - kwdefs = PyFunction_GET_KW_DEFAULTS(func); -#endif - if (argdefs != NULL) { - d = &PyTuple_GET_ITEM(argdefs, 0); - nd = Py_SIZE(argdefs); - } - else { - d = NULL; - nd = 0; - } -#if PY_MAJOR_VERSION >= 3 - result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, - args, (int)nargs, - k, (int)nk, - d, (int)nd, kwdefs, closure); -#else - result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, - args, (int)nargs, - k, (int)nk, - d, (int)nd, closure); -#endif - Py_XDECREF(kwtuple); -done: - Py_LeaveRecursiveCall(); - return result; -} -#endif - -/* PyObjectCall */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { - PyObject *result; - ternaryfunc call = Py_TYPE(func)->tp_call; - if (unlikely(!call)) - return PyObject_Call(func, arg, kw); - #if PY_MAJOR_VERSION < 3 - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - #else - if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) - return NULL; - #endif - result = (*call)(func, arg, kw); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - } - return result; -} -#endif - -/* PyObjectCallMethO */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { - PyObject *self, *result; - PyCFunction cfunc; - cfunc = __Pyx_CyOrPyCFunction_GET_FUNCTION(func); - self = __Pyx_CyOrPyCFunction_GET_SELF(func); - #if PY_MAJOR_VERSION < 3 - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - #else - if (unlikely(Py_EnterRecursiveCall(" while calling a Python object"))) - return NULL; - #endif - 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 **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 -static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **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 PY_VERSION_HEX < 0x030800B1 - #if CYTHON_FAST_PYCCALL - if (PyCFunction_Check(func)) { - if (kwargs) { - return _PyCFunction_FastCallDict(func, args, nargs, kwargs); - } else { - return _PyCFunction_FastCallKeywords(func, args, nargs, NULL); - } - } - #if PY_VERSION_HEX >= 0x030700A1 - if (!kwargs && __Pyx_IS_TYPE(func, &PyMethodDescr_Type)) { - return _PyMethodDescr_FastCallKeywords(func, args, nargs, NULL); - } - #endif - #endif - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs); - } - #endif - #endif - if (kwargs == NULL) { - #if CYTHON_VECTORCALL - #if PY_VERSION_HEX < 0x03090000 - vectorcallfunc f = _PyVectorcall_Function(func); - #else - vectorcallfunc f = PyVectorcall_Function(func); - #endif - if (f) { - return f(func, args, (size_t)nargs, NULL); - } - #elif defined(__Pyx_CyFunction_USED) && CYTHON_BACKPORT_VECTORCALL - if (__Pyx_CyFunction_CheckExact(func)) { - __pyx_vectorcallfunc f = __Pyx_CyFunction_func_vectorcall(func); - if (f) return f(func, args, (size_t)nargs, NULL); - } - #endif - } - if (nargs == 0) { - return __Pyx_PyObject_Call(func, __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 -} - -/* PyObjectCallNoArg */ -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); -} - -/* PyObjectCallOneArg */ -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); -} - -/* PyObjectGetMethod */ -static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) { - PyObject *attr; -#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP - __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)) -#elif PY_MAJOR_VERSION >= 3 - #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 -#else - #ifdef __Pyx_CyFunction_USED - if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr))) - #else - if (likely(PyFunction_Check(descr))) - #endif -#endif - { - meth_found = 1; - } else { - f = Py_TYPE(descr)->tp_descr_get; - if (f != NULL && PyDescr_IsData(descr)) { - attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); - Py_DECREF(descr); - goto try_unpack; - } - } - } - dictptr = _PyObject_GetDictPtr(obj); - if (dictptr != NULL && (dict = *dictptr) != NULL) { - Py_INCREF(dict); - attr = __Pyx_PyDict_GetItemStr(dict, name); - if (attr != NULL) { - Py_INCREF(attr); - Py_DECREF(dict); - Py_XDECREF(descr); - goto try_unpack; - } - Py_DECREF(dict); - } - if (meth_found) { - *method = descr; - return 1; - } - if (f != NULL) { - attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); - Py_DECREF(descr); - goto try_unpack; - } - if (likely(descr != NULL)) { - *method = descr; - return 0; - } - type_name = __Pyx_PyType_GetName(tp); - PyErr_Format(PyExc_AttributeError, -#if PY_MAJOR_VERSION >= 3 - "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'", - type_name, name); -#else - "'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'", - type_name, PyString_AS_STRING(name)); -#endif - __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; -} - -/* PyObjectCallMethod0 */ -static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) { - PyObject *method = NULL, *result = NULL; - int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); - if (likely(is_method)) { - result = __Pyx_PyObject_CallOneArg(method, obj); - Py_DECREF(method); - return result; - } - if (unlikely(!method)) goto bad; - result = __Pyx_PyObject_CallNoArg(method); - Py_DECREF(method); -bad: - return result; -} - -/* ValidateBasesTuple */ -#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_MACROS - n = PyTuple_GET_SIZE(bases); -#else - n = PyTuple_Size(bases); - if (n < 0) return -1; -#endif - for (i = 1; i < n; i++) - { -#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 - PyTypeObject *b; -#if PY_MAJOR_VERSION < 3 - if (PyClass_Check(b0)) - { - PyErr_Format(PyExc_TypeError, "base class '%.200s' is an old-style class", - PyString_AS_STRING(((PyClassObject*)b0)->cl_name)); -#if CYTHON_AVOID_BORROWED_REFS - Py_DECREF(b0); -#endif - return -1; - } -#endif - b = (PyTypeObject*) b0; - if (!__Pyx_PyType_HasFeature(b, Py_TPFLAGS_HEAPTYPE)) - { - __Pyx_TypeName b_name = __Pyx_PyType_GetName(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 || CYTHON_COMPILING_IN_PYPY - 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_GetName(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 || CYTHON_COMPILING_IN_PYPY) - 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 */ -static int __Pyx_PyType_Ready(PyTypeObject *t) { -#if CYTHON_USE_TYPE_SPECS || !(CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API) || 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; - 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 PY_VERSION_HEX >= 0x03050000 && !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 PY_VERSION_HEX >= 0x030700a1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM+0 >= 0x07030400) - gc = PyImport_GetModule(__pyx_kp_u_gc); - #endif - if (unlikely(!gc)) gc = PyImport_Import(__pyx_kp_u_gc); - if (unlikely(!gc)) return -1; - py_status = __Pyx_PyObject_CallMethod0(gc, __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_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 PY_VERSION_HEX >= 0x03050000 && !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_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 -} - -/* PyObject_GenericGetAttrNoDict */ -#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 -static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) { - __Pyx_TypeName type_name = __Pyx_PyType_GetName(tp); - PyErr_Format(PyExc_AttributeError, -#if PY_MAJOR_VERSION >= 3 - "'" __Pyx_FMT_TYPENAME "' object has no attribute '%U'", - type_name, attr_name); -#else - "'" __Pyx_FMT_TYPENAME "' object has no attribute '%.400s'", - type_name, PyString_AS_STRING(attr_name)); -#endif - __Pyx_DECREF_TypeName(type_name); - return NULL; -} -static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) { - PyObject *descr; - PyTypeObject *tp = Py_TYPE(obj); - if (unlikely(!PyString_Check(attr_name))) { - return PyObject_GenericGetAttr(obj, attr_name); - } - assert(!tp->tp_dictoffset); - descr = _PyType_Lookup(tp, attr_name); - if (unlikely(!descr)) { - return __Pyx_RaiseGenericGetAttributeError(tp, attr_name); - } - Py_INCREF(descr); - #if PY_MAJOR_VERSION < 3 - if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS))) - #endif - { - descrgetfunc f = Py_TYPE(descr)->tp_descr_get; - if (unlikely(f)) { - PyObject *res = f(descr, obj, (PyObject *)tp); - Py_DECREF(descr); - return res; - } - } - return descr; -} -#endif - -/* PyObject_GenericGetAttr */ -#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 -static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) { - if (unlikely(Py_TYPE(obj)->tp_dictoffset)) { - return PyObject_GenericGetAttr(obj, attr_name); - } - return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name); -} -#endif - -/* SetupReduce */ -#if !CYTHON_COMPILING_IN_LIMITED_API -static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) { - int ret; - PyObject *name_attr; - name_attr = __Pyx_PyObject_GetAttrStrNoError(meth, __pyx_n_s_name); - if (likely(name_attr)) { - ret = PyObject_RichCompareBool(name_attr, name, Py_EQ); - } else { - ret = -1; - } - if (unlikely(ret < 0)) { - PyErr_Clear(); - ret = 0; - } - Py_XDECREF(name_attr); - return ret; -} -static int __Pyx_setup_reduce(PyObject* type_obj) { - int ret = 0; - PyObject *object_reduce = NULL; - PyObject *object_getstate = NULL; - PyObject *object_reduce_ex = NULL; - PyObject *reduce = NULL; - PyObject *reduce_ex = NULL; - PyObject *reduce_cython = NULL; - PyObject *setstate = NULL; - PyObject *setstate_cython = NULL; - PyObject *getstate = NULL; -#if CYTHON_USE_PYTYPE_LOOKUP - getstate = _PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate); -#else - getstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_getstate); - if (!getstate && PyErr_Occurred()) { - goto __PYX_BAD; - } -#endif - if (getstate) { -#if CYTHON_USE_PYTYPE_LOOKUP - object_getstate = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_getstate); -#else - object_getstate = __Pyx_PyObject_GetAttrStrNoError((PyObject*)&PyBaseObject_Type, __pyx_n_s_getstate); - if (!object_getstate && PyErr_Occurred()) { - goto __PYX_BAD; - } -#endif - if (object_getstate != getstate) { - goto __PYX_GOOD; - } - } -#if CYTHON_USE_PYTYPE_LOOKUP - object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; -#else - object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; -#endif - reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD; - if (reduce_ex == object_reduce_ex) { -#if CYTHON_USE_PYTYPE_LOOKUP - object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD; -#else - object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD; -#endif - reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD; - if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) { - reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython); - if (likely(reduce_cython)) { - ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; - ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; - } else if (reduce == object_reduce || PyErr_Occurred()) { - goto __PYX_BAD; - } - setstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate); - if (!setstate) PyErr_Clear(); - if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) { - setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython); - if (likely(setstate_cython)) { - ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; - ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; - } else if (!setstate || PyErr_Occurred()) { - goto __PYX_BAD; - } - } - PyType_Modified((PyTypeObject*)type_obj); - } - } - goto __PYX_GOOD; -__PYX_BAD: - if (!PyErr_Occurred()) { - __Pyx_TypeName type_obj_name = - __Pyx_PyType_GetName((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; -} -#endif - -/* FetchSharedCythonModule */ -static PyObject *__Pyx_FetchSharedCythonABIModule(void) { - return __Pyx_PyImport_AddModuleRef((char*) __PYX_ABI_MODULE_NAME); -} - -/* FetchCommonType */ -static int __Pyx_VerifyCachedType(PyObject *cached_type, - const char *name, - Py_ssize_t basicsize, - Py_ssize_t expected_basicsize) { - if (!PyType_Check(cached_type)) { - PyErr_Format(PyExc_TypeError, - "Shared Cython type %.200s is not a type object", name); - return -1; - } - if (basicsize != expected_basicsize) { - PyErr_Format(PyExc_TypeError, - "Shared Cython type %.200s has the wrong size, try recompiling", - name); - return -1; - } - return 0; -} -#if !CYTHON_USE_TYPE_SPECS -static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { - PyObject* abi_module; - const char* object_name; - PyTypeObject *cached_type = NULL; - abi_module = __Pyx_FetchSharedCythonABIModule(); - if (!abi_module) return NULL; - object_name = strrchr(type->tp_name, '.'); - object_name = object_name ? object_name+1 : type->tp_name; - cached_type = (PyTypeObject*) PyObject_GetAttrString(abi_module, object_name); - if (cached_type) { - if (__Pyx_VerifyCachedType( - (PyObject *)cached_type, - object_name, - cached_type->tp_basicsize, - type->tp_basicsize) < 0) { - goto bad; - } - goto done; - } - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; - PyErr_Clear(); - if (PyType_Ready(type) < 0) goto bad; - if (PyObject_SetAttrString(abi_module, object_name, (PyObject *)type) < 0) - goto bad; - Py_INCREF(type); - cached_type = type; -done: - Py_DECREF(abi_module); - return cached_type; -bad: - Py_XDECREF(cached_type); - cached_type = NULL; - goto done; -} -#else -static PyTypeObject *__Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases) { - PyObject *abi_module, *cached_type = NULL; - const char* object_name = strrchr(spec->name, '.'); - object_name = object_name ? object_name+1 : spec->name; - abi_module = __Pyx_FetchSharedCythonABIModule(); - if (!abi_module) return NULL; - cached_type = PyObject_GetAttrString(abi_module, object_name); - if (cached_type) { - Py_ssize_t basicsize; -#if CYTHON_COMPILING_IN_LIMITED_API - PyObject *py_basicsize; - py_basicsize = PyObject_GetAttrString(cached_type, "__basicsize__"); - if (unlikely(!py_basicsize)) goto bad; - basicsize = PyLong_AsSsize_t(py_basicsize); - Py_DECREF(py_basicsize); - py_basicsize = 0; - if (unlikely(basicsize == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; -#else - basicsize = likely(PyType_Check(cached_type)) ? ((PyTypeObject*) cached_type)->tp_basicsize : -1; -#endif - if (__Pyx_VerifyCachedType( - cached_type, - object_name, - basicsize, - spec->basicsize) < 0) { - goto bad; - } - goto done; - } - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; - PyErr_Clear(); - CYTHON_UNUSED_VAR(module); - cached_type = __Pyx_PyType_FromModuleAndSpec(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; - if (PyObject_SetAttrString(abi_module, object_name, cached_type) < 0) goto bad; -done: - Py_DECREF(abi_module); - assert(cached_type == NULL || PyType_Check(cached_type)); - return (PyTypeObject *) cached_type; -bad: - Py_XDECREF(cached_type); - cached_type = NULL; - goto done; -} -#endif - -/* PyVectorcallFastCallDict */ -#if CYTHON_METH_FASTCALL -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, pos; - size_t j; - PyObject *key, *value; - unsigned long keys_are_strings; - Py_ssize_t nkw = PyDict_GET_SIZE(kw); - 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 = i = 0; - keys_are_strings = Py_TPFLAGS_UNICODE_SUBCLASS; - while (PyDict_Next(kw, &pos, &key, &value)) { - keys_are_strings &= Py_TYPE(key)->tp_flags; - Py_INCREF(key); - Py_INCREF(value); - PyTuple_SET_ITEM(kwnames, i, key); - 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: - 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) -{ - if (likely(kw == NULL) || PyDict_GET_SIZE(kw) == 0) { - return vc(func, args, nargs, NULL); - } - return __Pyx_PyVectorcall_FastCallDict_kw(func, vc, args, nargs, kw); -} -#endif - -/* CythonFunctionShared */ -#if CYTHON_COMPILING_IN_LIMITED_API -static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void *cfunc) { - 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; -} -#else -static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void *cfunc) { - 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(__pyx_CyFunctionObject *op, void *closure) -{ - CYTHON_UNUSED_VAR(closure); - 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) { -#if PY_MAJOR_VERSION >= 3 - op->func_doc = PyUnicode_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); -#else - op->func_doc = PyString_FromString(((PyCFunctionObject*)op)->m_ml->ml_doc); -#endif - 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 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_Py_XDECREF_SET(op->func_doc, value); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, void *context) -{ - CYTHON_UNUSED_VAR(context); - if (unlikely(op->func_name == NULL)) { -#if CYTHON_COMPILING_IN_LIMITED_API - op->func_name = PyObject_GetAttrString(op->func, "__name__"); -#elif PY_MAJOR_VERSION >= 3 - op->func_name = PyUnicode_InternFromString(((PyCFunctionObject*)op)->m_ml->ml_name); -#else - op->func_name = PyString_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 int -__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, void *context) -{ - CYTHON_UNUSED_VAR(context); -#if PY_MAJOR_VERSION >= 3 - if (unlikely(value == NULL || !PyUnicode_Check(value))) -#else - if (unlikely(value == NULL || !PyString_Check(value))) -#endif - { - PyErr_SetString(PyExc_TypeError, - "__name__ must be set to a string object"); - return -1; - } - Py_INCREF(value); - __Pyx_Py_XDECREF_SET(op->func_name, value); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, void *context) -{ - CYTHON_UNUSED_VAR(context); - Py_INCREF(op->func_qualname); - return op->func_qualname; -} -static int -__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, void *context) -{ - CYTHON_UNUSED_VAR(context); -#if PY_MAJOR_VERSION >= 3 - if (unlikely(value == NULL || !PyUnicode_Check(value))) -#else - if (unlikely(value == NULL || !PyString_Check(value))) -#endif - { - PyErr_SetString(PyExc_TypeError, - "__qualname__ must be set to a string object"); - return -1; - } - Py_INCREF(value); - __Pyx_Py_XDECREF_SET(op->func_qualname, value); - return 0; -} -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; -} -static int -__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, void *context) -{ - CYTHON_UNUSED_VAR(context); - if (unlikely(value == NULL)) { - PyErr_SetString(PyExc_TypeError, - "function's dictionary may not be deleted"); - return -1; - } - if (unlikely(!PyDict_Check(value))) { - PyErr_SetString(PyExc_TypeError, - "setting function's dictionary to a non-dict"); - return -1; - } - Py_INCREF(value); - __Pyx_Py_XDECREF_SET(op->func_dict, value); - return 0; -} -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_Py_XDECREF_SET(op->defaults_tuple, value); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, void *context) { - PyObject* result = op->defaults_tuple; - CYTHON_UNUSED_VAR(context); - 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 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_Py_XDECREF_SET(op->defaults_kwdict, value); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, void *context) { - PyObject* result = op->defaults_kwdict; - CYTHON_UNUSED_VAR(context); - 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 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_Py_XDECREF_SET(op->func_annotations, value); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, void *context) { - PyObject* result = op->func_annotations; - CYTHON_UNUSED_VAR(context); - 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_is_coroutine(__pyx_CyFunctionObject *op, void *context) { - int is_coroutine; - CYTHON_UNUSED_VAR(context); - if (op->func_is_coroutine) { - return __Pyx_NewRef(op->func_is_coroutine); - } - is_coroutine = op->flags & __Pyx_CYFUNCTION_COROUTINE; -#if PY_VERSION_HEX >= 0x03050000 - if (is_coroutine) { - PyObject *module, *fromlist, *marker = __pyx_n_s_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_n_s_asyncio_coroutines, NULL, NULL, fromlist, 0); - Py_DECREF(fromlist); - if (unlikely(!module)) goto ignore; - op->func_is_coroutine = __Pyx_PyObject_GetAttrStr(module, marker); - Py_DECREF(module); - if (likely(op->func_is_coroutine)) { - return __Pyx_NewRef(op->func_is_coroutine); - } -ignore: - PyErr_Clear(); - } -#endif - op->func_is_coroutine = __Pyx_PyBool_FromLong(is_coroutine); - return __Pyx_NewRef(op->func_is_coroutine); -} -#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[] = { - {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, - {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, - {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, - {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, - {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, - {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, - {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, - {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, - {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, - {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, - {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, - {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, - {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, - {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, - {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, - {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, - {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, - {(char *) "_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 - {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), 0, 0}, -#endif -#if CYTHON_USE_TYPE_SPECS - {(char *) "__dictoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_dict), READONLY, 0}, -#if CYTHON_METH_FASTCALL -#if CYTHON_BACKPORT_VECTORCALL - {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_vectorcall), READONLY, 0}, -#else -#if !CYTHON_COMPILING_IN_LIMITED_API - {(char *) "__vectorcalloffset__", T_PYSSIZET, offsetof(PyCFunctionObject, vectorcall), READONLY, 0}, -#endif -#endif -#endif -#if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API - {(char *) "__weaklistoffset__", T_PYSSIZET, offsetof(__pyx_CyFunctionObject, func_weakreflist), READONLY, 0}, -#else - {(char *) "__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) -{ - CYTHON_UNUSED_VAR(args); -#if PY_MAJOR_VERSION >= 3 - Py_INCREF(m->func_qualname); - return m->func_qualname; -#else - return PyString_FromString(((PyCFunctionObject*)m)->m_ml->ml_name); -#endif -} -static PyMethodDef __pyx_CyFunction_methods[] = { - {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, - {0, 0, 0, 0} -}; -#if PY_VERSION_HEX < 0x030500A0 || 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 - op->func_dict = NULL; - 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_pyobjects = 0; - op->defaults_size = 0; - op->defaults = NULL; - op->defaults_tuple = NULL; - op->defaults_kwdict = NULL; - op->defaults_getter = NULL; - op->func_annotations = NULL; - 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 - Py_CLEAR(m->func_dict); - Py_CLEAR(m->func_name); - Py_CLEAR(m->func_qualname); - Py_CLEAR(m->func_doc); - Py_CLEAR(m->func_globals); - Py_CLEAR(m->func_code); -#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); - if (m->defaults) { - PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); - int i; - for (i = 0; i < m->defaults_pyobjects; i++) - Py_XDECREF(pydefaults[i]); - PyObject_Free(m->defaults); - m->defaults = NULL; - } - return 0; -} -static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m) -{ - if (__Pyx_CyFunction_weakreflist(m) != NULL) - PyObject_ClearWeakRefs((PyObject *) m); - __Pyx_CyFunction_clear(m); - __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) -{ - Py_VISIT(m->func_closure); -#if CYTHON_COMPILING_IN_LIMITED_API - Py_VISIT(m->func); -#else - Py_VISIT(((PyCFunctionObject*)m)->m_module); -#endif - Py_VISIT(m->func_dict); - Py_VISIT(m->func_name); - Py_VISIT(m->func_qualname); - Py_VISIT(m->func_doc); - Py_VISIT(m->func_globals); - Py_VISIT(m->func_code); -#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); - if (m->defaults) { - PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); - int i; - for (i = 0; i < m->defaults_pyobjects; i++) - Py_VISIT(pydefaults[i]); - } - return 0; -} -static PyObject* -__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) -{ -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromFormat("", - op->func_qualname, (void *)op); -#else - return PyString_FromFormat("", - PyString_AsString(op->func_qualname), (void *)op); -#endif -} -static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) { -#if CYTHON_COMPILING_IN_LIMITED_API - PyObject *f = ((__pyx_CyFunctionObject*)func)->func; - PyObject *py_name = NULL; - 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*)meth)(self, arg, kw); - case METH_NOARGS: - if (likely(kw == NULL || PyDict_Size(kw) == 0)) { -#if CYTHON_ASSUME_SAFE_MACROS - 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); -#if CYTHON_COMPILING_IN_LIMITED_API - py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL); - if (!py_name) return NULL; - PyErr_Format(PyExc_TypeError, - "%.200S() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", - py_name, size); - Py_DECREF(py_name); -#else - PyErr_Format(PyExc_TypeError, - "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", - f->m_ml->ml_name, size); -#endif - return NULL; - } - break; - case METH_O: - if (likely(kw == NULL || PyDict_Size(kw) == 0)) { -#if CYTHON_ASSUME_SAFE_MACROS - 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; - } -#if CYTHON_COMPILING_IN_LIMITED_API - py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL); - if (!py_name) return NULL; - PyErr_Format(PyExc_TypeError, - "%.200S() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", - py_name, size); - Py_DECREF(py_name); -#else - PyErr_Format(PyExc_TypeError, - "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", - f->m_ml->ml_name, size); -#endif - return NULL; - } - break; - default: - PyErr_SetString(PyExc_SystemError, "Bad call flags for CyFunction"); - return NULL; - } -#if CYTHON_COMPILING_IN_LIMITED_API - py_name = __Pyx_CyFunction_get_name((__pyx_CyFunctionObject*)func, NULL); - if (!py_name) return NULL; - PyErr_Format(PyExc_TypeError, "%.200S() takes no keyword arguments", - py_name); - Py_DECREF(py_name); -#else - PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", - f->m_ml->ml_name); -#endif - 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 - __pyx_vectorcallfunc vc = __Pyx_CyFunction_func_vectorcall(cyfunc); - if (vc) { -#if CYTHON_ASSUME_SAFE_MACROS - 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_MACROS - 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); -#if PY_MAJOR_VERSION > 2 - PyErr_Format(PyExc_TypeError, - "unbound method %.200S() needs an argument", - cyfunc->func_qualname); -#else - PyErr_SetString(PyExc_TypeError, - "unbound method needs an argument"); -#endif - return NULL; - } - result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw); - Py_DECREF(new_args); - } else { - result = __Pyx_CyFunction_Call(func, args, kw); - } - return result; -} -#if CYTHON_METH_FASTCALL -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)) { - PyErr_Format(PyExc_TypeError, "%.200s() needs an argument", - ((PyCFunctionObject*)cyfunc)->m_ml->ml_name); - return -1; - } - ret = 1; - } - if (unlikely(kwnames) && unlikely(PyTuple_GET_SIZE(kwnames))) { - PyErr_Format(PyExc_TypeError, - "%.200s() takes no keyword arguments", ((PyCFunctionObject*)cyfunc)->m_ml->ml_name); - 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; - PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; -#if CYTHON_BACKPORT_VECTORCALL - Py_ssize_t nargs = (Py_ssize_t)nargsf; -#else - Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); -#endif - PyObject *self; - switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { - case 1: - self = args[0]; - args += 1; - nargs -= 1; - break; - case 0: - self = ((PyCFunctionObject*)cyfunc)->m_self; - break; - default: - return NULL; - } - if (unlikely(nargs != 0)) { - PyErr_Format(PyExc_TypeError, - "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", - def->ml_name, nargs); - return NULL; - } - return def->ml_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; - PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; -#if CYTHON_BACKPORT_VECTORCALL - Py_ssize_t nargs = (Py_ssize_t)nargsf; -#else - Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); -#endif - PyObject *self; - switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, kwnames)) { - case 1: - self = args[0]; - args += 1; - nargs -= 1; - break; - case 0: - self = ((PyCFunctionObject*)cyfunc)->m_self; - break; - default: - return NULL; - } - if (unlikely(nargs != 1)) { - PyErr_Format(PyExc_TypeError, - "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", - def->ml_name, nargs); - return NULL; - } - return def->ml_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; - PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; -#if CYTHON_BACKPORT_VECTORCALL - Py_ssize_t nargs = (Py_ssize_t)nargsf; -#else - Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); -#endif - PyObject *self; - switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { - case 1: - self = args[0]; - args += 1; - nargs -= 1; - break; - case 0: - self = ((PyCFunctionObject*)cyfunc)->m_self; - break; - default: - return NULL; - } - return ((_PyCFunctionFastWithKeywords)(void(*)(void))def->ml_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; - PyMethodDef* def = ((PyCFunctionObject*)cyfunc)->m_ml; - PyTypeObject *cls = (PyTypeObject *) __Pyx_CyFunction_GetClassObj(cyfunc); -#if CYTHON_BACKPORT_VECTORCALL - Py_ssize_t nargs = (Py_ssize_t)nargsf; -#else - Py_ssize_t nargs = PyVectorcall_NARGS(nargsf); -#endif - PyObject *self; - switch (__Pyx_CyFunction_Vectorcall_CheckArgs(cyfunc, nargs, NULL)) { - case 1: - self = args[0]; - args += 1; - nargs -= 1; - break; - case 0: - self = ((PyCFunctionObject*)cyfunc)->m_self; - break; - default: - return NULL; - } - return ((__Pyx_PyCMethod)(void(*)(void))def->ml_meth)(self, cls, args, (size_t)nargs, kwnames); -} -#endif -#if CYTHON_USE_TYPE_SPECS -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 (defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL) - _Py_TPFLAGS_HAVE_VECTORCALL | -#endif - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, - __pyx_CyFunctionType_slots -}; -#else -static PyTypeObject __pyx_CyFunctionType_type = { - PyVarObject_HEAD_INIT(0, 0) - __PYX_TYPE_MODULE_PREFIX "cython_function_or_method", - sizeof(__pyx_CyFunctionObject), - 0, - (destructor) __Pyx_CyFunction_dealloc, -#if !CYTHON_METH_FASTCALL - 0, -#elif CYTHON_BACKPORT_VECTORCALL - (printfunc)offsetof(__pyx_CyFunctionObject, func_vectorcall), -#else - offsetof(PyCFunctionObject, vectorcall), -#endif - 0, - 0, -#if PY_MAJOR_VERSION < 3 - 0, -#else - 0, -#endif - (reprfunc) __Pyx_CyFunction_repr, - 0, - 0, - 0, - 0, - __Pyx_CyFunction_CallAsMethod, - 0, - 0, - 0, - 0, -#ifdef Py_TPFLAGS_METHOD_DESCRIPTOR - Py_TPFLAGS_METHOD_DESCRIPTOR | -#endif -#if defined(_Py_TPFLAGS_HAVE_VECTORCALL) && CYTHON_METH_FASTCALL - _Py_TPFLAGS_HAVE_VECTORCALL | -#endif - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, - 0, - (traverseproc) __Pyx_CyFunction_traverse, - (inquiry) __Pyx_CyFunction_clear, - 0, -#if PY_VERSION_HEX < 0x030500A0 - offsetof(__pyx_CyFunctionObject, func_weakreflist), -#else - offsetof(PyCFunctionObject, m_weakreflist), -#endif - 0, - 0, - __pyx_CyFunction_methods, - __pyx_CyFunction_members, - __pyx_CyFunction_getsets, - 0, - 0, - __Pyx_PyMethod_New, - 0, - offsetof(__pyx_CyFunctionObject, func_dict), - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, -#if PY_VERSION_HEX >= 0x030400a1 - 0, -#endif -#if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800) - 0, -#endif -#if __PYX_NEED_TP_PRINT_SLOT - 0, -#endif -#if PY_VERSION_HEX >= 0x030C0000 - 0, -#endif -#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000 - 0, -#endif -}; -#endif -static int __pyx_CyFunction_init(PyObject *module) { -#if CYTHON_USE_TYPE_SPECS - __pyx_CyFunctionType = __Pyx_FetchCommonTypeFromSpec(module, &__pyx_CyFunctionType_spec, NULL); -#else - CYTHON_UNUSED_VAR(module); - __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type); -#endif - if (unlikely(__pyx_CyFunctionType == NULL)) { - return -1; - } - return 0; -} -static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->defaults = PyObject_Malloc(size); - if (unlikely(!m->defaults)) - return PyErr_NoMemory(); - memset(m->defaults, 0, size); - m->defaults_pyobjects = pyobjects; - m->defaults_size = size; - return m->defaults; -} -static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->defaults_tuple = tuple; - Py_INCREF(tuple); -} -static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->defaults_kwdict = dict; - Py_INCREF(dict); -} -static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->func_annotations = dict; - Py_INCREF(dict); -} - -/* CythonFunction */ -static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname, - PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { - PyObject *op = __Pyx_CyFunction_Init( - PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType), - ml, flags, qualname, closure, module, globals, code - ); - if (likely(op)) { - PyObject_GC_Track(op); - } - return op; -} - -/* 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 - -/* CLineInTraceback */ -#ifndef CYTHON_CLINE_IN_TRACEBACK -static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { - PyObject *use_cline; - PyObject *ptype, *pvalue, *ptraceback; -#if CYTHON_COMPILING_IN_CPYTHON - PyObject **cython_runtime_dict; -#endif - CYTHON_MAYBE_UNUSED_VAR(tstate); - if (unlikely(!__pyx_cython_runtime)) { - return c_line; - } - __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); -#if CYTHON_COMPILING_IN_CPYTHON - cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime); - if (likely(cython_runtime_dict)) { - __PYX_PY_DICT_LOOKUP_IF_MODIFIED( - use_cline, *cython_runtime_dict, - __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback)) - } else -#endif - { - PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStrNoError(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); - if (use_cline_obj) { - use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True; - Py_DECREF(use_cline_obj); - } else { - PyErr_Clear(); - use_cline = NULL; - } - } - if (!use_cline) { - c_line = 0; - (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); - } - else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { - c_line = 0; - } - __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); - return c_line; -} -#endif - -/* CodeObjectCache */ -#if !CYTHON_COMPILING_IN_LIMITED_API -static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { - int start = 0, mid = 0, end = count - 1; - if (end >= 0 && code_line > entries[end].code_line) { - return count; - } - while (start < end) { - mid = start + (end - start) / 2; - if (code_line < entries[mid].code_line) { - end = mid; - } else if (code_line > entries[mid].code_line) { - start = mid + 1; - } else { - return mid; - } - } - if (code_line <= entries[mid].code_line) { - return mid; - } else { - return mid + 1; - } -} -static PyCodeObject *__pyx_find_code_object(int code_line) { - PyCodeObject* code_object; - int pos; - if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { - return NULL; - } - pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); - if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { - return NULL; - } - code_object = __pyx_code_cache.entries[pos].code_object; - Py_INCREF(code_object); - return code_object; -} -static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { - int pos, i; - __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; - if (unlikely(!code_line)) { - return; - } - if (unlikely(!entries)) { - entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); - if (likely(entries)) { - __pyx_code_cache.entries = entries; - __pyx_code_cache.max_count = 64; - __pyx_code_cache.count = 1; - entries[0].code_line = code_line; - entries[0].code_object = code_object; - Py_INCREF(code_object); - } - return; - } - pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); - if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { - PyCodeObject* tmp = entries[pos].code_object; - entries[pos].code_object = code_object; - Py_DECREF(tmp); - return; - } - if (__pyx_code_cache.count == __pyx_code_cache.max_count) { - int new_max = __pyx_code_cache.max_count + 64; - entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( - __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry)); - if (unlikely(!entries)) { - return; - } - __pyx_code_cache.entries = entries; - __pyx_code_cache.max_count = new_max; - } - for (i=__pyx_code_cache.count; i>pos; i--) { - entries[i] = entries[i-1]; - } - entries[pos].code_line = code_line; - entries[pos].code_object = code_object; - __pyx_code_cache.count++; - Py_INCREF(code_object); -} -#endif - -/* AddTraceback */ -#include "compile.h" -#include "frameobject.h" -#include "traceback.h" -#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API - #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; - result = PyObject_Call(replace, __pyx_empty_tuple, scratch_dict); - Py_DECREF(replace); - return result; - } - PyErr_Clear(); - #if __PYX_LIMITED_VERSION_HEX < 0x030780000 - { - PyObject *compiled = NULL, *result = NULL; - if (unlikely(PyDict_SetItemString(scratch_dict, "code", code))) return NULL; - if (unlikely(PyDict_SetItemString(scratch_dict, "type", (PyObject*)(&PyType_Type)))) return NULL; - compiled = Py_CompileString( - "out = type(code)(\n" - " code.co_argcount, code.co_kwonlyargcount, code.co_nlocals, code.co_stacksize,\n" - " code.co_flags, code.co_code, code.co_consts, code.co_names,\n" - " code.co_varnames, code.co_filename, co_name, co_firstlineno,\n" - " code.co_lnotab)\n", "", Py_file_input); - if (!compiled) return NULL; - result = PyEval_EvalCode(compiled, scratch_dict, scratch_dict); - Py_DECREF(compiled); - if (!result) PyErr_Print(); - Py_DECREF(result); - result = PyDict_GetItemString(scratch_dict, "out"); - if (result) Py_INCREF(result); - return result; - } - #else - return NULL; - #endif -} -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) { - (void) __pyx_cfilenm; - (void) __Pyx_CLineForTraceback(__Pyx_PyThreadState_Current, c_line); - } - PyErr_Fetch(&exc_type, &exc_value, &exc_traceback); - 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; - 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; - 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 PY_MAJOR_VERSION < 3 - PyObject *py_srcfile = NULL; - py_srcfile = PyString_FromString(filename); - if (!py_srcfile) goto bad; - #endif - if (c_line) { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); - if (!py_funcname) goto bad; - #else - py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); - if (!py_funcname) goto bad; - funcname = PyUnicode_AsUTF8(py_funcname); - if (!funcname) goto bad; - #endif - } - else { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromString(funcname); - if (!py_funcname) goto bad; - #endif - } - #if PY_MAJOR_VERSION < 3 - py_code = __Pyx_PyCode_New( - 0, - 0, - 0, - 0, - 0, - 0, - __pyx_empty_bytes, /*PyObject *code,*/ - __pyx_empty_tuple, /*PyObject *consts,*/ - __pyx_empty_tuple, /*PyObject *names,*/ - __pyx_empty_tuple, /*PyObject *varnames,*/ - __pyx_empty_tuple, /*PyObject *freevars,*/ - __pyx_empty_tuple, /*PyObject *cellvars,*/ - py_srcfile, /*PyObject *filename,*/ - py_funcname, /*PyObject *name,*/ - py_line, - __pyx_empty_bytes /*PyObject *lnotab*/ - ); - Py_DECREF(py_srcfile); - #else - py_code = PyCode_NewEmpty(filename, funcname, py_line); - #endif - Py_XDECREF(py_funcname); - return py_code; -bad: - Py_XDECREF(py_funcname); - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(py_srcfile); - #endif - return NULL; -} -static void __Pyx_AddTraceback(const char *funcname, int c_line, - int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyFrameObject *py_frame = 0; - PyThreadState *tstate = __Pyx_PyThreadState_Current; - PyObject *ptype, *pvalue, *ptraceback; - if (c_line) { - c_line = __Pyx_CLineForTraceback(tstate, c_line); - } - py_code = __pyx_find_code_object(c_line ? -c_line : py_line); - if (!py_code) { - __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); - py_code = __Pyx_CreateCodeObjectForTraceback( - funcname, c_line, py_line, filename); - if (!py_code) { - /* If the code object creation fails, then we should clear the - fetched exception references and propagate the new exception */ - Py_XDECREF(ptype); - Py_XDECREF(pvalue); - Py_XDECREF(ptraceback); - goto bad; - } - __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); - __pyx_insert_code_object(c_line ? -c_line : py_line, py_code); - } - py_frame = PyFrame_New( - tstate, /*PyThreadState *tstate,*/ - py_code, /*PyCodeObject *code,*/ - __pyx_d, /*PyObject *globals,*/ - 0 /*PyObject *locals*/ - ); - if (!py_frame) goto bad; - __Pyx_PyFrame_SetLineNumber(py_frame, py_line); - PyTraceBack_Here(py_frame); -bad: - Py_XDECREF(py_code); - Py_XDECREF(py_frame); -} -#endif - -/* FormatTypeName */ -#if CYTHON_COMPILING_IN_LIMITED_API -static __Pyx_TypeName -__Pyx_PyType_GetName(PyTypeObject* tp) -{ - PyObject *name = __Pyx_PyObject_GetAttrStr((PyObject *)tp, - __pyx_n_s_name); - if (unlikely(name == NULL) || unlikely(!PyUnicode_Check(name))) { - PyErr_Clear(); - Py_XDECREF(name); - name = __Pyx_NewRef(__pyx_n_s__8); - } - return name; -} -#endif - -/* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - const long neg_one = (long) -1, const_zero = (long) 0; -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic pop -#endif - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(long) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(long) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(long) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; -#if !CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030d0000 - return _PyLong_FromByteArray(bytes, sizeof(long), - little, !is_unsigned); -#else - PyObject *from_bytes, *result = NULL; - PyObject *py_bytes = NULL, *arg_tuple = NULL, *kwds = 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; - arg_tuple = PyTuple_Pack(2, py_bytes, order_str); - if (!arg_tuple) goto limited_bad; - if (!is_unsigned) { - kwds = PyDict_New(); - if (!kwds) goto limited_bad; - if (PyDict_SetItemString(kwds, "signed", __Pyx_NewRef(Py_True))) goto limited_bad; - } - result = PyObject_Call(from_bytes, arg_tuple, kwds); - limited_bad: - Py_XDECREF(kwds); - Py_XDECREF(arg_tuple); - Py_XDECREF(order_str); - Py_XDECREF(py_bytes); - Py_XDECREF(from_bytes); - return result; -#endif - } -} - -/* CIntFromPyVerify */ -#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ - __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) -#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ - __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) -#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ - {\ - func_type value = func_value;\ - if (sizeof(target_type) < sizeof(func_type)) {\ - if (unlikely(value != (func_type) (target_type) value)) {\ - func_type zero = 0;\ - if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ - return (target_type) -1;\ - if (is_unsigned && unlikely(value < zero))\ - goto raise_neg_overflow;\ - else\ - goto raise_overflow;\ - }\ - }\ - return (target_type) value;\ - } - -/* CIntFromPy */ -static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - const long neg_one = (long) -1, const_zero = (long) 0; -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic pop -#endif - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if ((sizeof(long) < sizeof(long))) { - __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (long) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - 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)) -#ifdef HAVE_LONG_LONG - } else if ((sizeof(long) <= sizeof(unsigned PY_LONG_LONG))) { - __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) -#endif - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - 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)) -#ifdef HAVE_LONG_LONG - } else if ((sizeof(long) <= sizeof(PY_LONG_LONG))) { - __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) -#endif - } - } - { - long val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); -#if PY_MAJOR_VERSION < 3 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } -#endif - if (likely(v)) { - int ret = -1; -#if 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 *)v, - bytes, sizeof(val), - is_little, !is_unsigned); -#else - PyObject *stepval = NULL, *mask = NULL, *shift = NULL; - int bits, remaining_bits, is_negative = 0; - long idigit; - int chunk_size = (sizeof(long) < 8) ? 30 : 62; - if (unlikely(!PyLong_CheckExact(v))) { - PyObject *tmp = v; - v = PyNumber_Long(v); - assert(PyLong_CheckExact(v)); - Py_DECREF(tmp); - if (unlikely(!v)) return (long) -1; - } -#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 - if (Py_SIZE(x) == 0) - return (long) 0; - is_negative = Py_SIZE(x) < 0; -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (long) -1; - is_negative = result == 1; - } -#endif - if (is_unsigned && unlikely(is_negative)) { - goto raise_neg_overflow; - } else if (is_negative) { - stepval = PyNumber_Invert(v); - if (unlikely(!stepval)) - return (long) -1; - } else { - stepval = __Pyx_NewRef(v); - } - 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; - digit = PyNumber_And(stepval, mask); - if (unlikely(!digit)) goto done; - idigit = PyLong_AsLong(digit); - Py_DECREF(digit); - if (unlikely(idigit < 0)) goto done; - tmp = PyNumber_Rshift(stepval, shift); - if (unlikely(!tmp)) goto done; - Py_DECREF(stepval); stepval = tmp; - val |= ((long) idigit) << bits; - #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 - if (Py_SIZE(stepval) == 0) - goto unpacking_done; - #endif - } - 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 CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 - unpacking_done: - #endif - 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 - Py_DECREF(v); - if (likely(!ret)) - return val; - } - return (long) -1; - } - } else { - long val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (long) -1; - val = __Pyx_PyInt_As_long(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to long"); - return (long) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to long"); - return (long) -1; -} - -/* CIntFromPy */ -static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - const int neg_one = (int) -1, const_zero = (int) 0; -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic pop -#endif - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if ((sizeof(int) < sizeof(long))) { - __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (int) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - 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)) -#ifdef HAVE_LONG_LONG - } else if ((sizeof(int) <= sizeof(unsigned PY_LONG_LONG))) { - __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) -#endif - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - 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)) -#ifdef HAVE_LONG_LONG - } else if ((sizeof(int) <= sizeof(PY_LONG_LONG))) { - __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) -#endif - } - } - { - int val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); -#if PY_MAJOR_VERSION < 3 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } -#endif - if (likely(v)) { - int ret = -1; -#if 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 *)v, - bytes, sizeof(val), - is_little, !is_unsigned); -#else - PyObject *stepval = NULL, *mask = NULL, *shift = NULL; - int bits, remaining_bits, is_negative = 0; - long idigit; - int chunk_size = (sizeof(long) < 8) ? 30 : 62; - if (unlikely(!PyLong_CheckExact(v))) { - PyObject *tmp = v; - v = PyNumber_Long(v); - assert(PyLong_CheckExact(v)); - Py_DECREF(tmp); - if (unlikely(!v)) return (int) -1; - } -#if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 - if (Py_SIZE(x) == 0) - return (int) 0; - is_negative = Py_SIZE(x) < 0; -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (int) -1; - is_negative = result == 1; - } -#endif - if (is_unsigned && unlikely(is_negative)) { - goto raise_neg_overflow; - } else if (is_negative) { - stepval = PyNumber_Invert(v); - if (unlikely(!stepval)) - return (int) -1; - } else { - stepval = __Pyx_NewRef(v); - } - 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; - digit = PyNumber_And(stepval, mask); - if (unlikely(!digit)) goto done; - idigit = PyLong_AsLong(digit); - Py_DECREF(digit); - if (unlikely(idigit < 0)) goto done; - tmp = PyNumber_Rshift(stepval, shift); - if (unlikely(!tmp)) goto done; - Py_DECREF(stepval); stepval = tmp; - val |= ((int) idigit) << bits; - #if CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 - if (Py_SIZE(stepval) == 0) - goto unpacking_done; - #endif - } - 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 CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX < 0x030B0000 - unpacking_done: - #endif - 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 - Py_DECREF(v); - if (likely(!ret)) - return val; - } - return (int) -1; - } - } else { - int val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (int) -1; - val = __Pyx_PyInt_As_int(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to int"); - return (int) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to int"); - return (int) -1; -} - -/* 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); -} -#if PY_MAJOR_VERSION == 2 -static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { - PyObject *exception, *value, *tb; - int res; - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ErrFetch(&exception, &value, &tb); - res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0; - if (unlikely(res == -1)) { - PyErr_WriteUnraisable(err); - res = 0; - } - if (!res) { - res = PyObject_IsSubclass(err, exc_type2); - if (unlikely(res == -1)) { - PyErr_WriteUnraisable(err); - res = 0; - } - } - __Pyx_ErrRestore(exception, value, tb); - return res; -} -#else -static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { - if (exc_type1) { - return __Pyx_IsAnySubtype2((PyTypeObject*)err, (PyTypeObject*)exc_type1, (PyTypeObject*)exc_type2); - } else { - return __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); - } -} -#endif -static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { - Py_ssize_t i, n; - assert(PyExceptionClass_Check(exc_type)); - n = PyTuple_GET_SIZE(tuple); -#if PY_MAJOR_VERSION >= 3 - for (i=0; i= 0x030B00A4 - return Py_Version & ~0xFFUL; -#else - 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; - } - return version; -#endif -} -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); - } -} - -/* InitStrings */ -#if PY_MAJOR_VERSION >= 3 -static int __Pyx_InitString(__Pyx_StringTabEntry t, PyObject **str) { - if (t.is_unicode | t.is_str) { - if (t.intern) { - *str = PyUnicode_InternFromString(t.s); - } else if (t.encoding) { - *str = PyUnicode_Decode(t.s, t.n - 1, t.encoding, NULL); - } else { - *str = PyUnicode_FromStringAndSize(t.s, t.n - 1); - } - } else { - *str = PyBytes_FromStringAndSize(t.s, t.n - 1); - } - if (!*str) - return -1; - if (PyObject_Hash(*str) == -1) - return -1; - return 0; -} -#endif -static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { - while (t->p) { - #if PY_MAJOR_VERSION >= 3 - __Pyx_InitString(*t, t->p); - #else - if (t->is_unicode) { - *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); - } else if (t->intern) { - *t->p = PyString_InternFromString(t->s); - } else { - *t->p = PyString_FromStringAndSize(t->s, t->n - 1); - } - if (!*t->p) - return -1; - if (PyObject_Hash(*t->p) == -1) - return -1; - #endif - ++t; - } - return 0; -} - -#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_DEFAULT -#if !CYTHON_PEP393_ENABLED -static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { - char* defenc_c; - PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); - if (!defenc) return NULL; - defenc_c = PyBytes_AS_STRING(defenc); -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - { - char* end = defenc_c + PyBytes_GET_SIZE(defenc); - char* c; - for (c = defenc_c; c < end; c++) { - if ((unsigned char) (*c) >= 128) { - PyUnicode_AsASCIIString(o); - return NULL; - } - } - } -#endif - *length = PyBytes_GET_SIZE(defenc); - return defenc_c; -} -#else -static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { - if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL; -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - if (likely(PyUnicode_IS_ASCII(o))) { - *length = PyUnicode_GET_LENGTH(o); - return PyUnicode_AsUTF8(o); - } else { - PyUnicode_AsASCIIString(o); - return NULL; - } -#else - return PyUnicode_AsUTF8AndSize(o, length); -#endif -} -#endif -#endif -static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT - if ( -#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - __Pyx_sys_getdefaultencoding_not_ascii && -#endif - PyUnicode_Check(o)) { - return __Pyx_PyUnicode_AsStringAndSize(o, length); - } else -#endif -#if (!CYTHON_COMPILING_IN_PYPY && !CYTHON_COMPILING_IN_LIMITED_API) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) - if (PyByteArray_Check(o)) { - *length = PyByteArray_GET_SIZE(o); - return PyByteArray_AS_STRING(o); - } else -#endif - { - char* result; - int r = PyBytes_AsStringAndSize(o, &result, length); - if (unlikely(r < 0)) { - return NULL; - } else { - return result; - } - } -} -static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { - int is_true = x == Py_True; - if (is_true | (x == Py_False) | (x == Py_None)) return is_true; - else return PyObject_IsTrue(x); -} -static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) { - int retval; - if (unlikely(!x)) return -1; - retval = __Pyx_PyObject_IsTrue(x); - Py_DECREF(x); - return retval; -} -static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) { - __Pyx_TypeName result_type_name = __Pyx_PyType_GetName(Py_TYPE(result)); -#if PY_MAJOR_VERSION >= 3 - 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; - } -#endif - PyErr_Format(PyExc_TypeError, - "__%.4s__ returned non-%.4s (type " __Pyx_FMT_TYPENAME ")", - type_name, type_name, result_type_name); - __Pyx_DECREF_TypeName(result_type_name); - Py_DECREF(result); - return NULL; -} -static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) { -#if CYTHON_USE_TYPE_SLOTS - PyNumberMethods *m; -#endif - const char *name = NULL; - PyObject *res = NULL; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x) || PyLong_Check(x))) -#else - if (likely(PyLong_Check(x))) -#endif - return __Pyx_NewRef(x); -#if CYTHON_USE_TYPE_SLOTS - m = Py_TYPE(x)->tp_as_number; - #if PY_MAJOR_VERSION < 3 - if (m && m->nb_int) { - name = "int"; - res = m->nb_int(x); - } - else if (m && m->nb_long) { - name = "long"; - res = m->nb_long(x); - } - #else - if (likely(m && m->nb_int)) { - name = "int"; - res = m->nb_int(x); - } - #endif -#else - if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) { - res = PyNumber_Int(x); - } -#endif - if (likely(res)) { -#if PY_MAJOR_VERSION < 3 - if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) { -#else - if (unlikely(!PyLong_CheckExact(res))) { -#endif - return __Pyx_PyNumber_IntOrLongWrongResultType(res, name); - } - } - else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_TypeError, - "an integer is required"); - } - return res; -} -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { - Py_ssize_t ival; - PyObject *x; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(b))) { - if (sizeof(Py_ssize_t) >= sizeof(long)) - return PyInt_AS_LONG(b); - else - return PyInt_AsSsize_t(b); - } -#endif - if (likely(PyLong_CheckExact(b))) { - #if CYTHON_USE_PYLONG_INTERNALS - 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 = PyInt_AsSsize_t(x); - Py_DECREF(x); - return ival; -} -static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) { - if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) { - return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o); -#if PY_MAJOR_VERSION < 3 - } else if (likely(PyInt_CheckExact(o))) { - return PyInt_AS_LONG(o); -#endif - } else { - Py_ssize_t ival; - PyObject *x; - x = PyNumber_Index(o); - if (!x) return -1; - ival = PyInt_AsLong(x); - Py_DECREF(x); - return ival; - } -} -static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { - return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False); -} -static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { - return PyInt_FromSize_t(ival); -} - - -/* #### Code section: utility_code_pragmas_end ### */ -#ifdef _MSC_VER -#pragma warning( pop ) -#endif - - - -/* #### Code section: end ### */ -#endif /* Py_PYTHON_H */ diff --git a/src_/amulet_nbt/_string_encoding/encoding.pxd b/src_/amulet_nbt/_string_encoding/encoding.pxd deleted file mode 100644 index 7d2a70ee..00000000 --- a/src_/amulet_nbt/_string_encoding/encoding.pxd +++ /dev/null @@ -1,6 +0,0 @@ -from ._cpp cimport CStringEncode, CStringDecode - - -cdef class StringEncoding: - cdef CStringEncode encode_cpp - cdef CStringDecode decode_cpp diff --git a/src_/amulet_nbt/_string_encoding/encoding.pyx b/src_/amulet_nbt/_string_encoding/encoding.pyx deleted file mode 100644 index f6395cf3..00000000 --- a/src_/amulet_nbt/_string_encoding/encoding.pyx +++ /dev/null @@ -1,33 +0,0 @@ -# distutils: language = c++ -# distutils: extra_compile_args = CPPCARGS -# distutils: sources = [src/amulet_nbt/_string_encoding/_cpp/mutf8.cpp, src/amulet_nbt/_string_encoding/_cpp/utf8.cpp] - -from ._cpp.utf8 cimport utf8_to_utf8, utf8_escape_to_utf8, utf8_to_utf8_escape -from ._cpp.mutf8 cimport ( - mutf8_to_utf8, - utf8_to_mutf8 -) - - -cdef class StringEncoding: - def encode(self, bytes data: bytes) -> bytes: - return self.encode_cpp(data) - - def decode(self, bytes data: bytes) -> bytes: - return self.decode_cpp(data) - - -cdef StringEncoding _mutf8_encoding = StringEncoding() -_mutf8_encoding.decode_cpp = mutf8_to_utf8 -_mutf8_encoding.encode_cpp = utf8_to_mutf8 -mutf8_encoding = _mutf8_encoding - -cdef StringEncoding _utf8_encoding = StringEncoding() -_utf8_encoding.decode_cpp = utf8_to_utf8 -_utf8_encoding.encode_cpp = utf8_to_utf8 -utf8_encoding = _utf8_encoding - -cdef StringEncoding _utf8_escape_encoding = StringEncoding() -_utf8_escape_encoding.decode_cpp = utf8_escape_to_utf8 -_utf8_escape_encoding.encode_cpp = utf8_to_utf8_escape -utf8_escape_encoding = _utf8_escape_encoding diff --git a/template.py b/template.py deleted file mode 100644 index 895957e0..00000000 --- a/template.py +++ /dev/null @@ -1,83 +0,0 @@ -"""Cython has a template language called tempita. -This bakes the template files into real cython files.""" - -import glob -import os -from typing import Optional, Any - -from Cython import Tempita as tempita - - -ROOT_PATH = os.path.dirname(__file__) -SRC_PATH = os.path.join(ROOT_PATH, "src") - - -def include(rel_path: str, **kwargs: Any) -> str: - """ - Load and bake a template file. - - :param rel_path: The path relative to the root. - :return: The baked cython code. - """ - with open(os.path.join(SRC_PATH, rel_path)) as f: - return tempita.sub(f.read(), **kwargs) # type: ignore - - -class TempitaManager: - def __init__(self) -> None: - self.files: list[TempitaFile] = [] - for path in glob.glob(os.path.join(SRC_PATH, "**", "*.tp"), recursive=True): - rel_path = os.path.relpath(path, SRC_PATH) - save_path = path[:-3] - self.files.append(TempitaFile(path, rel_path, save_path)) - - def changed(self) -> bool: - return any(file.changed for file in self.files) - - def build(self) -> None: - for file in self.files: - file.build() - - -class TempitaFile: - def __init__(self, src_path: str, rel_path: str, save_path: str): - self.src_path = src_path - self.rel_path = rel_path - self.save_path = save_path - - @property - def baked(self) -> str: - """The result when the template is baked out.""" - with open(self.src_path) as template: - return tempita.sub(template.read()) # type: ignore - - @property - def written(self) -> Optional[str]: - """The previously baked out code (if any)""" - if os.path.isfile(self.save_path): - with open(self.save_path) as f: - return f.read() - return None - - @property - def changed(self) -> bool: - """Has the source changed since the last bake.""" - return self.baked != self.written - - def build(self) -> None: - """Build all changes and overwrite the previous bake.""" - print(f"Baking tempita file {self.rel_path}") - baked = self.baked - written = self.written - if baked != written: - with open(self.save_path, "w") as cy: - cy.write(baked) - - -def changed() -> bool: - """Have the source files changed since the last time tempita was run.""" - return TempitaManager().changed() - - -if __name__ == "__main__": - TempitaManager().build() From 3968aaabca66785d2fffea825de05f6ee734792c Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Mon, 8 Jul 2024 14:12:02 +0100 Subject: [PATCH 061/121] Added pickle support --- src/amulet_nbt/pybind/tag/abc.cpp | 7 +------ src/amulet_nbt/pybind/tag/array.cpp | 14 ++++++++++++++ src/amulet_nbt/pybind/tag/compound.cpp | 14 ++++++++++++++ src/amulet_nbt/pybind/tag/float.cpp | 10 ++++++++++ src/amulet_nbt/pybind/tag/int.cpp | 10 ++++++++++ src/amulet_nbt/pybind/tag/list.cpp | 14 ++++++++++++++ src/amulet_nbt/pybind/tag/named_tag.cpp | 10 ++++++++++ src/amulet_nbt/pybind/tag/string.cpp | 10 ++++++++++ 8 files changed, 83 insertions(+), 6 deletions(-) diff --git a/src/amulet_nbt/pybind/tag/abc.cpp b/src/amulet_nbt/pybind/tag/abc.cpp index 5718a3df..44e94e95 100644 --- a/src/amulet_nbt/pybind/tag/abc.cpp +++ b/src/amulet_nbt/pybind/tag/abc.cpp @@ -10,7 +10,7 @@ namespace py = pybind11; template -void abstract_method(T self){ +void abstract_method(T self, py::args, const py::kwargs&){ PyErr_SetString(PyExc_NotImplementedError, ""); throw py::error_already_set(); } @@ -182,11 +182,6 @@ void init_abc(py::module& m) { abstract_method, "A string representation of the object." ); - AbstractBaseTag.def( - "__reduce__", - abstract_method, - "A string representation of the object." - ); AbstractBaseTag.def( "__copy__", abstract_method, diff --git a/src/amulet_nbt/pybind/tag/array.cpp b/src/amulet_nbt/pybind/tag/array.cpp index 18cc5d56..632fafa3 100644 --- a/src/amulet_nbt/pybind/tag/array.cpp +++ b/src/amulet_nbt/pybind/tag/array.cpp @@ -90,6 +90,20 @@ namespace py = pybind11; return out;\ }\ );\ + CLSNAME.def(\ + py::pickle(\ + [](const Amulet::CLSNAME##Wrapper& self){\ + return py::bytes(Amulet::write_named_tag("", self.tag, std::endian::big, Amulet::utf8_to_mutf8));\ + },\ + [](py::bytes state){\ + return Amulet::CLSNAME##Wrapper(\ + std::get(\ + Amulet::read_named_tag(state, std::endian::big, Amulet::mutf8_to_utf8).tag_node\ + )\ + );\ + }\ + )\ + );\ CLSNAME.def(\ "__copy__",\ [](const Amulet::CLSNAME##Wrapper& self){\ diff --git a/src/amulet_nbt/pybind/tag/compound.cpp b/src/amulet_nbt/pybind/tag/compound.cpp index 5af1cd52..c65e186a 100644 --- a/src/amulet_nbt/pybind/tag/compound.cpp +++ b/src/amulet_nbt/pybind/tag/compound.cpp @@ -112,6 +112,20 @@ void init_compound(py::module& m) { return out; } ); + CompoundTag.def( + py::pickle( + [](const Amulet::CompoundTagWrapper& self){ + return py::bytes(Amulet::write_named_tag("", self.tag, std::endian::big, Amulet::utf8_to_mutf8)); + }, + [](py::bytes state){ + return Amulet::CompoundTagWrapper( + std::get( + Amulet::read_named_tag(state, std::endian::big, Amulet::mutf8_to_utf8).tag_node + ) + ); + } + ) + ); CompoundTag.def( "__copy__", [](const Amulet::CompoundTagWrapper& self){ diff --git a/src/amulet_nbt/pybind/tag/float.cpp b/src/amulet_nbt/pybind/tag/float.cpp index 359a8fc2..063a0864 100644 --- a/src/amulet_nbt/pybind/tag/float.cpp +++ b/src/amulet_nbt/pybind/tag/float.cpp @@ -50,6 +50,16 @@ namespace py = pybind11; return std::to_string(self.tag);\ }\ );\ + CLSNAME.def(\ + py::pickle(\ + [](const Amulet::CLSNAME##Wrapper& self){\ + return self.tag;\ + },\ + [](Amulet::CLSNAME state){\ + return Amulet::CLSNAME##Wrapper(state);\ + }\ + )\ + );\ CLSNAME.def(\ "__copy__",\ [](const Amulet::CLSNAME##Wrapper& self){\ diff --git a/src/amulet_nbt/pybind/tag/int.cpp b/src/amulet_nbt/pybind/tag/int.cpp index 91fafc97..77566bf0 100644 --- a/src/amulet_nbt/pybind/tag/int.cpp +++ b/src/amulet_nbt/pybind/tag/int.cpp @@ -52,6 +52,16 @@ namespace py = pybind11; return std::to_string(self.tag);\ }\ );\ + CLSNAME.def(\ + py::pickle(\ + [](const Amulet::CLSNAME##Wrapper& self){\ + return self.tag;\ + },\ + [](Amulet::CLSNAME state){\ + return Amulet::CLSNAME##Wrapper(state);\ + }\ + )\ + );\ CLSNAME.def(\ "__copy__",\ [](const Amulet::CLSNAME##Wrapper& self){\ diff --git a/src/amulet_nbt/pybind/tag/list.cpp b/src/amulet_nbt/pybind/tag/list.cpp index 7607fb60..74ac33de 100644 --- a/src/amulet_nbt/pybind/tag/list.cpp +++ b/src/amulet_nbt/pybind/tag/list.cpp @@ -235,6 +235,20 @@ void init_list(py::module& m) { return py::str(py::list(py::cast(self))); } ); + ListTag.def( + py::pickle( + [](const Amulet::ListTagWrapper& self){ + return py::bytes(Amulet::write_named_tag("", self.tag, std::endian::big, Amulet::utf8_to_mutf8)); + }, + [](py::bytes state){ + return Amulet::ListTagWrapper( + std::get( + Amulet::read_named_tag(state, std::endian::big, Amulet::mutf8_to_utf8).tag_node + ) + ); + } + ) + ); ListTag.def( "__copy__", [](const Amulet::ListTagWrapper& self){ diff --git a/src/amulet_nbt/pybind/tag/named_tag.cpp b/src/amulet_nbt/pybind/tag/named_tag.cpp index a3646cd0..a2a97494 100644 --- a/src/amulet_nbt/pybind/tag/named_tag.cpp +++ b/src/amulet_nbt/pybind/tag/named_tag.cpp @@ -98,6 +98,16 @@ void init_named_tag(py::module& m) { return out; } ); + NamedTag.def( + py::pickle( + [](const Amulet::NamedTag& self){ + return py::bytes(Amulet::write_named_tag(self, std::endian::big, Amulet::utf8_to_mutf8)); + }, + [](py::bytes state){ + return Amulet::read_named_tag(state, std::endian::big, Amulet::mutf8_to_utf8); + } + ) + ); NamedTag.def( "__copy__", [](const Amulet::NamedTag& self){ diff --git a/src/amulet_nbt/pybind/tag/string.cpp b/src/amulet_nbt/pybind/tag/string.cpp index 2d2ed36e..2dc781f6 100644 --- a/src/amulet_nbt/pybind/tag/string.cpp +++ b/src/amulet_nbt/pybind/tag/string.cpp @@ -70,6 +70,16 @@ void init_string(py::module& m) { return py::bytes(self.tag); } ); + StringTag.def( + py::pickle( + [](const Amulet::StringTagWrapper& self){ + return py::bytes(self.tag); + }, + [](py::bytes state){ + return Amulet::StringTagWrapper(state); + } + ) + ); StringTag.def( "__copy__", [](const Amulet::StringTagWrapper& self){ From 994c6dcaa6bce6f6905ef8a72abbfa38199f8333 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Mon, 8 Jul 2024 16:06:31 +0100 Subject: [PATCH 062/121] Added conversion to snbt and refactored --- .../cpp/nbt_encoding/string/write.cpp | 470 ++++++++++++++++++ .../amulet_nbt/nbt_encoding/string.hpp | 62 +++ .../include/amulet_nbt/tag/wrapper.hpp | 22 +- src/amulet_nbt/pybind/tag/abc.cpp | 19 +- 4 files changed, 569 insertions(+), 4 deletions(-) create mode 100644 src/amulet_nbt/cpp/nbt_encoding/string/write.cpp create mode 100644 src/amulet_nbt/include/amulet_nbt/nbt_encoding/string.hpp diff --git a/src/amulet_nbt/cpp/nbt_encoding/string/write.cpp b/src/amulet_nbt/cpp/nbt_encoding/string/write.cpp new file mode 100644 index 00000000..cd7627e8 --- /dev/null +++ b/src/amulet_nbt/cpp/nbt_encoding/string/write.cpp @@ -0,0 +1,470 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + + +namespace Amulet { + // Forward declarations + + inline void write_indent(std::string& snbt, const std::string& indent, size_t indent_count){ + for (size_t i = 0; i < indent_count; i++){ + snbt.append(indent); + } + } + + void write_snbt(std::string& snbt, const TagNode& tag){ + switch (tag.index()){ + case 1: write_snbt(snbt, std::get(tag)); break; + case 2: write_snbt(snbt, std::get(tag)); break; + case 3: write_snbt(snbt, std::get(tag)); break; + case 4: write_snbt(snbt, std::get(tag)); break; + case 5: write_snbt(snbt, std::get(tag)); break; + case 6: write_snbt(snbt, std::get(tag)); break; + case 7: write_snbt(snbt, std::get(tag)); break; + case 8: write_snbt(snbt, std::get(tag)); break; + case 9: write_snbt(snbt, std::get(tag)); break; + case 10: write_snbt(snbt, std::get(tag)); break; + case 11: write_snbt(snbt, std::get(tag)); break; + case 12: write_snbt(snbt, std::get(tag)); break; + default: throw std::runtime_error("TagNode cannot be in null state when writing."); + } + } + + void write_formatted_snbt(std::string& snbt, const TagNode& tag, const std::string& indent, size_t indent_count){ + switch (tag.index()){ + case 1: write_snbt(snbt, std::get(tag)); break; + case 2: write_snbt(snbt, std::get(tag)); break; + case 3: write_snbt(snbt, std::get(tag)); break; + case 4: write_snbt(snbt, std::get(tag)); break; + case 5: write_snbt(snbt, std::get(tag)); break; + case 6: write_snbt(snbt, std::get(tag)); break; + case 7: write_snbt(snbt, std::get(tag)); break; + case 8: write_snbt(snbt, std::get(tag)); break; + case 9: write_formatted_snbt(snbt, std::get(tag), indent, indent_count); break; + case 10: write_formatted_snbt(snbt, std::get(tag), indent, indent_count); break; + case 11: write_snbt(snbt, std::get(tag)); break; + case 12: write_snbt(snbt, std::get(tag)); break; + default: throw std::runtime_error("TagNode cannot be in null state when writing."); + } + } + + void write_snbt(std::string& snbt, const ByteTag& tag){ + snbt.append(std::to_string(tag)); + snbt.push_back('b'); + } + + void write_snbt(std::string& snbt, const ShortTag& tag){ + snbt.append(std::to_string(tag)); + snbt.push_back('s'); + } + + void write_snbt(std::string& snbt, const IntTag& tag){ + snbt.append(std::to_string(tag)); + } + + void write_snbt(std::string& snbt, const LongTag& tag){ + snbt.append(std::to_string(tag)); + snbt.push_back('L'); + } + + template + inline std::string encode_float(const T& num){ + std::ostringstream oss; + oss << std::setprecision(std::numeric_limits::max_digits10) << std::noshowpoint << num; + return oss.str(); + } + + void write_snbt(std::string& snbt, const FloatTag& tag){ + if (std::isfinite(tag)){ + snbt.append(encode_float(tag)); + snbt.push_back('f'); + } else if (tag == std::numeric_limits::infinity()){ + snbt.append("Infinityf"); + } else if (tag == -std::numeric_limits::infinity()){ + snbt.append("-Infinityf"); + } else { + snbt.append("NaNf"); + } + } + + void write_snbt(std::string& snbt, const DoubleTag& tag){ + if (std::isfinite(tag)){ + snbt.append(encode_float(tag)); + snbt.push_back('d'); + } else if (tag == std::numeric_limits::infinity()){ + snbt.append("Infinityd"); + } else if (tag == -std::numeric_limits::infinity()){ + snbt.append("-Infinityd"); + } else { + snbt.append("NaNd"); + } + } + + + void write_snbt(std::string& snbt, const StringTag& tag){ + std::string result = tag; + + size_t pos = 0; + while ((pos = result.find('\\', pos)) != std::string::npos) { + result.replace(pos, 1, "\\\\"); + pos += 2; + } + + pos = 0; + while ((pos = result.find('"', pos)) != std::string::npos) { + result.replace(pos, 1, "\\\""); + pos += 2; + } + + snbt.append("\""); + snbt.append(result); + snbt.append("\""); + } + + + template + void write_snbt_list(std::string& snbt, const ListTag& tag){ + const std::vector& list = std::get>(tag); + snbt.append("["); + for (size_t i = 0; i < list.size(); i++){ + if (i != 0){ + snbt.append(", "); + } + write_snbt(snbt, list[i]); + } + snbt.append("]"); + } + + + void write_snbt(std::string& snbt, const ListTag& tag){ + switch (tag.index()){ + case 0: snbt.append("[]"); break; + case 1: write_snbt_list(snbt, tag); break; + case 2: write_snbt_list(snbt, tag); break; + case 3: write_snbt_list(snbt, tag); break; + case 4: write_snbt_list(snbt, tag); break; + case 5: write_snbt_list(snbt, tag); break; + case 6: write_snbt_list(snbt, tag); break; + case 7: write_snbt_list(snbt, tag); break; + case 8: write_snbt_list(snbt, tag); break; + case 9: write_snbt_list(snbt, tag); break; + case 10: write_snbt_list(snbt, tag); break; + case 11: write_snbt_list(snbt, tag); break; + case 12: write_snbt_list(snbt, tag); break; + } + } + + template + void write_formatted_snbt_list(std::string& snbt, const ListTag& tag, const std::string& indent, size_t indent_count){ + const std::vector& list = std::get>(tag); + snbt.append("["); + for (size_t i = 0; i < list.size(); i++){ + snbt.append("\n"); + write_indent(snbt, indent, indent_count + 1); + if constexpr ( + std::is_same_v || + std::is_same_v + ){ + write_formatted_snbt(snbt, list[i], indent, indent_count + 1); + } else { + write_snbt(snbt, list[i]); + } + if (i + 1 == list.size()){ + snbt.append("\n"); + write_indent(snbt, indent, indent_count); + } else { + snbt.append(","); + } + } + snbt.append("]"); + } + + void write_formatted_snbt(std::string& snbt, const ListTag& tag, const std::string& indent, size_t indent_count){ + switch (tag.index()){ + case 0: snbt.append("[]"); break; + case 1: write_formatted_snbt_list(snbt, tag, indent, indent_count); break; + case 2: write_formatted_snbt_list(snbt, tag, indent, indent_count); break; + case 3: write_formatted_snbt_list(snbt, tag, indent, indent_count); break; + case 4: write_formatted_snbt_list(snbt, tag, indent, indent_count); break; + case 5: write_formatted_snbt_list(snbt, tag, indent, indent_count); break; + case 6: write_formatted_snbt_list(snbt, tag, indent, indent_count); break; + case 7: write_formatted_snbt_list(snbt, tag, indent, indent_count); break; + case 8: write_formatted_snbt_list(snbt, tag, indent, indent_count); break; + case 9: write_formatted_snbt_list(snbt, tag, indent, indent_count); break; + case 10: write_formatted_snbt_list(snbt, tag, indent, indent_count); break; + case 11: write_formatted_snbt_list(snbt, tag, indent, indent_count); break; + case 12: write_formatted_snbt_list(snbt, tag, indent, indent_count); break; + } + } + + + void write_key(std::string& snbt, const StringTag& key){ + if (std::all_of(key.begin(), key.end(), [](char c) { + return std::isalnum(c) || c == '.' || c == '_' || c == '+' || c == '-'; + })){ + snbt.append(key); + } else { + write_snbt(snbt, key); + } + } + + + std::vector> sort_compound(const CompoundTag& tag){ + std::vector> keys(tag.begin(), tag.end()); + std::locale locale; + try { + locale = std::locale("en_US.UTF-8"); + } catch (const std::runtime_error&) { + locale = std::locale(""); + } + std::sort(keys.begin(), keys.end(), [&locale]( + const std::pair& a, + const std::pair& b + ){ + return locale(a.first, b.first); + }); + return keys; + } + + + void write_snbt(std::string& snbt, const CompoundTag& tag){ + auto sorted = sort_compound(tag); + snbt.append("{"); + for (auto it = sorted.begin(); it != sorted.end(); it++){ + write_key(snbt, it->first); + snbt.append(": "); + write_snbt(snbt, it->second); + if (std::next(it) != sorted.end()){ + snbt.append(", "); + } + } + snbt.append("}"); + } + + + void write_formatted_snbt(std::string& snbt, const CompoundTag& tag, const std::string& indent, size_t indent_count){ + auto sorted = sort_compound(tag); + snbt.append("{"); + for (auto it = sorted.begin(); it != sorted.end(); it++){ + snbt.append("\n"); + write_indent(snbt, indent, indent_count + 1); + write_key(snbt, it->first); + snbt.append(": "); + write_formatted_snbt(snbt, it->second, indent, indent_count + 1); + if (std::next(it) == sorted.end()){ + snbt.append("\n"); + write_indent(snbt, indent, indent_count); + } else { + snbt.append(","); + } + } + snbt.append("}"); + } + + + void write_snbt(std::string& snbt, const ByteArrayTag& tag){ + snbt.append("[B;"); + for (size_t i = 0; i < tag.size(); i++){ + snbt.append(std::to_string(tag[i])); + snbt.push_back('B'); + if (i + 1 != tag.size()){ + snbt.append(", "); + } + } + snbt.append("]"); + } + + + void write_snbt(std::string& snbt, const IntArrayTag& tag){ + snbt.append("[I;"); + for (size_t i = 0; i < tag.size(); i++){ + snbt.append(std::to_string(tag[i])); + if (i + 1 != tag.size()){ + snbt.append(", "); + } + } + snbt.append("]"); + } + + + void write_snbt(std::string& snbt, const LongArrayTag& tag){ + snbt.append("[L;"); + for (size_t i = 0; i < tag.size(); i++){ + snbt.append(std::to_string(tag[i])); + snbt.push_back('L'); + if (i + 1 != tag.size()){ + snbt.append(", "); + } + } + snbt.append("]"); + } + + + std::string write_snbt(const TagNode& tag){ + std::string snbt; + write_snbt(snbt, tag); + return snbt; + } + std::string write_snbt(const ByteTag& tag){ + std::string snbt; + write_snbt(snbt, tag); + return snbt; + } + std::string write_snbt(const ShortTag& tag){ + std::string snbt; + write_snbt(snbt, tag); + return snbt; + } + std::string write_snbt(const IntTag& tag){ + std::string snbt; + write_snbt(snbt, tag); + return snbt; + } + std::string write_snbt(const LongTag& tag){ + std::string snbt; + write_snbt(snbt, tag); + return snbt; + } + std::string write_snbt(const FloatTag& tag){ + std::string snbt; + write_snbt(snbt, tag); + return snbt; + } + std::string write_snbt(const DoubleTag& tag){ + std::string snbt; + write_snbt(snbt, tag); + return snbt; + } + std::string write_snbt(const ByteArrayTag& tag){ + std::string snbt; + write_snbt(snbt, tag); + return snbt; + } + std::string write_snbt(const StringTag& tag){ + std::string snbt; + write_snbt(snbt, tag); + return snbt; + } + std::string write_snbt(const ListTag& tag){ + std::string snbt; + write_snbt(snbt, tag); + return snbt; + } + std::string write_snbt(const CompoundTag& tag){ + std::string snbt; + write_snbt(snbt, tag); + return snbt; + } + std::string write_snbt(const IntArrayTag& tag){ + std::string snbt; + write_snbt(snbt, tag); + return snbt; + } + std::string write_snbt(const LongArrayTag& tag){ + std::string snbt; + write_snbt(snbt, tag); + return snbt; + } + + void write_formatted_snbt(std::string& snbt, const TagNode& tag, const std::string& indent){ + size_t indent_count = 0; + return write_formatted_snbt(snbt, tag, indent, indent_count); + } + void write_formatted_snbt(std::string& snbt, const ByteTag& tag, const std::string& indent){ + write_snbt(snbt, tag); + } + void write_formatted_snbt(std::string& snbt, const ShortTag& tag, const std::string& indent){ + write_snbt(snbt, tag); + } + void write_formatted_snbt(std::string& snbt, const IntTag& tag, const std::string& indent){ + write_snbt(snbt, tag); + } + void write_formatted_snbt(std::string& snbt, const LongTag& tag, const std::string& indent){ + write_snbt(snbt, tag); + } + void write_formatted_snbt(std::string& snbt, const FloatTag& tag, const std::string& indent){ + write_snbt(snbt, tag); + } + void write_formatted_snbt(std::string& snbt, const DoubleTag& tag, const std::string& indent){ + write_snbt(snbt, tag); + } + void write_formatted_snbt(std::string& snbt, const ByteArrayTag& tag, const std::string& indent){ + write_snbt(snbt, tag); + } + void write_formatted_snbt(std::string& snbt, const StringTag& tag, const std::string& indent){ + write_snbt(snbt, tag); + } + void write_formatted_snbt(std::string& snbt, const ListTag& tag, const std::string& indent){ + size_t indent_count = 0; + return write_formatted_snbt(snbt, tag, indent, indent_count); + } + void write_formatted_snbt(std::string& snbt, const CompoundTag& tag, const std::string& indent){ + size_t indent_count = 0; + return write_formatted_snbt(snbt, tag, indent, indent_count); + } + void write_formatted_snbt(std::string& snbt, const IntArrayTag& tag, const std::string& indent){ + write_snbt(snbt, tag); + } + void write_formatted_snbt(std::string& snbt, const LongArrayTag& tag, const std::string& indent){ + write_snbt(snbt, tag); + } + + std::string write_formatted_snbt(const TagNode& tag, const std::string& indent){ + std::string snbt; + write_formatted_snbt(snbt, tag, indent); + return snbt; + } + std::string write_formatted_snbt(const ByteTag& tag, const std::string& indent){ + return write_formatted_snbt(tag, indent); + } + std::string write_formatted_snbt(const ShortTag& tag, const std::string& indent){ + return write_formatted_snbt(tag, indent); + } + std::string write_formatted_snbt(const IntTag& tag, const std::string& indent){ + return write_formatted_snbt(tag, indent); + } + std::string write_formatted_snbt(const LongTag& tag, const std::string& indent){ + return write_formatted_snbt(tag, indent); + } + std::string write_formatted_snbt(const FloatTag& tag, const std::string& indent){ + return write_formatted_snbt(tag, indent); + } + std::string write_formatted_snbt(const DoubleTag& tag, const std::string& indent){ + return write_formatted_snbt(tag, indent); + } + std::string write_formatted_snbt(const ByteArrayTag& tag, const std::string& indent){ + return write_formatted_snbt(tag, indent); + } + std::string write_formatted_snbt(const StringTag& tag, const std::string& indent){ + return write_formatted_snbt(tag, indent); + } + std::string write_formatted_snbt(const ListTag& tag, const std::string& indent){ + std::string snbt; + write_formatted_snbt(snbt, tag, indent); + return snbt; + } + std::string write_formatted_snbt(const CompoundTag& tag, const std::string& indent){ + std::string snbt; + write_formatted_snbt(snbt, tag, indent); + return snbt; + } + std::string write_formatted_snbt(const IntArrayTag& tag, const std::string& indent){ + return write_formatted_snbt(tag, indent); + } + std::string write_formatted_snbt(const LongArrayTag& tag, const std::string& indent){ + return write_formatted_snbt(tag, indent); + } +} diff --git a/src/amulet_nbt/include/amulet_nbt/nbt_encoding/string.hpp b/src/amulet_nbt/include/amulet_nbt/nbt_encoding/string.hpp new file mode 100644 index 00000000..d81af997 --- /dev/null +++ b/src/amulet_nbt/include/amulet_nbt/nbt_encoding/string.hpp @@ -0,0 +1,62 @@ +#include + +#include + +namespace Amulet { + void write_snbt(std::string&, const Amulet::TagNode&); + void write_snbt(std::string&, const Amulet::ByteTag&); + void write_snbt(std::string&, const Amulet::ShortTag&); + void write_snbt(std::string&, const Amulet::IntTag&); + void write_snbt(std::string&, const Amulet::LongTag&); + void write_snbt(std::string&, const Amulet::FloatTag&); + void write_snbt(std::string&, const Amulet::DoubleTag&); + void write_snbt(std::string&, const Amulet::ByteArrayTag&); + void write_snbt(std::string&, const Amulet::StringTag&); + void write_snbt(std::string&, const Amulet::ListTag&); + void write_snbt(std::string&, const Amulet::CompoundTag&); + void write_snbt(std::string&, const Amulet::IntArrayTag&); + void write_snbt(std::string&, const Amulet::LongArrayTag&); + + std::string write_snbt(const Amulet::TagNode&); + std::string write_snbt(const Amulet::ByteTag&); + std::string write_snbt(const Amulet::ShortTag&); + std::string write_snbt(const Amulet::IntTag&); + std::string write_snbt(const Amulet::LongTag&); + std::string write_snbt(const Amulet::FloatTag&); + std::string write_snbt(const Amulet::DoubleTag&); + std::string write_snbt(const Amulet::ByteArrayTag&); + std::string write_snbt(const Amulet::StringTag&); + std::string write_snbt(const Amulet::ListTag&); + std::string write_snbt(const Amulet::CompoundTag&); + std::string write_snbt(const Amulet::IntArrayTag&); + std::string write_snbt(const Amulet::LongArrayTag&); + + // Multi-line variants + void write_formatted_snbt(std::string&, const Amulet::TagNode&, const std::string& indent); + void write_formatted_snbt(std::string&, const Amulet::ByteTag&, const std::string& indent); + void write_formatted_snbt(std::string&, const Amulet::ShortTag&, const std::string& indent); + void write_formatted_snbt(std::string&, const Amulet::IntTag&, const std::string& indent); + void write_formatted_snbt(std::string&, const Amulet::LongTag&, const std::string& indent); + void write_formatted_snbt(std::string&, const Amulet::FloatTag&, const std::string& indent); + void write_formatted_snbt(std::string&, const Amulet::DoubleTag&, const std::string& indent); + void write_formatted_snbt(std::string&, const Amulet::ByteArrayTag&, const std::string& indent); + void write_formatted_snbt(std::string&, const Amulet::StringTag&, const std::string& indent); + void write_formatted_snbt(std::string&, const Amulet::ListTag&, const std::string& indent); + void write_formatted_snbt(std::string&, const Amulet::CompoundTag&, const std::string& indent); + void write_formatted_snbt(std::string&, const Amulet::IntArrayTag&, const std::string& indent); + void write_formatted_snbt(std::string&, const Amulet::LongArrayTag&, const std::string& indent); + + std::string write_formatted_snbt(const Amulet::TagNode&, const std::string& indent); + std::string write_formatted_snbt(const Amulet::ByteTag&, const std::string& indent); + std::string write_formatted_snbt(const Amulet::ShortTag&, const std::string& indent); + std::string write_formatted_snbt(const Amulet::IntTag&, const std::string& indent); + std::string write_formatted_snbt(const Amulet::LongTag&, const std::string& indent); + std::string write_formatted_snbt(const Amulet::FloatTag&, const std::string& indent); + std::string write_formatted_snbt(const Amulet::DoubleTag&, const std::string& indent); + std::string write_formatted_snbt(const Amulet::ByteArrayTag&, const std::string& indent); + std::string write_formatted_snbt(const Amulet::StringTag&, const std::string& indent); + std::string write_formatted_snbt(const Amulet::ListTag&, const std::string& indent); + std::string write_formatted_snbt(const Amulet::CompoundTag&, const std::string& indent); + std::string write_formatted_snbt(const Amulet::IntArrayTag&, const std::string& indent); + std::string write_formatted_snbt(const Amulet::LongArrayTag&, const std::string& indent); +} diff --git a/src/amulet_nbt/include/amulet_nbt/tag/wrapper.hpp b/src/amulet_nbt/include/amulet_nbt/tag/wrapper.hpp index eb588136..df407d58 100644 --- a/src/amulet_nbt/include/amulet_nbt/tag/wrapper.hpp +++ b/src/amulet_nbt/include/amulet_nbt/tag/wrapper.hpp @@ -3,15 +3,19 @@ #include #include +#include #include #include +#include #include namespace Amulet { class AbstractBaseTag { public: - virtual std::string write_bnbt(std::string, std::endian, Amulet::StringEncode) const = 0; + virtual std::string to_nbt(std::string, std::endian, Amulet::StringEncode) const = 0; + virtual std::string to_snbt() const = 0; + virtual std::string to_snbt(const std::string& indent) const = 0; }; class AbstractBaseImmutableTag: public AbstractBaseTag {}; @@ -42,9 +46,23 @@ namespace Amulet { public: T tag; TagWrapper(T tag): tag(tag) {}; - virtual std::string write_bnbt(std::string name, std::endian endianness, Amulet::StringEncode string_encode) const { + virtual std::string to_nbt(std::string name, std::endian endianness, Amulet::StringEncode string_encode) const { return Amulet::write_named_tag(name, tag, endianness, string_encode); } + virtual std::string to_snbt() const { + if constexpr (is_shared_ptr::value){ + return Amulet::write_snbt(*tag); + } else { + return Amulet::write_snbt(tag); + } + } + virtual std::string to_snbt(const std::string& indent) const { + if constexpr (is_shared_ptr::value){ + return Amulet::write_formatted_snbt(*tag, indent); + } else { + return Amulet::write_formatted_snbt(tag, indent); + } + } }; typedef TagWrapper ByteTagWrapper; typedef TagWrapper ShortTagWrapper; diff --git a/src/amulet_nbt/pybind/tag/abc.cpp b/src/amulet_nbt/pybind/tag/abc.cpp index 44e94e95..be3d3547 100644 --- a/src/amulet_nbt/pybind/tag/abc.cpp +++ b/src/amulet_nbt/pybind/tag/abc.cpp @@ -1,4 +1,5 @@ #include +#include #include #include @@ -43,7 +44,7 @@ void init_abc(py::module& m) { std::endian endianness, Amulet::StringEncode string_encoder ) -> py::bytes { - py::bytes data = self.write_bnbt(name, endianness, string_encoder); + py::bytes data = self.to_nbt(name, endianness, string_encoder); if (compressed){ return compress(data); } @@ -163,7 +164,21 @@ void init_abc(py::module& m) { ); AbstractBaseTag.def( "to_snbt", - abstract_method + []( + const Amulet::AbstractBaseTag& self, + py::object indent + ){ + if (indent.is(py::none())){ + return self.to_snbt(); + } else if (py::isinstance(indent)){ + return self.to_snbt(std::string(indent.cast(), ' ')); + } else if (py::isinstance(indent)){ + return self.to_snbt(indent.cast()); + } else { + throw std::invalid_argument("indent must be None, int or str"); + } + }, + py::arg("indent") = py::none() ); AbstractBaseTag.def( "__eq__", From d8ec49287ffb3c4b82a992cf65781ef5c81bc68b Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Tue, 9 Jul 2024 10:51:32 +0100 Subject: [PATCH 063/121] Expose lower level encoding functions The higher level functions convert one encoded format to another encoded format. The lower level functions expose the intermediate code point vector which may be useful when parsing text. --- src/amulet_nbt/cpp/string_encoding/mutf8.cpp | 217 +++++++++--------- src/amulet_nbt/cpp/string_encoding/utf8.cpp | 48 ++-- .../include/amulet_nbt/string_encoding.hpp | 10 + 3 files changed, 135 insertions(+), 140 deletions(-) diff --git a/src/amulet_nbt/cpp/string_encoding/mutf8.cpp b/src/amulet_nbt/cpp/string_encoding/mutf8.cpp index 2c365e50..19610cdc 100644 --- a/src/amulet_nbt/cpp/string_encoding/mutf8.cpp +++ b/src/amulet_nbt/cpp/string_encoding/mutf8.cpp @@ -7,140 +7,135 @@ #include #include -typedef std::vector CodePointVector; -CodePointVector read_mutf8(const std::string &src) { - CodePointVector dst; +namespace Amulet { + CodePointVector read_mutf8(const std::string &src) { + CodePointVector dst; - for (size_t index = 0; index < src.size(); index++) { - uint8_t b1 = src[index]; + for (size_t index = 0; index < src.size(); index++) { + uint8_t b1 = src[index]; - if (b1 == 0) { - throw std::invalid_argument("Embedded NULL byte at index " + std::to_string(index)); - } - else if (b1 < 0b10000000) { - // ASCII/1 byte codepoint. - dst.push_back(b1 & 0b01111111); - } - else if ((b1 & 0b11100000) == 0b11000000) { - // 2 byte codepoint. - if (index + 1 >= src.size()) { - throw std::invalid_argument("2-byte codepoint started at index " + std::to_string(index) + ", but input too short to finish."); - } - uint8_t b2 = src[index + 1]; - if ((b2 & 0b11000000) != 0b10000000) { - throw std::invalid_argument("2-byte codepoint started at index " + std::to_string(index) + ", but format bits of byte 2 are incorrect."); - } - size_t value = (0b00011111 & b1) << 6 | (0b00111111 & b2); - if (0 < value && value < 0x80){ - throw std::invalid_argument("2-byte codepoint at index " + std::to_string(index) + " has invalid value."); + if (b1 == 0) { + throw std::invalid_argument("Embedded NULL byte at index " + std::to_string(index)); } - dst.push_back(value); - index++; - } - else if ((b1 & 0b11110000) == 0b11100000) { - // 3 or 6 byte codepoint. - if (index + 2 >= src.size()) { - throw std::invalid_argument("3-byte codepoint started at index " + std::to_string(index) + ", but input too short to finish."); + else if (b1 < 0b10000000) { + // ASCII/1 byte codepoint. + dst.push_back(b1 & 0b01111111); } - uint8_t b2 = src[index + 1]; - uint8_t b3 = src[index + 2]; - - if (b1 == 0b11101101 && (b2 & 0b11100000) == 0b10100000) { - if (index + 5 >= src.size()) { - throw std::invalid_argument("6-byte codepoint started at index " + std::to_string(index) + ", but input too short to finish."); - } - - uint8_t b4 = src[index + 3]; - uint8_t b5 = src[index + 4]; - uint8_t b6 = src[index + 5]; - if ((b2 & 0b11110000) != 0b10100000) { - throw std::invalid_argument("6-byte codepoint started at index " + std::to_string(index) + ", but format bits of byte 2 are incorrect."); - } - if ((b3 & 0b11000000) != 0b10000000) { - throw std::invalid_argument("6-byte codepoint started at index " + std::to_string(index) + ", but format bits of byte 3 are incorrect."); + else if ((b1 & 0b11100000) == 0b11000000) { + // 2 byte codepoint. + if (index + 1 >= src.size()) { + throw std::invalid_argument("2-byte codepoint started at index " + std::to_string(index) + ", but input too short to finish."); } - if (b4 != 0b11101101) { - throw std::invalid_argument("6-byte codepoint started at index " + std::to_string(index) + ", but format bits of byte 4 are incorrect."); - } - if ((b5 & 0b11110000) != 0b10110000) { - throw std::invalid_argument("6-byte codepoint started at index " + std::to_string(index) + ", but format bits of byte 5 are incorrect."); - } - if ((b6 & 0b11000000) != 0b10000000) { - throw std::invalid_argument("6-byte codepoint started at index " + std::to_string(index) + ", but format bits of byte 6 are incorrect."); + uint8_t b2 = src[index + 1]; + if ((b2 & 0b11000000) != 0b10000000) { + throw std::invalid_argument("2-byte codepoint started at index " + std::to_string(index) + ", but format bits of byte 2 are incorrect."); } - size_t value = 0x10000 + ((0b00001111 & b2) << 16 | (0b00111111 & b3) << 10 | (0b00001111 & b5) << 6 | (0b00111111 & b6)); - if (value < 0x10000){ - throw std::invalid_argument("6-byte codepoint at index " + std::to_string(index) + " has invalid value."); + size_t value = (0b00011111 & b1) << 6 | (0b00111111 & b2); + if (value < 0x80){ + throw std::invalid_argument("2-byte codepoint at index " + std::to_string(index) + " has invalid value."); } dst.push_back(value); - index += 5; + index++; } - else { - if ((b2 & 0b11000000) != 0b10000000) { - throw std::invalid_argument("3-byte codepoint started at index " + std::to_string(index) + ", but format bits of byte 2 are incorrect."); + else if ((b1 & 0b11110000) == 0b11100000) { + // 3 or 6 byte codepoint. + if (index + 2 >= src.size()) { + throw std::invalid_argument("3-byte codepoint started at index " + std::to_string(index) + ", but input too short to finish."); } - if ((b3 & 0b11000000) != 0b10000000) { - throw std::invalid_argument("3-byte codepoint started at index " + std::to_string(index) + ", but format bits of byte 3 are incorrect."); + uint8_t b2 = src[index + 1]; + uint8_t b3 = src[index + 2]; + + if (b1 == 0b11101101 && (b2 & 0b11100000) == 0b10100000) { + if (index + 5 >= src.size()) { + throw std::invalid_argument("6-byte codepoint started at index " + std::to_string(index) + ", but input too short to finish."); + } + + uint8_t b4 = src[index + 3]; + uint8_t b5 = src[index + 4]; + uint8_t b6 = src[index + 5]; + if ((b2 & 0b11110000) != 0b10100000) { + throw std::invalid_argument("6-byte codepoint started at index " + std::to_string(index) + ", but format bits of byte 2 are incorrect."); + } + if ((b3 & 0b11000000) != 0b10000000) { + throw std::invalid_argument("6-byte codepoint started at index " + std::to_string(index) + ", but format bits of byte 3 are incorrect."); + } + if (b4 != 0b11101101) { + throw std::invalid_argument("6-byte codepoint started at index " + std::to_string(index) + ", but format bits of byte 4 are incorrect."); + } + if ((b5 & 0b11110000) != 0b10110000) { + throw std::invalid_argument("6-byte codepoint started at index " + std::to_string(index) + ", but format bits of byte 5 are incorrect."); + } + if ((b6 & 0b11000000) != 0b10000000) { + throw std::invalid_argument("6-byte codepoint started at index " + std::to_string(index) + ", but format bits of byte 6 are incorrect."); + } + size_t value = 0x10000 + ((0b00001111 & b2) << 16 | (0b00111111 & b3) << 10 | (0b00001111 & b5) << 6 | (0b00111111 & b6)); + if (value < 0x10000){ + throw std::invalid_argument("6-byte codepoint at index " + std::to_string(index) + " has invalid value."); + } + dst.push_back(value); + index += 5; } - size_t value = ((0b00001111 & b1) << 12) | ((0b00111111 & b2) << 6) | (0b00111111 & b3); - if (value < 0x800){ - throw std::invalid_argument("3-byte codepoint at index " + std::to_string(index) + " has invalid value."); + else { + if ((b2 & 0b11000000) != 0b10000000) { + throw std::invalid_argument("3-byte codepoint started at index " + std::to_string(index) + ", but format bits of byte 2 are incorrect."); + } + if ((b3 & 0b11000000) != 0b10000000) { + throw std::invalid_argument("3-byte codepoint started at index " + std::to_string(index) + ", but format bits of byte 3 are incorrect."); + } + size_t value = ((0b00001111 & b1) << 12) | ((0b00111111 & b2) << 6) | (0b00111111 & b3); + if (value < 0x800){ + throw std::invalid_argument("3-byte codepoint at index " + std::to_string(index) + " has invalid value."); + } + dst.push_back(value); + index += 2; } - dst.push_back(value); - index += 2; + } + else { + throw std::invalid_argument("Invalid byte at index " + std::to_string(index)); } } - else { - throw std::invalid_argument("Invalid byte at index " + std::to_string(index)); - } + return dst; } - return dst; -} -void write_mutf8(std::string& dst, const CodePointVector& src) { - for (size_t index = 0; index < src.size(); index++) { - const size_t& c = src[index]; - if (c == 0) { - dst.push_back(0xC0); - dst.push_back(0x80); - } - else if (c <= 127) { - dst.push_back(c & 0b01111111); - } - else if (c <= 2047) { - dst.push_back(0b11000000 | 0b00011111 & (c >> 6)); - dst.push_back(0b10000000 | 0b00111111 & c); - } - else if (c <= 65535) { - if ((c >= 0xD800) && (c <= 0xDFFF)) { - throw std::invalid_argument("code point at index " + std::to_string(index) + " cannot be encoded."); + void write_mutf8(std::string& dst, const CodePointVector& src) { + for (size_t index = 0; index < src.size(); index++) { + const size_t& c = src[index]; + if (c == 0) { + dst.push_back(0xC0); + dst.push_back(0x80); + } + else if (c <= 127) { + dst.push_back(c & 0b01111111); + } + else if (c <= 2047) { + dst.push_back(0b11000000 | 0b00011111 & (c >> 6)); + dst.push_back(0b10000000 | 0b00111111 & c); + } + else if (c <= 65535) { + if ((c >= 0xD800) && (c <= 0xDFFF)) { + throw std::invalid_argument("code point at index " + std::to_string(index) + " cannot be encoded."); + } + dst.push_back(0b11100000 | 0b00001111 & (c >> 12)); + dst.push_back(0b10000000 | 0b00111111 & (c >> 6)); + dst.push_back(0b10000000 | 0b00111111 & c); + } + else if (c <= 1114111) { + dst.push_back(0b11101101); + dst.push_back(0b10100000 | 0b00001111 & ((c >> 16) - 1)); + dst.push_back(0b10000000 | 0b00111111 & (c >> 10)); + dst.push_back(0b11101101); + dst.push_back(0b10110000 | 0b00001111 & (c >> 6)); + dst.push_back(0b10000000 | 0b00111111 & c); + } + else { + throw std::invalid_argument("Invalid code point at index " + std::to_string(index)); } - dst.push_back(0b11100000 | 0b00001111 & (c >> 12)); - dst.push_back(0b10000000 | 0b00111111 & (c >> 6)); - dst.push_back(0b10000000 | 0b00111111 & c); - } - else if (c <= 1114111) { - dst.push_back(0b11101101); - dst.push_back(0b10100000 | 0b00001111 & ((c >> 16) - 1)); - dst.push_back(0b10000000 | 0b00111111 & (c >> 10)); - dst.push_back(0b11101101); - dst.push_back(0b10110000 | 0b00001111 & (c >> 6)); - dst.push_back(0b10000000 | 0b00111111 & c); - } - else { - throw std::invalid_argument("Invalid code point at index " + std::to_string(index)); } } -} - -CodePointVector read_utf8(const std::string& src); -void write_utf8(std::string &dst, const CodePointVector& src); - -namespace Amulet { // Decode a modified utf-8 byte sequence to a regular utf-8 byte sequence std::string mutf8_to_utf8(const std::string& src) { std::string dst; diff --git a/src/amulet_nbt/cpp/string_encoding/utf8.cpp b/src/amulet_nbt/cpp/string_encoding/utf8.cpp index 7b0975af..98f7f2fd 100644 --- a/src/amulet_nbt/cpp/string_encoding/utf8.cpp +++ b/src/amulet_nbt/cpp/string_encoding/utf8.cpp @@ -7,12 +7,10 @@ #include #include -typedef std::vector CodePointVector; - const size_t HexChars[16] = {48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102}; -inline void push_escape(CodePointVector& dst, const uint8_t& b){ +inline void push_escape(Amulet::CodePointVector& dst, const uint8_t& b){ dst.push_back(9243); // ␛ dst.push_back(120); // x dst.push_back(HexChars[b >> 4]); @@ -21,8 +19,8 @@ inline void push_escape(CodePointVector& dst, const uint8_t& b){ template -CodePointVector _read_utf8(const std::string& src) { - CodePointVector dst; +Amulet::CodePointVector _read_utf8(const std::string& src) { + Amulet::CodePointVector dst; for (size_t index = 0; index < src.size(); index++) { uint8_t b1 = src[index]; @@ -51,7 +49,7 @@ CodePointVector _read_utf8(const std::string& src) { } } size_t value = (0b00011111 & b1) << 6 | (0b00111111 & b2); - if (0 < value && value < 0x80) { + if (value < 0x80) { if constexpr (escapeErrors){ push_escape(dst, b1); continue; @@ -73,8 +71,6 @@ CodePointVector _read_utf8(const std::string& src) { } } uint8_t b2 = src[index + 1]; - uint8_t b3 = src[index + 2]; - if ((b2 & 0b11000000) != 0b10000000) { if constexpr (escapeErrors){ push_escape(dst, b1); @@ -83,6 +79,7 @@ CodePointVector _read_utf8(const std::string& src) { throw std::invalid_argument("3-byte codepoint started at index " + std::to_string(index) + ", but format bits of byte 2 are incorrect."); } } + uint8_t b3 = src[index + 2]; if ((b3 & 0b11000000) != 0b10000000) { if constexpr (escapeErrors){ push_escape(dst, b1); @@ -114,9 +111,6 @@ CodePointVector _read_utf8(const std::string& src) { } } uint8_t b2 = src[index + 1]; - uint8_t b3 = src[index + 2]; - uint8_t b4 = src[index + 3]; - if ((b2 & 0b11000000) != 0b10000000) { if constexpr (escapeErrors){ push_escape(dst, b1); @@ -125,6 +119,7 @@ CodePointVector _read_utf8(const std::string& src) { throw std::invalid_argument("4-byte codepoint started at index " + std::to_string(index) + ", but format bits of byte 2 are incorrect."); } } + uint8_t b3 = src[index + 2]; if ((b3 & 0b11000000) != 0b10000000) { if constexpr (escapeErrors){ push_escape(dst, b1); @@ -133,6 +128,7 @@ CodePointVector _read_utf8(const std::string& src) { throw std::invalid_argument("4-byte codepoint started at index " + std::to_string(index) + ", but format bits of byte 3 are incorrect."); } } + uint8_t b4 = src[index + 3]; if ((b4 & 0b11000000) != 0b10000000) { if constexpr (escapeErrors){ push_escape(dst, b1); @@ -178,7 +174,7 @@ inline char char_to_hex(const size_t& c){ template -constexpr void _write_utf8(std::string &dst, const CodePointVector& src) { +constexpr void _write_utf8(std::string &dst, const Amulet::CodePointVector& src) { for (size_t index = 0; index < src.size(); index++) { const size_t& c = src[index]; if (c <= 127) { @@ -224,34 +220,29 @@ constexpr void _write_utf8(std::string &dst, const CodePointVector& src) { } -CodePointVector read_utf8(const std::string& src) { - return _read_utf8(src); -} - - -void write_utf8(std::string &dst, const CodePointVector& src) { - return _write_utf8(dst, src); -} - - namespace Amulet{ - // Validate a utf-8 byte sequence and convert to itself. - std::string utf8_to_utf8(const std::string& src) { - std::string dst; - write_utf8(dst, read_utf8(src)); - return dst; + CodePointVector read_utf8(const std::string& src) { + return _read_utf8(src); } + void write_utf8(std::string &dst, const CodePointVector& src) { + return _write_utf8(dst, src); + } CodePointVector read_utf8_escape(const std::string& src) { return _read_utf8(src); } - void write_utf8_escape(std::string &dst, const CodePointVector& src) { return _write_utf8(dst, src); } + // Validate a utf-8 byte sequence and convert to itself. + std::string utf8_to_utf8(const std::string& src) { + std::string dst; + write_utf8(dst, read_utf8(src)); + return dst; + } // Decode a utf-8 escape byte sequence to a regular utf-8 byte sequence std::string utf8_escape_to_utf8(const std::string& src) { @@ -260,7 +251,6 @@ namespace Amulet{ return dst; } - // Encode a regular utf-8 byte sequence to a utf-8 escape byte sequence std::string utf8_to_utf8_escape(const std::string& src) { std::string dst; diff --git a/src/amulet_nbt/include/amulet_nbt/string_encoding.hpp b/src/amulet_nbt/include/amulet_nbt/string_encoding.hpp index 3eaaf595..0d264ec5 100644 --- a/src/amulet_nbt/include/amulet_nbt/string_encoding.hpp +++ b/src/amulet_nbt/include/amulet_nbt/string_encoding.hpp @@ -4,6 +4,16 @@ #include namespace Amulet { + // Functions to convert between code point vector and encoded formats + typedef std::vector CodePointVector; + CodePointVector read_utf8(const std::string& src); + void write_utf8(std::string &dst, const CodePointVector& src); + CodePointVector read_utf8_escape(const std::string& src); + void write_utf8_escape(std::string &dst, const CodePointVector& src); + CodePointVector read_mutf8(const std::string &src); + void write_mutf8(std::string& dst, const CodePointVector& src); + + // Functions to convert between the encoded formats. std::string utf8_to_utf8(const std::string& src); std::string utf8_escape_to_utf8(const std::string& src); std::string utf8_to_utf8_escape(const std::string& src); From 4d3795cac922950431a395e648488a1c582a0ea2 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Tue, 9 Jul 2024 10:51:47 +0100 Subject: [PATCH 064/121] Fixed function calls --- .../cpp/nbt_encoding/string/write.cpp | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/amulet_nbt/cpp/nbt_encoding/string/write.cpp b/src/amulet_nbt/cpp/nbt_encoding/string/write.cpp index cd7627e8..eeb46ddb 100644 --- a/src/amulet_nbt/cpp/nbt_encoding/string/write.cpp +++ b/src/amulet_nbt/cpp/nbt_encoding/string/write.cpp @@ -428,28 +428,28 @@ namespace Amulet { return snbt; } std::string write_formatted_snbt(const ByteTag& tag, const std::string& indent){ - return write_formatted_snbt(tag, indent); + return write_snbt(tag); } std::string write_formatted_snbt(const ShortTag& tag, const std::string& indent){ - return write_formatted_snbt(tag, indent); + return write_snbt(tag); } std::string write_formatted_snbt(const IntTag& tag, const std::string& indent){ - return write_formatted_snbt(tag, indent); + return write_snbt(tag); } std::string write_formatted_snbt(const LongTag& tag, const std::string& indent){ - return write_formatted_snbt(tag, indent); + return write_snbt(tag); } std::string write_formatted_snbt(const FloatTag& tag, const std::string& indent){ - return write_formatted_snbt(tag, indent); + return write_snbt(tag); } std::string write_formatted_snbt(const DoubleTag& tag, const std::string& indent){ - return write_formatted_snbt(tag, indent); + return write_snbt(tag); } std::string write_formatted_snbt(const ByteArrayTag& tag, const std::string& indent){ - return write_formatted_snbt(tag, indent); + return write_snbt(tag); } std::string write_formatted_snbt(const StringTag& tag, const std::string& indent){ - return write_formatted_snbt(tag, indent); + return write_snbt(tag); } std::string write_formatted_snbt(const ListTag& tag, const std::string& indent){ std::string snbt; @@ -462,9 +462,9 @@ namespace Amulet { return snbt; } std::string write_formatted_snbt(const IntArrayTag& tag, const std::string& indent){ - return write_formatted_snbt(tag, indent); + return write_snbt(tag); } std::string write_formatted_snbt(const LongArrayTag& tag, const std::string& indent){ - return write_formatted_snbt(tag, indent); + return write_snbt(tag); } } From 022c16c35eefd87e6e649f25b24254f491557d48 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Wed, 10 Jul 2024 11:32:32 +0100 Subject: [PATCH 065/121] Added easier to call string encoding functions --- src/amulet_nbt/cpp/string_encoding/mutf8.cpp | 6 ++++++ src/amulet_nbt/cpp/string_encoding/utf8.cpp | 16 ++++++++++++++-- .../include/amulet_nbt/string_encoding.hpp | 12 +++++++++--- 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/src/amulet_nbt/cpp/string_encoding/mutf8.cpp b/src/amulet_nbt/cpp/string_encoding/mutf8.cpp index 19610cdc..bf0584b8 100644 --- a/src/amulet_nbt/cpp/string_encoding/mutf8.cpp +++ b/src/amulet_nbt/cpp/string_encoding/mutf8.cpp @@ -135,6 +135,12 @@ namespace Amulet { } } + std::string write_mutf8(const CodePointVector& src) { + std::string dst; + write_mutf8(dst, src); + return dst; + } + // Decode a modified utf-8 byte sequence to a regular utf-8 byte sequence std::string mutf8_to_utf8(const std::string& src) { diff --git a/src/amulet_nbt/cpp/string_encoding/utf8.cpp b/src/amulet_nbt/cpp/string_encoding/utf8.cpp index 98f7f2fd..71337578 100644 --- a/src/amulet_nbt/cpp/string_encoding/utf8.cpp +++ b/src/amulet_nbt/cpp/string_encoding/utf8.cpp @@ -226,7 +226,13 @@ namespace Amulet{ } void write_utf8(std::string &dst, const CodePointVector& src) { - return _write_utf8(dst, src); + _write_utf8(dst, src); + } + + std::string write_utf8(const CodePointVector& src) { + std::string dst; + _write_utf8(dst, src); + return dst; } CodePointVector read_utf8_escape(const std::string& src) { @@ -234,7 +240,13 @@ namespace Amulet{ } void write_utf8_escape(std::string &dst, const CodePointVector& src) { - return _write_utf8(dst, src); + _write_utf8(dst, src); + } + + std::string write_utf8_escape(const CodePointVector& src) { + std::string dst; + _write_utf8(dst, src); + return dst; } // Validate a utf-8 byte sequence and convert to itself. diff --git a/src/amulet_nbt/include/amulet_nbt/string_encoding.hpp b/src/amulet_nbt/include/amulet_nbt/string_encoding.hpp index 0d264ec5..0d30fcd5 100644 --- a/src/amulet_nbt/include/amulet_nbt/string_encoding.hpp +++ b/src/amulet_nbt/include/amulet_nbt/string_encoding.hpp @@ -4,15 +4,21 @@ #include namespace Amulet { - // Functions to convert between code point vector and encoded formats typedef std::vector CodePointVector; + + // Functions to convert between code point vector and encoded formats CodePointVector read_utf8(const std::string& src); - void write_utf8(std::string &dst, const CodePointVector& src); CodePointVector read_utf8_escape(const std::string& src); - void write_utf8_escape(std::string &dst, const CodePointVector& src); CodePointVector read_mutf8(const std::string &src); + + void write_utf8(std::string &dst, const CodePointVector& src); + void write_utf8_escape(std::string &dst, const CodePointVector& src); void write_mutf8(std::string& dst, const CodePointVector& src); + std::string write_utf8(const CodePointVector& src); + std::string write_utf8_escape(const CodePointVector& src); + std::string write_mutf8(const CodePointVector& src); + // Functions to convert between the encoded formats. std::string utf8_to_utf8(const std::string& src); std::string utf8_escape_to_utf8(const std::string& src); From 26358499a0f188c744ef0f4027c5c5bbdae1a325 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Wed, 10 Jul 2024 11:33:02 +0100 Subject: [PATCH 066/121] Partially implemented snbt parsing --- .../cpp/nbt_encoding/string/read.cpp | 198 ++++++++++++++++++ .../amulet_nbt/nbt_encoding/string.hpp | 4 + 2 files changed, 202 insertions(+) create mode 100644 src/amulet_nbt/cpp/nbt_encoding/string/read.cpp diff --git a/src/amulet_nbt/cpp/nbt_encoding/string/read.cpp b/src/amulet_nbt/cpp/nbt_encoding/string/read.cpp new file mode 100644 index 00000000..6f811672 --- /dev/null +++ b/src/amulet_nbt/cpp/nbt_encoding/string/read.cpp @@ -0,0 +1,198 @@ +#include +#include +#include +#include +#include + +#include + + +const std::set Whitespace{' ', '\t', '\r', '\n'}; + + +inline bool in_range(const Amulet::CodePointVector& snbt, const size_t& index){ + return index < snbt.size(); +} + +inline bool in_range(const Amulet::CodePointVector& snbt, const size_t& index, const size_t count){ + return index + count - 1 < snbt.size(); +} + +inline bool bounds_check(const Amulet::CodePointVector& snbt, const size_t& index){ + if (in_range(snbt, index)){ + return true; + } + throw std::out_of_range("SNBT string is incomplete. Reached the end of the string."); +} + +inline void read_whitespace(const Amulet::CodePointVector& snbt, size_t& index){ + while (in_range(snbt, index) && Whitespace.contains(snbt[index])){ + index++; + } +} + +inline size_t read_code_point(const Amulet::CodePointVector& snbt, const size_t& index){ + bounds_check(snbt, index); + return snbt[index]; +} + +inline std::pair read_string(const Amulet::CodePointVector& snbt, size_t& index){ + throw std::exception("not implemented"); +} + +inline std::string read_error(const Amulet::CodePointVector& snbt, size_t& index){ + return Amulet::write_utf8(Amulet::CodePointVector(snbt.begin() + index, snbt.begin() + std::min(index + 10, snbt.size()))); +} + +inline void read_colon(const Amulet::CodePointVector& snbt, size_t& index){ + read_whitespace(snbt, index); + if (read_code_point(snbt, index) != ':'){ + throw std::invalid_argument("Expected : at position " + std::to_string(index) + " but got ->" + read_error(snbt, index) + " instead"); + } + index++; + read_whitespace(snbt, index); +} + +inline void read_comma(const Amulet::CodePointVector& snbt, size_t& index, unsigned char end_chr){ + read_whitespace(snbt, index); + size_t code = read_code_point(snbt, index); + if (code == ','){ + index++; + read_whitespace(snbt, index); + } else if (code != end_chr){ + throw std::invalid_argument("Expected ',' or '" + std::string(1, end_chr) + "' at position " + std::to_string(index) + " but got ->" + read_error(snbt, index) + " instead"); + } +} + + +inline std::pair find_int(const Amulet::CodePointVector& snbt, const size_t& index){ + // Find an int at position index. + // If an int is found the return value will be the start and end position of the int + // If a valid int was not found the values will be equal. + size_t start = index; + size_t temp_index = index; + if (in_range(snbt, temp_index) && (snbt[temp_index] == '+' || snbt[temp_index] == '-')){ + // read past the sign + temp_index++; + } + size_t number_start = temp_index; + while (in_range(snbt, temp_index) && '0' <= snbt[temp_index] && snbt[temp_index] <= '9'){ + temp_index++; + } + if (temp_index == number_start){ + // expected at least one number + return std::make_pair(start, start); + } + return std::make_pair(start, temp_index); +} + + +template +inline T read_int(const Amulet::CodePointVector& snbt, size_t start, size_t stop){ + std::string text; + Amulet::write_utf8(text, Amulet::CodePointVector(snbt.begin() + start, snbt.begin() + stop)); + return static_cast(std::stoll(text)); +} + + +template +inline Amulet::TagNode read_array(const Amulet::CodePointVector& snbt, size_t& index){ + //The caller must have read [ and validated B; but not read it (index must be after "[") + + // read past B; + index += 2; + read_whitespace(snbt, index); + std::vector arr; + while (read_code_point(snbt, index) != ']'){ + // read the number + auto [start, stop] = find_int(snbt, index); + if (start == stop){ + throw std::invalid_argument("Expected a ] or int at position " + std::to_string(index) + " but got ->" + read_error(snbt, index) + " instead"); + } + if constexpr (std::is_same_v){ + if ((read_code_point(snbt, stop) & ~32) != 'B'){ + throw std::invalid_argument("Expected 'B' position " + std::to_string(stop) + " but got ->" + read_error(snbt, index) + " instead"); + } + index = stop + 1; + } else if constexpr (std::is_same_v){ + if ((read_code_point(snbt, stop) & ~32) != 'L'){ + throw std::invalid_argument("Expected 'L' position " + std::to_string(stop) + " but got ->" + read_error(snbt, index) + " instead"); + } + index = stop + 1; + } else { + index = stop; + } + + // read and append the value + arr.push_back(read_int(snbt, start, stop)); + + // Read past the comma + read_comma(snbt, index, ']'); + } + return std::make_shared>(arr.begin(), arr.end()); +} + + +Amulet::TagNode _read_snbt(const Amulet::CodePointVector& snbt, size_t& index){ + read_whitespace(snbt, index); + switch (read_code_point(snbt, index)){ + case '{': + // CompoundTag + { + index++; + read_whitespace(snbt, index); + auto tag = std::make_shared(); + while (read_code_point(snbt, index) != '}'){ + // read the key + std::string key = read_string(snbt, index).first; + + // Read past the colon + read_colon(snbt, index); + + // Read the nested value + (*tag)[key] = _read_snbt(snbt, index); + + // Read past the comma + read_comma(snbt, index, '}'); + } + index++; // seek past '{' + return tag; + } + case '[': + index++; + read_whitespace(snbt, index); + if (snbt.size() >= index + 2){ + if (snbt[index] == 'B' && snbt[index+1] == ';'){ + // byte array + return read_array(snbt, index); + } else if (snbt[index] == 'I' && snbt[index+1] == ';'){ + // int array + return read_array(snbt, index); + } else if (snbt[index] == 'L' && snbt[index+1] == ';'){ + // long array + return read_array(snbt, index); + } else { + // list + throw std::exception("not implemented"); + } + } else if (read_code_point(snbt, index) == ']'){ + // empty list + index++; + return std::make_shared(); + } + default: + throw std::exception("not implemented"); + } +} + + +Amulet::TagNode Amulet::read_snbt(const Amulet::CodePointVector& snbt){ + size_t index = 0; + return _read_snbt(snbt, index); +} + + +Amulet::TagNode Amulet::read_snbt(const std::string& snbt){ + Amulet::CodePointVector code_points = Amulet::read_utf8_escape(snbt); + return Amulet::read_snbt(code_points); +} diff --git a/src/amulet_nbt/include/amulet_nbt/nbt_encoding/string.hpp b/src/amulet_nbt/include/amulet_nbt/nbt_encoding/string.hpp index d81af997..5a1cfe6f 100644 --- a/src/amulet_nbt/include/amulet_nbt/nbt_encoding/string.hpp +++ b/src/amulet_nbt/include/amulet_nbt/nbt_encoding/string.hpp @@ -1,6 +1,7 @@ #include #include +#include namespace Amulet { void write_snbt(std::string&, const Amulet::TagNode&); @@ -59,4 +60,7 @@ namespace Amulet { std::string write_formatted_snbt(const Amulet::CompoundTag&, const std::string& indent); std::string write_formatted_snbt(const Amulet::IntArrayTag&, const std::string& indent); std::string write_formatted_snbt(const Amulet::LongArrayTag&, const std::string& indent); + + Amulet::TagNode read_snbt(const Amulet::CodePointVector& snbt); + Amulet::TagNode read_snbt(const std::string& snbt); } From ebde4b8907583eda823378dba4783bd8ce5d357a Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Wed, 10 Jul 2024 11:35:39 +0100 Subject: [PATCH 067/121] Added from_snbt --- src/amulet_nbt/pybind/amulet_nbt.cpp | 2 ++ src/amulet_nbt/pybind/snbt.cpp | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 src/amulet_nbt/pybind/snbt.cpp diff --git a/src/amulet_nbt/pybind/amulet_nbt.cpp b/src/amulet_nbt/pybind/amulet_nbt.cpp index c0e402aa..279674f0 100644 --- a/src/amulet_nbt/pybind/amulet_nbt.cpp +++ b/src/amulet_nbt/pybind/amulet_nbt.cpp @@ -14,6 +14,7 @@ void init_compound(py::module&); void init_named_tag(py::module&); void init_bnbt(py::module& m); +void init_snbt(py::module& m); PYBIND11_MODULE(_nbt, m) { @@ -29,4 +30,5 @@ PYBIND11_MODULE(_nbt, m) { init_named_tag(m); init_bnbt(m); + init_snbt(m); } diff --git a/src/amulet_nbt/pybind/snbt.cpp b/src/amulet_nbt/pybind/snbt.cpp new file mode 100644 index 00000000..33bb56a2 --- /dev/null +++ b/src/amulet_nbt/pybind/snbt.cpp @@ -0,0 +1,26 @@ +#include +#include +#include + +#include +#include + +namespace py = pybind11; + +void init_snbt(py::module& m) { + m.def( + "from_snbt", + [](std::string snbt){ + return Amulet::wrap_node(Amulet::read_snbt(snbt)); + }, + py::arg("snbt"), + py::doc( + "Parse Stringified NBT.\n" + "\n" + ":param snbt: The SNBT string to parse.\n" + ":return: The tag\n" + ":raises: ValueError if the SNBT format is invalid.\n" + ":raises: IndexError if the data overflows the given string.\n" + ) + ); +} From 98cc2467f3dea9e23dd9c8a8bb191dccc6ed19dd Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Wed, 10 Jul 2024 12:22:45 +0100 Subject: [PATCH 068/121] Renamed load functions The naming scheme for the loading function was a bit odd. This standardises the naming scheme across C++ and python functions --- docs_source/getting_started.rst | 14 +-- docs_source/index.rst | 10 +- src/amulet_nbt/__init__.py | 12 +- src/amulet_nbt/__init__.pyi | 16 +-- .../cpp/nbt_encoding/binary/read.cpp | 18 +-- .../cpp/nbt_encoding/binary/write.cpp | 58 ++++----- .../amulet_nbt/nbt_encoding/binary.hpp | 36 +++--- .../include/amulet_nbt/tag/wrapper.hpp | 2 +- src/amulet_nbt/pybind/bnbt.cpp | 40 +++---- src/amulet_nbt/pybind/snbt.cpp | 2 +- src/amulet_nbt/pybind/tag/array.cpp | 4 +- src/amulet_nbt/pybind/tag/compound.cpp | 4 +- src/amulet_nbt/pybind/tag/list.cpp | 4 +- src/amulet_nbt/pybind/tag/named_tag.cpp | 4 +- .../test_read_file/__init__.py | 10 +- tests/test_amulet_nbt/test_tag/test_array.py | 78 ++++++------ .../test_amulet_nbt/test_tag/test_compound.py | 48 ++++---- tests/test_amulet_nbt/test_tag/test_float.py | 14 +-- tests/test_amulet_nbt/test_tag/test_int.py | 112 +++++++++--------- tests/test_amulet_nbt/test_tag/test_list.py | 56 ++++----- .../test_tag/test_named_tag.py | 6 +- tests/test_amulet_nbt/test_tag/test_string.py | 64 +++++----- tests/test_file_nbt/gen_data.py | 2 +- tests/test_load/test_load.py | 38 +++--- tests/test_massive_nbt.py | 8 +- tests/test_nbt.py | 8 +- 26 files changed, 334 insertions(+), 334 deletions(-) diff --git a/docs_source/getting_started.rst b/docs_source/getting_started.rst index a6dc8dd1..6b65557c 100644 --- a/docs_source/getting_started.rst +++ b/docs_source/getting_started.rst @@ -52,32 +52,32 @@ bedrock_named_tag: NamedTag # Load binary NBT - named_tag = amulet_nbt.load( + named_tag = amulet_nbt.read_nbt( "the/path/to/your/binary/nbt/file", preset=java_encoding, compressed=True, # These inputs must be specified as keyword inputs like this. ) # from a file - named_tag = amulet_nbt.load( + named_tag = amulet_nbt.read_nbt( "the/path/to/your/binary/nbt/file", compressed=True, # These inputs must be specified as keyword inputs like this. little_endian=False, # If you do not define them they will default to these values string_encoding=mutf8_encoding ) # from a file - named_tag = amulet_nbt.load(b'') # from a bytes object + named_tag = amulet_nbt.read_nbt(b'') # from a bytes object # Note that Java Edition usually uses compressed modified UTF-8. - java_named_tag = amulet_nbt.load( + java_named_tag = amulet_nbt.read_nbt( "the/path/to/your/binary/java/nbt/file", string_encoding=mutf8_encoding ) # Bedrock edition data is stored in little endian format and uses non-compressed UTF-8 but can also have arbitrary bytes. - bedrock_named_tag = amulet_nbt.load( + bedrock_named_tag = amulet_nbt.read_nbt( "the/path/to/your/binary/bedrock/nbt/file", preset=bedrock_encoding, compressed=False, ) - bedrock_named_tag = amulet_nbt.load( + bedrock_named_tag = amulet_nbt.read_nbt( "the/path/to/your/binary/bedrock/nbt/file", compressed=False, little_endian=True, @@ -117,7 +117,7 @@ # You can also parse the stringified NBT format used in Java commands. - tag = amulet_nbt.from_snbt('{key1: "value", key2: 0b, key3: 0.0f}') + tag = amulet_nbt.read_snbt('{key1: "value", key2: 0b, key3: 0.0f}') # tag should look like this # TAG_Compound( # key1: TAG_String("value"), diff --git a/docs_source/index.rst b/docs_source/index.rst index edd693ab..1727ff7f 100644 --- a/docs_source/index.rst +++ b/docs_source/index.rst @@ -186,11 +186,11 @@ These are functions to load the binary and stringified NBT formats. -.. autofunction:: amulet_nbt.load -.. autofunction:: amulet_nbt.load_array +.. autofunction:: amulet_nbt.read_nbt +.. autofunction:: amulet_nbt.read_nbt_array .. autoclass:: amulet_nbt.ReadOffset :members: -.. autofunction:: amulet_nbt.from_snbt +.. autofunction:: amulet_nbt.read_snbt ############ @@ -217,7 +217,7 @@ These are instances of a class storing C++ functions to encode and decode string :inherited-members: :undoc-members: -They can be passed to the string_encoding argument in to_nbt, save_to, load and load_array to control the string encoding behaviour. +They can be passed to the string_encoding argument in to_nbt, save_to, read_nbt and read_nbt_array to control the string encoding behaviour. The usual string encoding scheme is called UTF-8. @@ -237,7 +237,7 @@ Java Edition uses a modified version of UTF-8 implemented by the Java programmin Encoding Presets ################## -The string encoding and endianness can be defined separatly but for simplicity the following presets have been defined. +The string encoding and endianness can be defined separately but for simplicity the following presets have been defined. .. autodata:: amulet_nbt.java_encoding .. autodata:: amulet_nbt.bedrock_encoding diff --git a/src/amulet_nbt/__init__.py b/src/amulet_nbt/__init__.py index 2577b6ce..ed02f4e3 100644 --- a/src/amulet_nbt/__init__.py +++ b/src/amulet_nbt/__init__.py @@ -54,14 +54,14 @@ def get_include() -> str: NamedTag, - load, - load_array, + read_nbt, + read_nbt_array, ReadOffset, - # from_snbt, # NBTError, # NBTLoadError, # NBTFormatError, # SNBTParseError, + read_snbt, StringEncoding, mutf8_encoding, utf8_encoding, @@ -115,14 +115,14 @@ def get_include() -> str: "CompoundTag", "TAG_Compound", "NamedTag", - "load", - "load_array", + "read_nbt", + "read_nbt_array", "ReadOffset", - "from_snbt", "NBTError", "NBTLoadError", "NBTFormatError", "SNBTParseError", + "read_snbt", "SNBTType", "IntType", "FloatType", diff --git a/src/amulet_nbt/__init__.pyi b/src/amulet_nbt/__init__.pyi index b8be6987..ee3435b9 100644 --- a/src/amulet_nbt/__init__.pyi +++ b/src/amulet_nbt/__init__.pyi @@ -58,10 +58,10 @@ __all__ = [ "CompoundTag", "TAG_Compound", "NamedTag", - "load", - "load_array", + "read_nbt", + "read_nbt_array", "ReadOffset", - "from_snbt", + "read_snbt", "NBTError", "NBTLoadError", "NBTFormatError", @@ -1604,7 +1604,7 @@ class ReadOffset: offset: int @overload -def load( +def read_nbt( filepath_or_buffer: str | bytes | memoryview | _Readable | None, *, preset: EncodingPreset | None = None, @@ -1619,7 +1619,7 @@ def load( """ @overload -def load( +def read_nbt( filepath_or_buffer: str | bytes | memoryview | _Readable | None, *, compressed: bool = True, @@ -1638,7 +1638,7 @@ def load( """ @overload -def load_array( +def read_nbt_array( filepath_or_buffer: str | bytes | memoryview | _Readable | None, *, count: int = 1, @@ -1655,7 +1655,7 @@ def load_array( """ @overload -def load_array( +def read_nbt_array( filepath_or_buffer: str | bytes | memoryview | _Readable | None, *, count: int = 1, @@ -1675,7 +1675,7 @@ def load_array( :raises: NBTLoadError if an error occurred when loading the data. """ -def from_snbt(snbt: str) -> AnyNBT: +def read_snbt(snbt: str) -> AnyNBT: """ Load Stringified NBT into a tag. """ diff --git a/src/amulet_nbt/cpp/nbt_encoding/binary/read.cpp b/src/amulet_nbt/cpp/nbt_encoding/binary/read.cpp index 92e9b271..b32e5849 100644 --- a/src/amulet_nbt/cpp/nbt_encoding/binary/read.cpp +++ b/src/amulet_nbt/cpp/nbt_encoding/binary/read.cpp @@ -152,7 +152,7 @@ Amulet::TagNode read_node(Amulet::BinaryReader& reader, std::uint8_t tag_id){ namespace Amulet { - Amulet::NamedTag read_named_tag(Amulet::BinaryReader& reader){ + Amulet::NamedTag read_nbt(Amulet::BinaryReader& reader){ std::uint8_t tag_id = reader.readNumeric(); std::string name = read_string_tag(reader); Amulet::TagNode node = read_node(reader, tag_id); @@ -160,33 +160,33 @@ namespace Amulet { } // Read one named tag from the string at position offset. - Amulet::NamedTag read_named_tag(const std::string& raw, std::endian endianness, Amulet::StringDecode string_decode, size_t& offset){ + Amulet::NamedTag read_nbt(const std::string& raw, std::endian endianness, Amulet::StringDecode string_decode, size_t& offset){ Amulet::BinaryReader reader(raw, offset, endianness, string_decode); - return read_named_tag(reader); + return read_nbt(reader); } // Read one named tag from the string. - Amulet::NamedTag read_named_tag(const std::string& raw, std::endian endianness, Amulet::StringDecode string_decode){ + Amulet::NamedTag read_nbt(const std::string& raw, std::endian endianness, Amulet::StringDecode string_decode){ size_t offset = 0; - return read_named_tag(raw, endianness, string_decode, offset); + return read_nbt(raw, endianness, string_decode, offset); } // Read count named tags from the string at position offset. - std::vector read_named_tags(const std::string& raw, std::endian endianness, Amulet::StringDecode string_decode, size_t& offset, size_t count){ + std::vector read_nbt_array(const std::string& raw, std::endian endianness, Amulet::StringDecode string_decode, size_t& offset, size_t count){ Amulet::BinaryReader reader(raw, offset, endianness, string_decode); std::vector out; for (size_t i = 0; i < count; i++){ - out.push_back(read_named_tag(reader)); + out.push_back(read_nbt(reader)); } return out; } // Read all named tags from the string at position offset. - std::vector read_named_tags(const std::string& raw, std::endian endianness, Amulet::StringDecode string_decode, size_t& offset){ + std::vector read_nbt_array(const std::string& raw, std::endian endianness, Amulet::StringDecode string_decode, size_t& offset){ Amulet::BinaryReader reader(raw, offset, endianness, string_decode); std::vector out; while (reader.has_more_data()){ - out.push_back(read_named_tag(reader)); + out.push_back(read_nbt(reader)); } return out; } diff --git a/src/amulet_nbt/cpp/nbt_encoding/binary/write.cpp b/src/amulet_nbt/cpp/nbt_encoding/binary/write.cpp index 88127a19..0e728731 100644 --- a/src/amulet_nbt/cpp/nbt_encoding/binary/write.cpp +++ b/src/amulet_nbt/cpp/nbt_encoding/binary/write.cpp @@ -182,53 +182,53 @@ void write_compound_payload(Amulet::BinaryWriter& writer, const Amulet::Compound template - std::string _write_named_tag(const std::string& name, const T& tag, std::endian endianness, Amulet::StringEncode string_encode){ + std::string _write_nbt(const std::string& name, const T& tag, std::endian endianness, Amulet::StringEncode string_encode){ Amulet::BinaryWriter writer(endianness, string_encode); write_name_and_tag(writer, name, tag); return writer.getBuffer(); } namespace Amulet { - std::string write_named_tag(const std::string& name, const Amulet::ByteTag& tag, std::endian endianness, Amulet::StringEncode string_encode){ - return _write_named_tag(name, tag, endianness, string_encode); + std::string write_nbt(const std::string& name, const Amulet::ByteTag& tag, std::endian endianness, Amulet::StringEncode string_encode){ + return _write_nbt(name, tag, endianness, string_encode); }; - std::string write_named_tag(const std::string& name, const Amulet::ShortTag& tag, std::endian endianness, Amulet::StringEncode string_encode){ - return _write_named_tag(name, tag, endianness, string_encode); + std::string write_nbt(const std::string& name, const Amulet::ShortTag& tag, std::endian endianness, Amulet::StringEncode string_encode){ + return _write_nbt(name, tag, endianness, string_encode); }; - std::string write_named_tag(const std::string& name, const Amulet::IntTag& tag, std::endian endianness, Amulet::StringEncode string_encode){ - return _write_named_tag(name, tag, endianness, string_encode); + std::string write_nbt(const std::string& name, const Amulet::IntTag& tag, std::endian endianness, Amulet::StringEncode string_encode){ + return _write_nbt(name, tag, endianness, string_encode); }; - std::string write_named_tag(const std::string& name, const Amulet::LongTag& tag, std::endian endianness, Amulet::StringEncode string_encode){ - return _write_named_tag(name, tag, endianness, string_encode); + std::string write_nbt(const std::string& name, const Amulet::LongTag& tag, std::endian endianness, Amulet::StringEncode string_encode){ + return _write_nbt(name, tag, endianness, string_encode); }; - std::string write_named_tag(const std::string& name, const Amulet::FloatTag& tag, std::endian endianness, Amulet::StringEncode string_encode){ - return _write_named_tag(name, tag, endianness, string_encode); + std::string write_nbt(const std::string& name, const Amulet::FloatTag& tag, std::endian endianness, Amulet::StringEncode string_encode){ + return _write_nbt(name, tag, endianness, string_encode); }; - std::string write_named_tag(const std::string& name, const Amulet::DoubleTag& tag, std::endian endianness, Amulet::StringEncode string_encode){ - return _write_named_tag(name, tag, endianness, string_encode); + std::string write_nbt(const std::string& name, const Amulet::DoubleTag& tag, std::endian endianness, Amulet::StringEncode string_encode){ + return _write_nbt(name, tag, endianness, string_encode); }; - std::string write_named_tag(const std::string& name, const Amulet::ByteArrayTagPtr& tag, std::endian endianness, Amulet::StringEncode string_encode){ - return _write_named_tag(name, tag, endianness, string_encode); + std::string write_nbt(const std::string& name, const Amulet::ByteArrayTagPtr& tag, std::endian endianness, Amulet::StringEncode string_encode){ + return _write_nbt(name, tag, endianness, string_encode); }; - std::string write_named_tag(const std::string& name, const Amulet::StringTag& tag, std::endian endianness, Amulet::StringEncode string_encode){ - return _write_named_tag(name, tag, endianness, string_encode); + std::string write_nbt(const std::string& name, const Amulet::StringTag& tag, std::endian endianness, Amulet::StringEncode string_encode){ + return _write_nbt(name, tag, endianness, string_encode); }; - std::string write_named_tag(const std::string& name, const Amulet::ListTagPtr& tag, std::endian endianness, Amulet::StringEncode string_encode){ - return _write_named_tag(name, tag, endianness, string_encode); + std::string write_nbt(const std::string& name, const Amulet::ListTagPtr& tag, std::endian endianness, Amulet::StringEncode string_encode){ + return _write_nbt(name, tag, endianness, string_encode); }; - std::string write_named_tag(const std::string& name, const Amulet::CompoundTagPtr& tag, std::endian endianness, Amulet::StringEncode string_encode){ - return _write_named_tag(name, tag, endianness, string_encode); + std::string write_nbt(const std::string& name, const Amulet::CompoundTagPtr& tag, std::endian endianness, Amulet::StringEncode string_encode){ + return _write_nbt(name, tag, endianness, string_encode); }; - std::string write_named_tag(const std::string& name, const Amulet::IntArrayTagPtr& tag, std::endian endianness, Amulet::StringEncode string_encode){ - return _write_named_tag(name, tag, endianness, string_encode); + std::string write_nbt(const std::string& name, const Amulet::IntArrayTagPtr& tag, std::endian endianness, Amulet::StringEncode string_encode){ + return _write_nbt(name, tag, endianness, string_encode); }; - std::string write_named_tag(const std::string& name, const Amulet::LongArrayTagPtr& tag, std::endian endianness, Amulet::StringEncode string_encode){ - return _write_named_tag(name, tag, endianness, string_encode); + std::string write_nbt(const std::string& name, const Amulet::LongArrayTagPtr& tag, std::endian endianness, Amulet::StringEncode string_encode){ + return _write_nbt(name, tag, endianness, string_encode); }; - std::string write_named_tag(const std::string& name, const Amulet::TagNode& tag, std::endian endianness, Amulet::StringEncode string_encode){ - return _write_named_tag(name, tag, endianness, string_encode); + std::string write_nbt(const std::string& name, const Amulet::TagNode& tag, std::endian endianness, Amulet::StringEncode string_encode){ + return _write_nbt(name, tag, endianness, string_encode); }; - std::string write_named_tag(const Amulet::NamedTag& named_tag, std::endian endianness, Amulet::StringEncode string_encode){ - return write_named_tag(named_tag.name, named_tag.tag_node, endianness, string_encode); + std::string write_nbt(const Amulet::NamedTag& named_tag, std::endian endianness, Amulet::StringEncode string_encode){ + return write_nbt(named_tag.name, named_tag.tag_node, endianness, string_encode); } } diff --git a/src/amulet_nbt/include/amulet_nbt/nbt_encoding/binary.hpp b/src/amulet_nbt/include/amulet_nbt/nbt_encoding/binary.hpp index ff8d6252..71cb65a8 100644 --- a/src/amulet_nbt/include/amulet_nbt/nbt_encoding/binary.hpp +++ b/src/amulet_nbt/include/amulet_nbt/nbt_encoding/binary.hpp @@ -10,23 +10,23 @@ #include namespace Amulet { - Amulet::NamedTag read_named_tag(const std::string&, std::endian, Amulet::StringDecode, size_t& offset); - Amulet::NamedTag read_named_tag(const std::string&, std::endian, Amulet::StringDecode); - std::vector read_named_tags(const std::string&, std::endian, Amulet::StringDecode, size_t& offset); - std::vector read_named_tags(const std::string&, std::endian, Amulet::StringDecode, size_t& offset, size_t count); + Amulet::NamedTag read_nbt(const std::string&, std::endian, Amulet::StringDecode, size_t& offset); + Amulet::NamedTag read_nbt(const std::string&, std::endian, Amulet::StringDecode); + std::vector read_nbt_array(const std::string&, std::endian, Amulet::StringDecode, size_t& offset); + std::vector read_nbt_array(const std::string&, std::endian, Amulet::StringDecode, size_t& offset, size_t count); - std::string write_named_tag(const std::string& name, const Amulet::ByteTag&, std::endian, Amulet::StringEncode); - std::string write_named_tag(const std::string& name, const Amulet::ShortTag&, std::endian, Amulet::StringEncode); - std::string write_named_tag(const std::string& name, const Amulet::IntTag&, std::endian, Amulet::StringEncode); - std::string write_named_tag(const std::string& name, const Amulet::LongTag&, std::endian, Amulet::StringEncode); - std::string write_named_tag(const std::string& name, const Amulet::FloatTag&, std::endian, Amulet::StringEncode); - std::string write_named_tag(const std::string& name, const Amulet::DoubleTag&, std::endian, Amulet::StringEncode); - std::string write_named_tag(const std::string& name, const Amulet::ByteArrayTagPtr&, std::endian, Amulet::StringEncode); - std::string write_named_tag(const std::string& name, const Amulet::StringTag&, std::endian, Amulet::StringEncode); - std::string write_named_tag(const std::string& name, const Amulet::ListTagPtr&, std::endian, Amulet::StringEncode); - std::string write_named_tag(const std::string& name, const Amulet::CompoundTagPtr&, std::endian, Amulet::StringEncode); - std::string write_named_tag(const std::string& name, const Amulet::IntArrayTagPtr&, std::endian, Amulet::StringEncode); - std::string write_named_tag(const std::string& name, const Amulet::LongArrayTagPtr&, std::endian, Amulet::StringEncode); - std::string write_named_tag(const std::string& name, const Amulet::TagNode&, std::endian, Amulet::StringEncode); - std::string write_named_tag(const Amulet::NamedTag& tag, std::endian, Amulet::StringEncode); + std::string write_nbt(const std::string& name, const Amulet::ByteTag&, std::endian, Amulet::StringEncode); + std::string write_nbt(const std::string& name, const Amulet::ShortTag&, std::endian, Amulet::StringEncode); + std::string write_nbt(const std::string& name, const Amulet::IntTag&, std::endian, Amulet::StringEncode); + std::string write_nbt(const std::string& name, const Amulet::LongTag&, std::endian, Amulet::StringEncode); + std::string write_nbt(const std::string& name, const Amulet::FloatTag&, std::endian, Amulet::StringEncode); + std::string write_nbt(const std::string& name, const Amulet::DoubleTag&, std::endian, Amulet::StringEncode); + std::string write_nbt(const std::string& name, const Amulet::ByteArrayTagPtr&, std::endian, Amulet::StringEncode); + std::string write_nbt(const std::string& name, const Amulet::StringTag&, std::endian, Amulet::StringEncode); + std::string write_nbt(const std::string& name, const Amulet::ListTagPtr&, std::endian, Amulet::StringEncode); + std::string write_nbt(const std::string& name, const Amulet::CompoundTagPtr&, std::endian, Amulet::StringEncode); + std::string write_nbt(const std::string& name, const Amulet::IntArrayTagPtr&, std::endian, Amulet::StringEncode); + std::string write_nbt(const std::string& name, const Amulet::LongArrayTagPtr&, std::endian, Amulet::StringEncode); + std::string write_nbt(const std::string& name, const Amulet::TagNode&, std::endian, Amulet::StringEncode); + std::string write_nbt(const Amulet::NamedTag& tag, std::endian, Amulet::StringEncode); } diff --git a/src/amulet_nbt/include/amulet_nbt/tag/wrapper.hpp b/src/amulet_nbt/include/amulet_nbt/tag/wrapper.hpp index df407d58..14c01919 100644 --- a/src/amulet_nbt/include/amulet_nbt/tag/wrapper.hpp +++ b/src/amulet_nbt/include/amulet_nbt/tag/wrapper.hpp @@ -47,7 +47,7 @@ namespace Amulet { T tag; TagWrapper(T tag): tag(tag) {}; virtual std::string to_nbt(std::string name, std::endian endianness, Amulet::StringEncode string_encode) const { - return Amulet::write_named_tag(name, tag, endianness, string_encode); + return Amulet::write_nbt(name, tag, endianness, string_encode); } virtual std::string to_snbt() const { if constexpr (is_shared_ptr::value){ diff --git a/src/amulet_nbt/pybind/bnbt.cpp b/src/amulet_nbt/pybind/bnbt.cpp index ea8f58b8..be02bfef 100644 --- a/src/amulet_nbt/pybind/bnbt.cpp +++ b/src/amulet_nbt/pybind/bnbt.cpp @@ -79,7 +79,7 @@ void init_bnbt(py::module& m) { return data; }; - auto load = [get_buffer]( + auto read_nbt = [get_buffer]( py::object filepath_or_buffer, bool compressed, std::endian endianness, @@ -89,14 +89,14 @@ void init_bnbt(py::module& m) { std::string buffer = get_buffer(filepath_or_buffer, compressed); if (py::isinstance(read_offset_py)){ Amulet::ReadOffset& read_offset = read_offset_py.cast(); - return Amulet::read_named_tag( + return Amulet::read_nbt( buffer, endianness, string_decoder, read_offset.offset ); } else if (read_offset_py.is(py::none())){ - return Amulet::read_named_tag( + return Amulet::read_nbt( buffer, endianness, string_decoder @@ -107,13 +107,13 @@ void init_bnbt(py::module& m) { }; m.def( - "load", - [load]( + "read_nbt", + [read_nbt]( py::object filepath_or_buffer, Amulet::EncodingPreset preset, py::object read_offset ){ - return load( + return read_nbt( filepath_or_buffer, preset.compressed, preset.endianness, @@ -135,15 +135,15 @@ void init_bnbt(py::module& m) { ) ); m.def( - "load", - [load]( + "read_nbt", + [read_nbt]( py::object filepath_or_buffer, bool compressed, bool little_endian, Amulet::StringEncoding string_encoding, py::object read_offset ){ - return load( + return read_nbt( filepath_or_buffer, compressed, little_endian ? std::endian::little : std::endian::big, @@ -169,7 +169,7 @@ void init_bnbt(py::module& m) { ) ); - auto load_array = [get_buffer]( + auto read_nbt_array = [get_buffer]( py::object filepath_or_buffer, Py_ssize_t count, bool compressed, @@ -184,14 +184,14 @@ void init_bnbt(py::module& m) { if (py::isinstance(read_offset_py)){ Amulet::ReadOffset& read_offset = read_offset_py.cast(); if (count == -1){ - return Amulet::read_named_tags( + return Amulet::read_nbt_array( buffer, endianness, string_decoder, read_offset.offset ); } else { - return Amulet::read_named_tags( + return Amulet::read_nbt_array( buffer, endianness, string_decoder, @@ -202,14 +202,14 @@ void init_bnbt(py::module& m) { } else if (read_offset_py.is(py::none())){ size_t offset = 0; if (count == -1){ - return Amulet::read_named_tags( + return Amulet::read_nbt_array( buffer, endianness, string_decoder, offset ); } else { - return Amulet::read_named_tags( + return Amulet::read_nbt_array( buffer, endianness, string_decoder, @@ -222,14 +222,14 @@ void init_bnbt(py::module& m) { } }; m.def( - "load_array", - [load_array]( + "read_nbt_array", + [read_nbt_array]( py::object filepath_or_buffer, Py_ssize_t count, Amulet::EncodingPreset preset, py::object read_offset ){ - return load_array( + return read_nbt_array( filepath_or_buffer, count, preset.compressed, @@ -255,8 +255,8 @@ void init_bnbt(py::module& m) { ); m.def( - "load_array", - [load_array]( + "read_nbt_array", + [read_nbt_array]( py::object filepath_or_buffer, Py_ssize_t count, bool compressed, @@ -264,7 +264,7 @@ void init_bnbt(py::module& m) { Amulet::StringEncoding string_encoding, py::object read_offset ){ - return load_array( + return read_nbt_array( filepath_or_buffer, count, compressed, diff --git a/src/amulet_nbt/pybind/snbt.cpp b/src/amulet_nbt/pybind/snbt.cpp index 33bb56a2..06d3340c 100644 --- a/src/amulet_nbt/pybind/snbt.cpp +++ b/src/amulet_nbt/pybind/snbt.cpp @@ -9,7 +9,7 @@ namespace py = pybind11; void init_snbt(py::module& m) { m.def( - "from_snbt", + "read_snbt", [](std::string snbt){ return Amulet::wrap_node(Amulet::read_snbt(snbt)); }, diff --git a/src/amulet_nbt/pybind/tag/array.cpp b/src/amulet_nbt/pybind/tag/array.cpp index 632fafa3..fcabf9f6 100644 --- a/src/amulet_nbt/pybind/tag/array.cpp +++ b/src/amulet_nbt/pybind/tag/array.cpp @@ -93,12 +93,12 @@ namespace py = pybind11; CLSNAME.def(\ py::pickle(\ [](const Amulet::CLSNAME##Wrapper& self){\ - return py::bytes(Amulet::write_named_tag("", self.tag, std::endian::big, Amulet::utf8_to_mutf8));\ + return py::bytes(Amulet::write_nbt("", self.tag, std::endian::big, Amulet::utf8_to_mutf8));\ },\ [](py::bytes state){\ return Amulet::CLSNAME##Wrapper(\ std::get(\ - Amulet::read_named_tag(state, std::endian::big, Amulet::mutf8_to_utf8).tag_node\ + Amulet::read_nbt(state, std::endian::big, Amulet::mutf8_to_utf8).tag_node\ )\ );\ }\ diff --git a/src/amulet_nbt/pybind/tag/compound.cpp b/src/amulet_nbt/pybind/tag/compound.cpp index c65e186a..ef45f245 100644 --- a/src/amulet_nbt/pybind/tag/compound.cpp +++ b/src/amulet_nbt/pybind/tag/compound.cpp @@ -115,12 +115,12 @@ void init_compound(py::module& m) { CompoundTag.def( py::pickle( [](const Amulet::CompoundTagWrapper& self){ - return py::bytes(Amulet::write_named_tag("", self.tag, std::endian::big, Amulet::utf8_to_mutf8)); + return py::bytes(Amulet::write_nbt("", self.tag, std::endian::big, Amulet::utf8_to_mutf8)); }, [](py::bytes state){ return Amulet::CompoundTagWrapper( std::get( - Amulet::read_named_tag(state, std::endian::big, Amulet::mutf8_to_utf8).tag_node + Amulet::read_nbt(state, std::endian::big, Amulet::mutf8_to_utf8).tag_node ) ); } diff --git a/src/amulet_nbt/pybind/tag/list.cpp b/src/amulet_nbt/pybind/tag/list.cpp index 74ac33de..0d069c53 100644 --- a/src/amulet_nbt/pybind/tag/list.cpp +++ b/src/amulet_nbt/pybind/tag/list.cpp @@ -238,12 +238,12 @@ void init_list(py::module& m) { ListTag.def( py::pickle( [](const Amulet::ListTagWrapper& self){ - return py::bytes(Amulet::write_named_tag("", self.tag, std::endian::big, Amulet::utf8_to_mutf8)); + return py::bytes(Amulet::write_nbt("", self.tag, std::endian::big, Amulet::utf8_to_mutf8)); }, [](py::bytes state){ return Amulet::ListTagWrapper( std::get( - Amulet::read_named_tag(state, std::endian::big, Amulet::mutf8_to_utf8).tag_node + Amulet::read_nbt(state, std::endian::big, Amulet::mutf8_to_utf8).tag_node ) ); } diff --git a/src/amulet_nbt/pybind/tag/named_tag.cpp b/src/amulet_nbt/pybind/tag/named_tag.cpp index a2a97494..35cee7b4 100644 --- a/src/amulet_nbt/pybind/tag/named_tag.cpp +++ b/src/amulet_nbt/pybind/tag/named_tag.cpp @@ -101,10 +101,10 @@ void init_named_tag(py::module& m) { NamedTag.def( py::pickle( [](const Amulet::NamedTag& self){ - return py::bytes(Amulet::write_named_tag(self, std::endian::big, Amulet::utf8_to_mutf8)); + return py::bytes(Amulet::write_nbt(self, std::endian::big, Amulet::utf8_to_mutf8)); }, [](py::bytes state){ - return Amulet::read_named_tag(state, std::endian::big, Amulet::mutf8_to_utf8); + return Amulet::read_nbt(state, std::endian::big, Amulet::mutf8_to_utf8); } ) ); diff --git a/tests/test_amulet_nbt/test_read_file/__init__.py b/tests/test_amulet_nbt/test_read_file/__init__.py index 8d5b1db3..d3c271cf 100644 --- a/tests/test_amulet_nbt/test_read_file/__init__.py +++ b/tests/test_amulet_nbt/test_read_file/__init__.py @@ -1,7 +1,7 @@ import os from typing import Callable, TypeVar, Sequence, TypeAlias import unittest -from amulet_nbt import CompoundTag, load, from_snbt, NamedTag, AbstractBaseTag +from amulet_nbt import CompoundTag, read_nbt, read_snbt, NamedTag, AbstractBaseTag DATA_DIR = os.path.join(os.path.dirname(__file__), "src") @@ -22,22 +22,22 @@ def _open_snbt(path_: str) -> NamedTag: snbt = f_.read() else: snbt = path_ - return NamedTag(from_snbt(snbt)) + return NamedTag(read_snbt(snbt)) self._groups: Sequence[GroupType] = ( ( "big_endian_compressed_nbt", - lambda path_: load(path_, compressed=True, little_endian=False), + lambda path_: read_nbt(path_, compressed=True, little_endian=False), lambda obj_: obj_.save_to(compressed=True, little_endian=False), ), ( "big_endian_nbt", - lambda path_: load(path_, compressed=False, little_endian=False), + lambda path_: read_nbt(path_, compressed=False, little_endian=False), lambda obj_: obj_.save_to(compressed=False, little_endian=False), ), ( "little_endian_nbt", - lambda path_: load(path_, compressed=False, little_endian=True), + lambda path_: read_nbt(path_, compressed=False, little_endian=True), lambda obj_: obj_.save_to(compressed=False, little_endian=True), ), ( diff --git a/tests/test_amulet_nbt/test_tag/test_array.py b/tests/test_amulet_nbt/test_tag/test_array.py index bc8c287c..0259367b 100644 --- a/tests/test_amulet_nbt/test_tag/test_array.py +++ b/tests/test_amulet_nbt/test_tag/test_array.py @@ -16,10 +16,10 @@ ByteArrayTag, IntArrayTag, LongArrayTag, - load as load_nbt, + read_nbt, NBTFormatError, SNBTParseError, - from_snbt, + read_snbt, ) @@ -212,7 +212,7 @@ def test_to_nbt(self) -> None: def test_from_nbt(self) -> None: self.assertEqual( ByteArrayTag(), - load_nbt( + read_nbt( b"\x07\x00\x00\x00\x00\x00\x00", compressed=False, little_endian=False, @@ -220,7 +220,7 @@ def test_from_nbt(self) -> None: ) self.assertEqual( ByteArrayTag([-3, -2, -1, 0, 1, 2, 3]), - load_nbt( + read_nbt( b"\x07\x00\x00\x00\x00\x00\x07\xFD\xFE\xFF\x00\x01\x02\x03", compressed=False, little_endian=False, @@ -228,36 +228,36 @@ def test_from_nbt(self) -> None: ) self.assertEqual( ByteArrayTag([-3, -2, -1, 0, 1, 2, 3]), - load_nbt( + read_nbt( b"\x07\x00\x00\x07\x00\x00\x00\xFD\xFE\xFF\x00\x01\x02\x03", compressed=False, little_endian=True, ).byte_array, ) with self.assertRaises(NBTFormatError): - load_nbt( + read_nbt( b"\x07", ) with self.assertRaises(NBTFormatError): - load_nbt( + read_nbt( b"\x07\x00\x00", ) with self.assertRaises(NBTFormatError): - load_nbt( + read_nbt( b"\x07\x00\x00\x00\x00\x00", ) with self.assertRaises(NBTFormatError): - load_nbt( + read_nbt( b"\x07\x00\x00\x00\x00\x00\x01", ) with self.assertRaises(NBTFormatError): - load_nbt( + read_nbt( b"\x07\x00\x00\x00\x00\x00\x02\x00", ) self.assertEqual( IntArrayTag(), - load_nbt( + read_nbt( b"\x0B\x00\x00\x00\x00\x00\x00", compressed=False, little_endian=False, @@ -265,7 +265,7 @@ def test_from_nbt(self) -> None: ) self.assertEqual( IntArrayTag([-3, -2, -1, 0, 1, 2, 3]), - load_nbt( + read_nbt( b"\x0B\x00\x00\x00\x00\x00\x07\xFF\xFF\xFF\xFD\xFF\xFF\xFF\xFE\xFF\xFF\xFF\xFF\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x02\x00\x00\x00\x03", compressed=False, little_endian=False, @@ -273,36 +273,36 @@ def test_from_nbt(self) -> None: ) self.assertEqual( IntArrayTag([-3, -2, -1, 0, 1, 2, 3]), - load_nbt( + read_nbt( b"\x0B\x00\x00\x07\x00\x00\x00\xFD\xFF\xFF\xFF\xFE\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\x00\x00\x00\x01\x00\x00\x00\x02\x00\x00\x00\x03\x00\x00\x00", compressed=False, little_endian=True, ).int_array, ) with self.assertRaises(NBTFormatError): - load_nbt( + read_nbt( b"\x0B", ) with self.assertRaises(NBTFormatError): - load_nbt( + read_nbt( b"\x0B\x00\x00", ) with self.assertRaises(NBTFormatError): - load_nbt( + read_nbt( b"\x0B\x00\x00\x00\x00\x00", ) with self.assertRaises(NBTFormatError): - load_nbt( + read_nbt( b"\x0B\x00\x00\x00\x00\x00\x01", ) with self.assertRaises(NBTFormatError): - load_nbt( + read_nbt( b"\x0B\x00\x00\x00\x00\x00\x02\x00", ) self.assertEqual( LongArrayTag(), - load_nbt( + read_nbt( b"\x0C\x00\x00\x00\x00\x00\x00", compressed=False, little_endian=False, @@ -310,7 +310,7 @@ def test_from_nbt(self) -> None: ) self.assertEqual( LongArrayTag([-3, -2, -1, 0, 1, 2, 3]), - load_nbt( + read_nbt( b"\x0C\x00\x00\x00\x00\x00\x07\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFD\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFE\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x03", compressed=False, little_endian=False, @@ -318,30 +318,30 @@ def test_from_nbt(self) -> None: ) self.assertEqual( LongArrayTag([-3, -2, -1, 0, 1, 2, 3]), - load_nbt( + read_nbt( b"\x0C\x00\x00\x07\x00\x00\x00\xFD\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFE\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00", compressed=False, little_endian=True, ).long_array, ) with self.assertRaises(NBTFormatError): - load_nbt( + read_nbt( b"\x0C", ) with self.assertRaises(NBTFormatError): - load_nbt( + read_nbt( b"\x0C\x00\x00", ) with self.assertRaises(NBTFormatError): - load_nbt( + read_nbt( b"\x0C\x00\x00\x00\x00\x00", ) with self.assertRaises(NBTFormatError): - load_nbt( + read_nbt( b"\x0C\x00\x00\x00\x00\x00\x01", ) with self.assertRaises(NBTFormatError): - load_nbt( + read_nbt( b"\x0C\x00\x00\x00\x00\x00\x02\x00", ) @@ -367,51 +367,51 @@ def test_to_snbt(self) -> None: def test_from_snbt(self) -> None: with self.subTest("ByteArrayTag"): - self.assertEqual(ByteArrayTag(), from_snbt("[B;]")) + self.assertEqual(ByteArrayTag(), read_snbt("[B;]")) self.assertEqual( ByteArrayTag([-3, -2, -1, 0, 1, 2, 3]), - from_snbt("[B;-3b, -2b, -1b, 0b, 1b, 2b, 3b]"), + read_snbt("[B;-3b, -2b, -1b, 0b, 1b, 2b, 3b]"), ) self.assertEqual( ByteArrayTag([-3, -2, -1, 0, 1, 2, 3]), - from_snbt("[B;-3B, -2B, -1B, 0B, 1B, 2B, 3B]"), + read_snbt("[B;-3B, -2B, -1B, 0B, 1B, 2B, 3B]"), ) with self.assertRaises(SNBTParseError): - from_snbt( + read_snbt( "[B;-5, 5]", ) with self.assertRaises(SNBTParseError): - from_snbt( + read_snbt( "[B;-5.0B, 5.0B]", ) with self.subTest("IntArrayTag"): - self.assertEqual(IntArrayTag(), from_snbt("[I;]")) + self.assertEqual(IntArrayTag(), read_snbt("[I;]")) self.assertEqual( IntArrayTag([-3, -2, -1, 0, 1, 2, 3]), - from_snbt("[I;-3, -2, -1, 0, 1, 2, 3]"), + read_snbt("[I;-3, -2, -1, 0, 1, 2, 3]"), ) with self.assertRaises(SNBTParseError): - from_snbt( + read_snbt( "[I;-5.0, 5.0]", ) with self.subTest("LongArrayTag"): - self.assertEqual(LongArrayTag(), from_snbt("[L;]")) + self.assertEqual(LongArrayTag(), read_snbt("[L;]")) self.assertEqual( LongArrayTag([-3, -2, -1, 0, 1, 2, 3]), - from_snbt("[L;-3l, -2l, -1l, 0l, 1l, 2l, 3l]"), + read_snbt("[L;-3l, -2l, -1l, 0l, 1l, 2l, 3l]"), ) self.assertEqual( LongArrayTag([-3, -2, -1, 0, 1, 2, 3]), - from_snbt("[L;-3L, -2L, -1L, 0L, 1L, 2L, 3L]"), + read_snbt("[L;-3L, -2L, -1L, 0L, 1L, 2L, 3L]"), ) with self.assertRaises(SNBTParseError): - from_snbt( + read_snbt( "[L;-5, 5]", ) with self.assertRaises(SNBTParseError): - from_snbt( + read_snbt( "[L;-5.0L, 5.0L]", ) diff --git a/tests/test_amulet_nbt/test_tag/test_compound.py b/tests/test_amulet_nbt/test_tag/test_compound.py index 71ef63e5..c640e4ab 100644 --- a/tests/test_amulet_nbt/test_tag/test_compound.py +++ b/tests/test_amulet_nbt/test_tag/test_compound.py @@ -24,10 +24,10 @@ ByteArrayTag, IntArrayTag, LongArrayTag, - from_snbt, + read_snbt, SNBTParseError, NBTFormatError, - load as load_nbt, + read_nbt, ) @@ -780,52 +780,52 @@ def test_to_nbt(self) -> None: def test_from_nbt(self) -> None: self.assertEqual( CompoundTag(byte=ByteTag(5)), - load_nbt(b"\x0A\x00\x00\x01\x00\x04byte\x05\x00").compound, + read_nbt(b"\x0A\x00\x00\x01\x00\x04byte\x05\x00").compound, ) self.assertEqual( CompoundTag(byte=ByteTag(5)), - load_nbt( + read_nbt( b"\x0A\x00\x00\x01\x04\x00byte\x05\x00", little_endian=True ).compound, ) self.assertEqual( CompoundTag(short=ShortTag(5)), - load_nbt(b"\x0A\x00\x00\x02\x00\x05short\x00\x05\x00").compound, + read_nbt(b"\x0A\x00\x00\x02\x00\x05short\x00\x05\x00").compound, ) self.assertEqual( CompoundTag(short=ShortTag(5)), - load_nbt( + read_nbt( b"\x0A\x00\x00\x02\x05\x00short\x05\x00\x00", little_endian=True ).compound, ) self.assertEqual( CompoundTag(int=IntTag(5)), - load_nbt(b"\x0A\x00\x00\x03\x00\x03int\x00\x00\x00\x05\x00").compound, + read_nbt(b"\x0A\x00\x00\x03\x00\x03int\x00\x00\x00\x05\x00").compound, ) self.assertEqual( CompoundTag(int=IntTag(5)), - load_nbt( + read_nbt( b"\x0A\x00\x00\x03\x03\x00int\x05\x00\x00\x00\x00", little_endian=True ).compound, ) self.assertEqual( CompoundTag(long=LongTag(5)), - load_nbt( + read_nbt( b"\x0A\x00\x00\x04\x00\x04long\x00\x00\x00\x00\x00\x00\x00\x05\x00" ).compound, ) self.assertEqual( CompoundTag(long=LongTag(5)), - load_nbt( + read_nbt( b"\x0A\x00\x00\x04\x04\x00long\x05\x00\x00\x00\x00\x00\x00\x00\x00", little_endian=True, ).compound, ) with self.assertRaises(NBTFormatError): - load_nbt(b"\x0A") + read_nbt(b"\x0A") with self.assertRaises(NBTFormatError): - load_nbt(b"\x0A\x00\x00") + read_nbt(b"\x0A\x00\x00") def test_to_snbt(self) -> None: full_compound = CompoundTag( @@ -917,31 +917,31 @@ def test_to_snbt(self) -> None: ) def test_from_snbt(self) -> None: - self.assertEqual(CompoundTag(), from_snbt("{}")) + self.assertEqual(CompoundTag(), read_snbt("{}")) with self.subTest("Formatting"): - self.assertEqual(CompoundTag({"1": IntTag(5)}), from_snbt("{1: 5}")) - self.assertEqual(CompoundTag({"1": IntTag(5)}), from_snbt('{"1": 5}')) - self.assertEqual(CompoundTag({"1": IntTag(5)}), from_snbt("{'1': 5}")) + self.assertEqual(CompoundTag({"1": IntTag(5)}), read_snbt("{1: 5}")) + self.assertEqual(CompoundTag({"1": IntTag(5)}), read_snbt('{"1": 5}')) + self.assertEqual(CompoundTag({"1": IntTag(5)}), read_snbt("{'1': 5}")) self.assertEqual( - CompoundTag({"1": IntTag(5)}), from_snbt("{ '1' : 5 }") + CompoundTag({"1": IntTag(5)}), read_snbt("{ '1' : 5 }") ) self.assertEqual( - CompoundTag({"1": IntTag(5)}), from_snbt("\n{ \n '1' \n : \n 5 \n }\n") + CompoundTag({"1": IntTag(5)}), read_snbt("\n{ \n '1' \n : \n 5 \n }\n") ) with self.assertRaises(SNBTParseError): - from_snbt("{") + read_snbt("{") with self.assertRaises(SNBTParseError): - from_snbt("}") + read_snbt("}") with self.assertRaises(SNBTParseError): - from_snbt("{a:}") + read_snbt("{a:}") with self.assertRaises(SNBTParseError): - from_snbt("{a 5}") + read_snbt("{a 5}") with self.assertRaises(SNBTParseError): - from_snbt("{a:5, b:}") + read_snbt("{a:5, b:}") with self.assertRaises(SNBTParseError): - from_snbt("{a:5 b:6}") + read_snbt("{a:5 b:6}") if __name__ == "__main__": diff --git a/tests/test_amulet_nbt/test_tag/test_float.py b/tests/test_amulet_nbt/test_tag/test_float.py index f42698d6..3af8d16b 100644 --- a/tests/test_amulet_nbt/test_tag/test_float.py +++ b/tests/test_amulet_nbt/test_tag/test_float.py @@ -15,8 +15,8 @@ AbstractBaseFloatTag, FloatTag, DoubleTag, - load as load_nbt, - from_snbt, + read_nbt, + read_snbt, StringTag, ) @@ -288,21 +288,21 @@ def test_to_nbt(self) -> None: def test_from_nbt(self) -> None: self.assertEqual( FloatTag(5), - load_nbt(b"\x05\x00\x00\x40\xa0\x00\x00", little_endian=False).float, + read_nbt(b"\x05\x00\x00\x40\xa0\x00\x00", little_endian=False).float, ) self.assertEqual( FloatTag(5), - load_nbt(b"\x05\x00\x00\x00\x00\xa0\x40", little_endian=True).float, + read_nbt(b"\x05\x00\x00\x00\x00\xa0\x40", little_endian=True).float, ) self.assertEqual( DoubleTag(5), - load_nbt( + read_nbt( b"\x06\x00\x00\x40\x14\x00\x00\x00\x00\x00\x00", little_endian=False ).double, ) self.assertEqual( DoubleTag(5), - load_nbt( + read_nbt( b"\x06\x00\x00\x00\x00\x00\x00\x00\x00\x14\x40", little_endian=True ).double, ) @@ -647,7 +647,7 @@ def test_from_snbt(self) -> None: for tag, snbt in float_data: with self.subTest(snbt): - self.assertEqual(tag, from_snbt(snbt)) + self.assertEqual(tag, read_snbt(snbt)) if __name__ == "__main__": diff --git a/tests/test_amulet_nbt/test_tag/test_int.py b/tests/test_amulet_nbt/test_tag/test_int.py index 4b4845d8..11f41e4f 100644 --- a/tests/test_amulet_nbt/test_tag/test_int.py +++ b/tests/test_amulet_nbt/test_tag/test_int.py @@ -17,9 +17,9 @@ ShortTag, IntTag, LongTag, - load as load_nbt, + read_nbt, StringTag, - from_snbt, + read_snbt, ) @@ -293,37 +293,37 @@ def test_to_nbt(self) -> None: def test_from_nbt(self) -> None: self.assertEqual( ByteTag(5), - load_nbt(b"\x01\x00\x00\x05", little_endian=False).byte, + read_nbt(b"\x01\x00\x00\x05", little_endian=False).byte, ) self.assertEqual( ByteTag(5), - load_nbt(b"\x01\x00\x00\x05", little_endian=True).byte, + read_nbt(b"\x01\x00\x00\x05", little_endian=True).byte, ) self.assertEqual( ShortTag(5), - load_nbt(b"\x02\x00\x00\x00\x05", little_endian=False).short, + read_nbt(b"\x02\x00\x00\x00\x05", little_endian=False).short, ) self.assertEqual( ShortTag(5), - load_nbt(b"\x02\x00\x00\x05\x00", little_endian=True).short, + read_nbt(b"\x02\x00\x00\x05\x00", little_endian=True).short, ) self.assertEqual( IntTag(5), - load_nbt(b"\x03\x00\x00\x00\x00\x00\x05", little_endian=False).int, + read_nbt(b"\x03\x00\x00\x00\x00\x00\x05", little_endian=False).int, ) self.assertEqual( IntTag(5), - load_nbt(b"\x03\x00\x00\x05\x00\x00\x00", little_endian=True).int, + read_nbt(b"\x03\x00\x00\x05\x00\x00\x00", little_endian=True).int, ) self.assertEqual( LongTag(5), - load_nbt( + read_nbt( b"\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05", little_endian=False ).long, ) self.assertEqual( LongTag(5), - load_nbt( + read_nbt( b"\x04\x00\x00\x05\x00\x00\x00\x00\x00\x00\x00", little_endian=True ).long, ) @@ -351,58 +351,58 @@ def test_to_snbt(self) -> None: def test_from_snbt(self) -> None: with self.subTest(): - self.assertEqual(ByteTag(-5), from_snbt("-5b")) - self.assertEqual(ByteTag(-5), from_snbt("-5B")) - self.assertEqual(ByteTag(0), from_snbt("0b")) - self.assertEqual(ByteTag(0), from_snbt("0B")) - self.assertEqual(ByteTag(0), from_snbt("+0b")) - self.assertEqual(ByteTag(0), from_snbt("+0B")) - self.assertEqual(ByteTag(0), from_snbt("false")) - self.assertEqual(ByteTag(0), from_snbt("False")) - self.assertEqual(ByteTag(1), from_snbt("true")) - self.assertEqual(ByteTag(1), from_snbt("True")) - self.assertEqual(ByteTag(5), from_snbt("5b")) - self.assertEqual(ByteTag(5), from_snbt("5B")) - self.assertEqual(ByteTag(5), from_snbt("+5b")) - self.assertEqual(ByteTag(5), from_snbt("+5B")) + self.assertEqual(ByteTag(-5), read_snbt("-5b")) + self.assertEqual(ByteTag(-5), read_snbt("-5B")) + self.assertEqual(ByteTag(0), read_snbt("0b")) + self.assertEqual(ByteTag(0), read_snbt("0B")) + self.assertEqual(ByteTag(0), read_snbt("+0b")) + self.assertEqual(ByteTag(0), read_snbt("+0B")) + self.assertEqual(ByteTag(0), read_snbt("false")) + self.assertEqual(ByteTag(0), read_snbt("False")) + self.assertEqual(ByteTag(1), read_snbt("true")) + self.assertEqual(ByteTag(1), read_snbt("True")) + self.assertEqual(ByteTag(5), read_snbt("5b")) + self.assertEqual(ByteTag(5), read_snbt("5B")) + self.assertEqual(ByteTag(5), read_snbt("+5b")) + self.assertEqual(ByteTag(5), read_snbt("+5B")) with self.subTest(): - self.assertEqual(ShortTag(-5), from_snbt("-5s")) - self.assertEqual(ShortTag(-5), from_snbt("-5S")) - self.assertEqual(ShortTag(0), from_snbt("0s")) - self.assertEqual(ShortTag(0), from_snbt("0S")) - self.assertEqual(ShortTag(0), from_snbt("+0s")) - self.assertEqual(ShortTag(0), from_snbt("+0S")) - self.assertEqual(ShortTag(5), from_snbt("5s")) - self.assertEqual(ShortTag(5), from_snbt("5S")) - self.assertEqual(ShortTag(5), from_snbt("+5s")) - self.assertEqual(ShortTag(5), from_snbt("+5S")) + self.assertEqual(ShortTag(-5), read_snbt("-5s")) + self.assertEqual(ShortTag(-5), read_snbt("-5S")) + self.assertEqual(ShortTag(0), read_snbt("0s")) + self.assertEqual(ShortTag(0), read_snbt("0S")) + self.assertEqual(ShortTag(0), read_snbt("+0s")) + self.assertEqual(ShortTag(0), read_snbt("+0S")) + self.assertEqual(ShortTag(5), read_snbt("5s")) + self.assertEqual(ShortTag(5), read_snbt("5S")) + self.assertEqual(ShortTag(5), read_snbt("+5s")) + self.assertEqual(ShortTag(5), read_snbt("+5S")) with self.subTest(): - self.assertEqual(IntTag(-5), from_snbt("-5")) - self.assertEqual(IntTag(0), from_snbt("0")) - self.assertEqual(IntTag(0), from_snbt("+0")) - self.assertEqual(IntTag(5), from_snbt("5")) - self.assertEqual(IntTag(5), from_snbt("+5")) - - self.assertEqual(StringTag("-5i"), from_snbt("-5i")) - self.assertEqual(StringTag("-5I"), from_snbt("-5I")) - self.assertEqual(StringTag("5i"), from_snbt("5i")) - self.assertEqual(StringTag("5I"), from_snbt("5I")) - self.assertEqual(StringTag("+5i"), from_snbt("+5i")) - self.assertEqual(StringTag("+5I"), from_snbt("+5I")) + self.assertEqual(IntTag(-5), read_snbt("-5")) + self.assertEqual(IntTag(0), read_snbt("0")) + self.assertEqual(IntTag(0), read_snbt("+0")) + self.assertEqual(IntTag(5), read_snbt("5")) + self.assertEqual(IntTag(5), read_snbt("+5")) + + self.assertEqual(StringTag("-5i"), read_snbt("-5i")) + self.assertEqual(StringTag("-5I"), read_snbt("-5I")) + self.assertEqual(StringTag("5i"), read_snbt("5i")) + self.assertEqual(StringTag("5I"), read_snbt("5I")) + self.assertEqual(StringTag("+5i"), read_snbt("+5i")) + self.assertEqual(StringTag("+5I"), read_snbt("+5I")) with self.subTest(): - self.assertEqual(LongTag(-5), from_snbt("-5l")) - self.assertEqual(LongTag(-5), from_snbt("-5L")) - self.assertEqual(LongTag(0), from_snbt("0l")) - self.assertEqual(LongTag(0), from_snbt("0L")) - self.assertEqual(LongTag(0), from_snbt("+0l")) - self.assertEqual(LongTag(0), from_snbt("+0L")) - self.assertEqual(LongTag(5), from_snbt("5l")) - self.assertEqual(LongTag(5), from_snbt("5L")) - self.assertEqual(LongTag(5), from_snbt("+5l")) - self.assertEqual(LongTag(5), from_snbt("+5L")) + self.assertEqual(LongTag(-5), read_snbt("-5l")) + self.assertEqual(LongTag(-5), read_snbt("-5L")) + self.assertEqual(LongTag(0), read_snbt("0l")) + self.assertEqual(LongTag(0), read_snbt("0L")) + self.assertEqual(LongTag(0), read_snbt("+0l")) + self.assertEqual(LongTag(0), read_snbt("+0L")) + self.assertEqual(LongTag(5), read_snbt("5l")) + self.assertEqual(LongTag(5), read_snbt("5L")) + self.assertEqual(LongTag(5), read_snbt("+5l")) + self.assertEqual(LongTag(5), read_snbt("+5L")) if __name__ == "__main__": diff --git a/tests/test_amulet_nbt/test_tag/test_list.py b/tests/test_amulet_nbt/test_tag/test_list.py index 092f280a..8f91e8c8 100644 --- a/tests/test_amulet_nbt/test_tag/test_list.py +++ b/tests/test_amulet_nbt/test_tag/test_list.py @@ -23,9 +23,9 @@ CompoundTag, IntArrayTag, LongArrayTag, - load as load_nbt, + read_nbt, NBTFormatError, - from_snbt, + read_snbt, SNBTParseError, ) @@ -840,21 +840,21 @@ def test_to_nbt(self) -> None: def test_from_nbt(self) -> None: self.assertEqual( - ListTag([], 1), load_nbt(b"\x09\x00\x00\x01\xFF\xFF\xFF\xFF").list + ListTag([], 1), read_nbt(b"\x09\x00\x00\x01\xFF\xFF\xFF\xFF").list ) with self.assertRaises(NBTFormatError): - load_nbt(b"\x09") + read_nbt(b"\x09") with self.assertRaises(NBTFormatError): - load_nbt(b"\x09\x00\x00") + read_nbt(b"\x09\x00\x00") with self.assertRaises(NBTFormatError): - load_nbt(b"\x09\x00\x00\x00") + read_nbt(b"\x09\x00\x00\x00") with self.assertRaises(NBTFormatError): - load_nbt(b"\x09\x00\x00\x00\x00") + read_nbt(b"\x09\x00\x00\x00\x00") with self.assertRaises(NBTFormatError): - load_nbt(b"\x09\x00\x00\x00\x00\x00") + read_nbt(b"\x09\x00\x00\x00\x00\x00") with self.assertRaises(NBTFormatError): - load_nbt(b"\x09\x00\x00\x00\x00\x00\x00") + read_nbt(b"\x09\x00\x00\x00\x00\x00\x00") def test_to_snbt(self) -> None: self.assertEqual("[]", ListTag().to_snbt()) @@ -869,42 +869,42 @@ def test_to_snbt(self) -> None: def test_from_snbt(self) -> None: with self.subTest("Formatting"): - self.assertEqual(ListTag(), from_snbt("[]")) - self.assertEqual(ListTag([IntTag(5)]), from_snbt("[5]")) - self.assertEqual(ListTag([IntTag(5)]), from_snbt("[5,]")) - self.assertEqual(ListTag([IntTag(5)]), from_snbt("[ 5 ]")) - self.assertEqual(ListTag([IntTag(5)]), from_snbt("[ 5 , ]")) - - self.assertEqual(ListTag([IntTag(5), IntTag(-5)]), from_snbt("[5, -5]")) - self.assertEqual(ListTag([IntTag(5), IntTag(-5)]), from_snbt("[5, -5, ]")) - self.assertEqual(ListTag([IntTag(5), IntTag(-5)]), from_snbt("[5,-5]")) - self.assertEqual(ListTag([IntTag(5), IntTag(-5)]), from_snbt("[5,-5,]")) + self.assertEqual(ListTag(), read_snbt("[]")) + self.assertEqual(ListTag([IntTag(5)]), read_snbt("[5]")) + self.assertEqual(ListTag([IntTag(5)]), read_snbt("[5,]")) + self.assertEqual(ListTag([IntTag(5)]), read_snbt("[ 5 ]")) + self.assertEqual(ListTag([IntTag(5)]), read_snbt("[ 5 , ]")) + + self.assertEqual(ListTag([IntTag(5), IntTag(-5)]), read_snbt("[5, -5]")) + self.assertEqual(ListTag([IntTag(5), IntTag(-5)]), read_snbt("[5, -5, ]")) + self.assertEqual(ListTag([IntTag(5), IntTag(-5)]), read_snbt("[5,-5]")) + self.assertEqual(ListTag([IntTag(5), IntTag(-5)]), read_snbt("[5,-5,]")) self.assertEqual( - ListTag([IntTag(5), IntTag(-5)]), from_snbt("[ 5 , -5 ]") + ListTag([IntTag(5), IntTag(-5)]), read_snbt("[ 5 , -5 ]") ) self.assertEqual( - ListTag([IntTag(5), IntTag(-5)]), from_snbt("[ 5 , -5 , ]") + ListTag([IntTag(5), IntTag(-5)]), read_snbt("[ 5 , -5 , ]") ) for cls in self.nbt_types: with self.subTest(cls=cls): tag = cls() - self.assertEqual(ListTag([tag]), from_snbt(f"[{tag.to_snbt()}]")) + self.assertEqual(ListTag([tag]), read_snbt(f"[{tag.to_snbt()}]")) self.assertEqual( ListTag([tag, tag]), - from_snbt(f"[{tag.to_snbt()}, {tag.to_snbt()}]"), + read_snbt(f"[{tag.to_snbt()}, {tag.to_snbt()}]"), ) with self.assertRaises(SNBTParseError): - from_snbt("[") + read_snbt("[") with self.assertRaises(SNBTParseError): - from_snbt("]") + read_snbt("]") with self.assertRaises(SNBTParseError): - from_snbt("[,]") + read_snbt("[,]") with self.assertRaises(SNBTParseError): - from_snbt("[,1]") + read_snbt("[,1]") with self.assertRaises(SNBTParseError): - from_snbt("[1 1]") + read_snbt("[1 1]") if __name__ == "__main__": diff --git a/tests/test_amulet_nbt/test_tag/test_named_tag.py b/tests/test_amulet_nbt/test_tag/test_named_tag.py index c8c7907f..474b18d8 100644 --- a/tests/test_amulet_nbt/test_tag/test_named_tag.py +++ b/tests/test_amulet_nbt/test_tag/test_named_tag.py @@ -23,7 +23,7 @@ mutf8_encoding, utf8_encoding, utf8_escape_encoding, - load as load_nbt, + read_nbt, ) from .test_abc import AbstractBaseTestCase, TagNameMap @@ -245,14 +245,14 @@ def test_from_nbt(self) -> None: (b"\x0C\x00\x00\x00\x00\x00\x00", NamedTag(LongArrayTag())), ): with self.subTest(str(bnbt)): - named_tag = load_nbt(bnbt, compressed=False) + named_tag = read_nbt(bnbt, compressed=False) self.assertIsInstance(named_tag, NamedTag) self.assertEqual(correct_named_tag, named_tag) self.assertEqual(correct_named_tag.tag, named_tag.tag) self.assertEqual( "hello world", - load_nbt(b"\x01\x00\x0Bhello world\x01", compressed=False).name, + read_nbt(b"\x01\x00\x0Bhello world\x01", compressed=False).name, ) def test_to_snbt(self) -> None: diff --git a/tests/test_amulet_nbt/test_tag/test_string.py b/tests/test_amulet_nbt/test_tag/test_string.py index 0ecef8fc..221071be 100644 --- a/tests/test_amulet_nbt/test_tag/test_string.py +++ b/tests/test_amulet_nbt/test_tag/test_string.py @@ -13,9 +13,9 @@ AbstractBaseTag, AbstractBaseImmutableTag, utf8_escape_encoding, - load as load_nbt, + read_nbt, NBTFormatError, - from_snbt, + read_snbt, SNBTParseError, ) @@ -162,31 +162,31 @@ def test_to_nbt(self) -> None: def test_from_nbt(self) -> None: self.assertEqual( StringTag(), - load_nbt( + read_nbt( b"\x08\x00\x00\x00\x00", compressed=False, little_endian=False ).string, ) self.assertEqual( StringTag(), - load_nbt( + read_nbt( b"\x08\x00\x00\x00\x00", compressed=False, little_endian=True ).string, ) self.assertEqual( StringTag("test"), - load_nbt( + read_nbt( b"\x08\x00\x00\x00\x04test", compressed=False, little_endian=False ).string, ) self.assertEqual( StringTag("test"), - load_nbt( + read_nbt( b"\x08\x00\x00\x04\x00test", compressed=False, little_endian=True ).string, ) self.assertEqual( StringTag("🏹"), - load_nbt( + read_nbt( b"\x08\x00\x00\x00\x06\xed\xa0\xbc\xed\xbf\xb9", compressed=False, little_endian=False, @@ -194,7 +194,7 @@ def test_from_nbt(self) -> None: ) self.assertEqual( StringTag("🏹"), - load_nbt( + read_nbt( b"\x08\x00\x00\x04\x00\xf0\x9f\x8f\xb9", compressed=False, little_endian=True, @@ -204,7 +204,7 @@ def test_from_nbt(self) -> None: # test invalid utf-8 string self.assertEqual( StringTag("␛xff␛xfe␛xfd␛xfc"), - load_nbt( + read_nbt( b"\x08\x00\x00\x04\x00\xff\xfe\xfd\xfc", compressed=False, little_endian=True, @@ -213,7 +213,7 @@ def test_from_nbt(self) -> None: ) with self.assertRaises(NBTFormatError): - load_nbt(b"\x08\x00\x00\x00\x05abcd") + read_nbt(b"\x08\x00\x00\x00\x05abcd") def test_to_snbt(self) -> None: self.assertEqual('""', StringTag().to_snbt()) @@ -222,62 +222,62 @@ def test_to_snbt(self) -> None: self.assertEqual('"quote\'value"', StringTag("quote'value").to_snbt()) def test_from_snbt(self) -> None: - self.assertEqual(StringTag(), from_snbt("''")) - self.assertEqual(StringTag(), from_snbt('""')) + self.assertEqual(StringTag(), read_snbt("''")) + self.assertEqual(StringTag(), read_snbt('""')) - self.assertEqual(StringTag('a"b'), from_snbt('"a\\"b"')) - self.assertEqual(StringTag('a"b'), from_snbt("'a\"b'")) + self.assertEqual(StringTag('a"b'), read_snbt('"a\\"b"')) + self.assertEqual(StringTag('a"b'), read_snbt("'a\"b'")) - self.assertEqual(StringTag(ascii_lowercase), from_snbt(ascii_lowercase)) - self.assertEqual(StringTag(ascii_lowercase), from_snbt(f"'{ascii_lowercase}'")) - self.assertEqual(StringTag(ascii_lowercase), from_snbt(f'"{ascii_lowercase}"')) + self.assertEqual(StringTag(ascii_lowercase), read_snbt(ascii_lowercase)) + self.assertEqual(StringTag(ascii_lowercase), read_snbt(f"'{ascii_lowercase}'")) + self.assertEqual(StringTag(ascii_lowercase), read_snbt(f'"{ascii_lowercase}"')) - self.assertEqual(StringTag(ascii_uppercase), from_snbt(ascii_uppercase)) - self.assertEqual(StringTag(ascii_uppercase), from_snbt(f"'{ascii_uppercase}'")) - self.assertEqual(StringTag(ascii_uppercase), from_snbt(f'"{ascii_uppercase}"')) + self.assertEqual(StringTag(ascii_uppercase), read_snbt(ascii_uppercase)) + self.assertEqual(StringTag(ascii_uppercase), read_snbt(f"'{ascii_uppercase}'")) + self.assertEqual(StringTag(ascii_uppercase), read_snbt(f'"{ascii_uppercase}"')) - self.assertEqual(StringTag(digits), from_snbt(f"'{digits}'")) - self.assertEqual(StringTag(digits), from_snbt(f'"{digits}"')) + self.assertEqual(StringTag(digits), read_snbt(f"'{digits}'")) + self.assertEqual(StringTag(digits), read_snbt(f'"{digits}"')) self.assertEqual( - StringTag(digits + ascii_lowercase), from_snbt(digits + ascii_lowercase) + StringTag(digits + ascii_lowercase), read_snbt(digits + ascii_lowercase) ) self.assertEqual( StringTag(digits + ascii_lowercase), - from_snbt(f"'{digits + ascii_lowercase}'"), + read_snbt(f"'{digits + ascii_lowercase}'"), ) self.assertEqual( StringTag(digits + ascii_lowercase), - from_snbt(f'"{digits + ascii_lowercase}"'), + read_snbt(f'"{digits + ascii_lowercase}"'), ) self.assertEqual( - StringTag(ascii_lowercase + digits), from_snbt(ascii_lowercase + digits) + StringTag(ascii_lowercase + digits), read_snbt(ascii_lowercase + digits) ) self.assertEqual( StringTag(ascii_lowercase + digits), - from_snbt(f"'{ascii_lowercase + digits}'"), + read_snbt(f"'{ascii_lowercase + digits}'"), ) self.assertEqual( StringTag(ascii_lowercase + digits), - from_snbt(f'"{ascii_lowercase + digits}"'), + read_snbt(f'"{ascii_lowercase + digits}"'), ) self.assertEqual( StringTag(ascii_uppercase + ascii_lowercase + digits + "._+-"), - from_snbt(ascii_uppercase + ascii_lowercase + digits + "._+-"), + read_snbt(ascii_uppercase + ascii_lowercase + digits + "._+-"), ) self.assertEqual( StringTag(ascii_uppercase + ascii_lowercase + digits + "._+-"), - from_snbt(f"'{ascii_uppercase + ascii_lowercase + digits + '._+-'}'"), + read_snbt(f"'{ascii_uppercase + ascii_lowercase + digits + '._+-'}'"), ) self.assertEqual( StringTag(ascii_uppercase + ascii_lowercase + digits + "._+-"), - from_snbt(f'"{ascii_uppercase + ascii_lowercase + digits + "._+-"}"'), + read_snbt(f'"{ascii_uppercase + ascii_lowercase + digits + "._+-"}"'), ) with self.assertRaises(SNBTParseError): - from_snbt("") + read_snbt("") if __name__ == "__main__": diff --git a/tests/test_file_nbt/gen_data.py b/tests/test_file_nbt/gen_data.py index f9c6fc0e..f9fc11fd 100644 --- a/tests/test_file_nbt/gen_data.py +++ b/tests/test_file_nbt/gen_data.py @@ -15,7 +15,7 @@ def main() -> None: for path in glob.glob(os.path.join(input_dir, "*.nbt")): fname = os.path.splitext(os.path.basename(path))[0] - nbt = amulet_nbt.load(path) + nbt = amulet_nbt.read_nbt(path) nbt.save_to( os.path.join(data_dir, "big_endian_nbt", fname + ".nbt"), compressed=False, diff --git a/tests/test_load/test_load.py b/tests/test_load/test_load.py index 9e9a9faf..3e8f9019 100644 --- a/tests/test_load/test_load.py +++ b/tests/test_load/test_load.py @@ -4,8 +4,8 @@ from amulet_nbt import ( ListTag, IntTag, - load as load_nbt, - load_array as load_nbt_array, + read_nbt, + read_nbt_array, NBTLoadError, NamedTag, ) @@ -18,52 +18,52 @@ class LoadTests(unittest.TestCase): def test_load(self) -> None: - load_nbt_array(OnePath) + read_nbt_array(OnePath) with self.assertRaises(NBTLoadError): - load_nbt(EmptyPath) + read_nbt(EmptyPath) with self.assertRaises(NBTLoadError): - load_nbt_array(EmptyPath, count=1) - self.assertEqual([], load_nbt_array(EmptyPath, count=0)) - self.assertEqual([], load_nbt_array(EmptyPath, count=-1)) + read_nbt_array(EmptyPath, count=1) + self.assertEqual([], read_nbt_array(EmptyPath, count=0)) + self.assertEqual([], read_nbt_array(EmptyPath, count=-1)) self.assertEqual( NamedTag(ListTag([IntTag(1), IntTag(2), IntTag(3), IntTag(4)])), - load_nbt(OnePath), + read_nbt(OnePath), ) self.assertEqual( [NamedTag(ListTag([IntTag(1), IntTag(2), IntTag(3), IntTag(4)]))], - load_nbt_array(OnePath), + read_nbt_array(OnePath), ) self.assertEqual( [NamedTag(ListTag([IntTag(1), IntTag(2), IntTag(3), IntTag(4)]))], - load_nbt_array(OnePath, count=1), + read_nbt_array(OnePath, count=1), ) self.assertEqual( [NamedTag(ListTag([IntTag(1), IntTag(2), IntTag(3), IntTag(4)]))], - load_nbt_array(OnePath, count=-1), + read_nbt_array(OnePath, count=-1), ) with self.assertRaises(NBTLoadError): - load_nbt_array(OnePath, count=2) + read_nbt_array(OnePath, count=2) self.assertEqual( NamedTag(ListTag([IntTag(1), IntTag(2), IntTag(3), IntTag(4)])), - load_nbt(ArrayPath), + read_nbt(ArrayPath), ) self.assertEqual( [NamedTag(ListTag([IntTag(1), IntTag(2), IntTag(3), IntTag(4)]))], - load_nbt_array(ArrayPath), + read_nbt_array(ArrayPath), ) self.assertEqual( [NamedTag(ListTag([IntTag(1), IntTag(2), IntTag(3), IntTag(4)]))], - load_nbt_array(ArrayPath, count=1), + read_nbt_array(ArrayPath, count=1), ) self.assertEqual( [ NamedTag(ListTag([IntTag(1), IntTag(2), IntTag(3), IntTag(4)])), NamedTag(ListTag([IntTag(1), IntTag(2), IntTag(3), IntTag(4)])), ], - load_nbt_array(ArrayPath, count=2), + read_nbt_array(ArrayPath, count=2), ) self.assertEqual( [ @@ -73,7 +73,7 @@ def test_load(self) -> None: NamedTag(ListTag([IntTag(1), IntTag(2), IntTag(3), IntTag(4)])), NamedTag(ListTag([IntTag(1), IntTag(2), IntTag(3), IntTag(4)])), ], - load_nbt_array(ArrayPath, count=5), + read_nbt_array(ArrayPath, count=5), ) self.assertEqual( [ @@ -83,10 +83,10 @@ def test_load(self) -> None: NamedTag(ListTag([IntTag(1), IntTag(2), IntTag(3), IntTag(4)])), NamedTag(ListTag([IntTag(1), IntTag(2), IntTag(3), IntTag(4)])), ], - load_nbt_array(ArrayPath, count=-1), + read_nbt_array(ArrayPath, count=-1), ) with self.assertRaises(NBTLoadError): - load_nbt_array(ArrayPath, count=6) + read_nbt_array(ArrayPath, count=6) if __name__ == "__main__": diff --git a/tests/test_massive_nbt.py b/tests/test_massive_nbt.py index 9dc98313..5b804545 100644 --- a/tests/test_massive_nbt.py +++ b/tests/test_massive_nbt.py @@ -15,7 +15,7 @@ ListTag, CompoundTag, NamedTag, - load, + read_nbt, ) @@ -146,11 +146,11 @@ def test_api(self) -> None: little_endian=True, ) - test_be = load(os.path.join("temp", "massive_nbt_test_big_endian.nbt")) - test_be_compressed = load( + test_be = read_nbt(os.path.join("temp", "massive_nbt_test_big_endian.nbt")) + test_be_compressed = read_nbt( os.path.join("temp", "massive_nbt_test_big_endian_compressed.nbt") ) - test_le = load( + test_le = read_nbt( os.path.join("temp", "massive_nbt_test_little_endian.nbt"), little_endian=True, ) diff --git a/tests/test_nbt.py b/tests/test_nbt.py index 71ef243f..841cd77a 100644 --- a/tests/test_nbt.py +++ b/tests/test_nbt.py @@ -8,9 +8,9 @@ class NBTTests(unittest.TestCase): def _load(self, b: bytes, little_endian: bool = False) -> amulet_nbt.NamedTag: b_copy = copy(b) - named_tag = amulet_nbt.load(b_copy, little_endian=little_endian) + named_tag = amulet_nbt.read_nbt(b_copy, little_endian=little_endian) self.assertEqual(b, b_copy, msg="The buffer changed.") - named_tag2 = amulet_nbt.load(b_copy, little_endian=little_endian) + named_tag2 = amulet_nbt.read_nbt(b_copy, little_endian=little_endian) self.assertEqual(named_tag.name, named_tag2.name) self.assertEqual(named_tag.tag, named_tag2.tag) return named_tag @@ -25,7 +25,7 @@ def test_read_big_endian_compressed(self) -> None: for data in binary_data_tuple: self.assertEqual( data.named_tag, - amulet_nbt.load(data.big_endian_compressed), + amulet_nbt.read_nbt(data.big_endian_compressed), msg=str(data.named_tag), ) @@ -41,7 +41,7 @@ def test_read_little_endian_compressed(self) -> None: for data in binary_data_tuple: self.assertEqual( data.named_tag, - amulet_nbt.load(data.little_endian_compressed, little_endian=True), + amulet_nbt.read_nbt(data.little_endian_compressed, little_endian=True), msg=str(data.named_tag), ) From d3306bf12af650f56e706a0ac8e1a87104c891a6 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Wed, 10 Jul 2024 12:23:42 +0100 Subject: [PATCH 069/121] Removed exceptions These are now handled by vanilla python exceptions --- src/amulet_nbt/__init__.py | 8 -------- src/amulet_nbt/__init__.pyi | 13 ------------- 2 files changed, 21 deletions(-) diff --git a/src/amulet_nbt/__init__.py b/src/amulet_nbt/__init__.py index ed02f4e3..e1b7fd25 100644 --- a/src/amulet_nbt/__init__.py +++ b/src/amulet_nbt/__init__.py @@ -57,10 +57,6 @@ def get_include() -> str: read_nbt, read_nbt_array, ReadOffset, - # NBTError, - # NBTLoadError, - # NBTFormatError, - # SNBTParseError, read_snbt, StringEncoding, mutf8_encoding, @@ -118,10 +114,6 @@ def get_include() -> str: "read_nbt", "read_nbt_array", "ReadOffset", - "NBTError", - "NBTLoadError", - "NBTFormatError", - "SNBTParseError", "read_snbt", "SNBTType", "IntType", diff --git a/src/amulet_nbt/__init__.pyi b/src/amulet_nbt/__init__.pyi index ee3435b9..3be7a42f 100644 --- a/src/amulet_nbt/__init__.pyi +++ b/src/amulet_nbt/__init__.pyi @@ -89,19 +89,6 @@ class _Writeable(Protocol): def write(self, s: bytes) -> Any: ... -class NBTError(Exception): - """Some error in the NBT library.""" - -class NBTLoadError(NBTError): - """The NBT data failed to load for some reason.""" - -class NBTFormatError(NBTLoadError): - """Indicates the NBT format is invalid.""" - -class SNBTParseError(NBTError): - """Indicates the SNBT format is invalid.""" - - index: Optional[int] # The index at which the error occurred class StringEncoding: def encode(self, data: bytes) -> bytes: ... From 54ba1be773122e5a66bc63d5bdb868f5adc139af Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Thu, 11 Jul 2024 11:19:35 +0100 Subject: [PATCH 070/121] Added missing return --- src/amulet_nbt/pybind/tag/compound.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/amulet_nbt/pybind/tag/compound.cpp b/src/amulet_nbt/pybind/tag/compound.cpp index ef45f245..ee1b8032 100644 --- a/src/amulet_nbt/pybind/tag/compound.cpp +++ b/src/amulet_nbt/pybind/tag/compound.cpp @@ -77,6 +77,7 @@ void init_compound(py::module& m) { out[key] = value; } } + return out; }; CompoundTag.def_property_readonly( "py_dict", From 9af51ae0ab03c56d7cfc97f12bd4f6f75df0a494 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Thu, 11 Jul 2024 11:19:47 +0100 Subject: [PATCH 071/121] Fixed NamedTag repr --- src/amulet_nbt/pybind/tag/named_tag.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/amulet_nbt/pybind/tag/named_tag.cpp b/src/amulet_nbt/pybind/tag/named_tag.cpp index 35cee7b4..11f6fbf4 100644 --- a/src/amulet_nbt/pybind/tag/named_tag.cpp +++ b/src/amulet_nbt/pybind/tag/named_tag.cpp @@ -87,13 +87,13 @@ void init_named_tag(py::module& m) { [](const Amulet::NamedTag& self){ std::string out; out += "NamedTag("; + out += py::repr(py::cast(Amulet::wrap_node(self.tag_node))); + out += ", "; try { out += py::repr(py::str(self.name)); } catch (py::error_already_set&){ out += py::repr(py::bytes(self.name)); } - out += ", "; - out += py::repr(py::cast(Amulet::wrap_node(self.tag_node))); out += ")"; return out; } From 340061d22f70336c3c0416826b9e7e67eeee6571 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Thu, 11 Jul 2024 11:20:05 +0100 Subject: [PATCH 072/121] Added more float snbt parse tests --- tests/test_amulet_nbt/test_tag/test_float.py | 4606 ++++++++++++++++++ 1 file changed, 4606 insertions(+) diff --git a/tests/test_amulet_nbt/test_tag/test_float.py b/tests/test_amulet_nbt/test_tag/test_float.py index 3af8d16b..84001102 100644 --- a/tests/test_amulet_nbt/test_tag/test_float.py +++ b/tests/test_amulet_nbt/test_tag/test_float.py @@ -643,6 +643,4612 @@ def test_from_snbt(self) -> None: (DoubleTag(0), "+.0E-2"), (DoubleTag(0), "+.0E-2d"), (DoubleTag(0), "+.0E-2D"), + + # validate false cases + (StringTag('+'), "+"), + (StringTag('++'), "++"), + (StringTag('++.'), "++."), + (StringTag('++.1'), "++.1"), + (StringTag('++.1D'), "++.1D"), + (StringTag('++.1F'), "++.1F"), + (StringTag('++.1d'), "++.1d"), + (StringTag('++.1f'), "++.1f"), + (StringTag('++.D'), "++.D"), + (StringTag('++.F'), "++.F"), + (StringTag('++.d'), "++.d"), + (StringTag('++.f'), "++.f"), + (StringTag('++1'), "++1"), + (StringTag('++1.'), "++1."), + (StringTag('++1.1'), "++1.1"), + (StringTag('++1.1D'), "++1.1D"), + (StringTag('++1.1F'), "++1.1F"), + (StringTag('++1.1d'), "++1.1d"), + (StringTag('++1.1f'), "++1.1f"), + (StringTag('++1.D'), "++1.D"), + (StringTag('++1.F'), "++1.F"), + (StringTag('++1.d'), "++1.d"), + (StringTag('++1.f'), "++1.f"), + (StringTag('++1D'), "++1D"), + (StringTag('++1F'), "++1F"), + (StringTag('++1d'), "++1d"), + (StringTag('++1f'), "++1f"), + (StringTag('++D'), "++D"), + (StringTag('++F'), "++F"), + (StringTag('++d'), "++d"), + (StringTag('++f'), "++f"), + (StringTag('+-'), "+-"), + (StringTag('+-.'), "+-."), + (StringTag('+-.1'), "+-.1"), + (StringTag('+-.1D'), "+-.1D"), + (StringTag('+-.1F'), "+-.1F"), + (StringTag('+-.1d'), "+-.1d"), + (StringTag('+-.1f'), "+-.1f"), + (StringTag('+-.D'), "+-.D"), + (StringTag('+-.F'), "+-.F"), + (StringTag('+-.d'), "+-.d"), + (StringTag('+-.f'), "+-.f"), + (StringTag('+-1'), "+-1"), + (StringTag('+-1.'), "+-1."), + (StringTag('+-1.1'), "+-1.1"), + (StringTag('+-1.1D'), "+-1.1D"), + (StringTag('+-1.1F'), "+-1.1F"), + (StringTag('+-1.1d'), "+-1.1d"), + (StringTag('+-1.1f'), "+-1.1f"), + (StringTag('+-1.D'), "+-1.D"), + (StringTag('+-1.F'), "+-1.F"), + (StringTag('+-1.d'), "+-1.d"), + (StringTag('+-1.f'), "+-1.f"), + (StringTag('+-1D'), "+-1D"), + (StringTag('+-1F'), "+-1F"), + (StringTag('+-1d'), "+-1d"), + (StringTag('+-1f'), "+-1f"), + (StringTag('+-D'), "+-D"), + (StringTag('+-F'), "+-F"), + (StringTag('+-d'), "+-d"), + (StringTag('+-f'), "+-f"), + (StringTag('+.'), "+."), + (StringTag('+.+'), "+.+"), + (StringTag('+.+.'), "+.+."), + (StringTag('+.+.1'), "+.+.1"), + (StringTag('+.+.1D'), "+.+.1D"), + (StringTag('+.+.1F'), "+.+.1F"), + (StringTag('+.+.1d'), "+.+.1d"), + (StringTag('+.+.1f'), "+.+.1f"), + (StringTag('+.+.D'), "+.+.D"), + (StringTag('+.+.F'), "+.+.F"), + (StringTag('+.+.d'), "+.+.d"), + (StringTag('+.+.f'), "+.+.f"), + (StringTag('+.+1'), "+.+1"), + (StringTag('+.+1.'), "+.+1."), + (StringTag('+.+1.1'), "+.+1.1"), + (StringTag('+.+1.1D'), "+.+1.1D"), + (StringTag('+.+1.1F'), "+.+1.1F"), + (StringTag('+.+1.1d'), "+.+1.1d"), + (StringTag('+.+1.1f'), "+.+1.1f"), + (StringTag('+.+1.D'), "+.+1.D"), + (StringTag('+.+1.F'), "+.+1.F"), + (StringTag('+.+1.d'), "+.+1.d"), + (StringTag('+.+1.f'), "+.+1.f"), + (StringTag('+.+1D'), "+.+1D"), + (StringTag('+.+1F'), "+.+1F"), + (StringTag('+.+1d'), "+.+1d"), + (StringTag('+.+1f'), "+.+1f"), + (StringTag('+.+D'), "+.+D"), + (StringTag('+.+F'), "+.+F"), + (StringTag('+.+d'), "+.+d"), + (StringTag('+.+f'), "+.+f"), + (StringTag('+.-'), "+.-"), + (StringTag('+.-.'), "+.-."), + (StringTag('+.-.1'), "+.-.1"), + (StringTag('+.-.1D'), "+.-.1D"), + (StringTag('+.-.1F'), "+.-.1F"), + (StringTag('+.-.1d'), "+.-.1d"), + (StringTag('+.-.1f'), "+.-.1f"), + (StringTag('+.-.D'), "+.-.D"), + (StringTag('+.-.F'), "+.-.F"), + (StringTag('+.-.d'), "+.-.d"), + (StringTag('+.-.f'), "+.-.f"), + (StringTag('+.-1'), "+.-1"), + (StringTag('+.-1.'), "+.-1."), + (StringTag('+.-1.1'), "+.-1.1"), + (StringTag('+.-1.1D'), "+.-1.1D"), + (StringTag('+.-1.1F'), "+.-1.1F"), + (StringTag('+.-1.1d'), "+.-1.1d"), + (StringTag('+.-1.1f'), "+.-1.1f"), + (StringTag('+.-1.D'), "+.-1.D"), + (StringTag('+.-1.F'), "+.-1.F"), + (StringTag('+.-1.d'), "+.-1.d"), + (StringTag('+.-1.f'), "+.-1.f"), + (StringTag('+.-1D'), "+.-1D"), + (StringTag('+.-1F'), "+.-1F"), + (StringTag('+.-1d'), "+.-1d"), + (StringTag('+.-1f'), "+.-1f"), + (StringTag('+.-D'), "+.-D"), + (StringTag('+.-F'), "+.-F"), + (StringTag('+.-d'), "+.-d"), + (StringTag('+.-f'), "+.-f"), + (StringTag('+..'), "+.."), + (StringTag('+..1'), "+..1"), + (StringTag('+..1D'), "+..1D"), + (StringTag('+..1F'), "+..1F"), + (StringTag('+..1d'), "+..1d"), + (StringTag('+..1f'), "+..1f"), + (StringTag('+..D'), "+..D"), + (StringTag('+..F'), "+..F"), + (StringTag('+..d'), "+..d"), + (StringTag('+..f'), "+..f"), + (DoubleTag(0.100000), "+.1"), + (StringTag('+.1+'), "+.1+"), + (StringTag('+.1+.'), "+.1+."), + (StringTag('+.1+.1'), "+.1+.1"), + (StringTag('+.1+.1D'), "+.1+.1D"), + (StringTag('+.1+.1F'), "+.1+.1F"), + (StringTag('+.1+.1d'), "+.1+.1d"), + (StringTag('+.1+.1f'), "+.1+.1f"), + (StringTag('+.1+.D'), "+.1+.D"), + (StringTag('+.1+.F'), "+.1+.F"), + (StringTag('+.1+.d'), "+.1+.d"), + (StringTag('+.1+.f'), "+.1+.f"), + (StringTag('+.1+1'), "+.1+1"), + (StringTag('+.1+1.'), "+.1+1."), + (StringTag('+.1+1.1'), "+.1+1.1"), + (StringTag('+.1+1.1D'), "+.1+1.1D"), + (StringTag('+.1+1.1F'), "+.1+1.1F"), + (StringTag('+.1+1.1d'), "+.1+1.1d"), + (StringTag('+.1+1.1f'), "+.1+1.1f"), + (StringTag('+.1+1.D'), "+.1+1.D"), + (StringTag('+.1+1.F'), "+.1+1.F"), + (StringTag('+.1+1.d'), "+.1+1.d"), + (StringTag('+.1+1.f'), "+.1+1.f"), + (StringTag('+.1+1D'), "+.1+1D"), + (StringTag('+.1+1F'), "+.1+1F"), + (StringTag('+.1+1d'), "+.1+1d"), + (StringTag('+.1+1f'), "+.1+1f"), + (StringTag('+.1+D'), "+.1+D"), + (StringTag('+.1+F'), "+.1+F"), + (StringTag('+.1+d'), "+.1+d"), + (StringTag('+.1+f'), "+.1+f"), + (StringTag('+.1-'), "+.1-"), + (StringTag('+.1-.'), "+.1-."), + (StringTag('+.1-.1'), "+.1-.1"), + (StringTag('+.1-.1D'), "+.1-.1D"), + (StringTag('+.1-.1F'), "+.1-.1F"), + (StringTag('+.1-.1d'), "+.1-.1d"), + (StringTag('+.1-.1f'), "+.1-.1f"), + (StringTag('+.1-.D'), "+.1-.D"), + (StringTag('+.1-.F'), "+.1-.F"), + (StringTag('+.1-.d'), "+.1-.d"), + (StringTag('+.1-.f'), "+.1-.f"), + (StringTag('+.1-1'), "+.1-1"), + (StringTag('+.1-1.'), "+.1-1."), + (StringTag('+.1-1.1'), "+.1-1.1"), + (StringTag('+.1-1.1D'), "+.1-1.1D"), + (StringTag('+.1-1.1F'), "+.1-1.1F"), + (StringTag('+.1-1.1d'), "+.1-1.1d"), + (StringTag('+.1-1.1f'), "+.1-1.1f"), + (StringTag('+.1-1.D'), "+.1-1.D"), + (StringTag('+.1-1.F'), "+.1-1.F"), + (StringTag('+.1-1.d'), "+.1-1.d"), + (StringTag('+.1-1.f'), "+.1-1.f"), + (StringTag('+.1-1D'), "+.1-1D"), + (StringTag('+.1-1F'), "+.1-1F"), + (StringTag('+.1-1d'), "+.1-1d"), + (StringTag('+.1-1f'), "+.1-1f"), + (StringTag('+.1-D'), "+.1-D"), + (StringTag('+.1-F'), "+.1-F"), + (StringTag('+.1-d'), "+.1-d"), + (StringTag('+.1-f'), "+.1-f"), + (StringTag('+.1.'), "+.1."), + (StringTag('+.1.1'), "+.1.1"), + (StringTag('+.1.1D'), "+.1.1D"), + (StringTag('+.1.1F'), "+.1.1F"), + (StringTag('+.1.1d'), "+.1.1d"), + (StringTag('+.1.1f'), "+.1.1f"), + (StringTag('+.1.D'), "+.1.D"), + (StringTag('+.1.F'), "+.1.F"), + (StringTag('+.1.d'), "+.1.d"), + (StringTag('+.1.f'), "+.1.f"), + (DoubleTag(0.110000), "+.11"), + (StringTag('+.11.'), "+.11."), + (StringTag('+.11.1'), "+.11.1"), + (StringTag('+.11.1D'), "+.11.1D"), + (StringTag('+.11.1F'), "+.11.1F"), + (StringTag('+.11.1d'), "+.11.1d"), + (StringTag('+.11.1f'), "+.11.1f"), + (StringTag('+.11.D'), "+.11.D"), + (StringTag('+.11.F'), "+.11.F"), + (StringTag('+.11.d'), "+.11.d"), + (StringTag('+.11.f'), "+.11.f"), + (DoubleTag(0.110000), "+.11D"), + (FloatTag(0.110000), "+.11F"), + (DoubleTag(0.110000), "+.11d"), + (FloatTag(0.110000), "+.11f"), + (DoubleTag(0.100000), "+.1D"), + (StringTag('+.1E'), "+.1E"), + (StringTag('+.1E+'), "+.1E+"), + (StringTag('+.1E+.'), "+.1E+."), + (StringTag('+.1E+.1'), "+.1E+.1"), + (StringTag('+.1E+.1D'), "+.1E+.1D"), + (StringTag('+.1E+.1F'), "+.1E+.1F"), + (StringTag('+.1E+.1d'), "+.1E+.1d"), + (StringTag('+.1E+.1f'), "+.1E+.1f"), + (StringTag('+.1E+.D'), "+.1E+.D"), + (StringTag('+.1E+.F'), "+.1E+.F"), + (StringTag('+.1E+.d'), "+.1E+.d"), + (StringTag('+.1E+.f'), "+.1E+.f"), + (DoubleTag(1.000000), "+.1E+1"), + (StringTag('+.1E+1.'), "+.1E+1."), + (StringTag('+.1E+1.1'), "+.1E+1.1"), + (StringTag('+.1E+1.1D'), "+.1E+1.1D"), + (StringTag('+.1E+1.1F'), "+.1E+1.1F"), + (StringTag('+.1E+1.1d'), "+.1E+1.1d"), + (StringTag('+.1E+1.1f'), "+.1E+1.1f"), + (StringTag('+.1E+1.D'), "+.1E+1.D"), + (StringTag('+.1E+1.F'), "+.1E+1.F"), + (StringTag('+.1E+1.d'), "+.1E+1.d"), + (StringTag('+.1E+1.f'), "+.1E+1.f"), + (DoubleTag(1.000000), "+.1E+1D"), + (FloatTag(1.000000), "+.1E+1F"), + (DoubleTag(1.000000), "+.1E+1d"), + (FloatTag(1.000000), "+.1E+1f"), + (StringTag('+.1E+D'), "+.1E+D"), + (StringTag('+.1E+F'), "+.1E+F"), + (StringTag('+.1E+d'), "+.1E+d"), + (StringTag('+.1E+f'), "+.1E+f"), + (StringTag('+.1E-'), "+.1E-"), + (StringTag('+.1E-.'), "+.1E-."), + (StringTag('+.1E-.1'), "+.1E-.1"), + (StringTag('+.1E-.1D'), "+.1E-.1D"), + (StringTag('+.1E-.1F'), "+.1E-.1F"), + (StringTag('+.1E-.1d'), "+.1E-.1d"), + (StringTag('+.1E-.1f'), "+.1E-.1f"), + (StringTag('+.1E-.D'), "+.1E-.D"), + (StringTag('+.1E-.F'), "+.1E-.F"), + (StringTag('+.1E-.d'), "+.1E-.d"), + (StringTag('+.1E-.f'), "+.1E-.f"), + (DoubleTag(0.010000), "+.1E-1"), + (StringTag('+.1E-1.'), "+.1E-1."), + (StringTag('+.1E-1.1'), "+.1E-1.1"), + (StringTag('+.1E-1.1D'), "+.1E-1.1D"), + (StringTag('+.1E-1.1F'), "+.1E-1.1F"), + (StringTag('+.1E-1.1d'), "+.1E-1.1d"), + (StringTag('+.1E-1.1f'), "+.1E-1.1f"), + (StringTag('+.1E-1.D'), "+.1E-1.D"), + (StringTag('+.1E-1.F'), "+.1E-1.F"), + (StringTag('+.1E-1.d'), "+.1E-1.d"), + (StringTag('+.1E-1.f'), "+.1E-1.f"), + (DoubleTag(0.010000), "+.1E-1D"), + (FloatTag(0.010000), "+.1E-1F"), + (DoubleTag(0.010000), "+.1E-1d"), + (FloatTag(0.010000), "+.1E-1f"), + (StringTag('+.1E-D'), "+.1E-D"), + (StringTag('+.1E-F'), "+.1E-F"), + (StringTag('+.1E-d'), "+.1E-d"), + (StringTag('+.1E-f'), "+.1E-f"), + (StringTag('+.1E.'), "+.1E."), + (StringTag('+.1E.1'), "+.1E.1"), + (StringTag('+.1E.1D'), "+.1E.1D"), + (StringTag('+.1E.1F'), "+.1E.1F"), + (StringTag('+.1E.1d'), "+.1E.1d"), + (StringTag('+.1E.1f'), "+.1E.1f"), + (StringTag('+.1E.D'), "+.1E.D"), + (StringTag('+.1E.F'), "+.1E.F"), + (StringTag('+.1E.d'), "+.1E.d"), + (StringTag('+.1E.f'), "+.1E.f"), + (DoubleTag(1.000000), "+.1E1"), + (StringTag('+.1E1.'), "+.1E1."), + (StringTag('+.1E1.1'), "+.1E1.1"), + (StringTag('+.1E1.1D'), "+.1E1.1D"), + (StringTag('+.1E1.1F'), "+.1E1.1F"), + (StringTag('+.1E1.1d'), "+.1E1.1d"), + (StringTag('+.1E1.1f'), "+.1E1.1f"), + (StringTag('+.1E1.D'), "+.1E1.D"), + (StringTag('+.1E1.F'), "+.1E1.F"), + (StringTag('+.1E1.d'), "+.1E1.d"), + (StringTag('+.1E1.f'), "+.1E1.f"), + (DoubleTag(1.000000), "+.1E1D"), + (FloatTag(1.000000), "+.1E1F"), + (DoubleTag(1.000000), "+.1E1d"), + (FloatTag(1.000000), "+.1E1f"), + (StringTag('+.1ED'), "+.1ED"), + (StringTag('+.1EF'), "+.1EF"), + (StringTag('+.1Ed'), "+.1Ed"), + (StringTag('+.1Ef'), "+.1Ef"), + (FloatTag(0.100000), "+.1F"), + (DoubleTag(0.100000), "+.1d"), + (StringTag('+.1e'), "+.1e"), + (StringTag('+.1e+'), "+.1e+"), + (StringTag('+.1e+.'), "+.1e+."), + (StringTag('+.1e+.1'), "+.1e+.1"), + (StringTag('+.1e+.1D'), "+.1e+.1D"), + (StringTag('+.1e+.1F'), "+.1e+.1F"), + (StringTag('+.1e+.1d'), "+.1e+.1d"), + (StringTag('+.1e+.1f'), "+.1e+.1f"), + (StringTag('+.1e+.D'), "+.1e+.D"), + (StringTag('+.1e+.F'), "+.1e+.F"), + (StringTag('+.1e+.d'), "+.1e+.d"), + (StringTag('+.1e+.f'), "+.1e+.f"), + (DoubleTag(1.000000), "+.1e+1"), + (StringTag('+.1e+1.'), "+.1e+1."), + (StringTag('+.1e+1.1'), "+.1e+1.1"), + (StringTag('+.1e+1.1D'), "+.1e+1.1D"), + (StringTag('+.1e+1.1F'), "+.1e+1.1F"), + (StringTag('+.1e+1.1d'), "+.1e+1.1d"), + (StringTag('+.1e+1.1f'), "+.1e+1.1f"), + (StringTag('+.1e+1.D'), "+.1e+1.D"), + (StringTag('+.1e+1.F'), "+.1e+1.F"), + (StringTag('+.1e+1.d'), "+.1e+1.d"), + (StringTag('+.1e+1.f'), "+.1e+1.f"), + (DoubleTag(1.000000), "+.1e+1D"), + (FloatTag(1.000000), "+.1e+1F"), + (DoubleTag(1.000000), "+.1e+1d"), + (FloatTag(1.000000), "+.1e+1f"), + (StringTag('+.1e+D'), "+.1e+D"), + (StringTag('+.1e+F'), "+.1e+F"), + (StringTag('+.1e+d'), "+.1e+d"), + (StringTag('+.1e+f'), "+.1e+f"), + (StringTag('+.1e-'), "+.1e-"), + (StringTag('+.1e-.'), "+.1e-."), + (StringTag('+.1e-.1'), "+.1e-.1"), + (StringTag('+.1e-.1D'), "+.1e-.1D"), + (StringTag('+.1e-.1F'), "+.1e-.1F"), + (StringTag('+.1e-.1d'), "+.1e-.1d"), + (StringTag('+.1e-.1f'), "+.1e-.1f"), + (StringTag('+.1e-.D'), "+.1e-.D"), + (StringTag('+.1e-.F'), "+.1e-.F"), + (StringTag('+.1e-.d'), "+.1e-.d"), + (StringTag('+.1e-.f'), "+.1e-.f"), + (DoubleTag(0.010000), "+.1e-1"), + (StringTag('+.1e-1.'), "+.1e-1."), + (StringTag('+.1e-1.1'), "+.1e-1.1"), + (StringTag('+.1e-1.1D'), "+.1e-1.1D"), + (StringTag('+.1e-1.1F'), "+.1e-1.1F"), + (StringTag('+.1e-1.1d'), "+.1e-1.1d"), + (StringTag('+.1e-1.1f'), "+.1e-1.1f"), + (StringTag('+.1e-1.D'), "+.1e-1.D"), + (StringTag('+.1e-1.F'), "+.1e-1.F"), + (StringTag('+.1e-1.d'), "+.1e-1.d"), + (StringTag('+.1e-1.f'), "+.1e-1.f"), + (DoubleTag(0.010000), "+.1e-1D"), + (FloatTag(0.010000), "+.1e-1F"), + (DoubleTag(0.010000), "+.1e-1d"), + (FloatTag(0.010000), "+.1e-1f"), + (StringTag('+.1e-D'), "+.1e-D"), + (StringTag('+.1e-F'), "+.1e-F"), + (StringTag('+.1e-d'), "+.1e-d"), + (StringTag('+.1e-f'), "+.1e-f"), + (StringTag('+.1e.'), "+.1e."), + (StringTag('+.1e.1'), "+.1e.1"), + (StringTag('+.1e.1D'), "+.1e.1D"), + (StringTag('+.1e.1F'), "+.1e.1F"), + (StringTag('+.1e.1d'), "+.1e.1d"), + (StringTag('+.1e.1f'), "+.1e.1f"), + (StringTag('+.1e.D'), "+.1e.D"), + (StringTag('+.1e.F'), "+.1e.F"), + (StringTag('+.1e.d'), "+.1e.d"), + (StringTag('+.1e.f'), "+.1e.f"), + (DoubleTag(1.000000), "+.1e1"), + (StringTag('+.1e1.'), "+.1e1."), + (StringTag('+.1e1.1'), "+.1e1.1"), + (StringTag('+.1e1.1D'), "+.1e1.1D"), + (StringTag('+.1e1.1F'), "+.1e1.1F"), + (StringTag('+.1e1.1d'), "+.1e1.1d"), + (StringTag('+.1e1.1f'), "+.1e1.1f"), + (StringTag('+.1e1.D'), "+.1e1.D"), + (StringTag('+.1e1.F'), "+.1e1.F"), + (StringTag('+.1e1.d'), "+.1e1.d"), + (StringTag('+.1e1.f'), "+.1e1.f"), + (DoubleTag(1.000000), "+.1e1D"), + (FloatTag(1.000000), "+.1e1F"), + (DoubleTag(1.000000), "+.1e1d"), + (FloatTag(1.000000), "+.1e1f"), + (StringTag('+.1eD'), "+.1eD"), + (StringTag('+.1eF'), "+.1eF"), + (StringTag('+.1ed'), "+.1ed"), + (StringTag('+.1ef'), "+.1ef"), + (FloatTag(0.100000), "+.1f"), + (StringTag('+.D'), "+.D"), + (StringTag('+.E'), "+.E"), + (StringTag('+.E+'), "+.E+"), + (StringTag('+.E+.'), "+.E+."), + (StringTag('+.E+.1'), "+.E+.1"), + (StringTag('+.E+.1D'), "+.E+.1D"), + (StringTag('+.E+.1F'), "+.E+.1F"), + (StringTag('+.E+.1d'), "+.E+.1d"), + (StringTag('+.E+.1f'), "+.E+.1f"), + (StringTag('+.E+.D'), "+.E+.D"), + (StringTag('+.E+.F'), "+.E+.F"), + (StringTag('+.E+.d'), "+.E+.d"), + (StringTag('+.E+.f'), "+.E+.f"), + (StringTag('+.E+1'), "+.E+1"), + (StringTag('+.E+1.'), "+.E+1."), + (StringTag('+.E+1.1'), "+.E+1.1"), + (StringTag('+.E+1.1D'), "+.E+1.1D"), + (StringTag('+.E+1.1F'), "+.E+1.1F"), + (StringTag('+.E+1.1d'), "+.E+1.1d"), + (StringTag('+.E+1.1f'), "+.E+1.1f"), + (StringTag('+.E+1.D'), "+.E+1.D"), + (StringTag('+.E+1.F'), "+.E+1.F"), + (StringTag('+.E+1.d'), "+.E+1.d"), + (StringTag('+.E+1.f'), "+.E+1.f"), + (StringTag('+.E+1D'), "+.E+1D"), + (StringTag('+.E+1F'), "+.E+1F"), + (StringTag('+.E+1d'), "+.E+1d"), + (StringTag('+.E+1f'), "+.E+1f"), + (StringTag('+.E+D'), "+.E+D"), + (StringTag('+.E+F'), "+.E+F"), + (StringTag('+.E+d'), "+.E+d"), + (StringTag('+.E+f'), "+.E+f"), + (StringTag('+.E-'), "+.E-"), + (StringTag('+.E-.'), "+.E-."), + (StringTag('+.E-.1'), "+.E-.1"), + (StringTag('+.E-.1D'), "+.E-.1D"), + (StringTag('+.E-.1F'), "+.E-.1F"), + (StringTag('+.E-.1d'), "+.E-.1d"), + (StringTag('+.E-.1f'), "+.E-.1f"), + (StringTag('+.E-.D'), "+.E-.D"), + (StringTag('+.E-.F'), "+.E-.F"), + (StringTag('+.E-.d'), "+.E-.d"), + (StringTag('+.E-.f'), "+.E-.f"), + (StringTag('+.E-1'), "+.E-1"), + (StringTag('+.E-1.'), "+.E-1."), + (StringTag('+.E-1.1'), "+.E-1.1"), + (StringTag('+.E-1.1D'), "+.E-1.1D"), + (StringTag('+.E-1.1F'), "+.E-1.1F"), + (StringTag('+.E-1.1d'), "+.E-1.1d"), + (StringTag('+.E-1.1f'), "+.E-1.1f"), + (StringTag('+.E-1.D'), "+.E-1.D"), + (StringTag('+.E-1.F'), "+.E-1.F"), + (StringTag('+.E-1.d'), "+.E-1.d"), + (StringTag('+.E-1.f'), "+.E-1.f"), + (StringTag('+.E-1D'), "+.E-1D"), + (StringTag('+.E-1F'), "+.E-1F"), + (StringTag('+.E-1d'), "+.E-1d"), + (StringTag('+.E-1f'), "+.E-1f"), + (StringTag('+.E-D'), "+.E-D"), + (StringTag('+.E-F'), "+.E-F"), + (StringTag('+.E-d'), "+.E-d"), + (StringTag('+.E-f'), "+.E-f"), + (StringTag('+.E.'), "+.E."), + (StringTag('+.E.1'), "+.E.1"), + (StringTag('+.E.1D'), "+.E.1D"), + (StringTag('+.E.1F'), "+.E.1F"), + (StringTag('+.E.1d'), "+.E.1d"), + (StringTag('+.E.1f'), "+.E.1f"), + (StringTag('+.E.D'), "+.E.D"), + (StringTag('+.E.F'), "+.E.F"), + (StringTag('+.E.d'), "+.E.d"), + (StringTag('+.E.f'), "+.E.f"), + (StringTag('+.E1'), "+.E1"), + (StringTag('+.E1.'), "+.E1."), + (StringTag('+.E1.1'), "+.E1.1"), + (StringTag('+.E1.1D'), "+.E1.1D"), + (StringTag('+.E1.1F'), "+.E1.1F"), + (StringTag('+.E1.1d'), "+.E1.1d"), + (StringTag('+.E1.1f'), "+.E1.1f"), + (StringTag('+.E1.D'), "+.E1.D"), + (StringTag('+.E1.F'), "+.E1.F"), + (StringTag('+.E1.d'), "+.E1.d"), + (StringTag('+.E1.f'), "+.E1.f"), + (StringTag('+.E1D'), "+.E1D"), + (StringTag('+.E1F'), "+.E1F"), + (StringTag('+.E1d'), "+.E1d"), + (StringTag('+.E1f'), "+.E1f"), + (StringTag('+.ED'), "+.ED"), + (StringTag('+.EF'), "+.EF"), + (StringTag('+.Ed'), "+.Ed"), + (StringTag('+.Ef'), "+.Ef"), + (StringTag('+.F'), "+.F"), + (StringTag('+.d'), "+.d"), + (StringTag('+.e'), "+.e"), + (StringTag('+.e+'), "+.e+"), + (StringTag('+.e+.'), "+.e+."), + (StringTag('+.e+.1'), "+.e+.1"), + (StringTag('+.e+.1D'), "+.e+.1D"), + (StringTag('+.e+.1F'), "+.e+.1F"), + (StringTag('+.e+.1d'), "+.e+.1d"), + (StringTag('+.e+.1f'), "+.e+.1f"), + (StringTag('+.e+.D'), "+.e+.D"), + (StringTag('+.e+.F'), "+.e+.F"), + (StringTag('+.e+.d'), "+.e+.d"), + (StringTag('+.e+.f'), "+.e+.f"), + (StringTag('+.e+1'), "+.e+1"), + (StringTag('+.e+1.'), "+.e+1."), + (StringTag('+.e+1.1'), "+.e+1.1"), + (StringTag('+.e+1.1D'), "+.e+1.1D"), + (StringTag('+.e+1.1F'), "+.e+1.1F"), + (StringTag('+.e+1.1d'), "+.e+1.1d"), + (StringTag('+.e+1.1f'), "+.e+1.1f"), + (StringTag('+.e+1.D'), "+.e+1.D"), + (StringTag('+.e+1.F'), "+.e+1.F"), + (StringTag('+.e+1.d'), "+.e+1.d"), + (StringTag('+.e+1.f'), "+.e+1.f"), + (StringTag('+.e+1D'), "+.e+1D"), + (StringTag('+.e+1F'), "+.e+1F"), + (StringTag('+.e+1d'), "+.e+1d"), + (StringTag('+.e+1f'), "+.e+1f"), + (StringTag('+.e+D'), "+.e+D"), + (StringTag('+.e+F'), "+.e+F"), + (StringTag('+.e+d'), "+.e+d"), + (StringTag('+.e+f'), "+.e+f"), + (StringTag('+.e-'), "+.e-"), + (StringTag('+.e-.'), "+.e-."), + (StringTag('+.e-.1'), "+.e-.1"), + (StringTag('+.e-.1D'), "+.e-.1D"), + (StringTag('+.e-.1F'), "+.e-.1F"), + (StringTag('+.e-.1d'), "+.e-.1d"), + (StringTag('+.e-.1f'), "+.e-.1f"), + (StringTag('+.e-.D'), "+.e-.D"), + (StringTag('+.e-.F'), "+.e-.F"), + (StringTag('+.e-.d'), "+.e-.d"), + (StringTag('+.e-.f'), "+.e-.f"), + (StringTag('+.e-1'), "+.e-1"), + (StringTag('+.e-1.'), "+.e-1."), + (StringTag('+.e-1.1'), "+.e-1.1"), + (StringTag('+.e-1.1D'), "+.e-1.1D"), + (StringTag('+.e-1.1F'), "+.e-1.1F"), + (StringTag('+.e-1.1d'), "+.e-1.1d"), + (StringTag('+.e-1.1f'), "+.e-1.1f"), + (StringTag('+.e-1.D'), "+.e-1.D"), + (StringTag('+.e-1.F'), "+.e-1.F"), + (StringTag('+.e-1.d'), "+.e-1.d"), + (StringTag('+.e-1.f'), "+.e-1.f"), + (StringTag('+.e-1D'), "+.e-1D"), + (StringTag('+.e-1F'), "+.e-1F"), + (StringTag('+.e-1d'), "+.e-1d"), + (StringTag('+.e-1f'), "+.e-1f"), + (StringTag('+.e-D'), "+.e-D"), + (StringTag('+.e-F'), "+.e-F"), + (StringTag('+.e-d'), "+.e-d"), + (StringTag('+.e-f'), "+.e-f"), + (StringTag('+.e.'), "+.e."), + (StringTag('+.e.1'), "+.e.1"), + (StringTag('+.e.1D'), "+.e.1D"), + (StringTag('+.e.1F'), "+.e.1F"), + (StringTag('+.e.1d'), "+.e.1d"), + (StringTag('+.e.1f'), "+.e.1f"), + (StringTag('+.e.D'), "+.e.D"), + (StringTag('+.e.F'), "+.e.F"), + (StringTag('+.e.d'), "+.e.d"), + (StringTag('+.e.f'), "+.e.f"), + (StringTag('+.e1'), "+.e1"), + (StringTag('+.e1.'), "+.e1."), + (StringTag('+.e1.1'), "+.e1.1"), + (StringTag('+.e1.1D'), "+.e1.1D"), + (StringTag('+.e1.1F'), "+.e1.1F"), + (StringTag('+.e1.1d'), "+.e1.1d"), + (StringTag('+.e1.1f'), "+.e1.1f"), + (StringTag('+.e1.D'), "+.e1.D"), + (StringTag('+.e1.F'), "+.e1.F"), + (StringTag('+.e1.d'), "+.e1.d"), + (StringTag('+.e1.f'), "+.e1.f"), + (StringTag('+.e1D'), "+.e1D"), + (StringTag('+.e1F'), "+.e1F"), + (StringTag('+.e1d'), "+.e1d"), + (StringTag('+.e1f'), "+.e1f"), + (StringTag('+.eD'), "+.eD"), + (StringTag('+.eF'), "+.eF"), + (StringTag('+.ed'), "+.ed"), + (StringTag('+.ef'), "+.ef"), + (StringTag('+.f'), "+.f"), + (IntTag(1), "+1"), + (StringTag('+1+'), "+1+"), + (StringTag('+1+.'), "+1+."), + (StringTag('+1+.1'), "+1+.1"), + (StringTag('+1+.1D'), "+1+.1D"), + (StringTag('+1+.1F'), "+1+.1F"), + (StringTag('+1+.1d'), "+1+.1d"), + (StringTag('+1+.1f'), "+1+.1f"), + (StringTag('+1+.D'), "+1+.D"), + (StringTag('+1+.F'), "+1+.F"), + (StringTag('+1+.d'), "+1+.d"), + (StringTag('+1+.f'), "+1+.f"), + (StringTag('+1+1'), "+1+1"), + (StringTag('+1+1.'), "+1+1."), + (StringTag('+1+1.1'), "+1+1.1"), + (StringTag('+1+1.1D'), "+1+1.1D"), + (StringTag('+1+1.1F'), "+1+1.1F"), + (StringTag('+1+1.1d'), "+1+1.1d"), + (StringTag('+1+1.1f'), "+1+1.1f"), + (StringTag('+1+1.D'), "+1+1.D"), + (StringTag('+1+1.F'), "+1+1.F"), + (StringTag('+1+1.d'), "+1+1.d"), + (StringTag('+1+1.f'), "+1+1.f"), + (StringTag('+1+1D'), "+1+1D"), + (StringTag('+1+1F'), "+1+1F"), + (StringTag('+1+1d'), "+1+1d"), + (StringTag('+1+1f'), "+1+1f"), + (StringTag('+1+D'), "+1+D"), + (StringTag('+1+F'), "+1+F"), + (StringTag('+1+d'), "+1+d"), + (StringTag('+1+f'), "+1+f"), + (StringTag('+1-'), "+1-"), + (StringTag('+1-.'), "+1-."), + (StringTag('+1-.1'), "+1-.1"), + (StringTag('+1-.1D'), "+1-.1D"), + (StringTag('+1-.1F'), "+1-.1F"), + (StringTag('+1-.1d'), "+1-.1d"), + (StringTag('+1-.1f'), "+1-.1f"), + (StringTag('+1-.D'), "+1-.D"), + (StringTag('+1-.F'), "+1-.F"), + (StringTag('+1-.d'), "+1-.d"), + (StringTag('+1-.f'), "+1-.f"), + (StringTag('+1-1'), "+1-1"), + (StringTag('+1-1.'), "+1-1."), + (StringTag('+1-1.1'), "+1-1.1"), + (StringTag('+1-1.1D'), "+1-1.1D"), + (StringTag('+1-1.1F'), "+1-1.1F"), + (StringTag('+1-1.1d'), "+1-1.1d"), + (StringTag('+1-1.1f'), "+1-1.1f"), + (StringTag('+1-1.D'), "+1-1.D"), + (StringTag('+1-1.F'), "+1-1.F"), + (StringTag('+1-1.d'), "+1-1.d"), + (StringTag('+1-1.f'), "+1-1.f"), + (StringTag('+1-1D'), "+1-1D"), + (StringTag('+1-1F'), "+1-1F"), + (StringTag('+1-1d'), "+1-1d"), + (StringTag('+1-1f'), "+1-1f"), + (StringTag('+1-D'), "+1-D"), + (StringTag('+1-F'), "+1-F"), + (StringTag('+1-d'), "+1-d"), + (StringTag('+1-f'), "+1-f"), + (DoubleTag(1.000000), "+1."), + (StringTag('+1.+'), "+1.+"), + (StringTag('+1.+.'), "+1.+."), + (StringTag('+1.+.1'), "+1.+.1"), + (StringTag('+1.+.1D'), "+1.+.1D"), + (StringTag('+1.+.1F'), "+1.+.1F"), + (StringTag('+1.+.1d'), "+1.+.1d"), + (StringTag('+1.+.1f'), "+1.+.1f"), + (StringTag('+1.+.D'), "+1.+.D"), + (StringTag('+1.+.F'), "+1.+.F"), + (StringTag('+1.+.d'), "+1.+.d"), + (StringTag('+1.+.f'), "+1.+.f"), + (StringTag('+1.+1'), "+1.+1"), + (StringTag('+1.+1.'), "+1.+1."), + (StringTag('+1.+1.1'), "+1.+1.1"), + (StringTag('+1.+1.1D'), "+1.+1.1D"), + (StringTag('+1.+1.1F'), "+1.+1.1F"), + (StringTag('+1.+1.1d'), "+1.+1.1d"), + (StringTag('+1.+1.1f'), "+1.+1.1f"), + (StringTag('+1.+1.D'), "+1.+1.D"), + (StringTag('+1.+1.F'), "+1.+1.F"), + (StringTag('+1.+1.d'), "+1.+1.d"), + (StringTag('+1.+1.f'), "+1.+1.f"), + (StringTag('+1.+1D'), "+1.+1D"), + (StringTag('+1.+1F'), "+1.+1F"), + (StringTag('+1.+1d'), "+1.+1d"), + (StringTag('+1.+1f'), "+1.+1f"), + (StringTag('+1.+D'), "+1.+D"), + (StringTag('+1.+F'), "+1.+F"), + (StringTag('+1.+d'), "+1.+d"), + (StringTag('+1.+f'), "+1.+f"), + (StringTag('+1.-'), "+1.-"), + (StringTag('+1.-.'), "+1.-."), + (StringTag('+1.-.1'), "+1.-.1"), + (StringTag('+1.-.1D'), "+1.-.1D"), + (StringTag('+1.-.1F'), "+1.-.1F"), + (StringTag('+1.-.1d'), "+1.-.1d"), + (StringTag('+1.-.1f'), "+1.-.1f"), + (StringTag('+1.-.D'), "+1.-.D"), + (StringTag('+1.-.F'), "+1.-.F"), + (StringTag('+1.-.d'), "+1.-.d"), + (StringTag('+1.-.f'), "+1.-.f"), + (StringTag('+1.-1'), "+1.-1"), + (StringTag('+1.-1.'), "+1.-1."), + (StringTag('+1.-1.1'), "+1.-1.1"), + (StringTag('+1.-1.1D'), "+1.-1.1D"), + (StringTag('+1.-1.1F'), "+1.-1.1F"), + (StringTag('+1.-1.1d'), "+1.-1.1d"), + (StringTag('+1.-1.1f'), "+1.-1.1f"), + (StringTag('+1.-1.D'), "+1.-1.D"), + (StringTag('+1.-1.F'), "+1.-1.F"), + (StringTag('+1.-1.d'), "+1.-1.d"), + (StringTag('+1.-1.f'), "+1.-1.f"), + (StringTag('+1.-1D'), "+1.-1D"), + (StringTag('+1.-1F'), "+1.-1F"), + (StringTag('+1.-1d'), "+1.-1d"), + (StringTag('+1.-1f'), "+1.-1f"), + (StringTag('+1.-D'), "+1.-D"), + (StringTag('+1.-F'), "+1.-F"), + (StringTag('+1.-d'), "+1.-d"), + (StringTag('+1.-f'), "+1.-f"), + (StringTag('+1..'), "+1.."), + (StringTag('+1..1'), "+1..1"), + (StringTag('+1..1D'), "+1..1D"), + (StringTag('+1..1F'), "+1..1F"), + (StringTag('+1..1d'), "+1..1d"), + (StringTag('+1..1f'), "+1..1f"), + (StringTag('+1..D'), "+1..D"), + (StringTag('+1..F'), "+1..F"), + (StringTag('+1..d'), "+1..d"), + (StringTag('+1..f'), "+1..f"), + (DoubleTag(1.100000), "+1.1"), + (StringTag('+1.1+'), "+1.1+"), + (StringTag('+1.1+.'), "+1.1+."), + (StringTag('+1.1+.1'), "+1.1+.1"), + (StringTag('+1.1+.1D'), "+1.1+.1D"), + (StringTag('+1.1+.1F'), "+1.1+.1F"), + (StringTag('+1.1+.1d'), "+1.1+.1d"), + (StringTag('+1.1+.1f'), "+1.1+.1f"), + (StringTag('+1.1+.D'), "+1.1+.D"), + (StringTag('+1.1+.F'), "+1.1+.F"), + (StringTag('+1.1+.d'), "+1.1+.d"), + (StringTag('+1.1+.f'), "+1.1+.f"), + (StringTag('+1.1+1'), "+1.1+1"), + (StringTag('+1.1+1.'), "+1.1+1."), + (StringTag('+1.1+1.1'), "+1.1+1.1"), + (StringTag('+1.1+1.1D'), "+1.1+1.1D"), + (StringTag('+1.1+1.1F'), "+1.1+1.1F"), + (StringTag('+1.1+1.1d'), "+1.1+1.1d"), + (StringTag('+1.1+1.1f'), "+1.1+1.1f"), + (StringTag('+1.1+1.D'), "+1.1+1.D"), + (StringTag('+1.1+1.F'), "+1.1+1.F"), + (StringTag('+1.1+1.d'), "+1.1+1.d"), + (StringTag('+1.1+1.f'), "+1.1+1.f"), + (StringTag('+1.1+1D'), "+1.1+1D"), + (StringTag('+1.1+1F'), "+1.1+1F"), + (StringTag('+1.1+1d'), "+1.1+1d"), + (StringTag('+1.1+1f'), "+1.1+1f"), + (StringTag('+1.1+D'), "+1.1+D"), + (StringTag('+1.1+F'), "+1.1+F"), + (StringTag('+1.1+d'), "+1.1+d"), + (StringTag('+1.1+f'), "+1.1+f"), + (StringTag('+1.1-'), "+1.1-"), + (StringTag('+1.1-.'), "+1.1-."), + (StringTag('+1.1-.1'), "+1.1-.1"), + (StringTag('+1.1-.1D'), "+1.1-.1D"), + (StringTag('+1.1-.1F'), "+1.1-.1F"), + (StringTag('+1.1-.1d'), "+1.1-.1d"), + (StringTag('+1.1-.1f'), "+1.1-.1f"), + (StringTag('+1.1-.D'), "+1.1-.D"), + (StringTag('+1.1-.F'), "+1.1-.F"), + (StringTag('+1.1-.d'), "+1.1-.d"), + (StringTag('+1.1-.f'), "+1.1-.f"), + (StringTag('+1.1-1'), "+1.1-1"), + (StringTag('+1.1-1.'), "+1.1-1."), + (StringTag('+1.1-1.1'), "+1.1-1.1"), + (StringTag('+1.1-1.1D'), "+1.1-1.1D"), + (StringTag('+1.1-1.1F'), "+1.1-1.1F"), + (StringTag('+1.1-1.1d'), "+1.1-1.1d"), + (StringTag('+1.1-1.1f'), "+1.1-1.1f"), + (StringTag('+1.1-1.D'), "+1.1-1.D"), + (StringTag('+1.1-1.F'), "+1.1-1.F"), + (StringTag('+1.1-1.d'), "+1.1-1.d"), + (StringTag('+1.1-1.f'), "+1.1-1.f"), + (StringTag('+1.1-1D'), "+1.1-1D"), + (StringTag('+1.1-1F'), "+1.1-1F"), + (StringTag('+1.1-1d'), "+1.1-1d"), + (StringTag('+1.1-1f'), "+1.1-1f"), + (StringTag('+1.1-D'), "+1.1-D"), + (StringTag('+1.1-F'), "+1.1-F"), + (StringTag('+1.1-d'), "+1.1-d"), + (StringTag('+1.1-f'), "+1.1-f"), + (StringTag('+1.1.'), "+1.1."), + (StringTag('+1.1.1'), "+1.1.1"), + (StringTag('+1.1.1D'), "+1.1.1D"), + (StringTag('+1.1.1F'), "+1.1.1F"), + (StringTag('+1.1.1d'), "+1.1.1d"), + (StringTag('+1.1.1f'), "+1.1.1f"), + (StringTag('+1.1.D'), "+1.1.D"), + (StringTag('+1.1.F'), "+1.1.F"), + (StringTag('+1.1.d'), "+1.1.d"), + (StringTag('+1.1.f'), "+1.1.f"), + (DoubleTag(1.110000), "+1.11"), + (StringTag('+1.11.'), "+1.11."), + (StringTag('+1.11.1'), "+1.11.1"), + (StringTag('+1.11.1D'), "+1.11.1D"), + (StringTag('+1.11.1F'), "+1.11.1F"), + (StringTag('+1.11.1d'), "+1.11.1d"), + (StringTag('+1.11.1f'), "+1.11.1f"), + (StringTag('+1.11.D'), "+1.11.D"), + (StringTag('+1.11.F'), "+1.11.F"), + (StringTag('+1.11.d'), "+1.11.d"), + (StringTag('+1.11.f'), "+1.11.f"), + (DoubleTag(1.110000), "+1.11D"), + (FloatTag(1.110000), "+1.11F"), + (DoubleTag(1.110000), "+1.11d"), + (FloatTag(1.110000), "+1.11f"), + (DoubleTag(1.100000), "+1.1D"), + (StringTag('+1.1E'), "+1.1E"), + (StringTag('+1.1E+'), "+1.1E+"), + (StringTag('+1.1E+.'), "+1.1E+."), + (StringTag('+1.1E+.1'), "+1.1E+.1"), + (StringTag('+1.1E+.1D'), "+1.1E+.1D"), + (StringTag('+1.1E+.1F'), "+1.1E+.1F"), + (StringTag('+1.1E+.1d'), "+1.1E+.1d"), + (StringTag('+1.1E+.1f'), "+1.1E+.1f"), + (StringTag('+1.1E+.D'), "+1.1E+.D"), + (StringTag('+1.1E+.F'), "+1.1E+.F"), + (StringTag('+1.1E+.d'), "+1.1E+.d"), + (StringTag('+1.1E+.f'), "+1.1E+.f"), + (DoubleTag(11.000000), "+1.1E+1"), + (StringTag('+1.1E+1.'), "+1.1E+1."), + (StringTag('+1.1E+1.1'), "+1.1E+1.1"), + (StringTag('+1.1E+1.1D'), "+1.1E+1.1D"), + (StringTag('+1.1E+1.1F'), "+1.1E+1.1F"), + (StringTag('+1.1E+1.1d'), "+1.1E+1.1d"), + (StringTag('+1.1E+1.1f'), "+1.1E+1.1f"), + (StringTag('+1.1E+1.D'), "+1.1E+1.D"), + (StringTag('+1.1E+1.F'), "+1.1E+1.F"), + (StringTag('+1.1E+1.d'), "+1.1E+1.d"), + (StringTag('+1.1E+1.f'), "+1.1E+1.f"), + (DoubleTag(11.000000), "+1.1E+1D"), + (FloatTag(11.000000), "+1.1E+1F"), + (DoubleTag(11.000000), "+1.1E+1d"), + (FloatTag(11.000000), "+1.1E+1f"), + (StringTag('+1.1E+D'), "+1.1E+D"), + (StringTag('+1.1E+F'), "+1.1E+F"), + (StringTag('+1.1E+d'), "+1.1E+d"), + (StringTag('+1.1E+f'), "+1.1E+f"), + (StringTag('+1.1E-'), "+1.1E-"), + (StringTag('+1.1E-.'), "+1.1E-."), + (StringTag('+1.1E-.1'), "+1.1E-.1"), + (StringTag('+1.1E-.1D'), "+1.1E-.1D"), + (StringTag('+1.1E-.1F'), "+1.1E-.1F"), + (StringTag('+1.1E-.1d'), "+1.1E-.1d"), + (StringTag('+1.1E-.1f'), "+1.1E-.1f"), + (StringTag('+1.1E-.D'), "+1.1E-.D"), + (StringTag('+1.1E-.F'), "+1.1E-.F"), + (StringTag('+1.1E-.d'), "+1.1E-.d"), + (StringTag('+1.1E-.f'), "+1.1E-.f"), + (DoubleTag(0.110000), "+1.1E-1"), + (StringTag('+1.1E-1.'), "+1.1E-1."), + (StringTag('+1.1E-1.1'), "+1.1E-1.1"), + (StringTag('+1.1E-1.1D'), "+1.1E-1.1D"), + (StringTag('+1.1E-1.1F'), "+1.1E-1.1F"), + (StringTag('+1.1E-1.1d'), "+1.1E-1.1d"), + (StringTag('+1.1E-1.1f'), "+1.1E-1.1f"), + (StringTag('+1.1E-1.D'), "+1.1E-1.D"), + (StringTag('+1.1E-1.F'), "+1.1E-1.F"), + (StringTag('+1.1E-1.d'), "+1.1E-1.d"), + (StringTag('+1.1E-1.f'), "+1.1E-1.f"), + (DoubleTag(0.110000), "+1.1E-1D"), + (FloatTag(0.110000), "+1.1E-1F"), + (DoubleTag(0.110000), "+1.1E-1d"), + (FloatTag(0.110000), "+1.1E-1f"), + (StringTag('+1.1E-D'), "+1.1E-D"), + (StringTag('+1.1E-F'), "+1.1E-F"), + (StringTag('+1.1E-d'), "+1.1E-d"), + (StringTag('+1.1E-f'), "+1.1E-f"), + (StringTag('+1.1E.'), "+1.1E."), + (StringTag('+1.1E.1'), "+1.1E.1"), + (StringTag('+1.1E.1D'), "+1.1E.1D"), + (StringTag('+1.1E.1F'), "+1.1E.1F"), + (StringTag('+1.1E.1d'), "+1.1E.1d"), + (StringTag('+1.1E.1f'), "+1.1E.1f"), + (StringTag('+1.1E.D'), "+1.1E.D"), + (StringTag('+1.1E.F'), "+1.1E.F"), + (StringTag('+1.1E.d'), "+1.1E.d"), + (StringTag('+1.1E.f'), "+1.1E.f"), + (DoubleTag(11.000000), "+1.1E1"), + (StringTag('+1.1E1.'), "+1.1E1."), + (StringTag('+1.1E1.1'), "+1.1E1.1"), + (StringTag('+1.1E1.1D'), "+1.1E1.1D"), + (StringTag('+1.1E1.1F'), "+1.1E1.1F"), + (StringTag('+1.1E1.1d'), "+1.1E1.1d"), + (StringTag('+1.1E1.1f'), "+1.1E1.1f"), + (StringTag('+1.1E1.D'), "+1.1E1.D"), + (StringTag('+1.1E1.F'), "+1.1E1.F"), + (StringTag('+1.1E1.d'), "+1.1E1.d"), + (StringTag('+1.1E1.f'), "+1.1E1.f"), + (DoubleTag(11.000000), "+1.1E1D"), + (FloatTag(11.000000), "+1.1E1F"), + (DoubleTag(11.000000), "+1.1E1d"), + (FloatTag(11.000000), "+1.1E1f"), + (StringTag('+1.1ED'), "+1.1ED"), + (StringTag('+1.1EF'), "+1.1EF"), + (StringTag('+1.1Ed'), "+1.1Ed"), + (StringTag('+1.1Ef'), "+1.1Ef"), + (FloatTag(1.100000), "+1.1F"), + (DoubleTag(1.100000), "+1.1d"), + (StringTag('+1.1e'), "+1.1e"), + (StringTag('+1.1e+'), "+1.1e+"), + (StringTag('+1.1e+.'), "+1.1e+."), + (StringTag('+1.1e+.1'), "+1.1e+.1"), + (StringTag('+1.1e+.1D'), "+1.1e+.1D"), + (StringTag('+1.1e+.1F'), "+1.1e+.1F"), + (StringTag('+1.1e+.1d'), "+1.1e+.1d"), + (StringTag('+1.1e+.1f'), "+1.1e+.1f"), + (StringTag('+1.1e+.D'), "+1.1e+.D"), + (StringTag('+1.1e+.F'), "+1.1e+.F"), + (StringTag('+1.1e+.d'), "+1.1e+.d"), + (StringTag('+1.1e+.f'), "+1.1e+.f"), + (DoubleTag(11.000000), "+1.1e+1"), + (StringTag('+1.1e+1.'), "+1.1e+1."), + (StringTag('+1.1e+1.1'), "+1.1e+1.1"), + (StringTag('+1.1e+1.1D'), "+1.1e+1.1D"), + (StringTag('+1.1e+1.1F'), "+1.1e+1.1F"), + (StringTag('+1.1e+1.1d'), "+1.1e+1.1d"), + (StringTag('+1.1e+1.1f'), "+1.1e+1.1f"), + (StringTag('+1.1e+1.D'), "+1.1e+1.D"), + (StringTag('+1.1e+1.F'), "+1.1e+1.F"), + (StringTag('+1.1e+1.d'), "+1.1e+1.d"), + (StringTag('+1.1e+1.f'), "+1.1e+1.f"), + (DoubleTag(11.000000), "+1.1e+1D"), + (FloatTag(11.000000), "+1.1e+1F"), + (DoubleTag(11.000000), "+1.1e+1d"), + (FloatTag(11.000000), "+1.1e+1f"), + (StringTag('+1.1e+D'), "+1.1e+D"), + (StringTag('+1.1e+F'), "+1.1e+F"), + (StringTag('+1.1e+d'), "+1.1e+d"), + (StringTag('+1.1e+f'), "+1.1e+f"), + (StringTag('+1.1e-'), "+1.1e-"), + (StringTag('+1.1e-.'), "+1.1e-."), + (StringTag('+1.1e-.1'), "+1.1e-.1"), + (StringTag('+1.1e-.1D'), "+1.1e-.1D"), + (StringTag('+1.1e-.1F'), "+1.1e-.1F"), + (StringTag('+1.1e-.1d'), "+1.1e-.1d"), + (StringTag('+1.1e-.1f'), "+1.1e-.1f"), + (StringTag('+1.1e-.D'), "+1.1e-.D"), + (StringTag('+1.1e-.F'), "+1.1e-.F"), + (StringTag('+1.1e-.d'), "+1.1e-.d"), + (StringTag('+1.1e-.f'), "+1.1e-.f"), + (DoubleTag(0.110000), "+1.1e-1"), + (StringTag('+1.1e-1.'), "+1.1e-1."), + (StringTag('+1.1e-1.1'), "+1.1e-1.1"), + (StringTag('+1.1e-1.1D'), "+1.1e-1.1D"), + (StringTag('+1.1e-1.1F'), "+1.1e-1.1F"), + (StringTag('+1.1e-1.1d'), "+1.1e-1.1d"), + (StringTag('+1.1e-1.1f'), "+1.1e-1.1f"), + (StringTag('+1.1e-1.D'), "+1.1e-1.D"), + (StringTag('+1.1e-1.F'), "+1.1e-1.F"), + (StringTag('+1.1e-1.d'), "+1.1e-1.d"), + (StringTag('+1.1e-1.f'), "+1.1e-1.f"), + (DoubleTag(0.110000), "+1.1e-1D"), + (FloatTag(0.110000), "+1.1e-1F"), + (DoubleTag(0.110000), "+1.1e-1d"), + (FloatTag(0.110000), "+1.1e-1f"), + (StringTag('+1.1e-D'), "+1.1e-D"), + (StringTag('+1.1e-F'), "+1.1e-F"), + (StringTag('+1.1e-d'), "+1.1e-d"), + (StringTag('+1.1e-f'), "+1.1e-f"), + (StringTag('+1.1e.'), "+1.1e."), + (StringTag('+1.1e.1'), "+1.1e.1"), + (StringTag('+1.1e.1D'), "+1.1e.1D"), + (StringTag('+1.1e.1F'), "+1.1e.1F"), + (StringTag('+1.1e.1d'), "+1.1e.1d"), + (StringTag('+1.1e.1f'), "+1.1e.1f"), + (StringTag('+1.1e.D'), "+1.1e.D"), + (StringTag('+1.1e.F'), "+1.1e.F"), + (StringTag('+1.1e.d'), "+1.1e.d"), + (StringTag('+1.1e.f'), "+1.1e.f"), + (DoubleTag(11.000000), "+1.1e1"), + (StringTag('+1.1e1.'), "+1.1e1."), + (StringTag('+1.1e1.1'), "+1.1e1.1"), + (StringTag('+1.1e1.1D'), "+1.1e1.1D"), + (StringTag('+1.1e1.1F'), "+1.1e1.1F"), + (StringTag('+1.1e1.1d'), "+1.1e1.1d"), + (StringTag('+1.1e1.1f'), "+1.1e1.1f"), + (StringTag('+1.1e1.D'), "+1.1e1.D"), + (StringTag('+1.1e1.F'), "+1.1e1.F"), + (StringTag('+1.1e1.d'), "+1.1e1.d"), + (StringTag('+1.1e1.f'), "+1.1e1.f"), + (DoubleTag(11.000000), "+1.1e1D"), + (FloatTag(11.000000), "+1.1e1F"), + (DoubleTag(11.000000), "+1.1e1d"), + (FloatTag(11.000000), "+1.1e1f"), + (StringTag('+1.1eD'), "+1.1eD"), + (StringTag('+1.1eF'), "+1.1eF"), + (StringTag('+1.1ed'), "+1.1ed"), + (StringTag('+1.1ef'), "+1.1ef"), + (FloatTag(1.100000), "+1.1f"), + (DoubleTag(1.000000), "+1.D"), + (StringTag('+1.E'), "+1.E"), + (StringTag('+1.E+'), "+1.E+"), + (StringTag('+1.E+.'), "+1.E+."), + (StringTag('+1.E+.1'), "+1.E+.1"), + (StringTag('+1.E+.1D'), "+1.E+.1D"), + (StringTag('+1.E+.1F'), "+1.E+.1F"), + (StringTag('+1.E+.1d'), "+1.E+.1d"), + (StringTag('+1.E+.1f'), "+1.E+.1f"), + (StringTag('+1.E+.D'), "+1.E+.D"), + (StringTag('+1.E+.F'), "+1.E+.F"), + (StringTag('+1.E+.d'), "+1.E+.d"), + (StringTag('+1.E+.f'), "+1.E+.f"), + (DoubleTag(10.000000), "+1.E+1"), + (StringTag('+1.E+1.'), "+1.E+1."), + (StringTag('+1.E+1.1'), "+1.E+1.1"), + (StringTag('+1.E+1.1D'), "+1.E+1.1D"), + (StringTag('+1.E+1.1F'), "+1.E+1.1F"), + (StringTag('+1.E+1.1d'), "+1.E+1.1d"), + (StringTag('+1.E+1.1f'), "+1.E+1.1f"), + (StringTag('+1.E+1.D'), "+1.E+1.D"), + (StringTag('+1.E+1.F'), "+1.E+1.F"), + (StringTag('+1.E+1.d'), "+1.E+1.d"), + (StringTag('+1.E+1.f'), "+1.E+1.f"), + (DoubleTag(10.000000), "+1.E+1D"), + (FloatTag(10.000000), "+1.E+1F"), + (DoubleTag(10.000000), "+1.E+1d"), + (FloatTag(10.000000), "+1.E+1f"), + (StringTag('+1.E+D'), "+1.E+D"), + (StringTag('+1.E+F'), "+1.E+F"), + (StringTag('+1.E+d'), "+1.E+d"), + (StringTag('+1.E+f'), "+1.E+f"), + (StringTag('+1.E-'), "+1.E-"), + (StringTag('+1.E-.'), "+1.E-."), + (StringTag('+1.E-.1'), "+1.E-.1"), + (StringTag('+1.E-.1D'), "+1.E-.1D"), + (StringTag('+1.E-.1F'), "+1.E-.1F"), + (StringTag('+1.E-.1d'), "+1.E-.1d"), + (StringTag('+1.E-.1f'), "+1.E-.1f"), + (StringTag('+1.E-.D'), "+1.E-.D"), + (StringTag('+1.E-.F'), "+1.E-.F"), + (StringTag('+1.E-.d'), "+1.E-.d"), + (StringTag('+1.E-.f'), "+1.E-.f"), + (DoubleTag(0.100000), "+1.E-1"), + (StringTag('+1.E-1.'), "+1.E-1."), + (StringTag('+1.E-1.1'), "+1.E-1.1"), + (StringTag('+1.E-1.1D'), "+1.E-1.1D"), + (StringTag('+1.E-1.1F'), "+1.E-1.1F"), + (StringTag('+1.E-1.1d'), "+1.E-1.1d"), + (StringTag('+1.E-1.1f'), "+1.E-1.1f"), + (StringTag('+1.E-1.D'), "+1.E-1.D"), + (StringTag('+1.E-1.F'), "+1.E-1.F"), + (StringTag('+1.E-1.d'), "+1.E-1.d"), + (StringTag('+1.E-1.f'), "+1.E-1.f"), + (DoubleTag(0.100000), "+1.E-1D"), + (FloatTag(0.100000), "+1.E-1F"), + (DoubleTag(0.100000), "+1.E-1d"), + (FloatTag(0.100000), "+1.E-1f"), + (StringTag('+1.E-D'), "+1.E-D"), + (StringTag('+1.E-F'), "+1.E-F"), + (StringTag('+1.E-d'), "+1.E-d"), + (StringTag('+1.E-f'), "+1.E-f"), + (StringTag('+1.E.'), "+1.E."), + (StringTag('+1.E.1'), "+1.E.1"), + (StringTag('+1.E.1D'), "+1.E.1D"), + (StringTag('+1.E.1F'), "+1.E.1F"), + (StringTag('+1.E.1d'), "+1.E.1d"), + (StringTag('+1.E.1f'), "+1.E.1f"), + (StringTag('+1.E.D'), "+1.E.D"), + (StringTag('+1.E.F'), "+1.E.F"), + (StringTag('+1.E.d'), "+1.E.d"), + (StringTag('+1.E.f'), "+1.E.f"), + (DoubleTag(10.000000), "+1.E1"), + (StringTag('+1.E1.'), "+1.E1."), + (StringTag('+1.E1.1'), "+1.E1.1"), + (StringTag('+1.E1.1D'), "+1.E1.1D"), + (StringTag('+1.E1.1F'), "+1.E1.1F"), + (StringTag('+1.E1.1d'), "+1.E1.1d"), + (StringTag('+1.E1.1f'), "+1.E1.1f"), + (StringTag('+1.E1.D'), "+1.E1.D"), + (StringTag('+1.E1.F'), "+1.E1.F"), + (StringTag('+1.E1.d'), "+1.E1.d"), + (StringTag('+1.E1.f'), "+1.E1.f"), + (DoubleTag(10.000000), "+1.E1D"), + (FloatTag(10.000000), "+1.E1F"), + (DoubleTag(10.000000), "+1.E1d"), + (FloatTag(10.000000), "+1.E1f"), + (StringTag('+1.ED'), "+1.ED"), + (StringTag('+1.EF'), "+1.EF"), + (StringTag('+1.Ed'), "+1.Ed"), + (StringTag('+1.Ef'), "+1.Ef"), + (FloatTag(1.000000), "+1.F"), + (DoubleTag(1.000000), "+1.d"), + (StringTag('+1.e'), "+1.e"), + (StringTag('+1.e+'), "+1.e+"), + (StringTag('+1.e+.'), "+1.e+."), + (StringTag('+1.e+.1'), "+1.e+.1"), + (StringTag('+1.e+.1D'), "+1.e+.1D"), + (StringTag('+1.e+.1F'), "+1.e+.1F"), + (StringTag('+1.e+.1d'), "+1.e+.1d"), + (StringTag('+1.e+.1f'), "+1.e+.1f"), + (StringTag('+1.e+.D'), "+1.e+.D"), + (StringTag('+1.e+.F'), "+1.e+.F"), + (StringTag('+1.e+.d'), "+1.e+.d"), + (StringTag('+1.e+.f'), "+1.e+.f"), + (DoubleTag(10.000000), "+1.e+1"), + (StringTag('+1.e+1.'), "+1.e+1."), + (StringTag('+1.e+1.1'), "+1.e+1.1"), + (StringTag('+1.e+1.1D'), "+1.e+1.1D"), + (StringTag('+1.e+1.1F'), "+1.e+1.1F"), + (StringTag('+1.e+1.1d'), "+1.e+1.1d"), + (StringTag('+1.e+1.1f'), "+1.e+1.1f"), + (StringTag('+1.e+1.D'), "+1.e+1.D"), + (StringTag('+1.e+1.F'), "+1.e+1.F"), + (StringTag('+1.e+1.d'), "+1.e+1.d"), + (StringTag('+1.e+1.f'), "+1.e+1.f"), + (DoubleTag(10.000000), "+1.e+1D"), + (FloatTag(10.000000), "+1.e+1F"), + (DoubleTag(10.000000), "+1.e+1d"), + (FloatTag(10.000000), "+1.e+1f"), + (StringTag('+1.e+D'), "+1.e+D"), + (StringTag('+1.e+F'), "+1.e+F"), + (StringTag('+1.e+d'), "+1.e+d"), + (StringTag('+1.e+f'), "+1.e+f"), + (StringTag('+1.e-'), "+1.e-"), + (StringTag('+1.e-.'), "+1.e-."), + (StringTag('+1.e-.1'), "+1.e-.1"), + (StringTag('+1.e-.1D'), "+1.e-.1D"), + (StringTag('+1.e-.1F'), "+1.e-.1F"), + (StringTag('+1.e-.1d'), "+1.e-.1d"), + (StringTag('+1.e-.1f'), "+1.e-.1f"), + (StringTag('+1.e-.D'), "+1.e-.D"), + (StringTag('+1.e-.F'), "+1.e-.F"), + (StringTag('+1.e-.d'), "+1.e-.d"), + (StringTag('+1.e-.f'), "+1.e-.f"), + (DoubleTag(0.100000), "+1.e-1"), + (StringTag('+1.e-1.'), "+1.e-1."), + (StringTag('+1.e-1.1'), "+1.e-1.1"), + (StringTag('+1.e-1.1D'), "+1.e-1.1D"), + (StringTag('+1.e-1.1F'), "+1.e-1.1F"), + (StringTag('+1.e-1.1d'), "+1.e-1.1d"), + (StringTag('+1.e-1.1f'), "+1.e-1.1f"), + (StringTag('+1.e-1.D'), "+1.e-1.D"), + (StringTag('+1.e-1.F'), "+1.e-1.F"), + (StringTag('+1.e-1.d'), "+1.e-1.d"), + (StringTag('+1.e-1.f'), "+1.e-1.f"), + (DoubleTag(0.100000), "+1.e-1D"), + (FloatTag(0.100000), "+1.e-1F"), + (DoubleTag(0.100000), "+1.e-1d"), + (FloatTag(0.100000), "+1.e-1f"), + (StringTag('+1.e-D'), "+1.e-D"), + (StringTag('+1.e-F'), "+1.e-F"), + (StringTag('+1.e-d'), "+1.e-d"), + (StringTag('+1.e-f'), "+1.e-f"), + (StringTag('+1.e.'), "+1.e."), + (StringTag('+1.e.1'), "+1.e.1"), + (StringTag('+1.e.1D'), "+1.e.1D"), + (StringTag('+1.e.1F'), "+1.e.1F"), + (StringTag('+1.e.1d'), "+1.e.1d"), + (StringTag('+1.e.1f'), "+1.e.1f"), + (StringTag('+1.e.D'), "+1.e.D"), + (StringTag('+1.e.F'), "+1.e.F"), + (StringTag('+1.e.d'), "+1.e.d"), + (StringTag('+1.e.f'), "+1.e.f"), + (DoubleTag(10.000000), "+1.e1"), + (StringTag('+1.e1.'), "+1.e1."), + (StringTag('+1.e1.1'), "+1.e1.1"), + (StringTag('+1.e1.1D'), "+1.e1.1D"), + (StringTag('+1.e1.1F'), "+1.e1.1F"), + (StringTag('+1.e1.1d'), "+1.e1.1d"), + (StringTag('+1.e1.1f'), "+1.e1.1f"), + (StringTag('+1.e1.D'), "+1.e1.D"), + (StringTag('+1.e1.F'), "+1.e1.F"), + (StringTag('+1.e1.d'), "+1.e1.d"), + (StringTag('+1.e1.f'), "+1.e1.f"), + (DoubleTag(10.000000), "+1.e1D"), + (FloatTag(10.000000), "+1.e1F"), + (DoubleTag(10.000000), "+1.e1d"), + (FloatTag(10.000000), "+1.e1f"), + (StringTag('+1.eD'), "+1.eD"), + (StringTag('+1.eF'), "+1.eF"), + (StringTag('+1.ed'), "+1.ed"), + (StringTag('+1.ef'), "+1.ef"), + (FloatTag(1.000000), "+1.f"), + (IntTag(11), "+11"), + (DoubleTag(11.000000), "+11."), + (DoubleTag(11.100000), "+11.1"), + (DoubleTag(11.100000), "+11.1D"), + (FloatTag(11.100000), "+11.1F"), + (DoubleTag(11.100000), "+11.1d"), + (FloatTag(11.100000), "+11.1f"), + (DoubleTag(11.000000), "+11.D"), + (FloatTag(11.000000), "+11.F"), + (DoubleTag(11.000000), "+11.d"), + (FloatTag(11.000000), "+11.f"), + (DoubleTag(11.000000), "+11D"), + (FloatTag(11.000000), "+11F"), + (DoubleTag(11.000000), "+11d"), + (FloatTag(11.000000), "+11f"), + (DoubleTag(1.000000), "+1D"), + (StringTag('+1E'), "+1E"), + (StringTag('+1E+'), "+1E+"), + (StringTag('+1E+.'), "+1E+."), + (StringTag('+1E+.1'), "+1E+.1"), + (StringTag('+1E+.1D'), "+1E+.1D"), + (StringTag('+1E+.1F'), "+1E+.1F"), + (StringTag('+1E+.1d'), "+1E+.1d"), + (StringTag('+1E+.1f'), "+1E+.1f"), + (StringTag('+1E+.D'), "+1E+.D"), + (StringTag('+1E+.F'), "+1E+.F"), + (StringTag('+1E+.d'), "+1E+.d"), + (StringTag('+1E+.f'), "+1E+.f"), + (StringTag('+1E+1'), "+1E+1"), + (StringTag('+1E+1.'), "+1E+1."), + (StringTag('+1E+1.1'), "+1E+1.1"), + (StringTag('+1E+1.1D'), "+1E+1.1D"), + (StringTag('+1E+1.1F'), "+1E+1.1F"), + (StringTag('+1E+1.1d'), "+1E+1.1d"), + (StringTag('+1E+1.1f'), "+1E+1.1f"), + (StringTag('+1E+1.D'), "+1E+1.D"), + (StringTag('+1E+1.F'), "+1E+1.F"), + (StringTag('+1E+1.d'), "+1E+1.d"), + (StringTag('+1E+1.f'), "+1E+1.f"), + (DoubleTag(10.000000), "+1E+1D"), + (FloatTag(10.000000), "+1E+1F"), + (DoubleTag(10.000000), "+1E+1d"), + (FloatTag(10.000000), "+1E+1f"), + (StringTag('+1E+D'), "+1E+D"), + (StringTag('+1E+F'), "+1E+F"), + (StringTag('+1E+d'), "+1E+d"), + (StringTag('+1E+f'), "+1E+f"), + (StringTag('+1E-'), "+1E-"), + (StringTag('+1E-.'), "+1E-."), + (StringTag('+1E-.1'), "+1E-.1"), + (StringTag('+1E-.1D'), "+1E-.1D"), + (StringTag('+1E-.1F'), "+1E-.1F"), + (StringTag('+1E-.1d'), "+1E-.1d"), + (StringTag('+1E-.1f'), "+1E-.1f"), + (StringTag('+1E-.D'), "+1E-.D"), + (StringTag('+1E-.F'), "+1E-.F"), + (StringTag('+1E-.d'), "+1E-.d"), + (StringTag('+1E-.f'), "+1E-.f"), + (StringTag('+1E-1'), "+1E-1"), + (StringTag('+1E-1.'), "+1E-1."), + (StringTag('+1E-1.1'), "+1E-1.1"), + (StringTag('+1E-1.1D'), "+1E-1.1D"), + (StringTag('+1E-1.1F'), "+1E-1.1F"), + (StringTag('+1E-1.1d'), "+1E-1.1d"), + (StringTag('+1E-1.1f'), "+1E-1.1f"), + (StringTag('+1E-1.D'), "+1E-1.D"), + (StringTag('+1E-1.F'), "+1E-1.F"), + (StringTag('+1E-1.d'), "+1E-1.d"), + (StringTag('+1E-1.f'), "+1E-1.f"), + (DoubleTag(0.100000), "+1E-1D"), + (FloatTag(0.100000), "+1E-1F"), + (DoubleTag(0.100000), "+1E-1d"), + (FloatTag(0.100000), "+1E-1f"), + (StringTag('+1E-D'), "+1E-D"), + (StringTag('+1E-F'), "+1E-F"), + (StringTag('+1E-d'), "+1E-d"), + (StringTag('+1E-f'), "+1E-f"), + (StringTag('+1E.'), "+1E."), + (StringTag('+1E.1'), "+1E.1"), + (StringTag('+1E.1D'), "+1E.1D"), + (StringTag('+1E.1F'), "+1E.1F"), + (StringTag('+1E.1d'), "+1E.1d"), + (StringTag('+1E.1f'), "+1E.1f"), + (StringTag('+1E.D'), "+1E.D"), + (StringTag('+1E.F'), "+1E.F"), + (StringTag('+1E.d'), "+1E.d"), + (StringTag('+1E.f'), "+1E.f"), + (StringTag('+1E1'), "+1E1"), + (StringTag('+1E1.'), "+1E1."), + (StringTag('+1E1.1'), "+1E1.1"), + (StringTag('+1E1.1D'), "+1E1.1D"), + (StringTag('+1E1.1F'), "+1E1.1F"), + (StringTag('+1E1.1d'), "+1E1.1d"), + (StringTag('+1E1.1f'), "+1E1.1f"), + (StringTag('+1E1.D'), "+1E1.D"), + (StringTag('+1E1.F'), "+1E1.F"), + (StringTag('+1E1.d'), "+1E1.d"), + (StringTag('+1E1.f'), "+1E1.f"), + (DoubleTag(10.000000), "+1E1D"), + (FloatTag(10.000000), "+1E1F"), + (DoubleTag(10.000000), "+1E1d"), + (FloatTag(10.000000), "+1E1f"), + (StringTag('+1ED'), "+1ED"), + (StringTag('+1EF'), "+1EF"), + (StringTag('+1Ed'), "+1Ed"), + (StringTag('+1Ef'), "+1Ef"), + (FloatTag(1.000000), "+1F"), + (DoubleTag(1.000000), "+1d"), + (StringTag('+1e'), "+1e"), + (StringTag('+1e+'), "+1e+"), + (StringTag('+1e+.'), "+1e+."), + (StringTag('+1e+.1'), "+1e+.1"), + (StringTag('+1e+.1D'), "+1e+.1D"), + (StringTag('+1e+.1F'), "+1e+.1F"), + (StringTag('+1e+.1d'), "+1e+.1d"), + (StringTag('+1e+.1f'), "+1e+.1f"), + (StringTag('+1e+.D'), "+1e+.D"), + (StringTag('+1e+.F'), "+1e+.F"), + (StringTag('+1e+.d'), "+1e+.d"), + (StringTag('+1e+.f'), "+1e+.f"), + (StringTag('+1e+1'), "+1e+1"), + (StringTag('+1e+1.'), "+1e+1."), + (StringTag('+1e+1.1'), "+1e+1.1"), + (StringTag('+1e+1.1D'), "+1e+1.1D"), + (StringTag('+1e+1.1F'), "+1e+1.1F"), + (StringTag('+1e+1.1d'), "+1e+1.1d"), + (StringTag('+1e+1.1f'), "+1e+1.1f"), + (StringTag('+1e+1.D'), "+1e+1.D"), + (StringTag('+1e+1.F'), "+1e+1.F"), + (StringTag('+1e+1.d'), "+1e+1.d"), + (StringTag('+1e+1.f'), "+1e+1.f"), + (DoubleTag(10.000000), "+1e+1D"), + (FloatTag(10.000000), "+1e+1F"), + (DoubleTag(10.000000), "+1e+1d"), + (FloatTag(10.000000), "+1e+1f"), + (StringTag('+1e+D'), "+1e+D"), + (StringTag('+1e+F'), "+1e+F"), + (StringTag('+1e+d'), "+1e+d"), + (StringTag('+1e+f'), "+1e+f"), + (StringTag('+1e-'), "+1e-"), + (StringTag('+1e-.'), "+1e-."), + (StringTag('+1e-.1'), "+1e-.1"), + (StringTag('+1e-.1D'), "+1e-.1D"), + (StringTag('+1e-.1F'), "+1e-.1F"), + (StringTag('+1e-.1d'), "+1e-.1d"), + (StringTag('+1e-.1f'), "+1e-.1f"), + (StringTag('+1e-.D'), "+1e-.D"), + (StringTag('+1e-.F'), "+1e-.F"), + (StringTag('+1e-.d'), "+1e-.d"), + (StringTag('+1e-.f'), "+1e-.f"), + (StringTag('+1e-1'), "+1e-1"), + (StringTag('+1e-1.'), "+1e-1."), + (StringTag('+1e-1.1'), "+1e-1.1"), + (StringTag('+1e-1.1D'), "+1e-1.1D"), + (StringTag('+1e-1.1F'), "+1e-1.1F"), + (StringTag('+1e-1.1d'), "+1e-1.1d"), + (StringTag('+1e-1.1f'), "+1e-1.1f"), + (StringTag('+1e-1.D'), "+1e-1.D"), + (StringTag('+1e-1.F'), "+1e-1.F"), + (StringTag('+1e-1.d'), "+1e-1.d"), + (StringTag('+1e-1.f'), "+1e-1.f"), + (DoubleTag(0.100000), "+1e-1D"), + (FloatTag(0.100000), "+1e-1F"), + (DoubleTag(0.100000), "+1e-1d"), + (FloatTag(0.100000), "+1e-1f"), + (StringTag('+1e-D'), "+1e-D"), + (StringTag('+1e-F'), "+1e-F"), + (StringTag('+1e-d'), "+1e-d"), + (StringTag('+1e-f'), "+1e-f"), + (StringTag('+1e.'), "+1e."), + (StringTag('+1e.1'), "+1e.1"), + (StringTag('+1e.1D'), "+1e.1D"), + (StringTag('+1e.1F'), "+1e.1F"), + (StringTag('+1e.1d'), "+1e.1d"), + (StringTag('+1e.1f'), "+1e.1f"), + (StringTag('+1e.D'), "+1e.D"), + (StringTag('+1e.F'), "+1e.F"), + (StringTag('+1e.d'), "+1e.d"), + (StringTag('+1e.f'), "+1e.f"), + (StringTag('+1e1'), "+1e1"), + (StringTag('+1e1.'), "+1e1."), + (StringTag('+1e1.1'), "+1e1.1"), + (StringTag('+1e1.1D'), "+1e1.1D"), + (StringTag('+1e1.1F'), "+1e1.1F"), + (StringTag('+1e1.1d'), "+1e1.1d"), + (StringTag('+1e1.1f'), "+1e1.1f"), + (StringTag('+1e1.D'), "+1e1.D"), + (StringTag('+1e1.F'), "+1e1.F"), + (StringTag('+1e1.d'), "+1e1.d"), + (StringTag('+1e1.f'), "+1e1.f"), + (DoubleTag(10.000000), "+1e1D"), + (FloatTag(10.000000), "+1e1F"), + (DoubleTag(10.000000), "+1e1d"), + (FloatTag(10.000000), "+1e1f"), + (StringTag('+1eD'), "+1eD"), + (StringTag('+1eF'), "+1eF"), + (StringTag('+1ed'), "+1ed"), + (StringTag('+1ef'), "+1ef"), + (FloatTag(1.000000), "+1f"), + (StringTag('+D'), "+D"), + (StringTag('+E'), "+E"), + (StringTag('+E+'), "+E+"), + (StringTag('+E+.'), "+E+."), + (StringTag('+E+.1'), "+E+.1"), + (StringTag('+E+.1D'), "+E+.1D"), + (StringTag('+E+.1F'), "+E+.1F"), + (StringTag('+E+.1d'), "+E+.1d"), + (StringTag('+E+.1f'), "+E+.1f"), + (StringTag('+E+.D'), "+E+.D"), + (StringTag('+E+.F'), "+E+.F"), + (StringTag('+E+.d'), "+E+.d"), + (StringTag('+E+.f'), "+E+.f"), + (StringTag('+E+1'), "+E+1"), + (StringTag('+E+1.'), "+E+1."), + (StringTag('+E+1.1'), "+E+1.1"), + (StringTag('+E+1.1D'), "+E+1.1D"), + (StringTag('+E+1.1F'), "+E+1.1F"), + (StringTag('+E+1.1d'), "+E+1.1d"), + (StringTag('+E+1.1f'), "+E+1.1f"), + (StringTag('+E+1.D'), "+E+1.D"), + (StringTag('+E+1.F'), "+E+1.F"), + (StringTag('+E+1.d'), "+E+1.d"), + (StringTag('+E+1.f'), "+E+1.f"), + (StringTag('+E+1D'), "+E+1D"), + (StringTag('+E+1F'), "+E+1F"), + (StringTag('+E+1d'), "+E+1d"), + (StringTag('+E+1f'), "+E+1f"), + (StringTag('+E+D'), "+E+D"), + (StringTag('+E+F'), "+E+F"), + (StringTag('+E+d'), "+E+d"), + (StringTag('+E+f'), "+E+f"), + (StringTag('+E-'), "+E-"), + (StringTag('+E-.'), "+E-."), + (StringTag('+E-.1'), "+E-.1"), + (StringTag('+E-.1D'), "+E-.1D"), + (StringTag('+E-.1F'), "+E-.1F"), + (StringTag('+E-.1d'), "+E-.1d"), + (StringTag('+E-.1f'), "+E-.1f"), + (StringTag('+E-.D'), "+E-.D"), + (StringTag('+E-.F'), "+E-.F"), + (StringTag('+E-.d'), "+E-.d"), + (StringTag('+E-.f'), "+E-.f"), + (StringTag('+E-1'), "+E-1"), + (StringTag('+E-1.'), "+E-1."), + (StringTag('+E-1.1'), "+E-1.1"), + (StringTag('+E-1.1D'), "+E-1.1D"), + (StringTag('+E-1.1F'), "+E-1.1F"), + (StringTag('+E-1.1d'), "+E-1.1d"), + (StringTag('+E-1.1f'), "+E-1.1f"), + (StringTag('+E-1.D'), "+E-1.D"), + (StringTag('+E-1.F'), "+E-1.F"), + (StringTag('+E-1.d'), "+E-1.d"), + (StringTag('+E-1.f'), "+E-1.f"), + (StringTag('+E-1D'), "+E-1D"), + (StringTag('+E-1F'), "+E-1F"), + (StringTag('+E-1d'), "+E-1d"), + (StringTag('+E-1f'), "+E-1f"), + (StringTag('+E-D'), "+E-D"), + (StringTag('+E-F'), "+E-F"), + (StringTag('+E-d'), "+E-d"), + (StringTag('+E-f'), "+E-f"), + (StringTag('+E.'), "+E."), + (StringTag('+E.1'), "+E.1"), + (StringTag('+E.1D'), "+E.1D"), + (StringTag('+E.1F'), "+E.1F"), + (StringTag('+E.1d'), "+E.1d"), + (StringTag('+E.1f'), "+E.1f"), + (StringTag('+E.D'), "+E.D"), + (StringTag('+E.F'), "+E.F"), + (StringTag('+E.d'), "+E.d"), + (StringTag('+E.f'), "+E.f"), + (StringTag('+E1'), "+E1"), + (StringTag('+E1.'), "+E1."), + (StringTag('+E1.1'), "+E1.1"), + (StringTag('+E1.1D'), "+E1.1D"), + (StringTag('+E1.1F'), "+E1.1F"), + (StringTag('+E1.1d'), "+E1.1d"), + (StringTag('+E1.1f'), "+E1.1f"), + (StringTag('+E1.D'), "+E1.D"), + (StringTag('+E1.F'), "+E1.F"), + (StringTag('+E1.d'), "+E1.d"), + (StringTag('+E1.f'), "+E1.f"), + (StringTag('+E1D'), "+E1D"), + (StringTag('+E1F'), "+E1F"), + (StringTag('+E1d'), "+E1d"), + (StringTag('+E1f'), "+E1f"), + (StringTag('+ED'), "+ED"), + (StringTag('+EF'), "+EF"), + (StringTag('+Ed'), "+Ed"), + (StringTag('+Ef'), "+Ef"), + (StringTag('+F'), "+F"), + (StringTag('+d'), "+d"), + (StringTag('+e'), "+e"), + (StringTag('+e+'), "+e+"), + (StringTag('+e+.'), "+e+."), + (StringTag('+e+.1'), "+e+.1"), + (StringTag('+e+.1D'), "+e+.1D"), + (StringTag('+e+.1F'), "+e+.1F"), + (StringTag('+e+.1d'), "+e+.1d"), + (StringTag('+e+.1f'), "+e+.1f"), + (StringTag('+e+.D'), "+e+.D"), + (StringTag('+e+.F'), "+e+.F"), + (StringTag('+e+.d'), "+e+.d"), + (StringTag('+e+.f'), "+e+.f"), + (StringTag('+e+1'), "+e+1"), + (StringTag('+e+1.'), "+e+1."), + (StringTag('+e+1.1'), "+e+1.1"), + (StringTag('+e+1.1D'), "+e+1.1D"), + (StringTag('+e+1.1F'), "+e+1.1F"), + (StringTag('+e+1.1d'), "+e+1.1d"), + (StringTag('+e+1.1f'), "+e+1.1f"), + (StringTag('+e+1.D'), "+e+1.D"), + (StringTag('+e+1.F'), "+e+1.F"), + (StringTag('+e+1.d'), "+e+1.d"), + (StringTag('+e+1.f'), "+e+1.f"), + (StringTag('+e+1D'), "+e+1D"), + (StringTag('+e+1F'), "+e+1F"), + (StringTag('+e+1d'), "+e+1d"), + (StringTag('+e+1f'), "+e+1f"), + (StringTag('+e+D'), "+e+D"), + (StringTag('+e+F'), "+e+F"), + (StringTag('+e+d'), "+e+d"), + (StringTag('+e+f'), "+e+f"), + (StringTag('+e-'), "+e-"), + (StringTag('+e-.'), "+e-."), + (StringTag('+e-.1'), "+e-.1"), + (StringTag('+e-.1D'), "+e-.1D"), + (StringTag('+e-.1F'), "+e-.1F"), + (StringTag('+e-.1d'), "+e-.1d"), + (StringTag('+e-.1f'), "+e-.1f"), + (StringTag('+e-.D'), "+e-.D"), + (StringTag('+e-.F'), "+e-.F"), + (StringTag('+e-.d'), "+e-.d"), + (StringTag('+e-.f'), "+e-.f"), + (StringTag('+e-1'), "+e-1"), + (StringTag('+e-1.'), "+e-1."), + (StringTag('+e-1.1'), "+e-1.1"), + (StringTag('+e-1.1D'), "+e-1.1D"), + (StringTag('+e-1.1F'), "+e-1.1F"), + (StringTag('+e-1.1d'), "+e-1.1d"), + (StringTag('+e-1.1f'), "+e-1.1f"), + (StringTag('+e-1.D'), "+e-1.D"), + (StringTag('+e-1.F'), "+e-1.F"), + (StringTag('+e-1.d'), "+e-1.d"), + (StringTag('+e-1.f'), "+e-1.f"), + (StringTag('+e-1D'), "+e-1D"), + (StringTag('+e-1F'), "+e-1F"), + (StringTag('+e-1d'), "+e-1d"), + (StringTag('+e-1f'), "+e-1f"), + (StringTag('+e-D'), "+e-D"), + (StringTag('+e-F'), "+e-F"), + (StringTag('+e-d'), "+e-d"), + (StringTag('+e-f'), "+e-f"), + (StringTag('+e.'), "+e."), + (StringTag('+e.1'), "+e.1"), + (StringTag('+e.1D'), "+e.1D"), + (StringTag('+e.1F'), "+e.1F"), + (StringTag('+e.1d'), "+e.1d"), + (StringTag('+e.1f'), "+e.1f"), + (StringTag('+e.D'), "+e.D"), + (StringTag('+e.F'), "+e.F"), + (StringTag('+e.d'), "+e.d"), + (StringTag('+e.f'), "+e.f"), + (StringTag('+e1'), "+e1"), + (StringTag('+e1.'), "+e1."), + (StringTag('+e1.1'), "+e1.1"), + (StringTag('+e1.1D'), "+e1.1D"), + (StringTag('+e1.1F'), "+e1.1F"), + (StringTag('+e1.1d'), "+e1.1d"), + (StringTag('+e1.1f'), "+e1.1f"), + (StringTag('+e1.D'), "+e1.D"), + (StringTag('+e1.F'), "+e1.F"), + (StringTag('+e1.d'), "+e1.d"), + (StringTag('+e1.f'), "+e1.f"), + (StringTag('+e1D'), "+e1D"), + (StringTag('+e1F'), "+e1F"), + (StringTag('+e1d'), "+e1d"), + (StringTag('+e1f'), "+e1f"), + (StringTag('+eD'), "+eD"), + (StringTag('+eF'), "+eF"), + (StringTag('+ed'), "+ed"), + (StringTag('+ef'), "+ef"), + (StringTag('+f'), "+f"), + (StringTag('-'), "-"), + (StringTag('-+'), "-+"), + (StringTag('-+.'), "-+."), + (StringTag('-+.1'), "-+.1"), + (StringTag('-+.1D'), "-+.1D"), + (StringTag('-+.1F'), "-+.1F"), + (StringTag('-+.1d'), "-+.1d"), + (StringTag('-+.1f'), "-+.1f"), + (StringTag('-+.D'), "-+.D"), + (StringTag('-+.F'), "-+.F"), + (StringTag('-+.d'), "-+.d"), + (StringTag('-+.f'), "-+.f"), + (StringTag('-+1'), "-+1"), + (StringTag('-+1.'), "-+1."), + (StringTag('-+1.1'), "-+1.1"), + (StringTag('-+1.1D'), "-+1.1D"), + (StringTag('-+1.1F'), "-+1.1F"), + (StringTag('-+1.1d'), "-+1.1d"), + (StringTag('-+1.1f'), "-+1.1f"), + (StringTag('-+1.D'), "-+1.D"), + (StringTag('-+1.F'), "-+1.F"), + (StringTag('-+1.d'), "-+1.d"), + (StringTag('-+1.f'), "-+1.f"), + (StringTag('-+1D'), "-+1D"), + (StringTag('-+1F'), "-+1F"), + (StringTag('-+1d'), "-+1d"), + (StringTag('-+1f'), "-+1f"), + (StringTag('-+D'), "-+D"), + (StringTag('-+F'), "-+F"), + (StringTag('-+d'), "-+d"), + (StringTag('-+f'), "-+f"), + (StringTag('--'), "--"), + (StringTag('--.'), "--."), + (StringTag('--.1'), "--.1"), + (StringTag('--.1D'), "--.1D"), + (StringTag('--.1F'), "--.1F"), + (StringTag('--.1d'), "--.1d"), + (StringTag('--.1f'), "--.1f"), + (StringTag('--.D'), "--.D"), + (StringTag('--.F'), "--.F"), + (StringTag('--.d'), "--.d"), + (StringTag('--.f'), "--.f"), + (StringTag('--1'), "--1"), + (StringTag('--1.'), "--1."), + (StringTag('--1.1'), "--1.1"), + (StringTag('--1.1D'), "--1.1D"), + (StringTag('--1.1F'), "--1.1F"), + (StringTag('--1.1d'), "--1.1d"), + (StringTag('--1.1f'), "--1.1f"), + (StringTag('--1.D'), "--1.D"), + (StringTag('--1.F'), "--1.F"), + (StringTag('--1.d'), "--1.d"), + (StringTag('--1.f'), "--1.f"), + (StringTag('--1D'), "--1D"), + (StringTag('--1F'), "--1F"), + (StringTag('--1d'), "--1d"), + (StringTag('--1f'), "--1f"), + (StringTag('--D'), "--D"), + (StringTag('--F'), "--F"), + (StringTag('--d'), "--d"), + (StringTag('--f'), "--f"), + (StringTag('-.'), "-."), + (StringTag('-.+'), "-.+"), + (StringTag('-.+.'), "-.+."), + (StringTag('-.+.1'), "-.+.1"), + (StringTag('-.+.1D'), "-.+.1D"), + (StringTag('-.+.1F'), "-.+.1F"), + (StringTag('-.+.1d'), "-.+.1d"), + (StringTag('-.+.1f'), "-.+.1f"), + (StringTag('-.+.D'), "-.+.D"), + (StringTag('-.+.F'), "-.+.F"), + (StringTag('-.+.d'), "-.+.d"), + (StringTag('-.+.f'), "-.+.f"), + (StringTag('-.+1'), "-.+1"), + (StringTag('-.+1.'), "-.+1."), + (StringTag('-.+1.1'), "-.+1.1"), + (StringTag('-.+1.1D'), "-.+1.1D"), + (StringTag('-.+1.1F'), "-.+1.1F"), + (StringTag('-.+1.1d'), "-.+1.1d"), + (StringTag('-.+1.1f'), "-.+1.1f"), + (StringTag('-.+1.D'), "-.+1.D"), + (StringTag('-.+1.F'), "-.+1.F"), + (StringTag('-.+1.d'), "-.+1.d"), + (StringTag('-.+1.f'), "-.+1.f"), + (StringTag('-.+1D'), "-.+1D"), + (StringTag('-.+1F'), "-.+1F"), + (StringTag('-.+1d'), "-.+1d"), + (StringTag('-.+1f'), "-.+1f"), + (StringTag('-.+D'), "-.+D"), + (StringTag('-.+F'), "-.+F"), + (StringTag('-.+d'), "-.+d"), + (StringTag('-.+f'), "-.+f"), + (StringTag('-.-'), "-.-"), + (StringTag('-.-.'), "-.-."), + (StringTag('-.-.1'), "-.-.1"), + (StringTag('-.-.1D'), "-.-.1D"), + (StringTag('-.-.1F'), "-.-.1F"), + (StringTag('-.-.1d'), "-.-.1d"), + (StringTag('-.-.1f'), "-.-.1f"), + (StringTag('-.-.D'), "-.-.D"), + (StringTag('-.-.F'), "-.-.F"), + (StringTag('-.-.d'), "-.-.d"), + (StringTag('-.-.f'), "-.-.f"), + (StringTag('-.-1'), "-.-1"), + (StringTag('-.-1.'), "-.-1."), + (StringTag('-.-1.1'), "-.-1.1"), + (StringTag('-.-1.1D'), "-.-1.1D"), + (StringTag('-.-1.1F'), "-.-1.1F"), + (StringTag('-.-1.1d'), "-.-1.1d"), + (StringTag('-.-1.1f'), "-.-1.1f"), + (StringTag('-.-1.D'), "-.-1.D"), + (StringTag('-.-1.F'), "-.-1.F"), + (StringTag('-.-1.d'), "-.-1.d"), + (StringTag('-.-1.f'), "-.-1.f"), + (StringTag('-.-1D'), "-.-1D"), + (StringTag('-.-1F'), "-.-1F"), + (StringTag('-.-1d'), "-.-1d"), + (StringTag('-.-1f'), "-.-1f"), + (StringTag('-.-D'), "-.-D"), + (StringTag('-.-F'), "-.-F"), + (StringTag('-.-d'), "-.-d"), + (StringTag('-.-f'), "-.-f"), + (StringTag('-..'), "-.."), + (StringTag('-..1'), "-..1"), + (StringTag('-..1D'), "-..1D"), + (StringTag('-..1F'), "-..1F"), + (StringTag('-..1d'), "-..1d"), + (StringTag('-..1f'), "-..1f"), + (StringTag('-..D'), "-..D"), + (StringTag('-..F'), "-..F"), + (StringTag('-..d'), "-..d"), + (StringTag('-..f'), "-..f"), + (DoubleTag(-0.100000), "-.1"), + (StringTag('-.1+'), "-.1+"), + (StringTag('-.1+.'), "-.1+."), + (StringTag('-.1+.1'), "-.1+.1"), + (StringTag('-.1+.1D'), "-.1+.1D"), + (StringTag('-.1+.1F'), "-.1+.1F"), + (StringTag('-.1+.1d'), "-.1+.1d"), + (StringTag('-.1+.1f'), "-.1+.1f"), + (StringTag('-.1+.D'), "-.1+.D"), + (StringTag('-.1+.F'), "-.1+.F"), + (StringTag('-.1+.d'), "-.1+.d"), + (StringTag('-.1+.f'), "-.1+.f"), + (StringTag('-.1+1'), "-.1+1"), + (StringTag('-.1+1.'), "-.1+1."), + (StringTag('-.1+1.1'), "-.1+1.1"), + (StringTag('-.1+1.1D'), "-.1+1.1D"), + (StringTag('-.1+1.1F'), "-.1+1.1F"), + (StringTag('-.1+1.1d'), "-.1+1.1d"), + (StringTag('-.1+1.1f'), "-.1+1.1f"), + (StringTag('-.1+1.D'), "-.1+1.D"), + (StringTag('-.1+1.F'), "-.1+1.F"), + (StringTag('-.1+1.d'), "-.1+1.d"), + (StringTag('-.1+1.f'), "-.1+1.f"), + (StringTag('-.1+1D'), "-.1+1D"), + (StringTag('-.1+1F'), "-.1+1F"), + (StringTag('-.1+1d'), "-.1+1d"), + (StringTag('-.1+1f'), "-.1+1f"), + (StringTag('-.1+D'), "-.1+D"), + (StringTag('-.1+F'), "-.1+F"), + (StringTag('-.1+d'), "-.1+d"), + (StringTag('-.1+f'), "-.1+f"), + (StringTag('-.1-'), "-.1-"), + (StringTag('-.1-.'), "-.1-."), + (StringTag('-.1-.1'), "-.1-.1"), + (StringTag('-.1-.1D'), "-.1-.1D"), + (StringTag('-.1-.1F'), "-.1-.1F"), + (StringTag('-.1-.1d'), "-.1-.1d"), + (StringTag('-.1-.1f'), "-.1-.1f"), + (StringTag('-.1-.D'), "-.1-.D"), + (StringTag('-.1-.F'), "-.1-.F"), + (StringTag('-.1-.d'), "-.1-.d"), + (StringTag('-.1-.f'), "-.1-.f"), + (StringTag('-.1-1'), "-.1-1"), + (StringTag('-.1-1.'), "-.1-1."), + (StringTag('-.1-1.1'), "-.1-1.1"), + (StringTag('-.1-1.1D'), "-.1-1.1D"), + (StringTag('-.1-1.1F'), "-.1-1.1F"), + (StringTag('-.1-1.1d'), "-.1-1.1d"), + (StringTag('-.1-1.1f'), "-.1-1.1f"), + (StringTag('-.1-1.D'), "-.1-1.D"), + (StringTag('-.1-1.F'), "-.1-1.F"), + (StringTag('-.1-1.d'), "-.1-1.d"), + (StringTag('-.1-1.f'), "-.1-1.f"), + (StringTag('-.1-1D'), "-.1-1D"), + (StringTag('-.1-1F'), "-.1-1F"), + (StringTag('-.1-1d'), "-.1-1d"), + (StringTag('-.1-1f'), "-.1-1f"), + (StringTag('-.1-D'), "-.1-D"), + (StringTag('-.1-F'), "-.1-F"), + (StringTag('-.1-d'), "-.1-d"), + (StringTag('-.1-f'), "-.1-f"), + (StringTag('-.1.'), "-.1."), + (StringTag('-.1.1'), "-.1.1"), + (StringTag('-.1.1D'), "-.1.1D"), + (StringTag('-.1.1F'), "-.1.1F"), + (StringTag('-.1.1d'), "-.1.1d"), + (StringTag('-.1.1f'), "-.1.1f"), + (StringTag('-.1.D'), "-.1.D"), + (StringTag('-.1.F'), "-.1.F"), + (StringTag('-.1.d'), "-.1.d"), + (StringTag('-.1.f'), "-.1.f"), + (DoubleTag(-0.110000), "-.11"), + (StringTag('-.11.'), "-.11."), + (StringTag('-.11.1'), "-.11.1"), + (StringTag('-.11.1D'), "-.11.1D"), + (StringTag('-.11.1F'), "-.11.1F"), + (StringTag('-.11.1d'), "-.11.1d"), + (StringTag('-.11.1f'), "-.11.1f"), + (StringTag('-.11.D'), "-.11.D"), + (StringTag('-.11.F'), "-.11.F"), + (StringTag('-.11.d'), "-.11.d"), + (StringTag('-.11.f'), "-.11.f"), + (DoubleTag(-0.110000), "-.11D"), + (FloatTag(-0.110000), "-.11F"), + (DoubleTag(-0.110000), "-.11d"), + (FloatTag(-0.110000), "-.11f"), + (DoubleTag(-0.100000), "-.1D"), + (StringTag('-.1E'), "-.1E"), + (StringTag('-.1E+'), "-.1E+"), + (StringTag('-.1E+.'), "-.1E+."), + (StringTag('-.1E+.1'), "-.1E+.1"), + (StringTag('-.1E+.1D'), "-.1E+.1D"), + (StringTag('-.1E+.1F'), "-.1E+.1F"), + (StringTag('-.1E+.1d'), "-.1E+.1d"), + (StringTag('-.1E+.1f'), "-.1E+.1f"), + (StringTag('-.1E+.D'), "-.1E+.D"), + (StringTag('-.1E+.F'), "-.1E+.F"), + (StringTag('-.1E+.d'), "-.1E+.d"), + (StringTag('-.1E+.f'), "-.1E+.f"), + (DoubleTag(-1.000000), "-.1E+1"), + (StringTag('-.1E+1.'), "-.1E+1."), + (StringTag('-.1E+1.1'), "-.1E+1.1"), + (StringTag('-.1E+1.1D'), "-.1E+1.1D"), + (StringTag('-.1E+1.1F'), "-.1E+1.1F"), + (StringTag('-.1E+1.1d'), "-.1E+1.1d"), + (StringTag('-.1E+1.1f'), "-.1E+1.1f"), + (StringTag('-.1E+1.D'), "-.1E+1.D"), + (StringTag('-.1E+1.F'), "-.1E+1.F"), + (StringTag('-.1E+1.d'), "-.1E+1.d"), + (StringTag('-.1E+1.f'), "-.1E+1.f"), + (DoubleTag(-1.000000), "-.1E+1D"), + (FloatTag(-1.000000), "-.1E+1F"), + (DoubleTag(-1.000000), "-.1E+1d"), + (FloatTag(-1.000000), "-.1E+1f"), + (StringTag('-.1E+D'), "-.1E+D"), + (StringTag('-.1E+F'), "-.1E+F"), + (StringTag('-.1E+d'), "-.1E+d"), + (StringTag('-.1E+f'), "-.1E+f"), + (StringTag('-.1E-'), "-.1E-"), + (StringTag('-.1E-.'), "-.1E-."), + (StringTag('-.1E-.1'), "-.1E-.1"), + (StringTag('-.1E-.1D'), "-.1E-.1D"), + (StringTag('-.1E-.1F'), "-.1E-.1F"), + (StringTag('-.1E-.1d'), "-.1E-.1d"), + (StringTag('-.1E-.1f'), "-.1E-.1f"), + (StringTag('-.1E-.D'), "-.1E-.D"), + (StringTag('-.1E-.F'), "-.1E-.F"), + (StringTag('-.1E-.d'), "-.1E-.d"), + (StringTag('-.1E-.f'), "-.1E-.f"), + (DoubleTag(-0.010000), "-.1E-1"), + (StringTag('-.1E-1.'), "-.1E-1."), + (StringTag('-.1E-1.1'), "-.1E-1.1"), + (StringTag('-.1E-1.1D'), "-.1E-1.1D"), + (StringTag('-.1E-1.1F'), "-.1E-1.1F"), + (StringTag('-.1E-1.1d'), "-.1E-1.1d"), + (StringTag('-.1E-1.1f'), "-.1E-1.1f"), + (StringTag('-.1E-1.D'), "-.1E-1.D"), + (StringTag('-.1E-1.F'), "-.1E-1.F"), + (StringTag('-.1E-1.d'), "-.1E-1.d"), + (StringTag('-.1E-1.f'), "-.1E-1.f"), + (DoubleTag(-0.010000), "-.1E-1D"), + (FloatTag(-0.010000), "-.1E-1F"), + (DoubleTag(-0.010000), "-.1E-1d"), + (FloatTag(-0.010000), "-.1E-1f"), + (StringTag('-.1E-D'), "-.1E-D"), + (StringTag('-.1E-F'), "-.1E-F"), + (StringTag('-.1E-d'), "-.1E-d"), + (StringTag('-.1E-f'), "-.1E-f"), + (StringTag('-.1E.'), "-.1E."), + (StringTag('-.1E.1'), "-.1E.1"), + (StringTag('-.1E.1D'), "-.1E.1D"), + (StringTag('-.1E.1F'), "-.1E.1F"), + (StringTag('-.1E.1d'), "-.1E.1d"), + (StringTag('-.1E.1f'), "-.1E.1f"), + (StringTag('-.1E.D'), "-.1E.D"), + (StringTag('-.1E.F'), "-.1E.F"), + (StringTag('-.1E.d'), "-.1E.d"), + (StringTag('-.1E.f'), "-.1E.f"), + (DoubleTag(-1.000000), "-.1E1"), + (StringTag('-.1E1.'), "-.1E1."), + (StringTag('-.1E1.1'), "-.1E1.1"), + (StringTag('-.1E1.1D'), "-.1E1.1D"), + (StringTag('-.1E1.1F'), "-.1E1.1F"), + (StringTag('-.1E1.1d'), "-.1E1.1d"), + (StringTag('-.1E1.1f'), "-.1E1.1f"), + (StringTag('-.1E1.D'), "-.1E1.D"), + (StringTag('-.1E1.F'), "-.1E1.F"), + (StringTag('-.1E1.d'), "-.1E1.d"), + (StringTag('-.1E1.f'), "-.1E1.f"), + (DoubleTag(-1.000000), "-.1E1D"), + (FloatTag(-1.000000), "-.1E1F"), + (DoubleTag(-1.000000), "-.1E1d"), + (FloatTag(-1.000000), "-.1E1f"), + (StringTag('-.1ED'), "-.1ED"), + (StringTag('-.1EF'), "-.1EF"), + (StringTag('-.1Ed'), "-.1Ed"), + (StringTag('-.1Ef'), "-.1Ef"), + (FloatTag(-0.100000), "-.1F"), + (DoubleTag(-0.100000), "-.1d"), + (StringTag('-.1e'), "-.1e"), + (StringTag('-.1e+'), "-.1e+"), + (StringTag('-.1e+.'), "-.1e+."), + (StringTag('-.1e+.1'), "-.1e+.1"), + (StringTag('-.1e+.1D'), "-.1e+.1D"), + (StringTag('-.1e+.1F'), "-.1e+.1F"), + (StringTag('-.1e+.1d'), "-.1e+.1d"), + (StringTag('-.1e+.1f'), "-.1e+.1f"), + (StringTag('-.1e+.D'), "-.1e+.D"), + (StringTag('-.1e+.F'), "-.1e+.F"), + (StringTag('-.1e+.d'), "-.1e+.d"), + (StringTag('-.1e+.f'), "-.1e+.f"), + (DoubleTag(-1.000000), "-.1e+1"), + (StringTag('-.1e+1.'), "-.1e+1."), + (StringTag('-.1e+1.1'), "-.1e+1.1"), + (StringTag('-.1e+1.1D'), "-.1e+1.1D"), + (StringTag('-.1e+1.1F'), "-.1e+1.1F"), + (StringTag('-.1e+1.1d'), "-.1e+1.1d"), + (StringTag('-.1e+1.1f'), "-.1e+1.1f"), + (StringTag('-.1e+1.D'), "-.1e+1.D"), + (StringTag('-.1e+1.F'), "-.1e+1.F"), + (StringTag('-.1e+1.d'), "-.1e+1.d"), + (StringTag('-.1e+1.f'), "-.1e+1.f"), + (DoubleTag(-1.000000), "-.1e+1D"), + (FloatTag(-1.000000), "-.1e+1F"), + (DoubleTag(-1.000000), "-.1e+1d"), + (FloatTag(-1.000000), "-.1e+1f"), + (StringTag('-.1e+D'), "-.1e+D"), + (StringTag('-.1e+F'), "-.1e+F"), + (StringTag('-.1e+d'), "-.1e+d"), + (StringTag('-.1e+f'), "-.1e+f"), + (StringTag('-.1e-'), "-.1e-"), + (StringTag('-.1e-.'), "-.1e-."), + (StringTag('-.1e-.1'), "-.1e-.1"), + (StringTag('-.1e-.1D'), "-.1e-.1D"), + (StringTag('-.1e-.1F'), "-.1e-.1F"), + (StringTag('-.1e-.1d'), "-.1e-.1d"), + (StringTag('-.1e-.1f'), "-.1e-.1f"), + (StringTag('-.1e-.D'), "-.1e-.D"), + (StringTag('-.1e-.F'), "-.1e-.F"), + (StringTag('-.1e-.d'), "-.1e-.d"), + (StringTag('-.1e-.f'), "-.1e-.f"), + (DoubleTag(-0.010000), "-.1e-1"), + (StringTag('-.1e-1.'), "-.1e-1."), + (StringTag('-.1e-1.1'), "-.1e-1.1"), + (StringTag('-.1e-1.1D'), "-.1e-1.1D"), + (StringTag('-.1e-1.1F'), "-.1e-1.1F"), + (StringTag('-.1e-1.1d'), "-.1e-1.1d"), + (StringTag('-.1e-1.1f'), "-.1e-1.1f"), + (StringTag('-.1e-1.D'), "-.1e-1.D"), + (StringTag('-.1e-1.F'), "-.1e-1.F"), + (StringTag('-.1e-1.d'), "-.1e-1.d"), + (StringTag('-.1e-1.f'), "-.1e-1.f"), + (DoubleTag(-0.010000), "-.1e-1D"), + (FloatTag(-0.010000), "-.1e-1F"), + (DoubleTag(-0.010000), "-.1e-1d"), + (FloatTag(-0.010000), "-.1e-1f"), + (StringTag('-.1e-D'), "-.1e-D"), + (StringTag('-.1e-F'), "-.1e-F"), + (StringTag('-.1e-d'), "-.1e-d"), + (StringTag('-.1e-f'), "-.1e-f"), + (StringTag('-.1e.'), "-.1e."), + (StringTag('-.1e.1'), "-.1e.1"), + (StringTag('-.1e.1D'), "-.1e.1D"), + (StringTag('-.1e.1F'), "-.1e.1F"), + (StringTag('-.1e.1d'), "-.1e.1d"), + (StringTag('-.1e.1f'), "-.1e.1f"), + (StringTag('-.1e.D'), "-.1e.D"), + (StringTag('-.1e.F'), "-.1e.F"), + (StringTag('-.1e.d'), "-.1e.d"), + (StringTag('-.1e.f'), "-.1e.f"), + (DoubleTag(-1.000000), "-.1e1"), + (StringTag('-.1e1.'), "-.1e1."), + (StringTag('-.1e1.1'), "-.1e1.1"), + (StringTag('-.1e1.1D'), "-.1e1.1D"), + (StringTag('-.1e1.1F'), "-.1e1.1F"), + (StringTag('-.1e1.1d'), "-.1e1.1d"), + (StringTag('-.1e1.1f'), "-.1e1.1f"), + (StringTag('-.1e1.D'), "-.1e1.D"), + (StringTag('-.1e1.F'), "-.1e1.F"), + (StringTag('-.1e1.d'), "-.1e1.d"), + (StringTag('-.1e1.f'), "-.1e1.f"), + (DoubleTag(-1.000000), "-.1e1D"), + (FloatTag(-1.000000), "-.1e1F"), + (DoubleTag(-1.000000), "-.1e1d"), + (FloatTag(-1.000000), "-.1e1f"), + (StringTag('-.1eD'), "-.1eD"), + (StringTag('-.1eF'), "-.1eF"), + (StringTag('-.1ed'), "-.1ed"), + (StringTag('-.1ef'), "-.1ef"), + (FloatTag(-0.100000), "-.1f"), + (StringTag('-.D'), "-.D"), + (StringTag('-.E'), "-.E"), + (StringTag('-.E+'), "-.E+"), + (StringTag('-.E+.'), "-.E+."), + (StringTag('-.E+.1'), "-.E+.1"), + (StringTag('-.E+.1D'), "-.E+.1D"), + (StringTag('-.E+.1F'), "-.E+.1F"), + (StringTag('-.E+.1d'), "-.E+.1d"), + (StringTag('-.E+.1f'), "-.E+.1f"), + (StringTag('-.E+.D'), "-.E+.D"), + (StringTag('-.E+.F'), "-.E+.F"), + (StringTag('-.E+.d'), "-.E+.d"), + (StringTag('-.E+.f'), "-.E+.f"), + (StringTag('-.E+1'), "-.E+1"), + (StringTag('-.E+1.'), "-.E+1."), + (StringTag('-.E+1.1'), "-.E+1.1"), + (StringTag('-.E+1.1D'), "-.E+1.1D"), + (StringTag('-.E+1.1F'), "-.E+1.1F"), + (StringTag('-.E+1.1d'), "-.E+1.1d"), + (StringTag('-.E+1.1f'), "-.E+1.1f"), + (StringTag('-.E+1.D'), "-.E+1.D"), + (StringTag('-.E+1.F'), "-.E+1.F"), + (StringTag('-.E+1.d'), "-.E+1.d"), + (StringTag('-.E+1.f'), "-.E+1.f"), + (StringTag('-.E+1D'), "-.E+1D"), + (StringTag('-.E+1F'), "-.E+1F"), + (StringTag('-.E+1d'), "-.E+1d"), + (StringTag('-.E+1f'), "-.E+1f"), + (StringTag('-.E+D'), "-.E+D"), + (StringTag('-.E+F'), "-.E+F"), + (StringTag('-.E+d'), "-.E+d"), + (StringTag('-.E+f'), "-.E+f"), + (StringTag('-.E-'), "-.E-"), + (StringTag('-.E-.'), "-.E-."), + (StringTag('-.E-.1'), "-.E-.1"), + (StringTag('-.E-.1D'), "-.E-.1D"), + (StringTag('-.E-.1F'), "-.E-.1F"), + (StringTag('-.E-.1d'), "-.E-.1d"), + (StringTag('-.E-.1f'), "-.E-.1f"), + (StringTag('-.E-.D'), "-.E-.D"), + (StringTag('-.E-.F'), "-.E-.F"), + (StringTag('-.E-.d'), "-.E-.d"), + (StringTag('-.E-.f'), "-.E-.f"), + (StringTag('-.E-1'), "-.E-1"), + (StringTag('-.E-1.'), "-.E-1."), + (StringTag('-.E-1.1'), "-.E-1.1"), + (StringTag('-.E-1.1D'), "-.E-1.1D"), + (StringTag('-.E-1.1F'), "-.E-1.1F"), + (StringTag('-.E-1.1d'), "-.E-1.1d"), + (StringTag('-.E-1.1f'), "-.E-1.1f"), + (StringTag('-.E-1.D'), "-.E-1.D"), + (StringTag('-.E-1.F'), "-.E-1.F"), + (StringTag('-.E-1.d'), "-.E-1.d"), + (StringTag('-.E-1.f'), "-.E-1.f"), + (StringTag('-.E-1D'), "-.E-1D"), + (StringTag('-.E-1F'), "-.E-1F"), + (StringTag('-.E-1d'), "-.E-1d"), + (StringTag('-.E-1f'), "-.E-1f"), + (StringTag('-.E-D'), "-.E-D"), + (StringTag('-.E-F'), "-.E-F"), + (StringTag('-.E-d'), "-.E-d"), + (StringTag('-.E-f'), "-.E-f"), + (StringTag('-.E.'), "-.E."), + (StringTag('-.E.1'), "-.E.1"), + (StringTag('-.E.1D'), "-.E.1D"), + (StringTag('-.E.1F'), "-.E.1F"), + (StringTag('-.E.1d'), "-.E.1d"), + (StringTag('-.E.1f'), "-.E.1f"), + (StringTag('-.E.D'), "-.E.D"), + (StringTag('-.E.F'), "-.E.F"), + (StringTag('-.E.d'), "-.E.d"), + (StringTag('-.E.f'), "-.E.f"), + (StringTag('-.E1'), "-.E1"), + (StringTag('-.E1.'), "-.E1."), + (StringTag('-.E1.1'), "-.E1.1"), + (StringTag('-.E1.1D'), "-.E1.1D"), + (StringTag('-.E1.1F'), "-.E1.1F"), + (StringTag('-.E1.1d'), "-.E1.1d"), + (StringTag('-.E1.1f'), "-.E1.1f"), + (StringTag('-.E1.D'), "-.E1.D"), + (StringTag('-.E1.F'), "-.E1.F"), + (StringTag('-.E1.d'), "-.E1.d"), + (StringTag('-.E1.f'), "-.E1.f"), + (StringTag('-.E1D'), "-.E1D"), + (StringTag('-.E1F'), "-.E1F"), + (StringTag('-.E1d'), "-.E1d"), + (StringTag('-.E1f'), "-.E1f"), + (StringTag('-.ED'), "-.ED"), + (StringTag('-.EF'), "-.EF"), + (StringTag('-.Ed'), "-.Ed"), + (StringTag('-.Ef'), "-.Ef"), + (StringTag('-.F'), "-.F"), + (StringTag('-.d'), "-.d"), + (StringTag('-.e'), "-.e"), + (StringTag('-.e+'), "-.e+"), + (StringTag('-.e+.'), "-.e+."), + (StringTag('-.e+.1'), "-.e+.1"), + (StringTag('-.e+.1D'), "-.e+.1D"), + (StringTag('-.e+.1F'), "-.e+.1F"), + (StringTag('-.e+.1d'), "-.e+.1d"), + (StringTag('-.e+.1f'), "-.e+.1f"), + (StringTag('-.e+.D'), "-.e+.D"), + (StringTag('-.e+.F'), "-.e+.F"), + (StringTag('-.e+.d'), "-.e+.d"), + (StringTag('-.e+.f'), "-.e+.f"), + (StringTag('-.e+1'), "-.e+1"), + (StringTag('-.e+1.'), "-.e+1."), + (StringTag('-.e+1.1'), "-.e+1.1"), + (StringTag('-.e+1.1D'), "-.e+1.1D"), + (StringTag('-.e+1.1F'), "-.e+1.1F"), + (StringTag('-.e+1.1d'), "-.e+1.1d"), + (StringTag('-.e+1.1f'), "-.e+1.1f"), + (StringTag('-.e+1.D'), "-.e+1.D"), + (StringTag('-.e+1.F'), "-.e+1.F"), + (StringTag('-.e+1.d'), "-.e+1.d"), + (StringTag('-.e+1.f'), "-.e+1.f"), + (StringTag('-.e+1D'), "-.e+1D"), + (StringTag('-.e+1F'), "-.e+1F"), + (StringTag('-.e+1d'), "-.e+1d"), + (StringTag('-.e+1f'), "-.e+1f"), + (StringTag('-.e+D'), "-.e+D"), + (StringTag('-.e+F'), "-.e+F"), + (StringTag('-.e+d'), "-.e+d"), + (StringTag('-.e+f'), "-.e+f"), + (StringTag('-.e-'), "-.e-"), + (StringTag('-.e-.'), "-.e-."), + (StringTag('-.e-.1'), "-.e-.1"), + (StringTag('-.e-.1D'), "-.e-.1D"), + (StringTag('-.e-.1F'), "-.e-.1F"), + (StringTag('-.e-.1d'), "-.e-.1d"), + (StringTag('-.e-.1f'), "-.e-.1f"), + (StringTag('-.e-.D'), "-.e-.D"), + (StringTag('-.e-.F'), "-.e-.F"), + (StringTag('-.e-.d'), "-.e-.d"), + (StringTag('-.e-.f'), "-.e-.f"), + (StringTag('-.e-1'), "-.e-1"), + (StringTag('-.e-1.'), "-.e-1."), + (StringTag('-.e-1.1'), "-.e-1.1"), + (StringTag('-.e-1.1D'), "-.e-1.1D"), + (StringTag('-.e-1.1F'), "-.e-1.1F"), + (StringTag('-.e-1.1d'), "-.e-1.1d"), + (StringTag('-.e-1.1f'), "-.e-1.1f"), + (StringTag('-.e-1.D'), "-.e-1.D"), + (StringTag('-.e-1.F'), "-.e-1.F"), + (StringTag('-.e-1.d'), "-.e-1.d"), + (StringTag('-.e-1.f'), "-.e-1.f"), + (StringTag('-.e-1D'), "-.e-1D"), + (StringTag('-.e-1F'), "-.e-1F"), + (StringTag('-.e-1d'), "-.e-1d"), + (StringTag('-.e-1f'), "-.e-1f"), + (StringTag('-.e-D'), "-.e-D"), + (StringTag('-.e-F'), "-.e-F"), + (StringTag('-.e-d'), "-.e-d"), + (StringTag('-.e-f'), "-.e-f"), + (StringTag('-.e.'), "-.e."), + (StringTag('-.e.1'), "-.e.1"), + (StringTag('-.e.1D'), "-.e.1D"), + (StringTag('-.e.1F'), "-.e.1F"), + (StringTag('-.e.1d'), "-.e.1d"), + (StringTag('-.e.1f'), "-.e.1f"), + (StringTag('-.e.D'), "-.e.D"), + (StringTag('-.e.F'), "-.e.F"), + (StringTag('-.e.d'), "-.e.d"), + (StringTag('-.e.f'), "-.e.f"), + (StringTag('-.e1'), "-.e1"), + (StringTag('-.e1.'), "-.e1."), + (StringTag('-.e1.1'), "-.e1.1"), + (StringTag('-.e1.1D'), "-.e1.1D"), + (StringTag('-.e1.1F'), "-.e1.1F"), + (StringTag('-.e1.1d'), "-.e1.1d"), + (StringTag('-.e1.1f'), "-.e1.1f"), + (StringTag('-.e1.D'), "-.e1.D"), + (StringTag('-.e1.F'), "-.e1.F"), + (StringTag('-.e1.d'), "-.e1.d"), + (StringTag('-.e1.f'), "-.e1.f"), + (StringTag('-.e1D'), "-.e1D"), + (StringTag('-.e1F'), "-.e1F"), + (StringTag('-.e1d'), "-.e1d"), + (StringTag('-.e1f'), "-.e1f"), + (StringTag('-.eD'), "-.eD"), + (StringTag('-.eF'), "-.eF"), + (StringTag('-.ed'), "-.ed"), + (StringTag('-.ef'), "-.ef"), + (StringTag('-.f'), "-.f"), + (IntTag(-1), "-1"), + (StringTag('-1+'), "-1+"), + (StringTag('-1+.'), "-1+."), + (StringTag('-1+.1'), "-1+.1"), + (StringTag('-1+.1D'), "-1+.1D"), + (StringTag('-1+.1F'), "-1+.1F"), + (StringTag('-1+.1d'), "-1+.1d"), + (StringTag('-1+.1f'), "-1+.1f"), + (StringTag('-1+.D'), "-1+.D"), + (StringTag('-1+.F'), "-1+.F"), + (StringTag('-1+.d'), "-1+.d"), + (StringTag('-1+.f'), "-1+.f"), + (StringTag('-1+1'), "-1+1"), + (StringTag('-1+1.'), "-1+1."), + (StringTag('-1+1.1'), "-1+1.1"), + (StringTag('-1+1.1D'), "-1+1.1D"), + (StringTag('-1+1.1F'), "-1+1.1F"), + (StringTag('-1+1.1d'), "-1+1.1d"), + (StringTag('-1+1.1f'), "-1+1.1f"), + (StringTag('-1+1.D'), "-1+1.D"), + (StringTag('-1+1.F'), "-1+1.F"), + (StringTag('-1+1.d'), "-1+1.d"), + (StringTag('-1+1.f'), "-1+1.f"), + (StringTag('-1+1D'), "-1+1D"), + (StringTag('-1+1F'), "-1+1F"), + (StringTag('-1+1d'), "-1+1d"), + (StringTag('-1+1f'), "-1+1f"), + (StringTag('-1+D'), "-1+D"), + (StringTag('-1+F'), "-1+F"), + (StringTag('-1+d'), "-1+d"), + (StringTag('-1+f'), "-1+f"), + (StringTag('-1-'), "-1-"), + (StringTag('-1-.'), "-1-."), + (StringTag('-1-.1'), "-1-.1"), + (StringTag('-1-.1D'), "-1-.1D"), + (StringTag('-1-.1F'), "-1-.1F"), + (StringTag('-1-.1d'), "-1-.1d"), + (StringTag('-1-.1f'), "-1-.1f"), + (StringTag('-1-.D'), "-1-.D"), + (StringTag('-1-.F'), "-1-.F"), + (StringTag('-1-.d'), "-1-.d"), + (StringTag('-1-.f'), "-1-.f"), + (StringTag('-1-1'), "-1-1"), + (StringTag('-1-1.'), "-1-1."), + (StringTag('-1-1.1'), "-1-1.1"), + (StringTag('-1-1.1D'), "-1-1.1D"), + (StringTag('-1-1.1F'), "-1-1.1F"), + (StringTag('-1-1.1d'), "-1-1.1d"), + (StringTag('-1-1.1f'), "-1-1.1f"), + (StringTag('-1-1.D'), "-1-1.D"), + (StringTag('-1-1.F'), "-1-1.F"), + (StringTag('-1-1.d'), "-1-1.d"), + (StringTag('-1-1.f'), "-1-1.f"), + (StringTag('-1-1D'), "-1-1D"), + (StringTag('-1-1F'), "-1-1F"), + (StringTag('-1-1d'), "-1-1d"), + (StringTag('-1-1f'), "-1-1f"), + (StringTag('-1-D'), "-1-D"), + (StringTag('-1-F'), "-1-F"), + (StringTag('-1-d'), "-1-d"), + (StringTag('-1-f'), "-1-f"), + (DoubleTag(-1.000000), "-1."), + (StringTag('-1.+'), "-1.+"), + (StringTag('-1.+.'), "-1.+."), + (StringTag('-1.+.1'), "-1.+.1"), + (StringTag('-1.+.1D'), "-1.+.1D"), + (StringTag('-1.+.1F'), "-1.+.1F"), + (StringTag('-1.+.1d'), "-1.+.1d"), + (StringTag('-1.+.1f'), "-1.+.1f"), + (StringTag('-1.+.D'), "-1.+.D"), + (StringTag('-1.+.F'), "-1.+.F"), + (StringTag('-1.+.d'), "-1.+.d"), + (StringTag('-1.+.f'), "-1.+.f"), + (StringTag('-1.+1'), "-1.+1"), + (StringTag('-1.+1.'), "-1.+1."), + (StringTag('-1.+1.1'), "-1.+1.1"), + (StringTag('-1.+1.1D'), "-1.+1.1D"), + (StringTag('-1.+1.1F'), "-1.+1.1F"), + (StringTag('-1.+1.1d'), "-1.+1.1d"), + (StringTag('-1.+1.1f'), "-1.+1.1f"), + (StringTag('-1.+1.D'), "-1.+1.D"), + (StringTag('-1.+1.F'), "-1.+1.F"), + (StringTag('-1.+1.d'), "-1.+1.d"), + (StringTag('-1.+1.f'), "-1.+1.f"), + (StringTag('-1.+1D'), "-1.+1D"), + (StringTag('-1.+1F'), "-1.+1F"), + (StringTag('-1.+1d'), "-1.+1d"), + (StringTag('-1.+1f'), "-1.+1f"), + (StringTag('-1.+D'), "-1.+D"), + (StringTag('-1.+F'), "-1.+F"), + (StringTag('-1.+d'), "-1.+d"), + (StringTag('-1.+f'), "-1.+f"), + (StringTag('-1.-'), "-1.-"), + (StringTag('-1.-.'), "-1.-."), + (StringTag('-1.-.1'), "-1.-.1"), + (StringTag('-1.-.1D'), "-1.-.1D"), + (StringTag('-1.-.1F'), "-1.-.1F"), + (StringTag('-1.-.1d'), "-1.-.1d"), + (StringTag('-1.-.1f'), "-1.-.1f"), + (StringTag('-1.-.D'), "-1.-.D"), + (StringTag('-1.-.F'), "-1.-.F"), + (StringTag('-1.-.d'), "-1.-.d"), + (StringTag('-1.-.f'), "-1.-.f"), + (StringTag('-1.-1'), "-1.-1"), + (StringTag('-1.-1.'), "-1.-1."), + (StringTag('-1.-1.1'), "-1.-1.1"), + (StringTag('-1.-1.1D'), "-1.-1.1D"), + (StringTag('-1.-1.1F'), "-1.-1.1F"), + (StringTag('-1.-1.1d'), "-1.-1.1d"), + (StringTag('-1.-1.1f'), "-1.-1.1f"), + (StringTag('-1.-1.D'), "-1.-1.D"), + (StringTag('-1.-1.F'), "-1.-1.F"), + (StringTag('-1.-1.d'), "-1.-1.d"), + (StringTag('-1.-1.f'), "-1.-1.f"), + (StringTag('-1.-1D'), "-1.-1D"), + (StringTag('-1.-1F'), "-1.-1F"), + (StringTag('-1.-1d'), "-1.-1d"), + (StringTag('-1.-1f'), "-1.-1f"), + (StringTag('-1.-D'), "-1.-D"), + (StringTag('-1.-F'), "-1.-F"), + (StringTag('-1.-d'), "-1.-d"), + (StringTag('-1.-f'), "-1.-f"), + (StringTag('-1..'), "-1.."), + (StringTag('-1..1'), "-1..1"), + (StringTag('-1..1D'), "-1..1D"), + (StringTag('-1..1F'), "-1..1F"), + (StringTag('-1..1d'), "-1..1d"), + (StringTag('-1..1f'), "-1..1f"), + (StringTag('-1..D'), "-1..D"), + (StringTag('-1..F'), "-1..F"), + (StringTag('-1..d'), "-1..d"), + (StringTag('-1..f'), "-1..f"), + (DoubleTag(-1.100000), "-1.1"), + (StringTag('-1.1+'), "-1.1+"), + (StringTag('-1.1+.'), "-1.1+."), + (StringTag('-1.1+.1'), "-1.1+.1"), + (StringTag('-1.1+.1D'), "-1.1+.1D"), + (StringTag('-1.1+.1F'), "-1.1+.1F"), + (StringTag('-1.1+.1d'), "-1.1+.1d"), + (StringTag('-1.1+.1f'), "-1.1+.1f"), + (StringTag('-1.1+.D'), "-1.1+.D"), + (StringTag('-1.1+.F'), "-1.1+.F"), + (StringTag('-1.1+.d'), "-1.1+.d"), + (StringTag('-1.1+.f'), "-1.1+.f"), + (StringTag('-1.1+1'), "-1.1+1"), + (StringTag('-1.1+1.'), "-1.1+1."), + (StringTag('-1.1+1.1'), "-1.1+1.1"), + (StringTag('-1.1+1.1D'), "-1.1+1.1D"), + (StringTag('-1.1+1.1F'), "-1.1+1.1F"), + (StringTag('-1.1+1.1d'), "-1.1+1.1d"), + (StringTag('-1.1+1.1f'), "-1.1+1.1f"), + (StringTag('-1.1+1.D'), "-1.1+1.D"), + (StringTag('-1.1+1.F'), "-1.1+1.F"), + (StringTag('-1.1+1.d'), "-1.1+1.d"), + (StringTag('-1.1+1.f'), "-1.1+1.f"), + (StringTag('-1.1+1D'), "-1.1+1D"), + (StringTag('-1.1+1F'), "-1.1+1F"), + (StringTag('-1.1+1d'), "-1.1+1d"), + (StringTag('-1.1+1f'), "-1.1+1f"), + (StringTag('-1.1+D'), "-1.1+D"), + (StringTag('-1.1+F'), "-1.1+F"), + (StringTag('-1.1+d'), "-1.1+d"), + (StringTag('-1.1+f'), "-1.1+f"), + (StringTag('-1.1-'), "-1.1-"), + (StringTag('-1.1-.'), "-1.1-."), + (StringTag('-1.1-.1'), "-1.1-.1"), + (StringTag('-1.1-.1D'), "-1.1-.1D"), + (StringTag('-1.1-.1F'), "-1.1-.1F"), + (StringTag('-1.1-.1d'), "-1.1-.1d"), + (StringTag('-1.1-.1f'), "-1.1-.1f"), + (StringTag('-1.1-.D'), "-1.1-.D"), + (StringTag('-1.1-.F'), "-1.1-.F"), + (StringTag('-1.1-.d'), "-1.1-.d"), + (StringTag('-1.1-.f'), "-1.1-.f"), + (StringTag('-1.1-1'), "-1.1-1"), + (StringTag('-1.1-1.'), "-1.1-1."), + (StringTag('-1.1-1.1'), "-1.1-1.1"), + (StringTag('-1.1-1.1D'), "-1.1-1.1D"), + (StringTag('-1.1-1.1F'), "-1.1-1.1F"), + (StringTag('-1.1-1.1d'), "-1.1-1.1d"), + (StringTag('-1.1-1.1f'), "-1.1-1.1f"), + (StringTag('-1.1-1.D'), "-1.1-1.D"), + (StringTag('-1.1-1.F'), "-1.1-1.F"), + (StringTag('-1.1-1.d'), "-1.1-1.d"), + (StringTag('-1.1-1.f'), "-1.1-1.f"), + (StringTag('-1.1-1D'), "-1.1-1D"), + (StringTag('-1.1-1F'), "-1.1-1F"), + (StringTag('-1.1-1d'), "-1.1-1d"), + (StringTag('-1.1-1f'), "-1.1-1f"), + (StringTag('-1.1-D'), "-1.1-D"), + (StringTag('-1.1-F'), "-1.1-F"), + (StringTag('-1.1-d'), "-1.1-d"), + (StringTag('-1.1-f'), "-1.1-f"), + (StringTag('-1.1.'), "-1.1."), + (StringTag('-1.1.1'), "-1.1.1"), + (StringTag('-1.1.1D'), "-1.1.1D"), + (StringTag('-1.1.1F'), "-1.1.1F"), + (StringTag('-1.1.1d'), "-1.1.1d"), + (StringTag('-1.1.1f'), "-1.1.1f"), + (StringTag('-1.1.D'), "-1.1.D"), + (StringTag('-1.1.F'), "-1.1.F"), + (StringTag('-1.1.d'), "-1.1.d"), + (StringTag('-1.1.f'), "-1.1.f"), + (DoubleTag(-1.110000), "-1.11"), + (StringTag('-1.11.'), "-1.11."), + (StringTag('-1.11.1'), "-1.11.1"), + (StringTag('-1.11.1D'), "-1.11.1D"), + (StringTag('-1.11.1F'), "-1.11.1F"), + (StringTag('-1.11.1d'), "-1.11.1d"), + (StringTag('-1.11.1f'), "-1.11.1f"), + (StringTag('-1.11.D'), "-1.11.D"), + (StringTag('-1.11.F'), "-1.11.F"), + (StringTag('-1.11.d'), "-1.11.d"), + (StringTag('-1.11.f'), "-1.11.f"), + (DoubleTag(-1.110000), "-1.11D"), + (FloatTag(-1.110000), "-1.11F"), + (DoubleTag(-1.110000), "-1.11d"), + (FloatTag(-1.110000), "-1.11f"), + (DoubleTag(-1.100000), "-1.1D"), + (StringTag('-1.1E'), "-1.1E"), + (StringTag('-1.1E+'), "-1.1E+"), + (StringTag('-1.1E+.'), "-1.1E+."), + (StringTag('-1.1E+.1'), "-1.1E+.1"), + (StringTag('-1.1E+.1D'), "-1.1E+.1D"), + (StringTag('-1.1E+.1F'), "-1.1E+.1F"), + (StringTag('-1.1E+.1d'), "-1.1E+.1d"), + (StringTag('-1.1E+.1f'), "-1.1E+.1f"), + (StringTag('-1.1E+.D'), "-1.1E+.D"), + (StringTag('-1.1E+.F'), "-1.1E+.F"), + (StringTag('-1.1E+.d'), "-1.1E+.d"), + (StringTag('-1.1E+.f'), "-1.1E+.f"), + (DoubleTag(-11.000000), "-1.1E+1"), + (StringTag('-1.1E+1.'), "-1.1E+1."), + (StringTag('-1.1E+1.1'), "-1.1E+1.1"), + (StringTag('-1.1E+1.1D'), "-1.1E+1.1D"), + (StringTag('-1.1E+1.1F'), "-1.1E+1.1F"), + (StringTag('-1.1E+1.1d'), "-1.1E+1.1d"), + (StringTag('-1.1E+1.1f'), "-1.1E+1.1f"), + (StringTag('-1.1E+1.D'), "-1.1E+1.D"), + (StringTag('-1.1E+1.F'), "-1.1E+1.F"), + (StringTag('-1.1E+1.d'), "-1.1E+1.d"), + (StringTag('-1.1E+1.f'), "-1.1E+1.f"), + (DoubleTag(-11.000000), "-1.1E+1D"), + (FloatTag(-11.000000), "-1.1E+1F"), + (DoubleTag(-11.000000), "-1.1E+1d"), + (FloatTag(-11.000000), "-1.1E+1f"), + (StringTag('-1.1E+D'), "-1.1E+D"), + (StringTag('-1.1E+F'), "-1.1E+F"), + (StringTag('-1.1E+d'), "-1.1E+d"), + (StringTag('-1.1E+f'), "-1.1E+f"), + (StringTag('-1.1E-'), "-1.1E-"), + (StringTag('-1.1E-.'), "-1.1E-."), + (StringTag('-1.1E-.1'), "-1.1E-.1"), + (StringTag('-1.1E-.1D'), "-1.1E-.1D"), + (StringTag('-1.1E-.1F'), "-1.1E-.1F"), + (StringTag('-1.1E-.1d'), "-1.1E-.1d"), + (StringTag('-1.1E-.1f'), "-1.1E-.1f"), + (StringTag('-1.1E-.D'), "-1.1E-.D"), + (StringTag('-1.1E-.F'), "-1.1E-.F"), + (StringTag('-1.1E-.d'), "-1.1E-.d"), + (StringTag('-1.1E-.f'), "-1.1E-.f"), + (DoubleTag(-0.110000), "-1.1E-1"), + (StringTag('-1.1E-1.'), "-1.1E-1."), + (StringTag('-1.1E-1.1'), "-1.1E-1.1"), + (StringTag('-1.1E-1.1D'), "-1.1E-1.1D"), + (StringTag('-1.1E-1.1F'), "-1.1E-1.1F"), + (StringTag('-1.1E-1.1d'), "-1.1E-1.1d"), + (StringTag('-1.1E-1.1f'), "-1.1E-1.1f"), + (StringTag('-1.1E-1.D'), "-1.1E-1.D"), + (StringTag('-1.1E-1.F'), "-1.1E-1.F"), + (StringTag('-1.1E-1.d'), "-1.1E-1.d"), + (StringTag('-1.1E-1.f'), "-1.1E-1.f"), + (DoubleTag(-0.110000), "-1.1E-1D"), + (FloatTag(-0.110000), "-1.1E-1F"), + (DoubleTag(-0.110000), "-1.1E-1d"), + (FloatTag(-0.110000), "-1.1E-1f"), + (StringTag('-1.1E-D'), "-1.1E-D"), + (StringTag('-1.1E-F'), "-1.1E-F"), + (StringTag('-1.1E-d'), "-1.1E-d"), + (StringTag('-1.1E-f'), "-1.1E-f"), + (StringTag('-1.1E.'), "-1.1E."), + (StringTag('-1.1E.1'), "-1.1E.1"), + (StringTag('-1.1E.1D'), "-1.1E.1D"), + (StringTag('-1.1E.1F'), "-1.1E.1F"), + (StringTag('-1.1E.1d'), "-1.1E.1d"), + (StringTag('-1.1E.1f'), "-1.1E.1f"), + (StringTag('-1.1E.D'), "-1.1E.D"), + (StringTag('-1.1E.F'), "-1.1E.F"), + (StringTag('-1.1E.d'), "-1.1E.d"), + (StringTag('-1.1E.f'), "-1.1E.f"), + (DoubleTag(-11.000000), "-1.1E1"), + (StringTag('-1.1E1.'), "-1.1E1."), + (StringTag('-1.1E1.1'), "-1.1E1.1"), + (StringTag('-1.1E1.1D'), "-1.1E1.1D"), + (StringTag('-1.1E1.1F'), "-1.1E1.1F"), + (StringTag('-1.1E1.1d'), "-1.1E1.1d"), + (StringTag('-1.1E1.1f'), "-1.1E1.1f"), + (StringTag('-1.1E1.D'), "-1.1E1.D"), + (StringTag('-1.1E1.F'), "-1.1E1.F"), + (StringTag('-1.1E1.d'), "-1.1E1.d"), + (StringTag('-1.1E1.f'), "-1.1E1.f"), + (DoubleTag(-11.000000), "-1.1E1D"), + (FloatTag(-11.000000), "-1.1E1F"), + (DoubleTag(-11.000000), "-1.1E1d"), + (FloatTag(-11.000000), "-1.1E1f"), + (StringTag('-1.1ED'), "-1.1ED"), + (StringTag('-1.1EF'), "-1.1EF"), + (StringTag('-1.1Ed'), "-1.1Ed"), + (StringTag('-1.1Ef'), "-1.1Ef"), + (FloatTag(-1.100000), "-1.1F"), + (DoubleTag(-1.100000), "-1.1d"), + (StringTag('-1.1e'), "-1.1e"), + (StringTag('-1.1e+'), "-1.1e+"), + (StringTag('-1.1e+.'), "-1.1e+."), + (StringTag('-1.1e+.1'), "-1.1e+.1"), + (StringTag('-1.1e+.1D'), "-1.1e+.1D"), + (StringTag('-1.1e+.1F'), "-1.1e+.1F"), + (StringTag('-1.1e+.1d'), "-1.1e+.1d"), + (StringTag('-1.1e+.1f'), "-1.1e+.1f"), + (StringTag('-1.1e+.D'), "-1.1e+.D"), + (StringTag('-1.1e+.F'), "-1.1e+.F"), + (StringTag('-1.1e+.d'), "-1.1e+.d"), + (StringTag('-1.1e+.f'), "-1.1e+.f"), + (DoubleTag(-11.000000), "-1.1e+1"), + (StringTag('-1.1e+1.'), "-1.1e+1."), + (StringTag('-1.1e+1.1'), "-1.1e+1.1"), + (StringTag('-1.1e+1.1D'), "-1.1e+1.1D"), + (StringTag('-1.1e+1.1F'), "-1.1e+1.1F"), + (StringTag('-1.1e+1.1d'), "-1.1e+1.1d"), + (StringTag('-1.1e+1.1f'), "-1.1e+1.1f"), + (StringTag('-1.1e+1.D'), "-1.1e+1.D"), + (StringTag('-1.1e+1.F'), "-1.1e+1.F"), + (StringTag('-1.1e+1.d'), "-1.1e+1.d"), + (StringTag('-1.1e+1.f'), "-1.1e+1.f"), + (DoubleTag(-11.000000), "-1.1e+1D"), + (FloatTag(-11.000000), "-1.1e+1F"), + (DoubleTag(-11.000000), "-1.1e+1d"), + (FloatTag(-11.000000), "-1.1e+1f"), + (StringTag('-1.1e+D'), "-1.1e+D"), + (StringTag('-1.1e+F'), "-1.1e+F"), + (StringTag('-1.1e+d'), "-1.1e+d"), + (StringTag('-1.1e+f'), "-1.1e+f"), + (StringTag('-1.1e-'), "-1.1e-"), + (StringTag('-1.1e-.'), "-1.1e-."), + (StringTag('-1.1e-.1'), "-1.1e-.1"), + (StringTag('-1.1e-.1D'), "-1.1e-.1D"), + (StringTag('-1.1e-.1F'), "-1.1e-.1F"), + (StringTag('-1.1e-.1d'), "-1.1e-.1d"), + (StringTag('-1.1e-.1f'), "-1.1e-.1f"), + (StringTag('-1.1e-.D'), "-1.1e-.D"), + (StringTag('-1.1e-.F'), "-1.1e-.F"), + (StringTag('-1.1e-.d'), "-1.1e-.d"), + (StringTag('-1.1e-.f'), "-1.1e-.f"), + (DoubleTag(-0.110000), "-1.1e-1"), + (StringTag('-1.1e-1.'), "-1.1e-1."), + (StringTag('-1.1e-1.1'), "-1.1e-1.1"), + (StringTag('-1.1e-1.1D'), "-1.1e-1.1D"), + (StringTag('-1.1e-1.1F'), "-1.1e-1.1F"), + (StringTag('-1.1e-1.1d'), "-1.1e-1.1d"), + (StringTag('-1.1e-1.1f'), "-1.1e-1.1f"), + (StringTag('-1.1e-1.D'), "-1.1e-1.D"), + (StringTag('-1.1e-1.F'), "-1.1e-1.F"), + (StringTag('-1.1e-1.d'), "-1.1e-1.d"), + (StringTag('-1.1e-1.f'), "-1.1e-1.f"), + (DoubleTag(-0.110000), "-1.1e-1D"), + (FloatTag(-0.110000), "-1.1e-1F"), + (DoubleTag(-0.110000), "-1.1e-1d"), + (FloatTag(-0.110000), "-1.1e-1f"), + (StringTag('-1.1e-D'), "-1.1e-D"), + (StringTag('-1.1e-F'), "-1.1e-F"), + (StringTag('-1.1e-d'), "-1.1e-d"), + (StringTag('-1.1e-f'), "-1.1e-f"), + (StringTag('-1.1e.'), "-1.1e."), + (StringTag('-1.1e.1'), "-1.1e.1"), + (StringTag('-1.1e.1D'), "-1.1e.1D"), + (StringTag('-1.1e.1F'), "-1.1e.1F"), + (StringTag('-1.1e.1d'), "-1.1e.1d"), + (StringTag('-1.1e.1f'), "-1.1e.1f"), + (StringTag('-1.1e.D'), "-1.1e.D"), + (StringTag('-1.1e.F'), "-1.1e.F"), + (StringTag('-1.1e.d'), "-1.1e.d"), + (StringTag('-1.1e.f'), "-1.1e.f"), + (DoubleTag(-11.000000), "-1.1e1"), + (StringTag('-1.1e1.'), "-1.1e1."), + (StringTag('-1.1e1.1'), "-1.1e1.1"), + (StringTag('-1.1e1.1D'), "-1.1e1.1D"), + (StringTag('-1.1e1.1F'), "-1.1e1.1F"), + (StringTag('-1.1e1.1d'), "-1.1e1.1d"), + (StringTag('-1.1e1.1f'), "-1.1e1.1f"), + (StringTag('-1.1e1.D'), "-1.1e1.D"), + (StringTag('-1.1e1.F'), "-1.1e1.F"), + (StringTag('-1.1e1.d'), "-1.1e1.d"), + (StringTag('-1.1e1.f'), "-1.1e1.f"), + (DoubleTag(-11.000000), "-1.1e1D"), + (FloatTag(-11.000000), "-1.1e1F"), + (DoubleTag(-11.000000), "-1.1e1d"), + (FloatTag(-11.000000), "-1.1e1f"), + (StringTag('-1.1eD'), "-1.1eD"), + (StringTag('-1.1eF'), "-1.1eF"), + (StringTag('-1.1ed'), "-1.1ed"), + (StringTag('-1.1ef'), "-1.1ef"), + (FloatTag(-1.100000), "-1.1f"), + (DoubleTag(-1.000000), "-1.D"), + (StringTag('-1.E'), "-1.E"), + (StringTag('-1.E+'), "-1.E+"), + (StringTag('-1.E+.'), "-1.E+."), + (StringTag('-1.E+.1'), "-1.E+.1"), + (StringTag('-1.E+.1D'), "-1.E+.1D"), + (StringTag('-1.E+.1F'), "-1.E+.1F"), + (StringTag('-1.E+.1d'), "-1.E+.1d"), + (StringTag('-1.E+.1f'), "-1.E+.1f"), + (StringTag('-1.E+.D'), "-1.E+.D"), + (StringTag('-1.E+.F'), "-1.E+.F"), + (StringTag('-1.E+.d'), "-1.E+.d"), + (StringTag('-1.E+.f'), "-1.E+.f"), + (DoubleTag(-10.000000), "-1.E+1"), + (StringTag('-1.E+1.'), "-1.E+1."), + (StringTag('-1.E+1.1'), "-1.E+1.1"), + (StringTag('-1.E+1.1D'), "-1.E+1.1D"), + (StringTag('-1.E+1.1F'), "-1.E+1.1F"), + (StringTag('-1.E+1.1d'), "-1.E+1.1d"), + (StringTag('-1.E+1.1f'), "-1.E+1.1f"), + (StringTag('-1.E+1.D'), "-1.E+1.D"), + (StringTag('-1.E+1.F'), "-1.E+1.F"), + (StringTag('-1.E+1.d'), "-1.E+1.d"), + (StringTag('-1.E+1.f'), "-1.E+1.f"), + (DoubleTag(-10.000000), "-1.E+1D"), + (FloatTag(-10.000000), "-1.E+1F"), + (DoubleTag(-10.000000), "-1.E+1d"), + (FloatTag(-10.000000), "-1.E+1f"), + (StringTag('-1.E+D'), "-1.E+D"), + (StringTag('-1.E+F'), "-1.E+F"), + (StringTag('-1.E+d'), "-1.E+d"), + (StringTag('-1.E+f'), "-1.E+f"), + (StringTag('-1.E-'), "-1.E-"), + (StringTag('-1.E-.'), "-1.E-."), + (StringTag('-1.E-.1'), "-1.E-.1"), + (StringTag('-1.E-.1D'), "-1.E-.1D"), + (StringTag('-1.E-.1F'), "-1.E-.1F"), + (StringTag('-1.E-.1d'), "-1.E-.1d"), + (StringTag('-1.E-.1f'), "-1.E-.1f"), + (StringTag('-1.E-.D'), "-1.E-.D"), + (StringTag('-1.E-.F'), "-1.E-.F"), + (StringTag('-1.E-.d'), "-1.E-.d"), + (StringTag('-1.E-.f'), "-1.E-.f"), + (DoubleTag(-0.100000), "-1.E-1"), + (StringTag('-1.E-1.'), "-1.E-1."), + (StringTag('-1.E-1.1'), "-1.E-1.1"), + (StringTag('-1.E-1.1D'), "-1.E-1.1D"), + (StringTag('-1.E-1.1F'), "-1.E-1.1F"), + (StringTag('-1.E-1.1d'), "-1.E-1.1d"), + (StringTag('-1.E-1.1f'), "-1.E-1.1f"), + (StringTag('-1.E-1.D'), "-1.E-1.D"), + (StringTag('-1.E-1.F'), "-1.E-1.F"), + (StringTag('-1.E-1.d'), "-1.E-1.d"), + (StringTag('-1.E-1.f'), "-1.E-1.f"), + (DoubleTag(-0.100000), "-1.E-1D"), + (FloatTag(-0.100000), "-1.E-1F"), + (DoubleTag(-0.100000), "-1.E-1d"), + (FloatTag(-0.100000), "-1.E-1f"), + (StringTag('-1.E-D'), "-1.E-D"), + (StringTag('-1.E-F'), "-1.E-F"), + (StringTag('-1.E-d'), "-1.E-d"), + (StringTag('-1.E-f'), "-1.E-f"), + (StringTag('-1.E.'), "-1.E."), + (StringTag('-1.E.1'), "-1.E.1"), + (StringTag('-1.E.1D'), "-1.E.1D"), + (StringTag('-1.E.1F'), "-1.E.1F"), + (StringTag('-1.E.1d'), "-1.E.1d"), + (StringTag('-1.E.1f'), "-1.E.1f"), + (StringTag('-1.E.D'), "-1.E.D"), + (StringTag('-1.E.F'), "-1.E.F"), + (StringTag('-1.E.d'), "-1.E.d"), + (StringTag('-1.E.f'), "-1.E.f"), + (DoubleTag(-10.000000), "-1.E1"), + (StringTag('-1.E1.'), "-1.E1."), + (StringTag('-1.E1.1'), "-1.E1.1"), + (StringTag('-1.E1.1D'), "-1.E1.1D"), + (StringTag('-1.E1.1F'), "-1.E1.1F"), + (StringTag('-1.E1.1d'), "-1.E1.1d"), + (StringTag('-1.E1.1f'), "-1.E1.1f"), + (StringTag('-1.E1.D'), "-1.E1.D"), + (StringTag('-1.E1.F'), "-1.E1.F"), + (StringTag('-1.E1.d'), "-1.E1.d"), + (StringTag('-1.E1.f'), "-1.E1.f"), + (DoubleTag(-10.000000), "-1.E1D"), + (FloatTag(-10.000000), "-1.E1F"), + (DoubleTag(-10.000000), "-1.E1d"), + (FloatTag(-10.000000), "-1.E1f"), + (StringTag('-1.ED'), "-1.ED"), + (StringTag('-1.EF'), "-1.EF"), + (StringTag('-1.Ed'), "-1.Ed"), + (StringTag('-1.Ef'), "-1.Ef"), + (FloatTag(-1.000000), "-1.F"), + (DoubleTag(-1.000000), "-1.d"), + (StringTag('-1.e'), "-1.e"), + (StringTag('-1.e+'), "-1.e+"), + (StringTag('-1.e+.'), "-1.e+."), + (StringTag('-1.e+.1'), "-1.e+.1"), + (StringTag('-1.e+.1D'), "-1.e+.1D"), + (StringTag('-1.e+.1F'), "-1.e+.1F"), + (StringTag('-1.e+.1d'), "-1.e+.1d"), + (StringTag('-1.e+.1f'), "-1.e+.1f"), + (StringTag('-1.e+.D'), "-1.e+.D"), + (StringTag('-1.e+.F'), "-1.e+.F"), + (StringTag('-1.e+.d'), "-1.e+.d"), + (StringTag('-1.e+.f'), "-1.e+.f"), + (DoubleTag(-10.000000), "-1.e+1"), + (StringTag('-1.e+1.'), "-1.e+1."), + (StringTag('-1.e+1.1'), "-1.e+1.1"), + (StringTag('-1.e+1.1D'), "-1.e+1.1D"), + (StringTag('-1.e+1.1F'), "-1.e+1.1F"), + (StringTag('-1.e+1.1d'), "-1.e+1.1d"), + (StringTag('-1.e+1.1f'), "-1.e+1.1f"), + (StringTag('-1.e+1.D'), "-1.e+1.D"), + (StringTag('-1.e+1.F'), "-1.e+1.F"), + (StringTag('-1.e+1.d'), "-1.e+1.d"), + (StringTag('-1.e+1.f'), "-1.e+1.f"), + (DoubleTag(-10.000000), "-1.e+1D"), + (FloatTag(-10.000000), "-1.e+1F"), + (DoubleTag(-10.000000), "-1.e+1d"), + (FloatTag(-10.000000), "-1.e+1f"), + (StringTag('-1.e+D'), "-1.e+D"), + (StringTag('-1.e+F'), "-1.e+F"), + (StringTag('-1.e+d'), "-1.e+d"), + (StringTag('-1.e+f'), "-1.e+f"), + (StringTag('-1.e-'), "-1.e-"), + (StringTag('-1.e-.'), "-1.e-."), + (StringTag('-1.e-.1'), "-1.e-.1"), + (StringTag('-1.e-.1D'), "-1.e-.1D"), + (StringTag('-1.e-.1F'), "-1.e-.1F"), + (StringTag('-1.e-.1d'), "-1.e-.1d"), + (StringTag('-1.e-.1f'), "-1.e-.1f"), + (StringTag('-1.e-.D'), "-1.e-.D"), + (StringTag('-1.e-.F'), "-1.e-.F"), + (StringTag('-1.e-.d'), "-1.e-.d"), + (StringTag('-1.e-.f'), "-1.e-.f"), + (DoubleTag(-0.100000), "-1.e-1"), + (StringTag('-1.e-1.'), "-1.e-1."), + (StringTag('-1.e-1.1'), "-1.e-1.1"), + (StringTag('-1.e-1.1D'), "-1.e-1.1D"), + (StringTag('-1.e-1.1F'), "-1.e-1.1F"), + (StringTag('-1.e-1.1d'), "-1.e-1.1d"), + (StringTag('-1.e-1.1f'), "-1.e-1.1f"), + (StringTag('-1.e-1.D'), "-1.e-1.D"), + (StringTag('-1.e-1.F'), "-1.e-1.F"), + (StringTag('-1.e-1.d'), "-1.e-1.d"), + (StringTag('-1.e-1.f'), "-1.e-1.f"), + (DoubleTag(-0.100000), "-1.e-1D"), + (FloatTag(-0.100000), "-1.e-1F"), + (DoubleTag(-0.100000), "-1.e-1d"), + (FloatTag(-0.100000), "-1.e-1f"), + (StringTag('-1.e-D'), "-1.e-D"), + (StringTag('-1.e-F'), "-1.e-F"), + (StringTag('-1.e-d'), "-1.e-d"), + (StringTag('-1.e-f'), "-1.e-f"), + (StringTag('-1.e.'), "-1.e."), + (StringTag('-1.e.1'), "-1.e.1"), + (StringTag('-1.e.1D'), "-1.e.1D"), + (StringTag('-1.e.1F'), "-1.e.1F"), + (StringTag('-1.e.1d'), "-1.e.1d"), + (StringTag('-1.e.1f'), "-1.e.1f"), + (StringTag('-1.e.D'), "-1.e.D"), + (StringTag('-1.e.F'), "-1.e.F"), + (StringTag('-1.e.d'), "-1.e.d"), + (StringTag('-1.e.f'), "-1.e.f"), + (DoubleTag(-10.000000), "-1.e1"), + (StringTag('-1.e1.'), "-1.e1."), + (StringTag('-1.e1.1'), "-1.e1.1"), + (StringTag('-1.e1.1D'), "-1.e1.1D"), + (StringTag('-1.e1.1F'), "-1.e1.1F"), + (StringTag('-1.e1.1d'), "-1.e1.1d"), + (StringTag('-1.e1.1f'), "-1.e1.1f"), + (StringTag('-1.e1.D'), "-1.e1.D"), + (StringTag('-1.e1.F'), "-1.e1.F"), + (StringTag('-1.e1.d'), "-1.e1.d"), + (StringTag('-1.e1.f'), "-1.e1.f"), + (DoubleTag(-10.000000), "-1.e1D"), + (FloatTag(-10.000000), "-1.e1F"), + (DoubleTag(-10.000000), "-1.e1d"), + (FloatTag(-10.000000), "-1.e1f"), + (StringTag('-1.eD'), "-1.eD"), + (StringTag('-1.eF'), "-1.eF"), + (StringTag('-1.ed'), "-1.ed"), + (StringTag('-1.ef'), "-1.ef"), + (FloatTag(-1.000000), "-1.f"), + (IntTag(-11), "-11"), + (DoubleTag(-11.000000), "-11."), + (DoubleTag(-11.100000), "-11.1"), + (DoubleTag(-11.100000), "-11.1D"), + (FloatTag(-11.100000), "-11.1F"), + (DoubleTag(-11.100000), "-11.1d"), + (FloatTag(-11.100000), "-11.1f"), + (DoubleTag(-11.000000), "-11.D"), + (FloatTag(-11.000000), "-11.F"), + (DoubleTag(-11.000000), "-11.d"), + (FloatTag(-11.000000), "-11.f"), + (DoubleTag(-11.000000), "-11D"), + (FloatTag(-11.000000), "-11F"), + (DoubleTag(-11.000000), "-11d"), + (FloatTag(-11.000000), "-11f"), + (DoubleTag(-1.000000), "-1D"), + (StringTag('-1E'), "-1E"), + (StringTag('-1E+'), "-1E+"), + (StringTag('-1E+.'), "-1E+."), + (StringTag('-1E+.1'), "-1E+.1"), + (StringTag('-1E+.1D'), "-1E+.1D"), + (StringTag('-1E+.1F'), "-1E+.1F"), + (StringTag('-1E+.1d'), "-1E+.1d"), + (StringTag('-1E+.1f'), "-1E+.1f"), + (StringTag('-1E+.D'), "-1E+.D"), + (StringTag('-1E+.F'), "-1E+.F"), + (StringTag('-1E+.d'), "-1E+.d"), + (StringTag('-1E+.f'), "-1E+.f"), + (StringTag('-1E+1'), "-1E+1"), + (StringTag('-1E+1.'), "-1E+1."), + (StringTag('-1E+1.1'), "-1E+1.1"), + (StringTag('-1E+1.1D'), "-1E+1.1D"), + (StringTag('-1E+1.1F'), "-1E+1.1F"), + (StringTag('-1E+1.1d'), "-1E+1.1d"), + (StringTag('-1E+1.1f'), "-1E+1.1f"), + (StringTag('-1E+1.D'), "-1E+1.D"), + (StringTag('-1E+1.F'), "-1E+1.F"), + (StringTag('-1E+1.d'), "-1E+1.d"), + (StringTag('-1E+1.f'), "-1E+1.f"), + (DoubleTag(-10.000000), "-1E+1D"), + (FloatTag(-10.000000), "-1E+1F"), + (DoubleTag(-10.000000), "-1E+1d"), + (FloatTag(-10.000000), "-1E+1f"), + (StringTag('-1E+D'), "-1E+D"), + (StringTag('-1E+F'), "-1E+F"), + (StringTag('-1E+d'), "-1E+d"), + (StringTag('-1E+f'), "-1E+f"), + (StringTag('-1E-'), "-1E-"), + (StringTag('-1E-.'), "-1E-."), + (StringTag('-1E-.1'), "-1E-.1"), + (StringTag('-1E-.1D'), "-1E-.1D"), + (StringTag('-1E-.1F'), "-1E-.1F"), + (StringTag('-1E-.1d'), "-1E-.1d"), + (StringTag('-1E-.1f'), "-1E-.1f"), + (StringTag('-1E-.D'), "-1E-.D"), + (StringTag('-1E-.F'), "-1E-.F"), + (StringTag('-1E-.d'), "-1E-.d"), + (StringTag('-1E-.f'), "-1E-.f"), + (StringTag('-1E-1'), "-1E-1"), + (StringTag('-1E-1.'), "-1E-1."), + (StringTag('-1E-1.1'), "-1E-1.1"), + (StringTag('-1E-1.1D'), "-1E-1.1D"), + (StringTag('-1E-1.1F'), "-1E-1.1F"), + (StringTag('-1E-1.1d'), "-1E-1.1d"), + (StringTag('-1E-1.1f'), "-1E-1.1f"), + (StringTag('-1E-1.D'), "-1E-1.D"), + (StringTag('-1E-1.F'), "-1E-1.F"), + (StringTag('-1E-1.d'), "-1E-1.d"), + (StringTag('-1E-1.f'), "-1E-1.f"), + (DoubleTag(-0.100000), "-1E-1D"), + (FloatTag(-0.100000), "-1E-1F"), + (DoubleTag(-0.100000), "-1E-1d"), + (FloatTag(-0.100000), "-1E-1f"), + (StringTag('-1E-D'), "-1E-D"), + (StringTag('-1E-F'), "-1E-F"), + (StringTag('-1E-d'), "-1E-d"), + (StringTag('-1E-f'), "-1E-f"), + (StringTag('-1E.'), "-1E."), + (StringTag('-1E.1'), "-1E.1"), + (StringTag('-1E.1D'), "-1E.1D"), + (StringTag('-1E.1F'), "-1E.1F"), + (StringTag('-1E.1d'), "-1E.1d"), + (StringTag('-1E.1f'), "-1E.1f"), + (StringTag('-1E.D'), "-1E.D"), + (StringTag('-1E.F'), "-1E.F"), + (StringTag('-1E.d'), "-1E.d"), + (StringTag('-1E.f'), "-1E.f"), + (StringTag('-1E1'), "-1E1"), + (StringTag('-1E1.'), "-1E1."), + (StringTag('-1E1.1'), "-1E1.1"), + (StringTag('-1E1.1D'), "-1E1.1D"), + (StringTag('-1E1.1F'), "-1E1.1F"), + (StringTag('-1E1.1d'), "-1E1.1d"), + (StringTag('-1E1.1f'), "-1E1.1f"), + (StringTag('-1E1.D'), "-1E1.D"), + (StringTag('-1E1.F'), "-1E1.F"), + (StringTag('-1E1.d'), "-1E1.d"), + (StringTag('-1E1.f'), "-1E1.f"), + (DoubleTag(-10.000000), "-1E1D"), + (FloatTag(-10.000000), "-1E1F"), + (DoubleTag(-10.000000), "-1E1d"), + (FloatTag(-10.000000), "-1E1f"), + (StringTag('-1ED'), "-1ED"), + (StringTag('-1EF'), "-1EF"), + (StringTag('-1Ed'), "-1Ed"), + (StringTag('-1Ef'), "-1Ef"), + (FloatTag(-1.000000), "-1F"), + (DoubleTag(-1.000000), "-1d"), + (StringTag('-1e'), "-1e"), + (StringTag('-1e+'), "-1e+"), + (StringTag('-1e+.'), "-1e+."), + (StringTag('-1e+.1'), "-1e+.1"), + (StringTag('-1e+.1D'), "-1e+.1D"), + (StringTag('-1e+.1F'), "-1e+.1F"), + (StringTag('-1e+.1d'), "-1e+.1d"), + (StringTag('-1e+.1f'), "-1e+.1f"), + (StringTag('-1e+.D'), "-1e+.D"), + (StringTag('-1e+.F'), "-1e+.F"), + (StringTag('-1e+.d'), "-1e+.d"), + (StringTag('-1e+.f'), "-1e+.f"), + (StringTag('-1e+1'), "-1e+1"), + (StringTag('-1e+1.'), "-1e+1."), + (StringTag('-1e+1.1'), "-1e+1.1"), + (StringTag('-1e+1.1D'), "-1e+1.1D"), + (StringTag('-1e+1.1F'), "-1e+1.1F"), + (StringTag('-1e+1.1d'), "-1e+1.1d"), + (StringTag('-1e+1.1f'), "-1e+1.1f"), + (StringTag('-1e+1.D'), "-1e+1.D"), + (StringTag('-1e+1.F'), "-1e+1.F"), + (StringTag('-1e+1.d'), "-1e+1.d"), + (StringTag('-1e+1.f'), "-1e+1.f"), + (DoubleTag(-10.000000), "-1e+1D"), + (FloatTag(-10.000000), "-1e+1F"), + (DoubleTag(-10.000000), "-1e+1d"), + (FloatTag(-10.000000), "-1e+1f"), + (StringTag('-1e+D'), "-1e+D"), + (StringTag('-1e+F'), "-1e+F"), + (StringTag('-1e+d'), "-1e+d"), + (StringTag('-1e+f'), "-1e+f"), + (StringTag('-1e-'), "-1e-"), + (StringTag('-1e-.'), "-1e-."), + (StringTag('-1e-.1'), "-1e-.1"), + (StringTag('-1e-.1D'), "-1e-.1D"), + (StringTag('-1e-.1F'), "-1e-.1F"), + (StringTag('-1e-.1d'), "-1e-.1d"), + (StringTag('-1e-.1f'), "-1e-.1f"), + (StringTag('-1e-.D'), "-1e-.D"), + (StringTag('-1e-.F'), "-1e-.F"), + (StringTag('-1e-.d'), "-1e-.d"), + (StringTag('-1e-.f'), "-1e-.f"), + (StringTag('-1e-1'), "-1e-1"), + (StringTag('-1e-1.'), "-1e-1."), + (StringTag('-1e-1.1'), "-1e-1.1"), + (StringTag('-1e-1.1D'), "-1e-1.1D"), + (StringTag('-1e-1.1F'), "-1e-1.1F"), + (StringTag('-1e-1.1d'), "-1e-1.1d"), + (StringTag('-1e-1.1f'), "-1e-1.1f"), + (StringTag('-1e-1.D'), "-1e-1.D"), + (StringTag('-1e-1.F'), "-1e-1.F"), + (StringTag('-1e-1.d'), "-1e-1.d"), + (StringTag('-1e-1.f'), "-1e-1.f"), + (DoubleTag(-0.100000), "-1e-1D"), + (FloatTag(-0.100000), "-1e-1F"), + (DoubleTag(-0.100000), "-1e-1d"), + (FloatTag(-0.100000), "-1e-1f"), + (StringTag('-1e-D'), "-1e-D"), + (StringTag('-1e-F'), "-1e-F"), + (StringTag('-1e-d'), "-1e-d"), + (StringTag('-1e-f'), "-1e-f"), + (StringTag('-1e.'), "-1e."), + (StringTag('-1e.1'), "-1e.1"), + (StringTag('-1e.1D'), "-1e.1D"), + (StringTag('-1e.1F'), "-1e.1F"), + (StringTag('-1e.1d'), "-1e.1d"), + (StringTag('-1e.1f'), "-1e.1f"), + (StringTag('-1e.D'), "-1e.D"), + (StringTag('-1e.F'), "-1e.F"), + (StringTag('-1e.d'), "-1e.d"), + (StringTag('-1e.f'), "-1e.f"), + (StringTag('-1e1'), "-1e1"), + (StringTag('-1e1.'), "-1e1."), + (StringTag('-1e1.1'), "-1e1.1"), + (StringTag('-1e1.1D'), "-1e1.1D"), + (StringTag('-1e1.1F'), "-1e1.1F"), + (StringTag('-1e1.1d'), "-1e1.1d"), + (StringTag('-1e1.1f'), "-1e1.1f"), + (StringTag('-1e1.D'), "-1e1.D"), + (StringTag('-1e1.F'), "-1e1.F"), + (StringTag('-1e1.d'), "-1e1.d"), + (StringTag('-1e1.f'), "-1e1.f"), + (DoubleTag(-10.000000), "-1e1D"), + (FloatTag(-10.000000), "-1e1F"), + (DoubleTag(-10.000000), "-1e1d"), + (FloatTag(-10.000000), "-1e1f"), + (StringTag('-1eD'), "-1eD"), + (StringTag('-1eF'), "-1eF"), + (StringTag('-1ed'), "-1ed"), + (StringTag('-1ef'), "-1ef"), + (FloatTag(-1.000000), "-1f"), + (StringTag('-D'), "-D"), + (StringTag('-E'), "-E"), + (StringTag('-E+'), "-E+"), + (StringTag('-E+.'), "-E+."), + (StringTag('-E+.1'), "-E+.1"), + (StringTag('-E+.1D'), "-E+.1D"), + (StringTag('-E+.1F'), "-E+.1F"), + (StringTag('-E+.1d'), "-E+.1d"), + (StringTag('-E+.1f'), "-E+.1f"), + (StringTag('-E+.D'), "-E+.D"), + (StringTag('-E+.F'), "-E+.F"), + (StringTag('-E+.d'), "-E+.d"), + (StringTag('-E+.f'), "-E+.f"), + (StringTag('-E+1'), "-E+1"), + (StringTag('-E+1.'), "-E+1."), + (StringTag('-E+1.1'), "-E+1.1"), + (StringTag('-E+1.1D'), "-E+1.1D"), + (StringTag('-E+1.1F'), "-E+1.1F"), + (StringTag('-E+1.1d'), "-E+1.1d"), + (StringTag('-E+1.1f'), "-E+1.1f"), + (StringTag('-E+1.D'), "-E+1.D"), + (StringTag('-E+1.F'), "-E+1.F"), + (StringTag('-E+1.d'), "-E+1.d"), + (StringTag('-E+1.f'), "-E+1.f"), + (StringTag('-E+1D'), "-E+1D"), + (StringTag('-E+1F'), "-E+1F"), + (StringTag('-E+1d'), "-E+1d"), + (StringTag('-E+1f'), "-E+1f"), + (StringTag('-E+D'), "-E+D"), + (StringTag('-E+F'), "-E+F"), + (StringTag('-E+d'), "-E+d"), + (StringTag('-E+f'), "-E+f"), + (StringTag('-E-'), "-E-"), + (StringTag('-E-.'), "-E-."), + (StringTag('-E-.1'), "-E-.1"), + (StringTag('-E-.1D'), "-E-.1D"), + (StringTag('-E-.1F'), "-E-.1F"), + (StringTag('-E-.1d'), "-E-.1d"), + (StringTag('-E-.1f'), "-E-.1f"), + (StringTag('-E-.D'), "-E-.D"), + (StringTag('-E-.F'), "-E-.F"), + (StringTag('-E-.d'), "-E-.d"), + (StringTag('-E-.f'), "-E-.f"), + (StringTag('-E-1'), "-E-1"), + (StringTag('-E-1.'), "-E-1."), + (StringTag('-E-1.1'), "-E-1.1"), + (StringTag('-E-1.1D'), "-E-1.1D"), + (StringTag('-E-1.1F'), "-E-1.1F"), + (StringTag('-E-1.1d'), "-E-1.1d"), + (StringTag('-E-1.1f'), "-E-1.1f"), + (StringTag('-E-1.D'), "-E-1.D"), + (StringTag('-E-1.F'), "-E-1.F"), + (StringTag('-E-1.d'), "-E-1.d"), + (StringTag('-E-1.f'), "-E-1.f"), + (StringTag('-E-1D'), "-E-1D"), + (StringTag('-E-1F'), "-E-1F"), + (StringTag('-E-1d'), "-E-1d"), + (StringTag('-E-1f'), "-E-1f"), + (StringTag('-E-D'), "-E-D"), + (StringTag('-E-F'), "-E-F"), + (StringTag('-E-d'), "-E-d"), + (StringTag('-E-f'), "-E-f"), + (StringTag('-E.'), "-E."), + (StringTag('-E.1'), "-E.1"), + (StringTag('-E.1D'), "-E.1D"), + (StringTag('-E.1F'), "-E.1F"), + (StringTag('-E.1d'), "-E.1d"), + (StringTag('-E.1f'), "-E.1f"), + (StringTag('-E.D'), "-E.D"), + (StringTag('-E.F'), "-E.F"), + (StringTag('-E.d'), "-E.d"), + (StringTag('-E.f'), "-E.f"), + (StringTag('-E1'), "-E1"), + (StringTag('-E1.'), "-E1."), + (StringTag('-E1.1'), "-E1.1"), + (StringTag('-E1.1D'), "-E1.1D"), + (StringTag('-E1.1F'), "-E1.1F"), + (StringTag('-E1.1d'), "-E1.1d"), + (StringTag('-E1.1f'), "-E1.1f"), + (StringTag('-E1.D'), "-E1.D"), + (StringTag('-E1.F'), "-E1.F"), + (StringTag('-E1.d'), "-E1.d"), + (StringTag('-E1.f'), "-E1.f"), + (StringTag('-E1D'), "-E1D"), + (StringTag('-E1F'), "-E1F"), + (StringTag('-E1d'), "-E1d"), + (StringTag('-E1f'), "-E1f"), + (StringTag('-ED'), "-ED"), + (StringTag('-EF'), "-EF"), + (StringTag('-Ed'), "-Ed"), + (StringTag('-Ef'), "-Ef"), + (StringTag('-F'), "-F"), + (StringTag('-d'), "-d"), + (StringTag('-e'), "-e"), + (StringTag('-e+'), "-e+"), + (StringTag('-e+.'), "-e+."), + (StringTag('-e+.1'), "-e+.1"), + (StringTag('-e+.1D'), "-e+.1D"), + (StringTag('-e+.1F'), "-e+.1F"), + (StringTag('-e+.1d'), "-e+.1d"), + (StringTag('-e+.1f'), "-e+.1f"), + (StringTag('-e+.D'), "-e+.D"), + (StringTag('-e+.F'), "-e+.F"), + (StringTag('-e+.d'), "-e+.d"), + (StringTag('-e+.f'), "-e+.f"), + (StringTag('-e+1'), "-e+1"), + (StringTag('-e+1.'), "-e+1."), + (StringTag('-e+1.1'), "-e+1.1"), + (StringTag('-e+1.1D'), "-e+1.1D"), + (StringTag('-e+1.1F'), "-e+1.1F"), + (StringTag('-e+1.1d'), "-e+1.1d"), + (StringTag('-e+1.1f'), "-e+1.1f"), + (StringTag('-e+1.D'), "-e+1.D"), + (StringTag('-e+1.F'), "-e+1.F"), + (StringTag('-e+1.d'), "-e+1.d"), + (StringTag('-e+1.f'), "-e+1.f"), + (StringTag('-e+1D'), "-e+1D"), + (StringTag('-e+1F'), "-e+1F"), + (StringTag('-e+1d'), "-e+1d"), + (StringTag('-e+1f'), "-e+1f"), + (StringTag('-e+D'), "-e+D"), + (StringTag('-e+F'), "-e+F"), + (StringTag('-e+d'), "-e+d"), + (StringTag('-e+f'), "-e+f"), + (StringTag('-e-'), "-e-"), + (StringTag('-e-.'), "-e-."), + (StringTag('-e-.1'), "-e-.1"), + (StringTag('-e-.1D'), "-e-.1D"), + (StringTag('-e-.1F'), "-e-.1F"), + (StringTag('-e-.1d'), "-e-.1d"), + (StringTag('-e-.1f'), "-e-.1f"), + (StringTag('-e-.D'), "-e-.D"), + (StringTag('-e-.F'), "-e-.F"), + (StringTag('-e-.d'), "-e-.d"), + (StringTag('-e-.f'), "-e-.f"), + (StringTag('-e-1'), "-e-1"), + (StringTag('-e-1.'), "-e-1."), + (StringTag('-e-1.1'), "-e-1.1"), + (StringTag('-e-1.1D'), "-e-1.1D"), + (StringTag('-e-1.1F'), "-e-1.1F"), + (StringTag('-e-1.1d'), "-e-1.1d"), + (StringTag('-e-1.1f'), "-e-1.1f"), + (StringTag('-e-1.D'), "-e-1.D"), + (StringTag('-e-1.F'), "-e-1.F"), + (StringTag('-e-1.d'), "-e-1.d"), + (StringTag('-e-1.f'), "-e-1.f"), + (StringTag('-e-1D'), "-e-1D"), + (StringTag('-e-1F'), "-e-1F"), + (StringTag('-e-1d'), "-e-1d"), + (StringTag('-e-1f'), "-e-1f"), + (StringTag('-e-D'), "-e-D"), + (StringTag('-e-F'), "-e-F"), + (StringTag('-e-d'), "-e-d"), + (StringTag('-e-f'), "-e-f"), + (StringTag('-e.'), "-e."), + (StringTag('-e.1'), "-e.1"), + (StringTag('-e.1D'), "-e.1D"), + (StringTag('-e.1F'), "-e.1F"), + (StringTag('-e.1d'), "-e.1d"), + (StringTag('-e.1f'), "-e.1f"), + (StringTag('-e.D'), "-e.D"), + (StringTag('-e.F'), "-e.F"), + (StringTag('-e.d'), "-e.d"), + (StringTag('-e.f'), "-e.f"), + (StringTag('-e1'), "-e1"), + (StringTag('-e1.'), "-e1."), + (StringTag('-e1.1'), "-e1.1"), + (StringTag('-e1.1D'), "-e1.1D"), + (StringTag('-e1.1F'), "-e1.1F"), + (StringTag('-e1.1d'), "-e1.1d"), + (StringTag('-e1.1f'), "-e1.1f"), + (StringTag('-e1.D'), "-e1.D"), + (StringTag('-e1.F'), "-e1.F"), + (StringTag('-e1.d'), "-e1.d"), + (StringTag('-e1.f'), "-e1.f"), + (StringTag('-e1D'), "-e1D"), + (StringTag('-e1F'), "-e1F"), + (StringTag('-e1d'), "-e1d"), + (StringTag('-e1f'), "-e1f"), + (StringTag('-eD'), "-eD"), + (StringTag('-eF'), "-eF"), + (StringTag('-ed'), "-ed"), + (StringTag('-ef'), "-ef"), + (StringTag('-f'), "-f"), + (StringTag('.'), "."), + (StringTag('.+'), ".+"), + (StringTag('.+.'), ".+."), + (StringTag('.+.1'), ".+.1"), + (StringTag('.+.1D'), ".+.1D"), + (StringTag('.+.1F'), ".+.1F"), + (StringTag('.+.1d'), ".+.1d"), + (StringTag('.+.1f'), ".+.1f"), + (StringTag('.+.D'), ".+.D"), + (StringTag('.+.F'), ".+.F"), + (StringTag('.+.d'), ".+.d"), + (StringTag('.+.f'), ".+.f"), + (StringTag('.+1'), ".+1"), + (StringTag('.+1.'), ".+1."), + (StringTag('.+1.1'), ".+1.1"), + (StringTag('.+1.1D'), ".+1.1D"), + (StringTag('.+1.1F'), ".+1.1F"), + (StringTag('.+1.1d'), ".+1.1d"), + (StringTag('.+1.1f'), ".+1.1f"), + (StringTag('.+1.D'), ".+1.D"), + (StringTag('.+1.F'), ".+1.F"), + (StringTag('.+1.d'), ".+1.d"), + (StringTag('.+1.f'), ".+1.f"), + (StringTag('.+1D'), ".+1D"), + (StringTag('.+1F'), ".+1F"), + (StringTag('.+1d'), ".+1d"), + (StringTag('.+1f'), ".+1f"), + (StringTag('.+D'), ".+D"), + (StringTag('.+F'), ".+F"), + (StringTag('.+d'), ".+d"), + (StringTag('.+f'), ".+f"), + (StringTag('.-'), ".-"), + (StringTag('.-.'), ".-."), + (StringTag('.-.1'), ".-.1"), + (StringTag('.-.1D'), ".-.1D"), + (StringTag('.-.1F'), ".-.1F"), + (StringTag('.-.1d'), ".-.1d"), + (StringTag('.-.1f'), ".-.1f"), + (StringTag('.-.D'), ".-.D"), + (StringTag('.-.F'), ".-.F"), + (StringTag('.-.d'), ".-.d"), + (StringTag('.-.f'), ".-.f"), + (StringTag('.-1'), ".-1"), + (StringTag('.-1.'), ".-1."), + (StringTag('.-1.1'), ".-1.1"), + (StringTag('.-1.1D'), ".-1.1D"), + (StringTag('.-1.1F'), ".-1.1F"), + (StringTag('.-1.1d'), ".-1.1d"), + (StringTag('.-1.1f'), ".-1.1f"), + (StringTag('.-1.D'), ".-1.D"), + (StringTag('.-1.F'), ".-1.F"), + (StringTag('.-1.d'), ".-1.d"), + (StringTag('.-1.f'), ".-1.f"), + (StringTag('.-1D'), ".-1D"), + (StringTag('.-1F'), ".-1F"), + (StringTag('.-1d'), ".-1d"), + (StringTag('.-1f'), ".-1f"), + (StringTag('.-D'), ".-D"), + (StringTag('.-F'), ".-F"), + (StringTag('.-d'), ".-d"), + (StringTag('.-f'), ".-f"), + (StringTag('..'), ".."), + (StringTag('..1'), "..1"), + (StringTag('..1D'), "..1D"), + (StringTag('..1F'), "..1F"), + (StringTag('..1d'), "..1d"), + (StringTag('..1f'), "..1f"), + (StringTag('..D'), "..D"), + (StringTag('..F'), "..F"), + (StringTag('..d'), "..d"), + (StringTag('..f'), "..f"), + (DoubleTag(0.100000), ".1"), + (StringTag('.1+'), ".1+"), + (StringTag('.1+.'), ".1+."), + (StringTag('.1+.1'), ".1+.1"), + (StringTag('.1+.1D'), ".1+.1D"), + (StringTag('.1+.1F'), ".1+.1F"), + (StringTag('.1+.1d'), ".1+.1d"), + (StringTag('.1+.1f'), ".1+.1f"), + (StringTag('.1+.D'), ".1+.D"), + (StringTag('.1+.F'), ".1+.F"), + (StringTag('.1+.d'), ".1+.d"), + (StringTag('.1+.f'), ".1+.f"), + (StringTag('.1+1'), ".1+1"), + (StringTag('.1+1.'), ".1+1."), + (StringTag('.1+1.1'), ".1+1.1"), + (StringTag('.1+1.1D'), ".1+1.1D"), + (StringTag('.1+1.1F'), ".1+1.1F"), + (StringTag('.1+1.1d'), ".1+1.1d"), + (StringTag('.1+1.1f'), ".1+1.1f"), + (StringTag('.1+1.D'), ".1+1.D"), + (StringTag('.1+1.F'), ".1+1.F"), + (StringTag('.1+1.d'), ".1+1.d"), + (StringTag('.1+1.f'), ".1+1.f"), + (StringTag('.1+1D'), ".1+1D"), + (StringTag('.1+1F'), ".1+1F"), + (StringTag('.1+1d'), ".1+1d"), + (StringTag('.1+1f'), ".1+1f"), + (StringTag('.1+D'), ".1+D"), + (StringTag('.1+F'), ".1+F"), + (StringTag('.1+d'), ".1+d"), + (StringTag('.1+f'), ".1+f"), + (StringTag('.1-'), ".1-"), + (StringTag('.1-.'), ".1-."), + (StringTag('.1-.1'), ".1-.1"), + (StringTag('.1-.1D'), ".1-.1D"), + (StringTag('.1-.1F'), ".1-.1F"), + (StringTag('.1-.1d'), ".1-.1d"), + (StringTag('.1-.1f'), ".1-.1f"), + (StringTag('.1-.D'), ".1-.D"), + (StringTag('.1-.F'), ".1-.F"), + (StringTag('.1-.d'), ".1-.d"), + (StringTag('.1-.f'), ".1-.f"), + (StringTag('.1-1'), ".1-1"), + (StringTag('.1-1.'), ".1-1."), + (StringTag('.1-1.1'), ".1-1.1"), + (StringTag('.1-1.1D'), ".1-1.1D"), + (StringTag('.1-1.1F'), ".1-1.1F"), + (StringTag('.1-1.1d'), ".1-1.1d"), + (StringTag('.1-1.1f'), ".1-1.1f"), + (StringTag('.1-1.D'), ".1-1.D"), + (StringTag('.1-1.F'), ".1-1.F"), + (StringTag('.1-1.d'), ".1-1.d"), + (StringTag('.1-1.f'), ".1-1.f"), + (StringTag('.1-1D'), ".1-1D"), + (StringTag('.1-1F'), ".1-1F"), + (StringTag('.1-1d'), ".1-1d"), + (StringTag('.1-1f'), ".1-1f"), + (StringTag('.1-D'), ".1-D"), + (StringTag('.1-F'), ".1-F"), + (StringTag('.1-d'), ".1-d"), + (StringTag('.1-f'), ".1-f"), + (StringTag('.1.'), ".1."), + (StringTag('.1.1'), ".1.1"), + (StringTag('.1.1D'), ".1.1D"), + (StringTag('.1.1F'), ".1.1F"), + (StringTag('.1.1d'), ".1.1d"), + (StringTag('.1.1f'), ".1.1f"), + (StringTag('.1.D'), ".1.D"), + (StringTag('.1.F'), ".1.F"), + (StringTag('.1.d'), ".1.d"), + (StringTag('.1.f'), ".1.f"), + (DoubleTag(0.110000), ".11"), + (StringTag('.11.'), ".11."), + (StringTag('.11.1'), ".11.1"), + (StringTag('.11.1D'), ".11.1D"), + (StringTag('.11.1F'), ".11.1F"), + (StringTag('.11.1d'), ".11.1d"), + (StringTag('.11.1f'), ".11.1f"), + (StringTag('.11.D'), ".11.D"), + (StringTag('.11.F'), ".11.F"), + (StringTag('.11.d'), ".11.d"), + (StringTag('.11.f'), ".11.f"), + (DoubleTag(0.110000), ".11D"), + (FloatTag(0.110000), ".11F"), + (DoubleTag(0.110000), ".11d"), + (FloatTag(0.110000), ".11f"), + (DoubleTag(0.100000), ".1D"), + (StringTag('.1E'), ".1E"), + (StringTag('.1E+'), ".1E+"), + (StringTag('.1E+.'), ".1E+."), + (StringTag('.1E+.1'), ".1E+.1"), + (StringTag('.1E+.1D'), ".1E+.1D"), + (StringTag('.1E+.1F'), ".1E+.1F"), + (StringTag('.1E+.1d'), ".1E+.1d"), + (StringTag('.1E+.1f'), ".1E+.1f"), + (StringTag('.1E+.D'), ".1E+.D"), + (StringTag('.1E+.F'), ".1E+.F"), + (StringTag('.1E+.d'), ".1E+.d"), + (StringTag('.1E+.f'), ".1E+.f"), + (DoubleTag(1.000000), ".1E+1"), + (StringTag('.1E+1.'), ".1E+1."), + (StringTag('.1E+1.1'), ".1E+1.1"), + (StringTag('.1E+1.1D'), ".1E+1.1D"), + (StringTag('.1E+1.1F'), ".1E+1.1F"), + (StringTag('.1E+1.1d'), ".1E+1.1d"), + (StringTag('.1E+1.1f'), ".1E+1.1f"), + (StringTag('.1E+1.D'), ".1E+1.D"), + (StringTag('.1E+1.F'), ".1E+1.F"), + (StringTag('.1E+1.d'), ".1E+1.d"), + (StringTag('.1E+1.f'), ".1E+1.f"), + (DoubleTag(1.000000), ".1E+1D"), + (FloatTag(1.000000), ".1E+1F"), + (DoubleTag(1.000000), ".1E+1d"), + (FloatTag(1.000000), ".1E+1f"), + (StringTag('.1E+D'), ".1E+D"), + (StringTag('.1E+F'), ".1E+F"), + (StringTag('.1E+d'), ".1E+d"), + (StringTag('.1E+f'), ".1E+f"), + (StringTag('.1E-'), ".1E-"), + (StringTag('.1E-.'), ".1E-."), + (StringTag('.1E-.1'), ".1E-.1"), + (StringTag('.1E-.1D'), ".1E-.1D"), + (StringTag('.1E-.1F'), ".1E-.1F"), + (StringTag('.1E-.1d'), ".1E-.1d"), + (StringTag('.1E-.1f'), ".1E-.1f"), + (StringTag('.1E-.D'), ".1E-.D"), + (StringTag('.1E-.F'), ".1E-.F"), + (StringTag('.1E-.d'), ".1E-.d"), + (StringTag('.1E-.f'), ".1E-.f"), + (DoubleTag(0.010000), ".1E-1"), + (StringTag('.1E-1.'), ".1E-1."), + (StringTag('.1E-1.1'), ".1E-1.1"), + (StringTag('.1E-1.1D'), ".1E-1.1D"), + (StringTag('.1E-1.1F'), ".1E-1.1F"), + (StringTag('.1E-1.1d'), ".1E-1.1d"), + (StringTag('.1E-1.1f'), ".1E-1.1f"), + (StringTag('.1E-1.D'), ".1E-1.D"), + (StringTag('.1E-1.F'), ".1E-1.F"), + (StringTag('.1E-1.d'), ".1E-1.d"), + (StringTag('.1E-1.f'), ".1E-1.f"), + (DoubleTag(0.010000), ".1E-1D"), + (FloatTag(0.010000), ".1E-1F"), + (DoubleTag(0.010000), ".1E-1d"), + (FloatTag(0.010000), ".1E-1f"), + (StringTag('.1E-D'), ".1E-D"), + (StringTag('.1E-F'), ".1E-F"), + (StringTag('.1E-d'), ".1E-d"), + (StringTag('.1E-f'), ".1E-f"), + (StringTag('.1E.'), ".1E."), + (StringTag('.1E.1'), ".1E.1"), + (StringTag('.1E.1D'), ".1E.1D"), + (StringTag('.1E.1F'), ".1E.1F"), + (StringTag('.1E.1d'), ".1E.1d"), + (StringTag('.1E.1f'), ".1E.1f"), + (StringTag('.1E.D'), ".1E.D"), + (StringTag('.1E.F'), ".1E.F"), + (StringTag('.1E.d'), ".1E.d"), + (StringTag('.1E.f'), ".1E.f"), + (DoubleTag(1.000000), ".1E1"), + (StringTag('.1E1.'), ".1E1."), + (StringTag('.1E1.1'), ".1E1.1"), + (StringTag('.1E1.1D'), ".1E1.1D"), + (StringTag('.1E1.1F'), ".1E1.1F"), + (StringTag('.1E1.1d'), ".1E1.1d"), + (StringTag('.1E1.1f'), ".1E1.1f"), + (StringTag('.1E1.D'), ".1E1.D"), + (StringTag('.1E1.F'), ".1E1.F"), + (StringTag('.1E1.d'), ".1E1.d"), + (StringTag('.1E1.f'), ".1E1.f"), + (DoubleTag(1.000000), ".1E1D"), + (FloatTag(1.000000), ".1E1F"), + (DoubleTag(1.000000), ".1E1d"), + (FloatTag(1.000000), ".1E1f"), + (StringTag('.1ED'), ".1ED"), + (StringTag('.1EF'), ".1EF"), + (StringTag('.1Ed'), ".1Ed"), + (StringTag('.1Ef'), ".1Ef"), + (FloatTag(0.100000), ".1F"), + (DoubleTag(0.100000), ".1d"), + (StringTag('.1e'), ".1e"), + (StringTag('.1e+'), ".1e+"), + (StringTag('.1e+.'), ".1e+."), + (StringTag('.1e+.1'), ".1e+.1"), + (StringTag('.1e+.1D'), ".1e+.1D"), + (StringTag('.1e+.1F'), ".1e+.1F"), + (StringTag('.1e+.1d'), ".1e+.1d"), + (StringTag('.1e+.1f'), ".1e+.1f"), + (StringTag('.1e+.D'), ".1e+.D"), + (StringTag('.1e+.F'), ".1e+.F"), + (StringTag('.1e+.d'), ".1e+.d"), + (StringTag('.1e+.f'), ".1e+.f"), + (DoubleTag(1.000000), ".1e+1"), + (StringTag('.1e+1.'), ".1e+1."), + (StringTag('.1e+1.1'), ".1e+1.1"), + (StringTag('.1e+1.1D'), ".1e+1.1D"), + (StringTag('.1e+1.1F'), ".1e+1.1F"), + (StringTag('.1e+1.1d'), ".1e+1.1d"), + (StringTag('.1e+1.1f'), ".1e+1.1f"), + (StringTag('.1e+1.D'), ".1e+1.D"), + (StringTag('.1e+1.F'), ".1e+1.F"), + (StringTag('.1e+1.d'), ".1e+1.d"), + (StringTag('.1e+1.f'), ".1e+1.f"), + (DoubleTag(1.000000), ".1e+1D"), + (FloatTag(1.000000), ".1e+1F"), + (DoubleTag(1.000000), ".1e+1d"), + (FloatTag(1.000000), ".1e+1f"), + (StringTag('.1e+D'), ".1e+D"), + (StringTag('.1e+F'), ".1e+F"), + (StringTag('.1e+d'), ".1e+d"), + (StringTag('.1e+f'), ".1e+f"), + (StringTag('.1e-'), ".1e-"), + (StringTag('.1e-.'), ".1e-."), + (StringTag('.1e-.1'), ".1e-.1"), + (StringTag('.1e-.1D'), ".1e-.1D"), + (StringTag('.1e-.1F'), ".1e-.1F"), + (StringTag('.1e-.1d'), ".1e-.1d"), + (StringTag('.1e-.1f'), ".1e-.1f"), + (StringTag('.1e-.D'), ".1e-.D"), + (StringTag('.1e-.F'), ".1e-.F"), + (StringTag('.1e-.d'), ".1e-.d"), + (StringTag('.1e-.f'), ".1e-.f"), + (DoubleTag(0.010000), ".1e-1"), + (StringTag('.1e-1.'), ".1e-1."), + (StringTag('.1e-1.1'), ".1e-1.1"), + (StringTag('.1e-1.1D'), ".1e-1.1D"), + (StringTag('.1e-1.1F'), ".1e-1.1F"), + (StringTag('.1e-1.1d'), ".1e-1.1d"), + (StringTag('.1e-1.1f'), ".1e-1.1f"), + (StringTag('.1e-1.D'), ".1e-1.D"), + (StringTag('.1e-1.F'), ".1e-1.F"), + (StringTag('.1e-1.d'), ".1e-1.d"), + (StringTag('.1e-1.f'), ".1e-1.f"), + (DoubleTag(0.010000), ".1e-1D"), + (FloatTag(0.010000), ".1e-1F"), + (DoubleTag(0.010000), ".1e-1d"), + (FloatTag(0.010000), ".1e-1f"), + (StringTag('.1e-D'), ".1e-D"), + (StringTag('.1e-F'), ".1e-F"), + (StringTag('.1e-d'), ".1e-d"), + (StringTag('.1e-f'), ".1e-f"), + (StringTag('.1e.'), ".1e."), + (StringTag('.1e.1'), ".1e.1"), + (StringTag('.1e.1D'), ".1e.1D"), + (StringTag('.1e.1F'), ".1e.1F"), + (StringTag('.1e.1d'), ".1e.1d"), + (StringTag('.1e.1f'), ".1e.1f"), + (StringTag('.1e.D'), ".1e.D"), + (StringTag('.1e.F'), ".1e.F"), + (StringTag('.1e.d'), ".1e.d"), + (StringTag('.1e.f'), ".1e.f"), + (DoubleTag(1.000000), ".1e1"), + (StringTag('.1e1.'), ".1e1."), + (StringTag('.1e1.1'), ".1e1.1"), + (StringTag('.1e1.1D'), ".1e1.1D"), + (StringTag('.1e1.1F'), ".1e1.1F"), + (StringTag('.1e1.1d'), ".1e1.1d"), + (StringTag('.1e1.1f'), ".1e1.1f"), + (StringTag('.1e1.D'), ".1e1.D"), + (StringTag('.1e1.F'), ".1e1.F"), + (StringTag('.1e1.d'), ".1e1.d"), + (StringTag('.1e1.f'), ".1e1.f"), + (DoubleTag(1.000000), ".1e1D"), + (FloatTag(1.000000), ".1e1F"), + (DoubleTag(1.000000), ".1e1d"), + (FloatTag(1.000000), ".1e1f"), + (StringTag('.1eD'), ".1eD"), + (StringTag('.1eF'), ".1eF"), + (StringTag('.1ed'), ".1ed"), + (StringTag('.1ef'), ".1ef"), + (FloatTag(0.100000), ".1f"), + (StringTag('.D'), ".D"), + (StringTag('.E'), ".E"), + (StringTag('.E+'), ".E+"), + (StringTag('.E+.'), ".E+."), + (StringTag('.E+.1'), ".E+.1"), + (StringTag('.E+.1D'), ".E+.1D"), + (StringTag('.E+.1F'), ".E+.1F"), + (StringTag('.E+.1d'), ".E+.1d"), + (StringTag('.E+.1f'), ".E+.1f"), + (StringTag('.E+.D'), ".E+.D"), + (StringTag('.E+.F'), ".E+.F"), + (StringTag('.E+.d'), ".E+.d"), + (StringTag('.E+.f'), ".E+.f"), + (StringTag('.E+1'), ".E+1"), + (StringTag('.E+1.'), ".E+1."), + (StringTag('.E+1.1'), ".E+1.1"), + (StringTag('.E+1.1D'), ".E+1.1D"), + (StringTag('.E+1.1F'), ".E+1.1F"), + (StringTag('.E+1.1d'), ".E+1.1d"), + (StringTag('.E+1.1f'), ".E+1.1f"), + (StringTag('.E+1.D'), ".E+1.D"), + (StringTag('.E+1.F'), ".E+1.F"), + (StringTag('.E+1.d'), ".E+1.d"), + (StringTag('.E+1.f'), ".E+1.f"), + (StringTag('.E+1D'), ".E+1D"), + (StringTag('.E+1F'), ".E+1F"), + (StringTag('.E+1d'), ".E+1d"), + (StringTag('.E+1f'), ".E+1f"), + (StringTag('.E+D'), ".E+D"), + (StringTag('.E+F'), ".E+F"), + (StringTag('.E+d'), ".E+d"), + (StringTag('.E+f'), ".E+f"), + (StringTag('.E-'), ".E-"), + (StringTag('.E-.'), ".E-."), + (StringTag('.E-.1'), ".E-.1"), + (StringTag('.E-.1D'), ".E-.1D"), + (StringTag('.E-.1F'), ".E-.1F"), + (StringTag('.E-.1d'), ".E-.1d"), + (StringTag('.E-.1f'), ".E-.1f"), + (StringTag('.E-.D'), ".E-.D"), + (StringTag('.E-.F'), ".E-.F"), + (StringTag('.E-.d'), ".E-.d"), + (StringTag('.E-.f'), ".E-.f"), + (StringTag('.E-1'), ".E-1"), + (StringTag('.E-1.'), ".E-1."), + (StringTag('.E-1.1'), ".E-1.1"), + (StringTag('.E-1.1D'), ".E-1.1D"), + (StringTag('.E-1.1F'), ".E-1.1F"), + (StringTag('.E-1.1d'), ".E-1.1d"), + (StringTag('.E-1.1f'), ".E-1.1f"), + (StringTag('.E-1.D'), ".E-1.D"), + (StringTag('.E-1.F'), ".E-1.F"), + (StringTag('.E-1.d'), ".E-1.d"), + (StringTag('.E-1.f'), ".E-1.f"), + (StringTag('.E-1D'), ".E-1D"), + (StringTag('.E-1F'), ".E-1F"), + (StringTag('.E-1d'), ".E-1d"), + (StringTag('.E-1f'), ".E-1f"), + (StringTag('.E-D'), ".E-D"), + (StringTag('.E-F'), ".E-F"), + (StringTag('.E-d'), ".E-d"), + (StringTag('.E-f'), ".E-f"), + (StringTag('.E.'), ".E."), + (StringTag('.E.1'), ".E.1"), + (StringTag('.E.1D'), ".E.1D"), + (StringTag('.E.1F'), ".E.1F"), + (StringTag('.E.1d'), ".E.1d"), + (StringTag('.E.1f'), ".E.1f"), + (StringTag('.E.D'), ".E.D"), + (StringTag('.E.F'), ".E.F"), + (StringTag('.E.d'), ".E.d"), + (StringTag('.E.f'), ".E.f"), + (StringTag('.E1'), ".E1"), + (StringTag('.E1.'), ".E1."), + (StringTag('.E1.1'), ".E1.1"), + (StringTag('.E1.1D'), ".E1.1D"), + (StringTag('.E1.1F'), ".E1.1F"), + (StringTag('.E1.1d'), ".E1.1d"), + (StringTag('.E1.1f'), ".E1.1f"), + (StringTag('.E1.D'), ".E1.D"), + (StringTag('.E1.F'), ".E1.F"), + (StringTag('.E1.d'), ".E1.d"), + (StringTag('.E1.f'), ".E1.f"), + (StringTag('.E1D'), ".E1D"), + (StringTag('.E1F'), ".E1F"), + (StringTag('.E1d'), ".E1d"), + (StringTag('.E1f'), ".E1f"), + (StringTag('.ED'), ".ED"), + (StringTag('.EF'), ".EF"), + (StringTag('.Ed'), ".Ed"), + (StringTag('.Ef'), ".Ef"), + (StringTag('.F'), ".F"), + (StringTag('.d'), ".d"), + (StringTag('.e'), ".e"), + (StringTag('.e+'), ".e+"), + (StringTag('.e+.'), ".e+."), + (StringTag('.e+.1'), ".e+.1"), + (StringTag('.e+.1D'), ".e+.1D"), + (StringTag('.e+.1F'), ".e+.1F"), + (StringTag('.e+.1d'), ".e+.1d"), + (StringTag('.e+.1f'), ".e+.1f"), + (StringTag('.e+.D'), ".e+.D"), + (StringTag('.e+.F'), ".e+.F"), + (StringTag('.e+.d'), ".e+.d"), + (StringTag('.e+.f'), ".e+.f"), + (StringTag('.e+1'), ".e+1"), + (StringTag('.e+1.'), ".e+1."), + (StringTag('.e+1.1'), ".e+1.1"), + (StringTag('.e+1.1D'), ".e+1.1D"), + (StringTag('.e+1.1F'), ".e+1.1F"), + (StringTag('.e+1.1d'), ".e+1.1d"), + (StringTag('.e+1.1f'), ".e+1.1f"), + (StringTag('.e+1.D'), ".e+1.D"), + (StringTag('.e+1.F'), ".e+1.F"), + (StringTag('.e+1.d'), ".e+1.d"), + (StringTag('.e+1.f'), ".e+1.f"), + (StringTag('.e+1D'), ".e+1D"), + (StringTag('.e+1F'), ".e+1F"), + (StringTag('.e+1d'), ".e+1d"), + (StringTag('.e+1f'), ".e+1f"), + (StringTag('.e+D'), ".e+D"), + (StringTag('.e+F'), ".e+F"), + (StringTag('.e+d'), ".e+d"), + (StringTag('.e+f'), ".e+f"), + (StringTag('.e-'), ".e-"), + (StringTag('.e-.'), ".e-."), + (StringTag('.e-.1'), ".e-.1"), + (StringTag('.e-.1D'), ".e-.1D"), + (StringTag('.e-.1F'), ".e-.1F"), + (StringTag('.e-.1d'), ".e-.1d"), + (StringTag('.e-.1f'), ".e-.1f"), + (StringTag('.e-.D'), ".e-.D"), + (StringTag('.e-.F'), ".e-.F"), + (StringTag('.e-.d'), ".e-.d"), + (StringTag('.e-.f'), ".e-.f"), + (StringTag('.e-1'), ".e-1"), + (StringTag('.e-1.'), ".e-1."), + (StringTag('.e-1.1'), ".e-1.1"), + (StringTag('.e-1.1D'), ".e-1.1D"), + (StringTag('.e-1.1F'), ".e-1.1F"), + (StringTag('.e-1.1d'), ".e-1.1d"), + (StringTag('.e-1.1f'), ".e-1.1f"), + (StringTag('.e-1.D'), ".e-1.D"), + (StringTag('.e-1.F'), ".e-1.F"), + (StringTag('.e-1.d'), ".e-1.d"), + (StringTag('.e-1.f'), ".e-1.f"), + (StringTag('.e-1D'), ".e-1D"), + (StringTag('.e-1F'), ".e-1F"), + (StringTag('.e-1d'), ".e-1d"), + (StringTag('.e-1f'), ".e-1f"), + (StringTag('.e-D'), ".e-D"), + (StringTag('.e-F'), ".e-F"), + (StringTag('.e-d'), ".e-d"), + (StringTag('.e-f'), ".e-f"), + (StringTag('.e.'), ".e."), + (StringTag('.e.1'), ".e.1"), + (StringTag('.e.1D'), ".e.1D"), + (StringTag('.e.1F'), ".e.1F"), + (StringTag('.e.1d'), ".e.1d"), + (StringTag('.e.1f'), ".e.1f"), + (StringTag('.e.D'), ".e.D"), + (StringTag('.e.F'), ".e.F"), + (StringTag('.e.d'), ".e.d"), + (StringTag('.e.f'), ".e.f"), + (StringTag('.e1'), ".e1"), + (StringTag('.e1.'), ".e1."), + (StringTag('.e1.1'), ".e1.1"), + (StringTag('.e1.1D'), ".e1.1D"), + (StringTag('.e1.1F'), ".e1.1F"), + (StringTag('.e1.1d'), ".e1.1d"), + (StringTag('.e1.1f'), ".e1.1f"), + (StringTag('.e1.D'), ".e1.D"), + (StringTag('.e1.F'), ".e1.F"), + (StringTag('.e1.d'), ".e1.d"), + (StringTag('.e1.f'), ".e1.f"), + (StringTag('.e1D'), ".e1D"), + (StringTag('.e1F'), ".e1F"), + (StringTag('.e1d'), ".e1d"), + (StringTag('.e1f'), ".e1f"), + (StringTag('.eD'), ".eD"), + (StringTag('.eF'), ".eF"), + (StringTag('.ed'), ".ed"), + (StringTag('.ef'), ".ef"), + (StringTag('.f'), ".f"), + (IntTag(1), "1"), + (StringTag('1+'), "1+"), + (StringTag('1+.'), "1+."), + (StringTag('1+.1'), "1+.1"), + (StringTag('1+.1D'), "1+.1D"), + (StringTag('1+.1F'), "1+.1F"), + (StringTag('1+.1d'), "1+.1d"), + (StringTag('1+.1f'), "1+.1f"), + (StringTag('1+.D'), "1+.D"), + (StringTag('1+.F'), "1+.F"), + (StringTag('1+.d'), "1+.d"), + (StringTag('1+.f'), "1+.f"), + (StringTag('1+1'), "1+1"), + (StringTag('1+1.'), "1+1."), + (StringTag('1+1.1'), "1+1.1"), + (StringTag('1+1.1D'), "1+1.1D"), + (StringTag('1+1.1F'), "1+1.1F"), + (StringTag('1+1.1d'), "1+1.1d"), + (StringTag('1+1.1f'), "1+1.1f"), + (StringTag('1+1.D'), "1+1.D"), + (StringTag('1+1.F'), "1+1.F"), + (StringTag('1+1.d'), "1+1.d"), + (StringTag('1+1.f'), "1+1.f"), + (StringTag('1+1D'), "1+1D"), + (StringTag('1+1F'), "1+1F"), + (StringTag('1+1d'), "1+1d"), + (StringTag('1+1f'), "1+1f"), + (StringTag('1+D'), "1+D"), + (StringTag('1+F'), "1+F"), + (StringTag('1+d'), "1+d"), + (StringTag('1+f'), "1+f"), + (StringTag('1-'), "1-"), + (StringTag('1-.'), "1-."), + (StringTag('1-.1'), "1-.1"), + (StringTag('1-.1D'), "1-.1D"), + (StringTag('1-.1F'), "1-.1F"), + (StringTag('1-.1d'), "1-.1d"), + (StringTag('1-.1f'), "1-.1f"), + (StringTag('1-.D'), "1-.D"), + (StringTag('1-.F'), "1-.F"), + (StringTag('1-.d'), "1-.d"), + (StringTag('1-.f'), "1-.f"), + (StringTag('1-1'), "1-1"), + (StringTag('1-1.'), "1-1."), + (StringTag('1-1.1'), "1-1.1"), + (StringTag('1-1.1D'), "1-1.1D"), + (StringTag('1-1.1F'), "1-1.1F"), + (StringTag('1-1.1d'), "1-1.1d"), + (StringTag('1-1.1f'), "1-1.1f"), + (StringTag('1-1.D'), "1-1.D"), + (StringTag('1-1.F'), "1-1.F"), + (StringTag('1-1.d'), "1-1.d"), + (StringTag('1-1.f'), "1-1.f"), + (StringTag('1-1D'), "1-1D"), + (StringTag('1-1F'), "1-1F"), + (StringTag('1-1d'), "1-1d"), + (StringTag('1-1f'), "1-1f"), + (StringTag('1-D'), "1-D"), + (StringTag('1-F'), "1-F"), + (StringTag('1-d'), "1-d"), + (StringTag('1-f'), "1-f"), + (DoubleTag(1.000000), "1."), + (StringTag('1.+'), "1.+"), + (StringTag('1.+.'), "1.+."), + (StringTag('1.+.1'), "1.+.1"), + (StringTag('1.+.1D'), "1.+.1D"), + (StringTag('1.+.1F'), "1.+.1F"), + (StringTag('1.+.1d'), "1.+.1d"), + (StringTag('1.+.1f'), "1.+.1f"), + (StringTag('1.+.D'), "1.+.D"), + (StringTag('1.+.F'), "1.+.F"), + (StringTag('1.+.d'), "1.+.d"), + (StringTag('1.+.f'), "1.+.f"), + (StringTag('1.+1'), "1.+1"), + (StringTag('1.+1.'), "1.+1."), + (StringTag('1.+1.1'), "1.+1.1"), + (StringTag('1.+1.1D'), "1.+1.1D"), + (StringTag('1.+1.1F'), "1.+1.1F"), + (StringTag('1.+1.1d'), "1.+1.1d"), + (StringTag('1.+1.1f'), "1.+1.1f"), + (StringTag('1.+1.D'), "1.+1.D"), + (StringTag('1.+1.F'), "1.+1.F"), + (StringTag('1.+1.d'), "1.+1.d"), + (StringTag('1.+1.f'), "1.+1.f"), + (StringTag('1.+1D'), "1.+1D"), + (StringTag('1.+1F'), "1.+1F"), + (StringTag('1.+1d'), "1.+1d"), + (StringTag('1.+1f'), "1.+1f"), + (StringTag('1.+D'), "1.+D"), + (StringTag('1.+F'), "1.+F"), + (StringTag('1.+d'), "1.+d"), + (StringTag('1.+f'), "1.+f"), + (StringTag('1.-'), "1.-"), + (StringTag('1.-.'), "1.-."), + (StringTag('1.-.1'), "1.-.1"), + (StringTag('1.-.1D'), "1.-.1D"), + (StringTag('1.-.1F'), "1.-.1F"), + (StringTag('1.-.1d'), "1.-.1d"), + (StringTag('1.-.1f'), "1.-.1f"), + (StringTag('1.-.D'), "1.-.D"), + (StringTag('1.-.F'), "1.-.F"), + (StringTag('1.-.d'), "1.-.d"), + (StringTag('1.-.f'), "1.-.f"), + (StringTag('1.-1'), "1.-1"), + (StringTag('1.-1.'), "1.-1."), + (StringTag('1.-1.1'), "1.-1.1"), + (StringTag('1.-1.1D'), "1.-1.1D"), + (StringTag('1.-1.1F'), "1.-1.1F"), + (StringTag('1.-1.1d'), "1.-1.1d"), + (StringTag('1.-1.1f'), "1.-1.1f"), + (StringTag('1.-1.D'), "1.-1.D"), + (StringTag('1.-1.F'), "1.-1.F"), + (StringTag('1.-1.d'), "1.-1.d"), + (StringTag('1.-1.f'), "1.-1.f"), + (StringTag('1.-1D'), "1.-1D"), + (StringTag('1.-1F'), "1.-1F"), + (StringTag('1.-1d'), "1.-1d"), + (StringTag('1.-1f'), "1.-1f"), + (StringTag('1.-D'), "1.-D"), + (StringTag('1.-F'), "1.-F"), + (StringTag('1.-d'), "1.-d"), + (StringTag('1.-f'), "1.-f"), + (StringTag('1..'), "1.."), + (StringTag('1..1'), "1..1"), + (StringTag('1..1D'), "1..1D"), + (StringTag('1..1F'), "1..1F"), + (StringTag('1..1d'), "1..1d"), + (StringTag('1..1f'), "1..1f"), + (StringTag('1..D'), "1..D"), + (StringTag('1..F'), "1..F"), + (StringTag('1..d'), "1..d"), + (StringTag('1..f'), "1..f"), + (DoubleTag(1.100000), "1.1"), + (StringTag('1.1+'), "1.1+"), + (StringTag('1.1+.'), "1.1+."), + (StringTag('1.1+.1'), "1.1+.1"), + (StringTag('1.1+.1D'), "1.1+.1D"), + (StringTag('1.1+.1F'), "1.1+.1F"), + (StringTag('1.1+.1d'), "1.1+.1d"), + (StringTag('1.1+.1f'), "1.1+.1f"), + (StringTag('1.1+.D'), "1.1+.D"), + (StringTag('1.1+.F'), "1.1+.F"), + (StringTag('1.1+.d'), "1.1+.d"), + (StringTag('1.1+.f'), "1.1+.f"), + (StringTag('1.1+1'), "1.1+1"), + (StringTag('1.1+1.'), "1.1+1."), + (StringTag('1.1+1.1'), "1.1+1.1"), + (StringTag('1.1+1.1D'), "1.1+1.1D"), + (StringTag('1.1+1.1F'), "1.1+1.1F"), + (StringTag('1.1+1.1d'), "1.1+1.1d"), + (StringTag('1.1+1.1f'), "1.1+1.1f"), + (StringTag('1.1+1.D'), "1.1+1.D"), + (StringTag('1.1+1.F'), "1.1+1.F"), + (StringTag('1.1+1.d'), "1.1+1.d"), + (StringTag('1.1+1.f'), "1.1+1.f"), + (StringTag('1.1+1D'), "1.1+1D"), + (StringTag('1.1+1F'), "1.1+1F"), + (StringTag('1.1+1d'), "1.1+1d"), + (StringTag('1.1+1f'), "1.1+1f"), + (StringTag('1.1+D'), "1.1+D"), + (StringTag('1.1+F'), "1.1+F"), + (StringTag('1.1+d'), "1.1+d"), + (StringTag('1.1+f'), "1.1+f"), + (StringTag('1.1-'), "1.1-"), + (StringTag('1.1-.'), "1.1-."), + (StringTag('1.1-.1'), "1.1-.1"), + (StringTag('1.1-.1D'), "1.1-.1D"), + (StringTag('1.1-.1F'), "1.1-.1F"), + (StringTag('1.1-.1d'), "1.1-.1d"), + (StringTag('1.1-.1f'), "1.1-.1f"), + (StringTag('1.1-.D'), "1.1-.D"), + (StringTag('1.1-.F'), "1.1-.F"), + (StringTag('1.1-.d'), "1.1-.d"), + (StringTag('1.1-.f'), "1.1-.f"), + (StringTag('1.1-1'), "1.1-1"), + (StringTag('1.1-1.'), "1.1-1."), + (StringTag('1.1-1.1'), "1.1-1.1"), + (StringTag('1.1-1.1D'), "1.1-1.1D"), + (StringTag('1.1-1.1F'), "1.1-1.1F"), + (StringTag('1.1-1.1d'), "1.1-1.1d"), + (StringTag('1.1-1.1f'), "1.1-1.1f"), + (StringTag('1.1-1.D'), "1.1-1.D"), + (StringTag('1.1-1.F'), "1.1-1.F"), + (StringTag('1.1-1.d'), "1.1-1.d"), + (StringTag('1.1-1.f'), "1.1-1.f"), + (StringTag('1.1-1D'), "1.1-1D"), + (StringTag('1.1-1F'), "1.1-1F"), + (StringTag('1.1-1d'), "1.1-1d"), + (StringTag('1.1-1f'), "1.1-1f"), + (StringTag('1.1-D'), "1.1-D"), + (StringTag('1.1-F'), "1.1-F"), + (StringTag('1.1-d'), "1.1-d"), + (StringTag('1.1-f'), "1.1-f"), + (StringTag('1.1.'), "1.1."), + (StringTag('1.1.1'), "1.1.1"), + (StringTag('1.1.1D'), "1.1.1D"), + (StringTag('1.1.1F'), "1.1.1F"), + (StringTag('1.1.1d'), "1.1.1d"), + (StringTag('1.1.1f'), "1.1.1f"), + (StringTag('1.1.D'), "1.1.D"), + (StringTag('1.1.F'), "1.1.F"), + (StringTag('1.1.d'), "1.1.d"), + (StringTag('1.1.f'), "1.1.f"), + (DoubleTag(1.110000), "1.11"), + (StringTag('1.11.'), "1.11."), + (StringTag('1.11.1'), "1.11.1"), + (StringTag('1.11.1D'), "1.11.1D"), + (StringTag('1.11.1F'), "1.11.1F"), + (StringTag('1.11.1d'), "1.11.1d"), + (StringTag('1.11.1f'), "1.11.1f"), + (StringTag('1.11.D'), "1.11.D"), + (StringTag('1.11.F'), "1.11.F"), + (StringTag('1.11.d'), "1.11.d"), + (StringTag('1.11.f'), "1.11.f"), + (DoubleTag(1.110000), "1.11D"), + (FloatTag(1.110000), "1.11F"), + (DoubleTag(1.110000), "1.11d"), + (FloatTag(1.110000), "1.11f"), + (DoubleTag(1.100000), "1.1D"), + (StringTag('1.1E'), "1.1E"), + (StringTag('1.1E+'), "1.1E+"), + (StringTag('1.1E+.'), "1.1E+."), + (StringTag('1.1E+.1'), "1.1E+.1"), + (StringTag('1.1E+.1D'), "1.1E+.1D"), + (StringTag('1.1E+.1F'), "1.1E+.1F"), + (StringTag('1.1E+.1d'), "1.1E+.1d"), + (StringTag('1.1E+.1f'), "1.1E+.1f"), + (StringTag('1.1E+.D'), "1.1E+.D"), + (StringTag('1.1E+.F'), "1.1E+.F"), + (StringTag('1.1E+.d'), "1.1E+.d"), + (StringTag('1.1E+.f'), "1.1E+.f"), + (DoubleTag(11.000000), "1.1E+1"), + (StringTag('1.1E+1.'), "1.1E+1."), + (StringTag('1.1E+1.1'), "1.1E+1.1"), + (StringTag('1.1E+1.1D'), "1.1E+1.1D"), + (StringTag('1.1E+1.1F'), "1.1E+1.1F"), + (StringTag('1.1E+1.1d'), "1.1E+1.1d"), + (StringTag('1.1E+1.1f'), "1.1E+1.1f"), + (StringTag('1.1E+1.D'), "1.1E+1.D"), + (StringTag('1.1E+1.F'), "1.1E+1.F"), + (StringTag('1.1E+1.d'), "1.1E+1.d"), + (StringTag('1.1E+1.f'), "1.1E+1.f"), + (DoubleTag(11.000000), "1.1E+1D"), + (FloatTag(11.000000), "1.1E+1F"), + (DoubleTag(11.000000), "1.1E+1d"), + (FloatTag(11.000000), "1.1E+1f"), + (StringTag('1.1E+D'), "1.1E+D"), + (StringTag('1.1E+F'), "1.1E+F"), + (StringTag('1.1E+d'), "1.1E+d"), + (StringTag('1.1E+f'), "1.1E+f"), + (StringTag('1.1E-'), "1.1E-"), + (StringTag('1.1E-.'), "1.1E-."), + (StringTag('1.1E-.1'), "1.1E-.1"), + (StringTag('1.1E-.1D'), "1.1E-.1D"), + (StringTag('1.1E-.1F'), "1.1E-.1F"), + (StringTag('1.1E-.1d'), "1.1E-.1d"), + (StringTag('1.1E-.1f'), "1.1E-.1f"), + (StringTag('1.1E-.D'), "1.1E-.D"), + (StringTag('1.1E-.F'), "1.1E-.F"), + (StringTag('1.1E-.d'), "1.1E-.d"), + (StringTag('1.1E-.f'), "1.1E-.f"), + (DoubleTag(0.110000), "1.1E-1"), + (StringTag('1.1E-1.'), "1.1E-1."), + (StringTag('1.1E-1.1'), "1.1E-1.1"), + (StringTag('1.1E-1.1D'), "1.1E-1.1D"), + (StringTag('1.1E-1.1F'), "1.1E-1.1F"), + (StringTag('1.1E-1.1d'), "1.1E-1.1d"), + (StringTag('1.1E-1.1f'), "1.1E-1.1f"), + (StringTag('1.1E-1.D'), "1.1E-1.D"), + (StringTag('1.1E-1.F'), "1.1E-1.F"), + (StringTag('1.1E-1.d'), "1.1E-1.d"), + (StringTag('1.1E-1.f'), "1.1E-1.f"), + (DoubleTag(0.110000), "1.1E-1D"), + (FloatTag(0.110000), "1.1E-1F"), + (DoubleTag(0.110000), "1.1E-1d"), + (FloatTag(0.110000), "1.1E-1f"), + (StringTag('1.1E-D'), "1.1E-D"), + (StringTag('1.1E-F'), "1.1E-F"), + (StringTag('1.1E-d'), "1.1E-d"), + (StringTag('1.1E-f'), "1.1E-f"), + (StringTag('1.1E.'), "1.1E."), + (StringTag('1.1E.1'), "1.1E.1"), + (StringTag('1.1E.1D'), "1.1E.1D"), + (StringTag('1.1E.1F'), "1.1E.1F"), + (StringTag('1.1E.1d'), "1.1E.1d"), + (StringTag('1.1E.1f'), "1.1E.1f"), + (StringTag('1.1E.D'), "1.1E.D"), + (StringTag('1.1E.F'), "1.1E.F"), + (StringTag('1.1E.d'), "1.1E.d"), + (StringTag('1.1E.f'), "1.1E.f"), + (DoubleTag(11.000000), "1.1E1"), + (StringTag('1.1E1.'), "1.1E1."), + (StringTag('1.1E1.1'), "1.1E1.1"), + (StringTag('1.1E1.1D'), "1.1E1.1D"), + (StringTag('1.1E1.1F'), "1.1E1.1F"), + (StringTag('1.1E1.1d'), "1.1E1.1d"), + (StringTag('1.1E1.1f'), "1.1E1.1f"), + (StringTag('1.1E1.D'), "1.1E1.D"), + (StringTag('1.1E1.F'), "1.1E1.F"), + (StringTag('1.1E1.d'), "1.1E1.d"), + (StringTag('1.1E1.f'), "1.1E1.f"), + (DoubleTag(11.000000), "1.1E1D"), + (FloatTag(11.000000), "1.1E1F"), + (DoubleTag(11.000000), "1.1E1d"), + (FloatTag(11.000000), "1.1E1f"), + (StringTag('1.1ED'), "1.1ED"), + (StringTag('1.1EF'), "1.1EF"), + (StringTag('1.1Ed'), "1.1Ed"), + (StringTag('1.1Ef'), "1.1Ef"), + (FloatTag(1.100000), "1.1F"), + (DoubleTag(1.100000), "1.1d"), + (StringTag('1.1e'), "1.1e"), + (StringTag('1.1e+'), "1.1e+"), + (StringTag('1.1e+.'), "1.1e+."), + (StringTag('1.1e+.1'), "1.1e+.1"), + (StringTag('1.1e+.1D'), "1.1e+.1D"), + (StringTag('1.1e+.1F'), "1.1e+.1F"), + (StringTag('1.1e+.1d'), "1.1e+.1d"), + (StringTag('1.1e+.1f'), "1.1e+.1f"), + (StringTag('1.1e+.D'), "1.1e+.D"), + (StringTag('1.1e+.F'), "1.1e+.F"), + (StringTag('1.1e+.d'), "1.1e+.d"), + (StringTag('1.1e+.f'), "1.1e+.f"), + (DoubleTag(11.000000), "1.1e+1"), + (StringTag('1.1e+1.'), "1.1e+1."), + (StringTag('1.1e+1.1'), "1.1e+1.1"), + (StringTag('1.1e+1.1D'), "1.1e+1.1D"), + (StringTag('1.1e+1.1F'), "1.1e+1.1F"), + (StringTag('1.1e+1.1d'), "1.1e+1.1d"), + (StringTag('1.1e+1.1f'), "1.1e+1.1f"), + (StringTag('1.1e+1.D'), "1.1e+1.D"), + (StringTag('1.1e+1.F'), "1.1e+1.F"), + (StringTag('1.1e+1.d'), "1.1e+1.d"), + (StringTag('1.1e+1.f'), "1.1e+1.f"), + (DoubleTag(11.000000), "1.1e+1D"), + (FloatTag(11.000000), "1.1e+1F"), + (DoubleTag(11.000000), "1.1e+1d"), + (FloatTag(11.000000), "1.1e+1f"), + (StringTag('1.1e+D'), "1.1e+D"), + (StringTag('1.1e+F'), "1.1e+F"), + (StringTag('1.1e+d'), "1.1e+d"), + (StringTag('1.1e+f'), "1.1e+f"), + (StringTag('1.1e-'), "1.1e-"), + (StringTag('1.1e-.'), "1.1e-."), + (StringTag('1.1e-.1'), "1.1e-.1"), + (StringTag('1.1e-.1D'), "1.1e-.1D"), + (StringTag('1.1e-.1F'), "1.1e-.1F"), + (StringTag('1.1e-.1d'), "1.1e-.1d"), + (StringTag('1.1e-.1f'), "1.1e-.1f"), + (StringTag('1.1e-.D'), "1.1e-.D"), + (StringTag('1.1e-.F'), "1.1e-.F"), + (StringTag('1.1e-.d'), "1.1e-.d"), + (StringTag('1.1e-.f'), "1.1e-.f"), + (DoubleTag(0.110000), "1.1e-1"), + (StringTag('1.1e-1.'), "1.1e-1."), + (StringTag('1.1e-1.1'), "1.1e-1.1"), + (StringTag('1.1e-1.1D'), "1.1e-1.1D"), + (StringTag('1.1e-1.1F'), "1.1e-1.1F"), + (StringTag('1.1e-1.1d'), "1.1e-1.1d"), + (StringTag('1.1e-1.1f'), "1.1e-1.1f"), + (StringTag('1.1e-1.D'), "1.1e-1.D"), + (StringTag('1.1e-1.F'), "1.1e-1.F"), + (StringTag('1.1e-1.d'), "1.1e-1.d"), + (StringTag('1.1e-1.f'), "1.1e-1.f"), + (DoubleTag(0.110000), "1.1e-1D"), + (FloatTag(0.110000), "1.1e-1F"), + (DoubleTag(0.110000), "1.1e-1d"), + (FloatTag(0.110000), "1.1e-1f"), + (StringTag('1.1e-D'), "1.1e-D"), + (StringTag('1.1e-F'), "1.1e-F"), + (StringTag('1.1e-d'), "1.1e-d"), + (StringTag('1.1e-f'), "1.1e-f"), + (StringTag('1.1e.'), "1.1e."), + (StringTag('1.1e.1'), "1.1e.1"), + (StringTag('1.1e.1D'), "1.1e.1D"), + (StringTag('1.1e.1F'), "1.1e.1F"), + (StringTag('1.1e.1d'), "1.1e.1d"), + (StringTag('1.1e.1f'), "1.1e.1f"), + (StringTag('1.1e.D'), "1.1e.D"), + (StringTag('1.1e.F'), "1.1e.F"), + (StringTag('1.1e.d'), "1.1e.d"), + (StringTag('1.1e.f'), "1.1e.f"), + (DoubleTag(11.000000), "1.1e1"), + (StringTag('1.1e1.'), "1.1e1."), + (StringTag('1.1e1.1'), "1.1e1.1"), + (StringTag('1.1e1.1D'), "1.1e1.1D"), + (StringTag('1.1e1.1F'), "1.1e1.1F"), + (StringTag('1.1e1.1d'), "1.1e1.1d"), + (StringTag('1.1e1.1f'), "1.1e1.1f"), + (StringTag('1.1e1.D'), "1.1e1.D"), + (StringTag('1.1e1.F'), "1.1e1.F"), + (StringTag('1.1e1.d'), "1.1e1.d"), + (StringTag('1.1e1.f'), "1.1e1.f"), + (DoubleTag(11.000000), "1.1e1D"), + (FloatTag(11.000000), "1.1e1F"), + (DoubleTag(11.000000), "1.1e1d"), + (FloatTag(11.000000), "1.1e1f"), + (StringTag('1.1eD'), "1.1eD"), + (StringTag('1.1eF'), "1.1eF"), + (StringTag('1.1ed'), "1.1ed"), + (StringTag('1.1ef'), "1.1ef"), + (FloatTag(1.100000), "1.1f"), + (DoubleTag(1.000000), "1.D"), + (StringTag('1.E'), "1.E"), + (StringTag('1.E+'), "1.E+"), + (StringTag('1.E+.'), "1.E+."), + (StringTag('1.E+.1'), "1.E+.1"), + (StringTag('1.E+.1D'), "1.E+.1D"), + (StringTag('1.E+.1F'), "1.E+.1F"), + (StringTag('1.E+.1d'), "1.E+.1d"), + (StringTag('1.E+.1f'), "1.E+.1f"), + (StringTag('1.E+.D'), "1.E+.D"), + (StringTag('1.E+.F'), "1.E+.F"), + (StringTag('1.E+.d'), "1.E+.d"), + (StringTag('1.E+.f'), "1.E+.f"), + (DoubleTag(10.000000), "1.E+1"), + (StringTag('1.E+1.'), "1.E+1."), + (StringTag('1.E+1.1'), "1.E+1.1"), + (StringTag('1.E+1.1D'), "1.E+1.1D"), + (StringTag('1.E+1.1F'), "1.E+1.1F"), + (StringTag('1.E+1.1d'), "1.E+1.1d"), + (StringTag('1.E+1.1f'), "1.E+1.1f"), + (StringTag('1.E+1.D'), "1.E+1.D"), + (StringTag('1.E+1.F'), "1.E+1.F"), + (StringTag('1.E+1.d'), "1.E+1.d"), + (StringTag('1.E+1.f'), "1.E+1.f"), + (DoubleTag(10.000000), "1.E+1D"), + (FloatTag(10.000000), "1.E+1F"), + (DoubleTag(10.000000), "1.E+1d"), + (FloatTag(10.000000), "1.E+1f"), + (StringTag('1.E+D'), "1.E+D"), + (StringTag('1.E+F'), "1.E+F"), + (StringTag('1.E+d'), "1.E+d"), + (StringTag('1.E+f'), "1.E+f"), + (StringTag('1.E-'), "1.E-"), + (StringTag('1.E-.'), "1.E-."), + (StringTag('1.E-.1'), "1.E-.1"), + (StringTag('1.E-.1D'), "1.E-.1D"), + (StringTag('1.E-.1F'), "1.E-.1F"), + (StringTag('1.E-.1d'), "1.E-.1d"), + (StringTag('1.E-.1f'), "1.E-.1f"), + (StringTag('1.E-.D'), "1.E-.D"), + (StringTag('1.E-.F'), "1.E-.F"), + (StringTag('1.E-.d'), "1.E-.d"), + (StringTag('1.E-.f'), "1.E-.f"), + (DoubleTag(0.100000), "1.E-1"), + (StringTag('1.E-1.'), "1.E-1."), + (StringTag('1.E-1.1'), "1.E-1.1"), + (StringTag('1.E-1.1D'), "1.E-1.1D"), + (StringTag('1.E-1.1F'), "1.E-1.1F"), + (StringTag('1.E-1.1d'), "1.E-1.1d"), + (StringTag('1.E-1.1f'), "1.E-1.1f"), + (StringTag('1.E-1.D'), "1.E-1.D"), + (StringTag('1.E-1.F'), "1.E-1.F"), + (StringTag('1.E-1.d'), "1.E-1.d"), + (StringTag('1.E-1.f'), "1.E-1.f"), + (DoubleTag(0.100000), "1.E-1D"), + (FloatTag(0.100000), "1.E-1F"), + (DoubleTag(0.100000), "1.E-1d"), + (FloatTag(0.100000), "1.E-1f"), + (StringTag('1.E-D'), "1.E-D"), + (StringTag('1.E-F'), "1.E-F"), + (StringTag('1.E-d'), "1.E-d"), + (StringTag('1.E-f'), "1.E-f"), + (StringTag('1.E.'), "1.E."), + (StringTag('1.E.1'), "1.E.1"), + (StringTag('1.E.1D'), "1.E.1D"), + (StringTag('1.E.1F'), "1.E.1F"), + (StringTag('1.E.1d'), "1.E.1d"), + (StringTag('1.E.1f'), "1.E.1f"), + (StringTag('1.E.D'), "1.E.D"), + (StringTag('1.E.F'), "1.E.F"), + (StringTag('1.E.d'), "1.E.d"), + (StringTag('1.E.f'), "1.E.f"), + (DoubleTag(10.000000), "1.E1"), + (StringTag('1.E1.'), "1.E1."), + (StringTag('1.E1.1'), "1.E1.1"), + (StringTag('1.E1.1D'), "1.E1.1D"), + (StringTag('1.E1.1F'), "1.E1.1F"), + (StringTag('1.E1.1d'), "1.E1.1d"), + (StringTag('1.E1.1f'), "1.E1.1f"), + (StringTag('1.E1.D'), "1.E1.D"), + (StringTag('1.E1.F'), "1.E1.F"), + (StringTag('1.E1.d'), "1.E1.d"), + (StringTag('1.E1.f'), "1.E1.f"), + (DoubleTag(10.000000), "1.E1D"), + (FloatTag(10.000000), "1.E1F"), + (DoubleTag(10.000000), "1.E1d"), + (FloatTag(10.000000), "1.E1f"), + (StringTag('1.ED'), "1.ED"), + (StringTag('1.EF'), "1.EF"), + (StringTag('1.Ed'), "1.Ed"), + (StringTag('1.Ef'), "1.Ef"), + (FloatTag(1.000000), "1.F"), + (DoubleTag(1.000000), "1.d"), + (StringTag('1.e'), "1.e"), + (StringTag('1.e+'), "1.e+"), + (StringTag('1.e+.'), "1.e+."), + (StringTag('1.e+.1'), "1.e+.1"), + (StringTag('1.e+.1D'), "1.e+.1D"), + (StringTag('1.e+.1F'), "1.e+.1F"), + (StringTag('1.e+.1d'), "1.e+.1d"), + (StringTag('1.e+.1f'), "1.e+.1f"), + (StringTag('1.e+.D'), "1.e+.D"), + (StringTag('1.e+.F'), "1.e+.F"), + (StringTag('1.e+.d'), "1.e+.d"), + (StringTag('1.e+.f'), "1.e+.f"), + (DoubleTag(10.000000), "1.e+1"), + (StringTag('1.e+1.'), "1.e+1."), + (StringTag('1.e+1.1'), "1.e+1.1"), + (StringTag('1.e+1.1D'), "1.e+1.1D"), + (StringTag('1.e+1.1F'), "1.e+1.1F"), + (StringTag('1.e+1.1d'), "1.e+1.1d"), + (StringTag('1.e+1.1f'), "1.e+1.1f"), + (StringTag('1.e+1.D'), "1.e+1.D"), + (StringTag('1.e+1.F'), "1.e+1.F"), + (StringTag('1.e+1.d'), "1.e+1.d"), + (StringTag('1.e+1.f'), "1.e+1.f"), + (DoubleTag(10.000000), "1.e+1D"), + (FloatTag(10.000000), "1.e+1F"), + (DoubleTag(10.000000), "1.e+1d"), + (FloatTag(10.000000), "1.e+1f"), + (StringTag('1.e+D'), "1.e+D"), + (StringTag('1.e+F'), "1.e+F"), + (StringTag('1.e+d'), "1.e+d"), + (StringTag('1.e+f'), "1.e+f"), + (StringTag('1.e-'), "1.e-"), + (StringTag('1.e-.'), "1.e-."), + (StringTag('1.e-.1'), "1.e-.1"), + (StringTag('1.e-.1D'), "1.e-.1D"), + (StringTag('1.e-.1F'), "1.e-.1F"), + (StringTag('1.e-.1d'), "1.e-.1d"), + (StringTag('1.e-.1f'), "1.e-.1f"), + (StringTag('1.e-.D'), "1.e-.D"), + (StringTag('1.e-.F'), "1.e-.F"), + (StringTag('1.e-.d'), "1.e-.d"), + (StringTag('1.e-.f'), "1.e-.f"), + (DoubleTag(0.100000), "1.e-1"), + (StringTag('1.e-1.'), "1.e-1."), + (StringTag('1.e-1.1'), "1.e-1.1"), + (StringTag('1.e-1.1D'), "1.e-1.1D"), + (StringTag('1.e-1.1F'), "1.e-1.1F"), + (StringTag('1.e-1.1d'), "1.e-1.1d"), + (StringTag('1.e-1.1f'), "1.e-1.1f"), + (StringTag('1.e-1.D'), "1.e-1.D"), + (StringTag('1.e-1.F'), "1.e-1.F"), + (StringTag('1.e-1.d'), "1.e-1.d"), + (StringTag('1.e-1.f'), "1.e-1.f"), + (DoubleTag(0.100000), "1.e-1D"), + (FloatTag(0.100000), "1.e-1F"), + (DoubleTag(0.100000), "1.e-1d"), + (FloatTag(0.100000), "1.e-1f"), + (StringTag('1.e-D'), "1.e-D"), + (StringTag('1.e-F'), "1.e-F"), + (StringTag('1.e-d'), "1.e-d"), + (StringTag('1.e-f'), "1.e-f"), + (StringTag('1.e.'), "1.e."), + (StringTag('1.e.1'), "1.e.1"), + (StringTag('1.e.1D'), "1.e.1D"), + (StringTag('1.e.1F'), "1.e.1F"), + (StringTag('1.e.1d'), "1.e.1d"), + (StringTag('1.e.1f'), "1.e.1f"), + (StringTag('1.e.D'), "1.e.D"), + (StringTag('1.e.F'), "1.e.F"), + (StringTag('1.e.d'), "1.e.d"), + (StringTag('1.e.f'), "1.e.f"), + (DoubleTag(10.000000), "1.e1"), + (StringTag('1.e1.'), "1.e1."), + (StringTag('1.e1.1'), "1.e1.1"), + (StringTag('1.e1.1D'), "1.e1.1D"), + (StringTag('1.e1.1F'), "1.e1.1F"), + (StringTag('1.e1.1d'), "1.e1.1d"), + (StringTag('1.e1.1f'), "1.e1.1f"), + (StringTag('1.e1.D'), "1.e1.D"), + (StringTag('1.e1.F'), "1.e1.F"), + (StringTag('1.e1.d'), "1.e1.d"), + (StringTag('1.e1.f'), "1.e1.f"), + (DoubleTag(10.000000), "1.e1D"), + (FloatTag(10.000000), "1.e1F"), + (DoubleTag(10.000000), "1.e1d"), + (FloatTag(10.000000), "1.e1f"), + (StringTag('1.eD'), "1.eD"), + (StringTag('1.eF'), "1.eF"), + (StringTag('1.ed'), "1.ed"), + (StringTag('1.ef'), "1.ef"), + (FloatTag(1.000000), "1.f"), + (IntTag(11), "11"), + (DoubleTag(11.000000), "11."), + (DoubleTag(11.100000), "11.1"), + (DoubleTag(11.100000), "11.1D"), + (FloatTag(11.100000), "11.1F"), + (DoubleTag(11.100000), "11.1d"), + (FloatTag(11.100000), "11.1f"), + (DoubleTag(11.000000), "11.D"), + (FloatTag(11.000000), "11.F"), + (DoubleTag(11.000000), "11.d"), + (FloatTag(11.000000), "11.f"), + (DoubleTag(11.000000), "11D"), + (FloatTag(11.000000), "11F"), + (DoubleTag(11.000000), "11d"), + (FloatTag(11.000000), "11f"), + (DoubleTag(1.000000), "1D"), + (StringTag('1E'), "1E"), + (StringTag('1E+'), "1E+"), + (StringTag('1E+.'), "1E+."), + (StringTag('1E+.1'), "1E+.1"), + (StringTag('1E+.1D'), "1E+.1D"), + (StringTag('1E+.1F'), "1E+.1F"), + (StringTag('1E+.1d'), "1E+.1d"), + (StringTag('1E+.1f'), "1E+.1f"), + (StringTag('1E+.D'), "1E+.D"), + (StringTag('1E+.F'), "1E+.F"), + (StringTag('1E+.d'), "1E+.d"), + (StringTag('1E+.f'), "1E+.f"), + (StringTag('1E+1'), "1E+1"), + (StringTag('1E+1.'), "1E+1."), + (StringTag('1E+1.1'), "1E+1.1"), + (StringTag('1E+1.1D'), "1E+1.1D"), + (StringTag('1E+1.1F'), "1E+1.1F"), + (StringTag('1E+1.1d'), "1E+1.1d"), + (StringTag('1E+1.1f'), "1E+1.1f"), + (StringTag('1E+1.D'), "1E+1.D"), + (StringTag('1E+1.F'), "1E+1.F"), + (StringTag('1E+1.d'), "1E+1.d"), + (StringTag('1E+1.f'), "1E+1.f"), + (DoubleTag(10.000000), "1E+1D"), + (FloatTag(10.000000), "1E+1F"), + (DoubleTag(10.000000), "1E+1d"), + (FloatTag(10.000000), "1E+1f"), + (StringTag('1E+D'), "1E+D"), + (StringTag('1E+F'), "1E+F"), + (StringTag('1E+d'), "1E+d"), + (StringTag('1E+f'), "1E+f"), + (StringTag('1E-'), "1E-"), + (StringTag('1E-.'), "1E-."), + (StringTag('1E-.1'), "1E-.1"), + (StringTag('1E-.1D'), "1E-.1D"), + (StringTag('1E-.1F'), "1E-.1F"), + (StringTag('1E-.1d'), "1E-.1d"), + (StringTag('1E-.1f'), "1E-.1f"), + (StringTag('1E-.D'), "1E-.D"), + (StringTag('1E-.F'), "1E-.F"), + (StringTag('1E-.d'), "1E-.d"), + (StringTag('1E-.f'), "1E-.f"), + (StringTag('1E-1'), "1E-1"), + (StringTag('1E-1.'), "1E-1."), + (StringTag('1E-1.1'), "1E-1.1"), + (StringTag('1E-1.1D'), "1E-1.1D"), + (StringTag('1E-1.1F'), "1E-1.1F"), + (StringTag('1E-1.1d'), "1E-1.1d"), + (StringTag('1E-1.1f'), "1E-1.1f"), + (StringTag('1E-1.D'), "1E-1.D"), + (StringTag('1E-1.F'), "1E-1.F"), + (StringTag('1E-1.d'), "1E-1.d"), + (StringTag('1E-1.f'), "1E-1.f"), + (DoubleTag(0.100000), "1E-1D"), + (FloatTag(0.100000), "1E-1F"), + (DoubleTag(0.100000), "1E-1d"), + (FloatTag(0.100000), "1E-1f"), + (StringTag('1E-D'), "1E-D"), + (StringTag('1E-F'), "1E-F"), + (StringTag('1E-d'), "1E-d"), + (StringTag('1E-f'), "1E-f"), + (StringTag('1E.'), "1E."), + (StringTag('1E.1'), "1E.1"), + (StringTag('1E.1D'), "1E.1D"), + (StringTag('1E.1F'), "1E.1F"), + (StringTag('1E.1d'), "1E.1d"), + (StringTag('1E.1f'), "1E.1f"), + (StringTag('1E.D'), "1E.D"), + (StringTag('1E.F'), "1E.F"), + (StringTag('1E.d'), "1E.d"), + (StringTag('1E.f'), "1E.f"), + (StringTag('1E1'), "1E1"), + (StringTag('1E1.'), "1E1."), + (StringTag('1E1.1'), "1E1.1"), + (StringTag('1E1.1D'), "1E1.1D"), + (StringTag('1E1.1F'), "1E1.1F"), + (StringTag('1E1.1d'), "1E1.1d"), + (StringTag('1E1.1f'), "1E1.1f"), + (StringTag('1E1.D'), "1E1.D"), + (StringTag('1E1.F'), "1E1.F"), + (StringTag('1E1.d'), "1E1.d"), + (StringTag('1E1.f'), "1E1.f"), + (DoubleTag(10.000000), "1E1D"), + (FloatTag(10.000000), "1E1F"), + (DoubleTag(10.000000), "1E1d"), + (FloatTag(10.000000), "1E1f"), + (StringTag('1ED'), "1ED"), + (StringTag('1EF'), "1EF"), + (StringTag('1Ed'), "1Ed"), + (StringTag('1Ef'), "1Ef"), + (FloatTag(1.000000), "1F"), + (DoubleTag(1.000000), "1d"), + (StringTag('1e'), "1e"), + (StringTag('1e+'), "1e+"), + (StringTag('1e+.'), "1e+."), + (StringTag('1e+.1'), "1e+.1"), + (StringTag('1e+.1D'), "1e+.1D"), + (StringTag('1e+.1F'), "1e+.1F"), + (StringTag('1e+.1d'), "1e+.1d"), + (StringTag('1e+.1f'), "1e+.1f"), + (StringTag('1e+.D'), "1e+.D"), + (StringTag('1e+.F'), "1e+.F"), + (StringTag('1e+.d'), "1e+.d"), + (StringTag('1e+.f'), "1e+.f"), + (StringTag('1e+1'), "1e+1"), + (StringTag('1e+1.'), "1e+1."), + (StringTag('1e+1.1'), "1e+1.1"), + (StringTag('1e+1.1D'), "1e+1.1D"), + (StringTag('1e+1.1F'), "1e+1.1F"), + (StringTag('1e+1.1d'), "1e+1.1d"), + (StringTag('1e+1.1f'), "1e+1.1f"), + (StringTag('1e+1.D'), "1e+1.D"), + (StringTag('1e+1.F'), "1e+1.F"), + (StringTag('1e+1.d'), "1e+1.d"), + (StringTag('1e+1.f'), "1e+1.f"), + (DoubleTag(10.000000), "1e+1D"), + (FloatTag(10.000000), "1e+1F"), + (DoubleTag(10.000000), "1e+1d"), + (FloatTag(10.000000), "1e+1f"), + (StringTag('1e+D'), "1e+D"), + (StringTag('1e+F'), "1e+F"), + (StringTag('1e+d'), "1e+d"), + (StringTag('1e+f'), "1e+f"), + (StringTag('1e-'), "1e-"), + (StringTag('1e-.'), "1e-."), + (StringTag('1e-.1'), "1e-.1"), + (StringTag('1e-.1D'), "1e-.1D"), + (StringTag('1e-.1F'), "1e-.1F"), + (StringTag('1e-.1d'), "1e-.1d"), + (StringTag('1e-.1f'), "1e-.1f"), + (StringTag('1e-.D'), "1e-.D"), + (StringTag('1e-.F'), "1e-.F"), + (StringTag('1e-.d'), "1e-.d"), + (StringTag('1e-.f'), "1e-.f"), + (StringTag('1e-1'), "1e-1"), + (StringTag('1e-1.'), "1e-1."), + (StringTag('1e-1.1'), "1e-1.1"), + (StringTag('1e-1.1D'), "1e-1.1D"), + (StringTag('1e-1.1F'), "1e-1.1F"), + (StringTag('1e-1.1d'), "1e-1.1d"), + (StringTag('1e-1.1f'), "1e-1.1f"), + (StringTag('1e-1.D'), "1e-1.D"), + (StringTag('1e-1.F'), "1e-1.F"), + (StringTag('1e-1.d'), "1e-1.d"), + (StringTag('1e-1.f'), "1e-1.f"), + (DoubleTag(0.100000), "1e-1D"), + (FloatTag(0.100000), "1e-1F"), + (DoubleTag(0.100000), "1e-1d"), + (FloatTag(0.100000), "1e-1f"), + (StringTag('1e-D'), "1e-D"), + (StringTag('1e-F'), "1e-F"), + (StringTag('1e-d'), "1e-d"), + (StringTag('1e-f'), "1e-f"), + (StringTag('1e.'), "1e."), + (StringTag('1e.1'), "1e.1"), + (StringTag('1e.1D'), "1e.1D"), + (StringTag('1e.1F'), "1e.1F"), + (StringTag('1e.1d'), "1e.1d"), + (StringTag('1e.1f'), "1e.1f"), + (StringTag('1e.D'), "1e.D"), + (StringTag('1e.F'), "1e.F"), + (StringTag('1e.d'), "1e.d"), + (StringTag('1e.f'), "1e.f"), + (StringTag('1e1'), "1e1"), + (StringTag('1e1.'), "1e1."), + (StringTag('1e1.1'), "1e1.1"), + (StringTag('1e1.1D'), "1e1.1D"), + (StringTag('1e1.1F'), "1e1.1F"), + (StringTag('1e1.1d'), "1e1.1d"), + (StringTag('1e1.1f'), "1e1.1f"), + (StringTag('1e1.D'), "1e1.D"), + (StringTag('1e1.F'), "1e1.F"), + (StringTag('1e1.d'), "1e1.d"), + (StringTag('1e1.f'), "1e1.f"), + (DoubleTag(10.000000), "1e1D"), + (FloatTag(10.000000), "1e1F"), + (DoubleTag(10.000000), "1e1d"), + (FloatTag(10.000000), "1e1f"), + (StringTag('1eD'), "1eD"), + (StringTag('1eF'), "1eF"), + (StringTag('1ed'), "1ed"), + (StringTag('1ef'), "1ef"), + (FloatTag(1.000000), "1f"), + (StringTag('D'), "D"), + (StringTag('E'), "E"), + (StringTag('E+'), "E+"), + (StringTag('E+.'), "E+."), + (StringTag('E+.1'), "E+.1"), + (StringTag('E+.1D'), "E+.1D"), + (StringTag('E+.1F'), "E+.1F"), + (StringTag('E+.1d'), "E+.1d"), + (StringTag('E+.1f'), "E+.1f"), + (StringTag('E+.D'), "E+.D"), + (StringTag('E+.F'), "E+.F"), + (StringTag('E+.d'), "E+.d"), + (StringTag('E+.f'), "E+.f"), + (StringTag('E+1'), "E+1"), + (StringTag('E+1.'), "E+1."), + (StringTag('E+1.1'), "E+1.1"), + (StringTag('E+1.1D'), "E+1.1D"), + (StringTag('E+1.1F'), "E+1.1F"), + (StringTag('E+1.1d'), "E+1.1d"), + (StringTag('E+1.1f'), "E+1.1f"), + (StringTag('E+1.D'), "E+1.D"), + (StringTag('E+1.F'), "E+1.F"), + (StringTag('E+1.d'), "E+1.d"), + (StringTag('E+1.f'), "E+1.f"), + (StringTag('E+1D'), "E+1D"), + (StringTag('E+1F'), "E+1F"), + (StringTag('E+1d'), "E+1d"), + (StringTag('E+1f'), "E+1f"), + (StringTag('E+D'), "E+D"), + (StringTag('E+F'), "E+F"), + (StringTag('E+d'), "E+d"), + (StringTag('E+f'), "E+f"), + (StringTag('E-'), "E-"), + (StringTag('E-.'), "E-."), + (StringTag('E-.1'), "E-.1"), + (StringTag('E-.1D'), "E-.1D"), + (StringTag('E-.1F'), "E-.1F"), + (StringTag('E-.1d'), "E-.1d"), + (StringTag('E-.1f'), "E-.1f"), + (StringTag('E-.D'), "E-.D"), + (StringTag('E-.F'), "E-.F"), + (StringTag('E-.d'), "E-.d"), + (StringTag('E-.f'), "E-.f"), + (StringTag('E-1'), "E-1"), + (StringTag('E-1.'), "E-1."), + (StringTag('E-1.1'), "E-1.1"), + (StringTag('E-1.1D'), "E-1.1D"), + (StringTag('E-1.1F'), "E-1.1F"), + (StringTag('E-1.1d'), "E-1.1d"), + (StringTag('E-1.1f'), "E-1.1f"), + (StringTag('E-1.D'), "E-1.D"), + (StringTag('E-1.F'), "E-1.F"), + (StringTag('E-1.d'), "E-1.d"), + (StringTag('E-1.f'), "E-1.f"), + (StringTag('E-1D'), "E-1D"), + (StringTag('E-1F'), "E-1F"), + (StringTag('E-1d'), "E-1d"), + (StringTag('E-1f'), "E-1f"), + (StringTag('E-D'), "E-D"), + (StringTag('E-F'), "E-F"), + (StringTag('E-d'), "E-d"), + (StringTag('E-f'), "E-f"), + (StringTag('E.'), "E."), + (StringTag('E.1'), "E.1"), + (StringTag('E.1D'), "E.1D"), + (StringTag('E.1F'), "E.1F"), + (StringTag('E.1d'), "E.1d"), + (StringTag('E.1f'), "E.1f"), + (StringTag('E.D'), "E.D"), + (StringTag('E.F'), "E.F"), + (StringTag('E.d'), "E.d"), + (StringTag('E.f'), "E.f"), + (StringTag('E1'), "E1"), + (StringTag('E1.'), "E1."), + (StringTag('E1.1'), "E1.1"), + (StringTag('E1.1D'), "E1.1D"), + (StringTag('E1.1F'), "E1.1F"), + (StringTag('E1.1d'), "E1.1d"), + (StringTag('E1.1f'), "E1.1f"), + (StringTag('E1.D'), "E1.D"), + (StringTag('E1.F'), "E1.F"), + (StringTag('E1.d'), "E1.d"), + (StringTag('E1.f'), "E1.f"), + (StringTag('E1D'), "E1D"), + (StringTag('E1F'), "E1F"), + (StringTag('E1d'), "E1d"), + (StringTag('E1f'), "E1f"), + (StringTag('ED'), "ED"), + (StringTag('EF'), "EF"), + (StringTag('Ed'), "Ed"), + (StringTag('Ef'), "Ef"), + (StringTag('F'), "F"), + (StringTag('d'), "d"), + (StringTag('e'), "e"), + (StringTag('e+'), "e+"), + (StringTag('e+.'), "e+."), + (StringTag('e+.1'), "e+.1"), + (StringTag('e+.1D'), "e+.1D"), + (StringTag('e+.1F'), "e+.1F"), + (StringTag('e+.1d'), "e+.1d"), + (StringTag('e+.1f'), "e+.1f"), + (StringTag('e+.D'), "e+.D"), + (StringTag('e+.F'), "e+.F"), + (StringTag('e+.d'), "e+.d"), + (StringTag('e+.f'), "e+.f"), + (StringTag('e+1'), "e+1"), + (StringTag('e+1.'), "e+1."), + (StringTag('e+1.1'), "e+1.1"), + (StringTag('e+1.1D'), "e+1.1D"), + (StringTag('e+1.1F'), "e+1.1F"), + (StringTag('e+1.1d'), "e+1.1d"), + (StringTag('e+1.1f'), "e+1.1f"), + (StringTag('e+1.D'), "e+1.D"), + (StringTag('e+1.F'), "e+1.F"), + (StringTag('e+1.d'), "e+1.d"), + (StringTag('e+1.f'), "e+1.f"), + (StringTag('e+1D'), "e+1D"), + (StringTag('e+1F'), "e+1F"), + (StringTag('e+1d'), "e+1d"), + (StringTag('e+1f'), "e+1f"), + (StringTag('e+D'), "e+D"), + (StringTag('e+F'), "e+F"), + (StringTag('e+d'), "e+d"), + (StringTag('e+f'), "e+f"), + (StringTag('e-'), "e-"), + (StringTag('e-.'), "e-."), + (StringTag('e-.1'), "e-.1"), + (StringTag('e-.1D'), "e-.1D"), + (StringTag('e-.1F'), "e-.1F"), + (StringTag('e-.1d'), "e-.1d"), + (StringTag('e-.1f'), "e-.1f"), + (StringTag('e-.D'), "e-.D"), + (StringTag('e-.F'), "e-.F"), + (StringTag('e-.d'), "e-.d"), + (StringTag('e-.f'), "e-.f"), + (StringTag('e-1'), "e-1"), + (StringTag('e-1.'), "e-1."), + (StringTag('e-1.1'), "e-1.1"), + (StringTag('e-1.1D'), "e-1.1D"), + (StringTag('e-1.1F'), "e-1.1F"), + (StringTag('e-1.1d'), "e-1.1d"), + (StringTag('e-1.1f'), "e-1.1f"), + (StringTag('e-1.D'), "e-1.D"), + (StringTag('e-1.F'), "e-1.F"), + (StringTag('e-1.d'), "e-1.d"), + (StringTag('e-1.f'), "e-1.f"), + (StringTag('e-1D'), "e-1D"), + (StringTag('e-1F'), "e-1F"), + (StringTag('e-1d'), "e-1d"), + (StringTag('e-1f'), "e-1f"), + (StringTag('e-D'), "e-D"), + (StringTag('e-F'), "e-F"), + (StringTag('e-d'), "e-d"), + (StringTag('e-f'), "e-f"), + (StringTag('e.'), "e."), + (StringTag('e.1'), "e.1"), + (StringTag('e.1D'), "e.1D"), + (StringTag('e.1F'), "e.1F"), + (StringTag('e.1d'), "e.1d"), + (StringTag('e.1f'), "e.1f"), + (StringTag('e.D'), "e.D"), + (StringTag('e.F'), "e.F"), + (StringTag('e.d'), "e.d"), + (StringTag('e.f'), "e.f"), + (StringTag('e1'), "e1"), + (StringTag('e1.'), "e1."), + (StringTag('e1.1'), "e1.1"), + (StringTag('e1.1D'), "e1.1D"), + (StringTag('e1.1F'), "e1.1F"), + (StringTag('e1.1d'), "e1.1d"), + (StringTag('e1.1f'), "e1.1f"), + (StringTag('e1.D'), "e1.D"), + (StringTag('e1.F'), "e1.F"), + (StringTag('e1.d'), "e1.d"), + (StringTag('e1.f'), "e1.f"), + (StringTag('e1D'), "e1D"), + (StringTag('e1F'), "e1F"), + (StringTag('e1d'), "e1d"), + (StringTag('e1f'), "e1f"), + (StringTag('eD'), "eD"), + (StringTag('eF'), "eF"), + (StringTag('ed'), "ed"), + (StringTag('ef'), "ef"), + (StringTag('f'), "f"), ] for tag, snbt in float_data: From 774763a5fc65a82b19bda6feb7286ec79b457c0c Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Thu, 11 Jul 2024 11:20:57 +0100 Subject: [PATCH 073/121] Added int, float and string SNBT parsing --- .../cpp/nbt_encoding/string/read.cpp | 178 +++++++++++++++++- 1 file changed, 168 insertions(+), 10 deletions(-) diff --git a/src/amulet_nbt/cpp/nbt_encoding/string/read.cpp b/src/amulet_nbt/cpp/nbt_encoding/string/read.cpp index 6f811672..9314abcf 100644 --- a/src/amulet_nbt/cpp/nbt_encoding/string/read.cpp +++ b/src/amulet_nbt/cpp/nbt_encoding/string/read.cpp @@ -8,6 +8,11 @@ const std::set Whitespace{' ', '\t', '\r', '\n'}; +const std::set AlphaNumPlus{'+', '-', '.', '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'}; +const Amulet::CodePointVector false_text{'f', 'a', 'l', 's', 'e'}; +const Amulet::ByteTag byte_false = 0; +const Amulet::CodePointVector true_text{'t', 'r', 'u', 'e'}; +const Amulet::ByteTag byte_true = 1; inline bool in_range(const Amulet::CodePointVector& snbt, const size_t& index){ @@ -36,12 +41,55 @@ inline size_t read_code_point(const Amulet::CodePointVector& snbt, const size_t& return snbt[index]; } -inline std::pair read_string(const Amulet::CodePointVector& snbt, size_t& index){ - throw std::exception("not implemented"); +inline std::string read_error(const Amulet::CodePointVector& snbt, const size_t& index){ + return Amulet::write_utf8(Amulet::CodePointVector(snbt.begin() + index, snbt.begin() + std::min(index + 10, snbt.size()))); } -inline std::string read_error(const Amulet::CodePointVector& snbt, size_t& index){ - return Amulet::write_utf8(Amulet::CodePointVector(snbt.begin() + index, snbt.begin() + std::min(index + 10, snbt.size()))); +inline std::pair read_string(const Amulet::CodePointVector& snbt, size_t& index){ + size_t quote_code = read_code_point(snbt, index); + if (quote_code == '"' || quote_code == '\''){ + // quoted string + index++; + Amulet::CodePointVector string; + bool escaped = false; + while (true){ + size_t code = read_code_point(snbt, index); + if (code == '\\'){ + if (escaped){ + string.push_back('\\'); + escaped = false; + } else { + escaped = true; + } + } else if (code == quote_code){ + if (escaped){ + // found an escaped quote + string.push_back(quote_code); + escaped = false; + } else { + // found the closing quote + index++; + break; + } + } else if (escaped){ + throw std::invalid_argument("Invalid escape sequence " + read_error(snbt, index-1) + " at position " + std::to_string(index)); + } else { + string.push_back(code); + } + index++; + } + return std::make_pair(string, true); + } else { + // unquoted string + size_t start = index; + while (in_range(snbt, index) && AlphaNumPlus.contains(snbt[index])){ + index++; + } + return std::make_pair( + Amulet::CodePointVector(snbt.begin() + start, snbt.begin() + index), + true + ); + } } inline void read_colon(const Amulet::CodePointVector& snbt, size_t& index){ @@ -67,8 +115,8 @@ inline void read_comma(const Amulet::CodePointVector& snbt, size_t& index, unsig inline std::pair find_int(const Amulet::CodePointVector& snbt, const size_t& index){ // Find an int at position index. - // If an int is found the return value will be the start and end position of the int - // If a valid int was not found the values will be equal. + // If an int is found, the return value will be the start and end position of the int + // If a valid int was not found, the values will be equal. size_t start = index; size_t temp_index = index; if (in_range(snbt, temp_index) && (snbt[temp_index] == '+' || snbt[temp_index] == '-')){ @@ -95,6 +143,69 @@ inline T read_int(const Amulet::CodePointVector& snbt, size_t start, size_t stop } +inline std::pair find_float(const Amulet::CodePointVector& snbt, const size_t& index){ + // Find a float at position index. + // If an float is found, the return value will be the start and end position of the float + // If a valid float was not found, the values will be equal. + size_t start = index; + size_t temp_index = index; + // read optional sign + if (in_range(snbt, temp_index) && (snbt[temp_index] == '+' || snbt[temp_index] == '-')){ + temp_index++; + } + size_t whole_start = temp_index; + // read leading numbers + while (in_range(snbt, temp_index) && '0' <= snbt[temp_index] && snbt[temp_index] <= '9'){ + temp_index++; + } + size_t whole_end = temp_index; + // read decimal + if (in_range(snbt, temp_index) && snbt[temp_index] == '.'){ + temp_index++; + size_t decimal_start = temp_index; + while (in_range(snbt, temp_index) && '0' <= snbt[temp_index] && snbt[temp_index] <= '9'){ + temp_index++; + } + if (decimal_start == temp_index && whole_start == whole_end){ + // no whole or decimal numbers + return std::make_pair(start, temp_index); + } + } else if (whole_start == whole_end){ + // no decimal so there must be at least one whole number + return std::make_pair(start, start); + } + // read optional exponent + if (in_range(snbt, temp_index) && (snbt[temp_index] & ~32) == 'E'){ + temp_index++; + // read optional sign + if (in_range(snbt, temp_index) && (snbt[temp_index] == '+' || snbt[temp_index] == '-')){ + temp_index++; + } + size_t exp_start = temp_index; + while (in_range(snbt, temp_index) && '0' <= snbt[temp_index] && snbt[temp_index] <= '9'){ + temp_index++; + } + if (exp_start == temp_index){ + // if exponent is defined there must be a number. + return std::make_pair(start, start); + } + } + return std::make_pair(start, temp_index); +} + + +template +inline T read_float(const Amulet::CodePointVector& snbt, size_t start, size_t stop){ + std::string text; + Amulet::write_utf8(text, Amulet::CodePointVector(snbt.begin() + start, snbt.begin() + stop)); + if constexpr (std::is_same_v){ + return std::stod(text); + } else { + return std::stof(text); + } +} + + template inline Amulet::TagNode read_array(const Amulet::CodePointVector& snbt, size_t& index){ //The caller must have read [ and validated B; but not read it (index must be after "[") @@ -111,12 +222,12 @@ inline Amulet::TagNode read_array(const Amulet::CodePointVector& snbt, size_t& i } if constexpr (std::is_same_v){ if ((read_code_point(snbt, stop) & ~32) != 'B'){ - throw std::invalid_argument("Expected 'B' position " + std::to_string(stop) + " but got ->" + read_error(snbt, index) + " instead"); + throw std::invalid_argument("Expected 'B' position " + std::to_string(stop) + " but got ->" + read_error(snbt, stop) + " instead"); } index = stop + 1; } else if constexpr (std::is_same_v){ if ((read_code_point(snbt, stop) & ~32) != 'L'){ - throw std::invalid_argument("Expected 'L' position " + std::to_string(stop) + " but got ->" + read_error(snbt, index) + " instead"); + throw std::invalid_argument("Expected 'L' position " + std::to_string(stop) + " but got ->" + read_error(snbt, stop) + " instead"); } index = stop + 1; } else { @@ -144,7 +255,7 @@ Amulet::TagNode _read_snbt(const Amulet::CodePointVector& snbt, size_t& index){ auto tag = std::make_shared(); while (read_code_point(snbt, index) != '}'){ // read the key - std::string key = read_string(snbt, index).first; + std::string key = Amulet::write_utf8(read_string(snbt, index).first); // Read past the colon read_colon(snbt, index); @@ -181,7 +292,54 @@ Amulet::TagNode _read_snbt(const Amulet::CodePointVector& snbt, size_t& index){ return std::make_shared(); } default: - throw std::exception("not implemented"); + { + auto [string, is_quoted] = read_string(snbt, index); + if (is_quoted){ + return Amulet::write_utf8(string); + } + if (string.empty()) { + throw std::invalid_argument("Expected data matching [A-Za-z0-9._+-]+ at position " + std::to_string(index) + " but got ->" + read_error(snbt, index) + " instead"); + } + if (string == true_text) { + return byte_true; + } + if (string == false_text) { + return byte_false; + } + + // try matching an int + auto [int_start, int_stop] = find_int(string, 0); + if (int_stop == string.size()){ + // found an int that takes the whole string + return read_int(string, int_start, int_stop); + } else if (int_stop == string.size() - 1) { + switch (string[string.size() - 1] & ~32){ + case 'B': + return read_int(string, int_start, int_stop - 1); + case 'S': + return read_int(string, int_start, int_stop - 1); + case 'L': + return read_int(string, int_start, int_stop - 1); + } + } + + // if not an int, try matching a float + auto [float_start, float_stop] = find_float(string, 0); + if (float_stop == string.size()){ + // found an int that takes the whole string + return read_float(string, float_start, float_stop); + } else if (float_stop == string.size() - 1) { + switch (string[string.size() - 1] & ~32){ + case 'F': + return read_float(string, float_start, float_stop - 1); + case 'D': + return read_float(string, float_start, float_stop - 1); + } + } + + // if none of the above, return as string + return Amulet::write_utf8(string); + } } } From 2827e77a54ff2625dada4f7b17b7a1a8074414e3 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Thu, 11 Jul 2024 20:32:43 +0100 Subject: [PATCH 074/121] Removed numpy build-time dependency Apparently pybind does not need numpy at compile time. --- pyproject.toml | 1 - setup.py | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 5e458287..d6536fc9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,6 @@ requires = [ "setuptools >= 42", "wheel", "versioneer", - "numpy ~= 2.0", "pybind11 ~= 2.12", ] build-backend = "setuptools.build_meta" diff --git a/setup.py b/setup.py index c98d796e..b69083b0 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,5 @@ from setuptools import setup, Extension import versioneer -import numpy import sysconfig from distutils import ccompiler import sys @@ -33,7 +32,7 @@ Extension( name="amulet_nbt._nbt", sources=glob.glob("src/amulet_nbt/pybind/**/*.cpp", recursive=True), - include_dirs=["src/amulet_nbt/include", numpy.get_include(), pybind11.get_include()], + include_dirs=["src/amulet_nbt/include", pybind11.get_include()], libraries=["amulet_nbt"], define_macros=[("PYBIND11_DETAILED_ERROR_MESSAGES", None)], extra_compile_args=CompileArgs From e0ce2cf3c4d7acc198c81931f7b2417bcee3f8a3 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Thu, 11 Jul 2024 20:33:09 +0100 Subject: [PATCH 075/121] Modified numpy requirement This library should work with both versions of numpy --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index a0e6627f..375528df 100644 --- a/setup.cfg +++ b/setup.cfg @@ -19,7 +19,7 @@ packages = find_namespace: zip_safe = False python_requires = ~=3.11 install_requires = - numpy ~= 2.0 + numpy >= 1.17, < 3.0 [options.packages.find] where=src From 4909ef6f9b4d3115eb4b334e63b8a2ae44eebdf1 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Thu, 11 Jul 2024 20:34:16 +0100 Subject: [PATCH 076/121] Remove python errors --- docs_source/index.rst | 13 ------ src/amulet_nbt/__init__.pyi | 12 ++---- src/amulet_nbt/pybind/bnbt.cpp | 8 ++-- tests/test_amulet_nbt/test_tag/test_array.py | 42 +++++++++---------- .../test_amulet_nbt/test_tag/test_compound.py | 18 ++++---- tests/test_amulet_nbt/test_tag/test_list.py | 24 +++++------ tests/test_amulet_nbt/test_tag/test_string.py | 6 +-- tests/test_load/test_load.py | 9 ++-- 8 files changed, 53 insertions(+), 79 deletions(-) diff --git a/docs_source/index.rst b/docs_source/index.rst index 1727ff7f..1a485a00 100644 --- a/docs_source/index.rst +++ b/docs_source/index.rst @@ -193,19 +193,6 @@ These are functions to load the binary and stringified NBT formats. .. autofunction:: amulet_nbt.read_snbt -############ - Exceptions -############ - -.. autoexception:: amulet_nbt.NBTError -.. autoexception:: amulet_nbt.NBTLoadError - :show-inheritance: -.. autoexception:: amulet_nbt.NBTFormatError - :show-inheritance: -.. autoexception:: amulet_nbt.SNBTParseError - :show-inheritance: - - ################# String Encoding ################# diff --git a/src/amulet_nbt/__init__.pyi b/src/amulet_nbt/__init__.pyi index 3be7a42f..333e86ca 100644 --- a/src/amulet_nbt/__init__.pyi +++ b/src/amulet_nbt/__init__.pyi @@ -62,10 +62,6 @@ __all__ = [ "read_nbt_array", "ReadOffset", "read_snbt", - "NBTError", - "NBTLoadError", - "NBTFormatError", - "SNBTParseError", "SNBTType", "IntType", "FloatType", @@ -1602,7 +1598,7 @@ def read_nbt( :param filepath_or_buffer: A string path to a file on disk, a bytes or memory view object containing the binary NBT or a file-like object to read the binary data from. :param preset: The encoding preset. If this is defined little_endian and string_encoding have no effect. :param read_offset: Optional ReadOffset object to get read end offset. - :raises: NBTLoadError if an error occurred when loading the data. + :raises: IndexError if the data is not long enough. """ @overload @@ -1621,7 +1617,7 @@ def read_nbt( :param little_endian: Are the numerical values stored as little endian. True for Bedrock, False for Java. :param string_encoding: The bytes decoder function to parse strings. mutf8_encoding for Java, utf8_escape_encoding for Bedrock. :param read_offset: Optional ReadOffset object to get read end offset. - :raises: NBTLoadError if an error occurred when loading the data. + :raises: IndexError if the data is not long enough. """ @overload @@ -1638,7 +1634,7 @@ def read_nbt_array( :param count: The number of binary NBT objects to read. Use -1 to exhaust the buffer. :param preset: The encoding preset. If this is defined little_endian and string_encoding have no effect. :param read_offset: Optional ReadOffset object to get read end offset. - :raises: NBTLoadError if an error occurred when loading the data. + :raises: IndexError if the data is not long enough. """ @overload @@ -1659,7 +1655,7 @@ def read_nbt_array( :param little_endian: Are the numerical values stored as little endian. True for Bedrock, False for Java. :param string_encoding: The bytes decoder function to parse strings. mutf8.decode_modified_utf8 for Java, amulet_nbt.utf8_escape_decoder for Bedrock. :param read_offset: Optional ReadOffset object to get read end offset. - :raises: NBTLoadError if an error occurred when loading the data. + :raises: IndexError if the data is not long enough. """ def read_snbt(snbt: str) -> AnyNBT: diff --git a/src/amulet_nbt/pybind/bnbt.cpp b/src/amulet_nbt/pybind/bnbt.cpp index be02bfef..9426fb51 100644 --- a/src/amulet_nbt/pybind/bnbt.cpp +++ b/src/amulet_nbt/pybind/bnbt.cpp @@ -131,7 +131,7 @@ void init_bnbt(py::module& m) { ":param filepath_or_buffer: A string path to a file on disk, a bytes or memory view object containing the binary NBT or a file-like object to read the binary data from.\n" ":param preset: The encoding preset. If this is defined little_endian and string_encoding have no effect.\n" ":param read_offset: Optional ReadOffset object to get read end offset.\n" - ":raises: NBTLoadError if an error occurred when loading the data." + ":raises: IndexError if the data is not long enough." ) ); m.def( @@ -165,7 +165,7 @@ void init_bnbt(py::module& m) { ":param little_endian: Are the numerical values stored as little endian. True for Bedrock, False for Java.\n" ":param string_encoding: The bytes decoder function to parse strings. mutf8_encoding for Java, utf8_escape_encoding for Bedrock.\n" ":param read_offset: Optional ReadOffset object to get read end offset.\n" - ":raises: NBTLoadError if an error occurred when loading the data." + ":raises: IndexError if the data is not long enough." ) ); @@ -250,7 +250,7 @@ void init_bnbt(py::module& m) { ":param count: The number of binary NBT objects to read. Use -1 to exhaust the buffer.\n" ":param preset: The encoding preset. If this is defined little_endian and string_encoding have no effect.\n" ":param read_offset: Optional ReadOffset object to get read end offset.\n" - ":raises: NBTLoadError if an error occurred when loading the data." + ":raises: IndexError if the data is not long enough." ) ); @@ -289,7 +289,7 @@ void init_bnbt(py::module& m) { ":param little_endian: Are the numerical values stored as little endian. True for Bedrock, False for Java.\n" ":param string_encoding: The bytes decoder function to parse strings. mutf8.decode_modified_utf8 for Java, amulet_nbt.utf8_escape_decoder for Bedrock.\n" ":param read_offset: Optional ReadOffset object to get read end offset.\n" - ":raises: NBTLoadError if an error occurred when loading the data." + ":raises: IndexError if the data is not long enough." ) ); } diff --git a/tests/test_amulet_nbt/test_tag/test_array.py b/tests/test_amulet_nbt/test_tag/test_array.py index 0259367b..59425dc0 100644 --- a/tests/test_amulet_nbt/test_tag/test_array.py +++ b/tests/test_amulet_nbt/test_tag/test_array.py @@ -17,8 +17,6 @@ IntArrayTag, LongArrayTag, read_nbt, - NBTFormatError, - SNBTParseError, read_snbt, ) @@ -234,23 +232,23 @@ def test_from_nbt(self) -> None: little_endian=True, ).byte_array, ) - with self.assertRaises(NBTFormatError): + with self.assertRaises(IndexError): read_nbt( b"\x07", ) - with self.assertRaises(NBTFormatError): + with self.assertRaises(IndexError): read_nbt( b"\x07\x00\x00", ) - with self.assertRaises(NBTFormatError): + with self.assertRaises(IndexError): read_nbt( b"\x07\x00\x00\x00\x00\x00", ) - with self.assertRaises(NBTFormatError): + with self.assertRaises(IndexError): read_nbt( b"\x07\x00\x00\x00\x00\x00\x01", ) - with self.assertRaises(NBTFormatError): + with self.assertRaises(IndexError): read_nbt( b"\x07\x00\x00\x00\x00\x00\x02\x00", ) @@ -279,23 +277,23 @@ def test_from_nbt(self) -> None: little_endian=True, ).int_array, ) - with self.assertRaises(NBTFormatError): + with self.assertRaises(IndexError): read_nbt( b"\x0B", ) - with self.assertRaises(NBTFormatError): + with self.assertRaises(IndexError): read_nbt( b"\x0B\x00\x00", ) - with self.assertRaises(NBTFormatError): + with self.assertRaises(IndexError): read_nbt( b"\x0B\x00\x00\x00\x00\x00", ) - with self.assertRaises(NBTFormatError): + with self.assertRaises(IndexError): read_nbt( b"\x0B\x00\x00\x00\x00\x00\x01", ) - with self.assertRaises(NBTFormatError): + with self.assertRaises(IndexError): read_nbt( b"\x0B\x00\x00\x00\x00\x00\x02\x00", ) @@ -324,23 +322,23 @@ def test_from_nbt(self) -> None: little_endian=True, ).long_array, ) - with self.assertRaises(NBTFormatError): + with self.assertRaises(IndexError): read_nbt( b"\x0C", ) - with self.assertRaises(NBTFormatError): + with self.assertRaises(IndexError): read_nbt( b"\x0C\x00\x00", ) - with self.assertRaises(NBTFormatError): + with self.assertRaises(IndexError): read_nbt( b"\x0C\x00\x00\x00\x00\x00", ) - with self.assertRaises(NBTFormatError): + with self.assertRaises(IndexError): read_nbt( b"\x0C\x00\x00\x00\x00\x00\x01", ) - with self.assertRaises(NBTFormatError): + with self.assertRaises(IndexError): read_nbt( b"\x0C\x00\x00\x00\x00\x00\x02\x00", ) @@ -376,11 +374,11 @@ def test_from_snbt(self) -> None: ByteArrayTag([-3, -2, -1, 0, 1, 2, 3]), read_snbt("[B;-3B, -2B, -1B, 0B, 1B, 2B, 3B]"), ) - with self.assertRaises(SNBTParseError): + with self.assertRaises(ValueError): read_snbt( "[B;-5, 5]", ) - with self.assertRaises(SNBTParseError): + with self.assertRaises(ValueError): read_snbt( "[B;-5.0B, 5.0B]", ) @@ -391,7 +389,7 @@ def test_from_snbt(self) -> None: IntArrayTag([-3, -2, -1, 0, 1, 2, 3]), read_snbt("[I;-3, -2, -1, 0, 1, 2, 3]"), ) - with self.assertRaises(SNBTParseError): + with self.assertRaises(ValueError): read_snbt( "[I;-5.0, 5.0]", ) @@ -406,11 +404,11 @@ def test_from_snbt(self) -> None: LongArrayTag([-3, -2, -1, 0, 1, 2, 3]), read_snbt("[L;-3L, -2L, -1L, 0L, 1L, 2L, 3L]"), ) - with self.assertRaises(SNBTParseError): + with self.assertRaises(ValueError): read_snbt( "[L;-5, 5]", ) - with self.assertRaises(SNBTParseError): + with self.assertRaises(ValueError): read_snbt( "[L;-5.0L, 5.0L]", ) diff --git a/tests/test_amulet_nbt/test_tag/test_compound.py b/tests/test_amulet_nbt/test_tag/test_compound.py index c640e4ab..c9ea550d 100644 --- a/tests/test_amulet_nbt/test_tag/test_compound.py +++ b/tests/test_amulet_nbt/test_tag/test_compound.py @@ -25,8 +25,6 @@ IntArrayTag, LongArrayTag, read_snbt, - SNBTParseError, - NBTFormatError, read_nbt, ) @@ -822,9 +820,9 @@ def test_from_nbt(self) -> None: ).compound, ) - with self.assertRaises(NBTFormatError): + with self.assertRaises(IndexError): read_nbt(b"\x0A") - with self.assertRaises(NBTFormatError): + with self.assertRaises(IndexError): read_nbt(b"\x0A\x00\x00") def test_to_snbt(self) -> None: @@ -930,17 +928,17 @@ def test_from_snbt(self) -> None: CompoundTag({"1": IntTag(5)}), read_snbt("\n{ \n '1' \n : \n 5 \n }\n") ) - with self.assertRaises(SNBTParseError): + with self.assertRaises(ValueError): read_snbt("{") - with self.assertRaises(SNBTParseError): + with self.assertRaises(ValueError): read_snbt("}") - with self.assertRaises(SNBTParseError): + with self.assertRaises(ValueError): read_snbt("{a:}") - with self.assertRaises(SNBTParseError): + with self.assertRaises(ValueError): read_snbt("{a 5}") - with self.assertRaises(SNBTParseError): + with self.assertRaises(ValueError): read_snbt("{a:5, b:}") - with self.assertRaises(SNBTParseError): + with self.assertRaises(ValueError): read_snbt("{a:5 b:6}") diff --git a/tests/test_amulet_nbt/test_tag/test_list.py b/tests/test_amulet_nbt/test_tag/test_list.py index 8f91e8c8..164eee0a 100644 --- a/tests/test_amulet_nbt/test_tag/test_list.py +++ b/tests/test_amulet_nbt/test_tag/test_list.py @@ -24,9 +24,7 @@ IntArrayTag, LongArrayTag, read_nbt, - NBTFormatError, read_snbt, - SNBTParseError, ) @@ -843,17 +841,17 @@ def test_from_nbt(self) -> None: ListTag([], 1), read_nbt(b"\x09\x00\x00\x01\xFF\xFF\xFF\xFF").list ) - with self.assertRaises(NBTFormatError): + with self.assertRaises(IndexError): read_nbt(b"\x09") - with self.assertRaises(NBTFormatError): + with self.assertRaises(IndexError): read_nbt(b"\x09\x00\x00") - with self.assertRaises(NBTFormatError): + with self.assertRaises(IndexError): read_nbt(b"\x09\x00\x00\x00") - with self.assertRaises(NBTFormatError): + with self.assertRaises(IndexError): read_nbt(b"\x09\x00\x00\x00\x00") - with self.assertRaises(NBTFormatError): + with self.assertRaises(IndexError): read_nbt(b"\x09\x00\x00\x00\x00\x00") - with self.assertRaises(NBTFormatError): + with self.assertRaises(IndexError): read_nbt(b"\x09\x00\x00\x00\x00\x00\x00") def test_to_snbt(self) -> None: @@ -895,15 +893,15 @@ def test_from_snbt(self) -> None: read_snbt(f"[{tag.to_snbt()}, {tag.to_snbt()}]"), ) - with self.assertRaises(SNBTParseError): + with self.assertRaises(ValueError): read_snbt("[") - with self.assertRaises(SNBTParseError): + with self.assertRaises(ValueError): read_snbt("]") - with self.assertRaises(SNBTParseError): + with self.assertRaises(ValueError): read_snbt("[,]") - with self.assertRaises(SNBTParseError): + with self.assertRaises(ValueError): read_snbt("[,1]") - with self.assertRaises(SNBTParseError): + with self.assertRaises(ValueError): read_snbt("[1 1]") diff --git a/tests/test_amulet_nbt/test_tag/test_string.py b/tests/test_amulet_nbt/test_tag/test_string.py index 221071be..7c65574b 100644 --- a/tests/test_amulet_nbt/test_tag/test_string.py +++ b/tests/test_amulet_nbt/test_tag/test_string.py @@ -14,9 +14,7 @@ AbstractBaseImmutableTag, utf8_escape_encoding, read_nbt, - NBTFormatError, read_snbt, - SNBTParseError, ) @@ -212,7 +210,7 @@ def test_from_nbt(self) -> None: ).string, ) - with self.assertRaises(NBTFormatError): + with self.assertRaises(IndexError): read_nbt(b"\x08\x00\x00\x00\x05abcd") def test_to_snbt(self) -> None: @@ -276,7 +274,7 @@ def test_from_snbt(self) -> None: read_snbt(f'"{ascii_uppercase + ascii_lowercase + digits + "._+-"}"'), ) - with self.assertRaises(SNBTParseError): + with self.assertRaises(ValueError): read_snbt("") diff --git a/tests/test_load/test_load.py b/tests/test_load/test_load.py index 3e8f9019..a1cb02fc 100644 --- a/tests/test_load/test_load.py +++ b/tests/test_load/test_load.py @@ -6,7 +6,6 @@ IntTag, read_nbt, read_nbt_array, - NBTLoadError, NamedTag, ) @@ -20,9 +19,9 @@ class LoadTests(unittest.TestCase): def test_load(self) -> None: read_nbt_array(OnePath) - with self.assertRaises(NBTLoadError): + with self.assertRaises(IndexError): read_nbt(EmptyPath) - with self.assertRaises(NBTLoadError): + with self.assertRaises(IndexError): read_nbt_array(EmptyPath, count=1) self.assertEqual([], read_nbt_array(EmptyPath, count=0)) self.assertEqual([], read_nbt_array(EmptyPath, count=-1)) @@ -43,7 +42,7 @@ def test_load(self) -> None: [NamedTag(ListTag([IntTag(1), IntTag(2), IntTag(3), IntTag(4)]))], read_nbt_array(OnePath, count=-1), ) - with self.assertRaises(NBTLoadError): + with self.assertRaises(IndexError): read_nbt_array(OnePath, count=2) self.assertEqual( @@ -85,7 +84,7 @@ def test_load(self) -> None: ], read_nbt_array(ArrayPath, count=-1), ) - with self.assertRaises(NBTLoadError): + with self.assertRaises(IndexError): read_nbt_array(ArrayPath, count=6) From 2c3c3db58d971164f101158111fcc8091b4042c3 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Thu, 11 Jul 2024 20:34:42 +0100 Subject: [PATCH 077/121] Remove template test This is no longer used --- tests/test_amulet_nbt/test_template.py | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 tests/test_amulet_nbt/test_template.py diff --git a/tests/test_amulet_nbt/test_template.py b/tests/test_amulet_nbt/test_template.py deleted file mode 100644 index 8b7a7efb..00000000 --- a/tests/test_amulet_nbt/test_template.py +++ /dev/null @@ -1,16 +0,0 @@ -import unittest -from template import TempitaManager - - -class TestString(unittest.TestCase): - def test_is_compiled(self) -> None: - """Check if the files have been baked out.""" - for file in TempitaManager().files: - if file.changed: - raise self.failureException( - f"Tempita file {file.rel_path} has not been compiled." - ) - - -if __name__ == "__main__": - unittest.main() From a56b33450094fa4dcc2ab15536ca18b66e3ac7b2 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Thu, 11 Jul 2024 20:35:20 +0100 Subject: [PATCH 078/121] Added NamedTag serialisation methods --- src/amulet_nbt/pybind/tag/named_tag.cpp | 139 ++++++++++++++++++++++++ 1 file changed, 139 insertions(+) diff --git a/src/amulet_nbt/pybind/tag/named_tag.cpp b/src/amulet_nbt/pybind/tag/named_tag.cpp index 11f6fbf4..c90d9478 100644 --- a/src/amulet_nbt/pybind/tag/named_tag.cpp +++ b/src/amulet_nbt/pybind/tag/named_tag.cpp @@ -1,3 +1,6 @@ +#include +#include + #include #include #include @@ -6,6 +9,9 @@ #include #include #include +#include +#include +#include namespace py = pybind11; @@ -34,6 +40,10 @@ namespace AmuletPy { void init_named_tag(py::module& m) { + py::object mutf8_encoding = m.attr("mutf8_encoding"); + py::object java_encoding = m.attr("java_encoding"); + py::object compress = py::module::import("gzip").attr("compress"); + py::class_ NamedTagIterator(m, "NamedTagIterator"); NamedTagIterator.def( "__next__", @@ -82,6 +92,135 @@ void init_named_tag(py::module& m) { self.tag_node = Amulet::unwrap_node(tag); } ); + auto to_nbt = [compress]( + const Amulet::NamedTag& self, + bool compressed, + std::endian endianness, + Amulet::StringEncode string_encoder + ) -> py::bytes { + py::bytes data = Amulet::write_nbt(self.name, self.tag_node, endianness, string_encoder); + if (compressed){ + return compress(data); + } + return data; + }; + NamedTag.def( + "to_nbt", + [to_nbt]( + const Amulet::NamedTag& self, + Amulet::EncodingPreset preset + ){ + return to_nbt( + self, + preset.compressed, + preset.endianness, + preset.string_encoding.encode + ); + }, + py::kw_only(), + py::arg("preset") = java_encoding + ); + NamedTag.def( + "to_nbt", + [to_nbt]( + const Amulet::NamedTag& self, + bool compressed, + bool little_endian, + Amulet::StringEncoding string_encoding + ){ + return to_nbt( + self, + compressed, + little_endian ? std::endian::little : std::endian::big, + string_encoding.encode + ); + }, + py::kw_only(), + py::arg("compressed") = true, + py::arg("little_endian") = false, + py::arg("string_encoding") = mutf8_encoding + ); + auto save_to = [to_nbt]( + const Amulet::NamedTag& self, + py::object filepath_or_writable, + bool compressed, + std::endian endianness, + Amulet::StringEncode string_encoder + ){ + py::bytes py_data = to_nbt(self, compressed, endianness, string_encoder); + if (!filepath_or_writable.is(py::none())){ + if (py::isinstance(filepath_or_writable)){ + std::string data = py_data.cast(); + std::ofstream file(filepath_or_writable.cast(), std::ios::out | std::ios::binary | std::ios::trunc); + file.write(data.c_str(), data.size()); + } else { + filepath_or_writable.attr("write")(py_data); + } + } + return py_data; + }; + NamedTag.def( + "save_to", + [save_to]( + const Amulet::NamedTag& self, + py::object filepath_or_writable, + Amulet::EncodingPreset preset + ){ + return save_to( + self, + filepath_or_writable, + preset.compressed, + preset.endianness, + preset.string_encoding.encode + ); + }, + py::arg("filepath_or_writable"), + py::pos_only(), + py::kw_only(), + py::arg("preset") = java_encoding + ); + NamedTag.def( + "save_to", + [save_to]( + const Amulet::NamedTag& self, + py::object filepath_or_writable, + bool compressed, + bool little_endian, + Amulet::StringEncoding string_encoding + ){ + return save_to( + self, + filepath_or_writable, + compressed, + little_endian ? std::endian::little : std::endian::big, + string_encoding.encode + ); + }, + py::arg("filepath_or_writable"), + py::pos_only(), + py::kw_only(), + py::arg("compressed") = true, + py::arg("little_endian") = false, + py::arg("string_encoding") = mutf8_encoding + ); + NamedTag.def( + "to_snbt", + []( + const Amulet::NamedTag& self, + py::object indent + ){ + if (indent.is(py::none())){ + return Amulet::write_snbt(self.tag_node); + } else if (py::isinstance(indent)){ + return Amulet::write_formatted_snbt(self.tag_node, std::string(indent.cast(), ' ')); + } else if (py::isinstance(indent)){ + return Amulet::write_formatted_snbt(self.tag_node, indent.cast()); + } else { + throw std::invalid_argument("indent must be None, int or str"); + } + }, + py::arg("indent") = py::none() + ); NamedTag.def( "__repr__", [](const Amulet::NamedTag& self){ From c9240ce14bf8bf4d3360374f16bc0d9e4f138c0e Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Thu, 11 Jul 2024 20:35:57 +0100 Subject: [PATCH 079/121] Fixed some snbt read and write issues --- .../cpp/nbt_encoding/string/read.cpp | 75 +++++++++++-------- .../cpp/nbt_encoding/string/write.cpp | 40 ++++++---- 2 files changed, 69 insertions(+), 46 deletions(-) diff --git a/src/amulet_nbt/cpp/nbt_encoding/string/read.cpp b/src/amulet_nbt/cpp/nbt_encoding/string/read.cpp index 9314abcf..4748d89f 100644 --- a/src/amulet_nbt/cpp/nbt_encoding/string/read.cpp +++ b/src/amulet_nbt/cpp/nbt_encoding/string/read.cpp @@ -9,9 +9,7 @@ const std::set Whitespace{' ', '\t', '\r', '\n'}; const std::set AlphaNumPlus{'+', '-', '.', '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'}; -const Amulet::CodePointVector false_text{'f', 'a', 'l', 's', 'e'}; const Amulet::ByteTag byte_false = 0; -const Amulet::CodePointVector true_text{'t', 'r', 'u', 'e'}; const Amulet::ByteTag byte_true = 1; @@ -87,7 +85,7 @@ inline std::pair read_string(const Amulet::CodePo } return std::make_pair( Amulet::CodePointVector(snbt.begin() + start, snbt.begin() + index), - true + false ); } } @@ -143,7 +141,7 @@ inline T read_int(const Amulet::CodePointVector& snbt, size_t start, size_t stop } -inline std::pair find_float(const Amulet::CodePointVector& snbt, const size_t& index){ +inline std::tuple find_float(const Amulet::CodePointVector& snbt, const size_t& index){ // Find a float at position index. // If an float is found, the return value will be the start and end position of the float // If a valid float was not found, the values will be equal. @@ -160,7 +158,9 @@ inline std::pair find_float(const Amulet::CodePointVector& snbt, } size_t whole_end = temp_index; // read decimal + bool needs_code = true; if (in_range(snbt, temp_index) && snbt[temp_index] == '.'){ + needs_code = false; temp_index++; size_t decimal_start = temp_index; while (in_range(snbt, temp_index) && '0' <= snbt[temp_index] && snbt[temp_index] <= '9'){ @@ -168,14 +168,14 @@ inline std::pair find_float(const Amulet::CodePointVector& snbt, } if (decimal_start == temp_index && whole_start == whole_end){ // no whole or decimal numbers - return std::make_pair(start, temp_index); + return std::make_tuple(start, start, false); } } else if (whole_start == whole_end){ // no decimal so there must be at least one whole number - return std::make_pair(start, start); + return std::make_tuple(start, start, false); } // read optional exponent - if (in_range(snbt, temp_index) && (snbt[temp_index] & ~32) == 'E'){ + if (in_range(snbt, temp_index) && (snbt[temp_index] | 32) == 'e'){ temp_index++; // read optional sign if (in_range(snbt, temp_index) && (snbt[temp_index] == '+' || snbt[temp_index] == '-')){ @@ -187,10 +187,10 @@ inline std::pair find_float(const Amulet::CodePointVector& snbt, } if (exp_start == temp_index){ // if exponent is defined there must be a number. - return std::make_pair(start, start); + return std::make_tuple(start, start, false); } } - return std::make_pair(start, temp_index); + return std::make_tuple(start, temp_index, needs_code); } @@ -221,12 +221,12 @@ inline Amulet::TagNode read_array(const Amulet::CodePointVector& snbt, size_t& i throw std::invalid_argument("Expected a ] or int at position " + std::to_string(index) + " but got ->" + read_error(snbt, index) + " instead"); } if constexpr (std::is_same_v){ - if ((read_code_point(snbt, stop) & ~32) != 'B'){ + if ((read_code_point(snbt, stop) | 32) != 'b'){ throw std::invalid_argument("Expected 'B' position " + std::to_string(stop) + " but got ->" + read_error(snbt, stop) + " instead"); } index = stop + 1; } else if constexpr (std::is_same_v){ - if ((read_code_point(snbt, stop) & ~32) != 'L'){ + if ((read_code_point(snbt, stop) | 32) != 'l'){ throw std::invalid_argument("Expected 'L' position " + std::to_string(stop) + " but got ->" + read_error(snbt, stop) + " instead"); } index = stop + 1; @@ -300,10 +300,23 @@ Amulet::TagNode _read_snbt(const Amulet::CodePointVector& snbt, size_t& index){ if (string.empty()) { throw std::invalid_argument("Expected data matching [A-Za-z0-9._+-]+ at position " + std::to_string(index) + " but got ->" + read_error(snbt, index) + " instead"); } - if (string == true_text) { + if ( + string.size() == 4 && + (string[0] | 32) == 't' && + (string[1] | 32) == 'r' && + (string[2] | 32) == 'u' && + (string[3] | 32) == 'e' + ) { return byte_true; } - if (string == false_text) { + if ( + string.size() == 5 && + (string[0] | 32) == 'f' && + (string[1] | 32) == 'a' && + (string[2] | 32) == 'l' && + (string[3] | 32) == 's' && + (string[4] | 32) == 'e' + ) { return byte_false; } @@ -312,28 +325,30 @@ Amulet::TagNode _read_snbt(const Amulet::CodePointVector& snbt, size_t& index){ if (int_stop == string.size()){ // found an int that takes the whole string return read_int(string, int_start, int_stop); - } else if (int_stop == string.size() - 1) { - switch (string[string.size() - 1] & ~32){ - case 'B': - return read_int(string, int_start, int_stop - 1); - case 'S': - return read_int(string, int_start, int_stop - 1); - case 'L': - return read_int(string, int_start, int_stop - 1); + } else if (int_start != int_stop && int_stop == string.size() - 1) { + switch (string[string.size() - 1] | 32){ + case 'b': + return read_int(string, int_start, int_stop); + case 's': + return read_int(string, int_start, int_stop); + case 'l': + return read_int(string, int_start, int_stop); } } // if not an int, try matching a float - auto [float_start, float_stop] = find_float(string, 0); + auto [float_start, float_stop, needs_code] = find_float(string, 0); if (float_stop == string.size()){ - // found an int that takes the whole string - return read_float(string, float_start, float_stop); - } else if (float_stop == string.size() - 1) { - switch (string[string.size() - 1] & ~32){ - case 'F': - return read_float(string, float_start, float_stop - 1); - case 'D': - return read_float(string, float_start, float_stop - 1); + // found a float that takes the whole string + if (!needs_code){ + return read_float(string, float_start, float_stop); + } + } else if (float_start != float_stop && float_stop == string.size() - 1) { + switch (string[string.size() - 1] | 32){ + case 'f': + return read_float(string, float_start, float_stop); + case 'd': + return read_float(string, float_start, float_stop); } } diff --git a/src/amulet_nbt/cpp/nbt_encoding/string/write.cpp b/src/amulet_nbt/cpp/nbt_encoding/string/write.cpp index eeb46ddb..3b0afea8 100644 --- a/src/amulet_nbt/cpp/nbt_encoding/string/write.cpp +++ b/src/amulet_nbt/cpp/nbt_encoding/string/write.cpp @@ -11,6 +11,7 @@ #include #include +#include #include #include #include @@ -18,6 +19,9 @@ namespace Amulet { // Forward declarations + void write_formatted_snbt(std::string&, const Amulet::TagNode&, const std::string&, size_t); + void write_formatted_snbt(std::string&, const Amulet::ListTag&, const std::string&, size_t); + void write_formatted_snbt(std::string&, const Amulet::CompoundTag&, const std::string&, size_t); inline void write_indent(std::string& snbt, const std::string& indent, size_t indent_count){ for (size_t i = 0; i < indent_count; i++){ @@ -33,12 +37,12 @@ namespace Amulet { case 4: write_snbt(snbt, std::get(tag)); break; case 5: write_snbt(snbt, std::get(tag)); break; case 6: write_snbt(snbt, std::get(tag)); break; - case 7: write_snbt(snbt, std::get(tag)); break; + case 7: write_snbt(snbt, *std::get(tag)); break; case 8: write_snbt(snbt, std::get(tag)); break; - case 9: write_snbt(snbt, std::get(tag)); break; - case 10: write_snbt(snbt, std::get(tag)); break; - case 11: write_snbt(snbt, std::get(tag)); break; - case 12: write_snbt(snbt, std::get(tag)); break; + case 9: write_snbt(snbt, *std::get(tag)); break; + case 10: write_snbt(snbt, *std::get(tag)); break; + case 11: write_snbt(snbt, *std::get(tag)); break; + case 12: write_snbt(snbt, *std::get(tag)); break; default: throw std::runtime_error("TagNode cannot be in null state when writing."); } } @@ -51,12 +55,12 @@ namespace Amulet { case 4: write_snbt(snbt, std::get(tag)); break; case 5: write_snbt(snbt, std::get(tag)); break; case 6: write_snbt(snbt, std::get(tag)); break; - case 7: write_snbt(snbt, std::get(tag)); break; + case 7: write_snbt(snbt, *std::get(tag)); break; case 8: write_snbt(snbt, std::get(tag)); break; - case 9: write_formatted_snbt(snbt, std::get(tag), indent, indent_count); break; - case 10: write_formatted_snbt(snbt, std::get(tag), indent, indent_count); break; - case 11: write_snbt(snbt, std::get(tag)); break; - case 12: write_snbt(snbt, std::get(tag)); break; + case 9: write_formatted_snbt(snbt, *std::get(tag), indent, indent_count); break; + case 10: write_formatted_snbt(snbt, *std::get(tag), indent, indent_count); break; + case 11: write_snbt(snbt, *std::get(tag)); break; + case 12: write_snbt(snbt, *std::get(tag)); break; default: throw std::runtime_error("TagNode cannot be in null state when writing."); } } @@ -143,7 +147,11 @@ namespace Amulet { if (i != 0){ snbt.append(", "); } - write_snbt(snbt, list[i]); + if constexpr (is_shared_ptr::value){ + write_snbt(snbt, *list[i]); + } else { + write_snbt(snbt, list[i]); + } } snbt.append("]"); } @@ -243,13 +251,13 @@ namespace Amulet { void write_snbt(std::string& snbt, const CompoundTag& tag){ auto sorted = sort_compound(tag); snbt.append("{"); - for (auto it = sorted.begin(); it != sorted.end(); it++){ - write_key(snbt, it->first); - snbt.append(": "); - write_snbt(snbt, it->second); - if (std::next(it) != sorted.end()){ + for (size_t i = 0; i < sorted.size(); i++){ + if (i != 0){ snbt.append(", "); } + write_key(snbt, sorted[i].first); + snbt.append(": "); + write_snbt(snbt, sorted[i].second); } snbt.append("}"); } From be53fa9c0f4c1b648535aeed0e840bf94c1693de Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Thu, 11 Jul 2024 20:46:26 +0100 Subject: [PATCH 080/121] Revert lower bounds check In mutf8 0 is a valid 2-byte code point --- src/amulet_nbt/cpp/string_encoding/mutf8.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/amulet_nbt/cpp/string_encoding/mutf8.cpp b/src/amulet_nbt/cpp/string_encoding/mutf8.cpp index bf0584b8..598814ad 100644 --- a/src/amulet_nbt/cpp/string_encoding/mutf8.cpp +++ b/src/amulet_nbt/cpp/string_encoding/mutf8.cpp @@ -32,7 +32,7 @@ namespace Amulet { throw std::invalid_argument("2-byte codepoint started at index " + std::to_string(index) + ", but format bits of byte 2 are incorrect."); } size_t value = (0b00011111 & b1) << 6 | (0b00111111 & b2); - if (value < 0x80){ + if (0 < value && value < 0x80){ throw std::invalid_argument("2-byte codepoint at index " + std::to_string(index) + " has invalid value."); } dst.push_back(value); From 4a55f85db32076877e698ac5ff5cd9f30705f670 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 12 Jul 2024 09:30:16 +0100 Subject: [PATCH 081/121] Improved constructors --- src/amulet_nbt/pybind/tag/array.cpp | 9 +++++---- src/amulet_nbt/pybind/tag/float.cpp | 6 +++++- src/amulet_nbt/pybind/tag/int.cpp | 6 +++++- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/amulet_nbt/pybind/tag/array.cpp b/src/amulet_nbt/pybind/tag/array.cpp index fcabf9f6..a1d230a2 100644 --- a/src/amulet_nbt/pybind/tag/array.cpp +++ b/src/amulet_nbt/pybind/tag/array.cpp @@ -17,11 +17,11 @@ namespace py = pybind11; );\ CLSNAME.def_property_readonly_static("tag_id", [](py::object) {return TAGID;});\ CLSNAME.def(\ - py::init([](py::object value) {\ + py::init([asarray, dtype](py::object value) {\ /* Is there a better way to do this? */\ - auto v = value.cast> ();\ - Amulet::CLSNAME tag(v.begin(), v.end());\ - std::shared_ptr tag_ptr = std::make_shared(tag);\ + py::array arr = asarray(value, dtype("int"#BITCOUNT)).attr("ravel")().cast();\ + std::vector v = arr.cast> ();\ + std::shared_ptr tag_ptr = std::make_shared(v.begin(), v.end());\ return Amulet::CLSNAME##Wrapper(tag_ptr);\ }),\ py::arg("value") = py::tuple(),\ @@ -160,6 +160,7 @@ namespace py = pybind11; void init_array(py::module& m) { py::object asarray = py::module::import("numpy").attr("asarray"); + py::object dtype = py::module::import("numpy").attr("dtype"); PyArray(ByteArrayTag, ByteTag, 8, 7) PyArray(IntArrayTag, IntTag, 32, 11) PyArray(LongArrayTag, LongTag, 64, 12) diff --git a/src/amulet_nbt/pybind/tag/float.cpp b/src/amulet_nbt/pybind/tag/float.cpp index 063a0864..73cd1b75 100644 --- a/src/amulet_nbt/pybind/tag/float.cpp +++ b/src/amulet_nbt/pybind/tag/float.cpp @@ -14,7 +14,11 @@ namespace py = pybind11; CLSNAME.def_property_readonly_static("tag_id", [](py::object) {return TAGID;});\ CLSNAME.def(\ py::init([](py::object value) {\ - return Amulet::CLSNAME##Wrapper(value.cast());\ + try {\ + return Amulet::CLSNAME##Wrapper(value.cast());\ + } catch (const py::cast_error&){\ + throw py::type_error("value must be float or float-like");\ + }\ }),\ py::arg("value") = 0.0,\ py::doc("__init__(self: amulet_nbt."#CLSNAME", value: typing.SupportsFloat) -> None")\ diff --git a/src/amulet_nbt/pybind/tag/int.cpp b/src/amulet_nbt/pybind/tag/int.cpp index 77566bf0..133b9adb 100644 --- a/src/amulet_nbt/pybind/tag/int.cpp +++ b/src/amulet_nbt/pybind/tag/int.cpp @@ -16,7 +16,11 @@ namespace py = pybind11; CLSNAME.def_property_readonly_static("tag_id", [](py::object) {return TAGID;});\ CLSNAME.def(\ py::init([](py::object value) {\ - return Amulet::CLSNAME##Wrapper(py::int_(value).cast());\ + try {\ + return Amulet::CLSNAME##Wrapper(static_cast(py::int_(value).cast()));\ + } catch (const py::cast_error&){\ + throw py::type_error("value must be int or int-like");\ + }\ }),\ py::arg("value") = 0,\ py::doc("__init__(self: amulet_nbt."#CLSNAME", value: typing.SupportsInt) -> None")\ From 85ebd97bcee216b7096a61e33219af25827e6cdd Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 12 Jul 2024 09:30:35 +0100 Subject: [PATCH 082/121] Convert cast_error to type_error --- src/amulet_nbt/pybind/amulet_nbt.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/amulet_nbt/pybind/amulet_nbt.cpp b/src/amulet_nbt/pybind/amulet_nbt.cpp index 279674f0..16c3f38f 100644 --- a/src/amulet_nbt/pybind/amulet_nbt.cpp +++ b/src/amulet_nbt/pybind/amulet_nbt.cpp @@ -18,6 +18,17 @@ void init_snbt(py::module& m); PYBIND11_MODULE(_nbt, m) { + // Convert cast_error to type_error + py::register_local_exception_translator([](std::exception_ptr p) { + try { + if (p) { + std::rethrow_exception(p); + } + } catch (const py::cast_error& e) { + py::set_error(PyExc_TypeError, e.what()); + } + }); + init_encoding(m); init_abc(m); init_int(m); From 5affa66c7a6cc768c275f4d54293bf97c8e90091 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 12 Jul 2024 09:30:43 +0100 Subject: [PATCH 083/121] Fixed getitem --- src/amulet_nbt/pybind/tag/array.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/amulet_nbt/pybind/tag/array.cpp b/src/amulet_nbt/pybind/tag/array.cpp index a1d230a2..18db1266 100644 --- a/src/amulet_nbt/pybind/tag/array.cpp +++ b/src/amulet_nbt/pybind/tag/array.cpp @@ -141,7 +141,7 @@ namespace py = pybind11; CLSNAME.def(\ "__getitem__",\ [asarray](const Amulet::CLSNAME##Wrapper& self, py::object item){\ - return asarray(self)[item];\ + return asarray(self).attr("__getitem__")(item);\ }\ );\ CLSNAME.def(\ From 26997465f231679d70ffbdbccc50a68b5894e274 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 12 Jul 2024 09:33:48 +0100 Subject: [PATCH 084/121] Fixed errors --- src/amulet_nbt/pybind/tag/compound.cpp | 8 ++++---- tests/test_amulet_nbt/test_tag/test_compound.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/amulet_nbt/pybind/tag/compound.cpp b/src/amulet_nbt/pybind/tag/compound.cpp index ee1b8032..18e57faf 100644 --- a/src/amulet_nbt/pybind/tag/compound.cpp +++ b/src/amulet_nbt/pybind/tag/compound.cpp @@ -17,7 +17,7 @@ void CompoundTag_update(Amulet::CompoundTag& self, py::dict other){ auto map = other.cast>(); for (auto it = map.begin(); it != map.end(); it++){ if (it->second.index() == 0){ - throw std::invalid_argument("Value cannot be None"); + throw py::type_error("Value cannot be None"); } self[it->first] = unwrap_node(it->second); } @@ -239,7 +239,7 @@ void init_compound(py::module& m) { "__setitem__", [](const Amulet::CompoundTagWrapper& self, std::string key, Amulet::WrapperNode value){ if (value.index() == 0){ - throw std::invalid_argument("Value cannot be None"); + throw py::type_error("Value cannot be None"); } (*self.tag)[key] = Amulet::unwrap_node(value); } @@ -310,7 +310,7 @@ void init_compound(py::module& m) { [isinstance](const Amulet::CompoundTagWrapper& self, std::string key, Amulet::WrapperNode tag, py::object cls) -> py::object { auto set_value = [self, key, tag](){ if (tag.index() == 0){ - throw std::invalid_argument("Cannot setdefault a value of None."); + throw py::type_error("Cannot setdefault a value of None."); } (*self.tag)[key] = Amulet::unwrap_node(tag); return py::cast(tag); @@ -332,7 +332,7 @@ void init_compound(py::module& m) { "fromkeys", [](py::object keys, Amulet::WrapperNode value){ if (value.index() == 0){ - throw std::invalid_argument("Value cannot be None"); + throw py::type_error("Value cannot be None"); } Amulet::TagNode node = Amulet::unwrap_node(value); Amulet::CompoundTagPtr tag = std::make_shared(); diff --git a/tests/test_amulet_nbt/test_tag/test_compound.py b/tests/test_amulet_nbt/test_tag/test_compound.py index c9ea550d..79ffc283 100644 --- a/tests/test_amulet_nbt/test_tag/test_compound.py +++ b/tests/test_amulet_nbt/test_tag/test_compound.py @@ -928,7 +928,7 @@ def test_from_snbt(self) -> None: CompoundTag({"1": IntTag(5)}), read_snbt("\n{ \n '1' \n : \n 5 \n }\n") ) - with self.assertRaises(ValueError): + with self.assertRaises(IndexError): read_snbt("{") with self.assertRaises(ValueError): read_snbt("}") From 84d684d7fd82998eeaea03e0d618e86927049ea2 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 12 Jul 2024 09:33:56 +0100 Subject: [PATCH 085/121] Added missing import --- tests/test_amulet_nbt/test_tag/test_float.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_amulet_nbt/test_tag/test_float.py b/tests/test_amulet_nbt/test_tag/test_float.py index 84001102..e8400d51 100644 --- a/tests/test_amulet_nbt/test_tag/test_float.py +++ b/tests/test_amulet_nbt/test_tag/test_float.py @@ -18,6 +18,7 @@ read_nbt, read_snbt, StringTag, + IntTag, ) From b3533cde5ae7f4e3bb5be48d4e8de3c6d39e3465 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 12 Jul 2024 14:10:09 +0100 Subject: [PATCH 086/121] Added snbt list parsing --- src/amulet_nbt/cpp/nbt_encoding/string/read.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/amulet_nbt/cpp/nbt_encoding/string/read.cpp b/src/amulet_nbt/cpp/nbt_encoding/string/read.cpp index 4748d89f..1b858aea 100644 --- a/src/amulet_nbt/cpp/nbt_encoding/string/read.cpp +++ b/src/amulet_nbt/cpp/nbt_encoding/string/read.cpp @@ -5,6 +5,7 @@ #include #include +#include const std::set Whitespace{' ', '\t', '\r', '\n'}; @@ -284,7 +285,21 @@ Amulet::TagNode _read_snbt(const Amulet::CodePointVector& snbt, size_t& index){ return read_array(snbt, index); } else { // list - throw std::exception("not implemented"); + auto tag = std::make_shared(); + while (read_code_point(snbt, index) != ']'){ + // read the value + auto value = _read_snbt(snbt, index); + + if (tag->index() != 0 && tag->index() != value.index()){ + throw std::invalid_argument("All elements of a list tag must have the same type."); + } + + Amulet::ListTag_append(*tag, value); + + // Read past the comma + read_comma(snbt, index, ']'); + } + return tag; } } else if (read_code_point(snbt, index) == ']'){ // empty list From cc8bec6645733bcdd3357e54552086d9309e47a2 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 12 Jul 2024 14:10:26 +0100 Subject: [PATCH 087/121] Fixed float repr and string --- src/amulet_nbt/pybind/tag/float.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/amulet_nbt/pybind/tag/float.cpp b/src/amulet_nbt/pybind/tag/float.cpp index 73cd1b75..bdede36d 100644 --- a/src/amulet_nbt/pybind/tag/float.cpp +++ b/src/amulet_nbt/pybind/tag/float.cpp @@ -45,13 +45,13 @@ namespace py = pybind11; CLSNAME.def(\ "__repr__",\ [](const Amulet::CLSNAME##Wrapper& self){\ - return #CLSNAME "(" + std::to_string(self.tag) + ")";\ + return #CLSNAME "(" + py::repr(py::cast(self.tag)).cast() + ")";\ }\ );\ CLSNAME.def(\ "__str__",\ [](const Amulet::CLSNAME##Wrapper& self){\ - return std::to_string(self.tag);\ + return py::repr(py::cast(self.tag));\ }\ );\ CLSNAME.def(\ From 1a24886c0500e0bc969032dec7a205e4a3252f81 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 12 Jul 2024 14:10:46 +0100 Subject: [PATCH 088/121] Fixed int construction --- src/amulet_nbt/pybind/tag/int.cpp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/amulet_nbt/pybind/tag/int.cpp b/src/amulet_nbt/pybind/tag/int.cpp index 133b9adb..ea5741b2 100644 --- a/src/amulet_nbt/pybind/tag/int.cpp +++ b/src/amulet_nbt/pybind/tag/int.cpp @@ -7,7 +7,7 @@ namespace py = pybind11; -#define PyInt(CLSNAME, BYTEWIDTH, BITPOW, TAGID)\ +#define PyInt(CLSNAME, BYTEWIDTH, BITPOW, SIGNBIT, MAGBITS, TAGID)\ py::class_ CLSNAME(m, #CLSNAME,\ "A "#BYTEWIDTH" byte integer class.\n"\ "\n"\ @@ -15,12 +15,14 @@ namespace py = pybind11; );\ CLSNAME.def_property_readonly_static("tag_id", [](py::object) {return TAGID;});\ CLSNAME.def(\ - py::init([](py::object value) {\ - try {\ - return Amulet::CLSNAME##Wrapper(static_cast(py::int_(value).cast()));\ - } catch (const py::cast_error&){\ - throw py::type_error("value must be int or int-like");\ - }\ + py::init([PyIntCls](py::object py_value) {\ + /* cast to a python int */\ + py::object py_int = PyIntCls(py_value);\ + /* get the magnitude bits */\ + Amulet::CLSNAME value = py_int.attr("__and__")(py::cast(MAGBITS)).cast();\ + /* get the sign bits */\ + if (py_int.attr("__and__")(py::cast(SIGNBIT)).cast()){value -= SIGNBIT;}\ + return Amulet::CLSNAME##Wrapper(value);\ }),\ py::arg("value") = 0,\ py::doc("__init__(self: amulet_nbt."#CLSNAME", value: typing.SupportsInt) -> None")\ @@ -141,8 +143,9 @@ namespace py = pybind11; void init_int(py::module& m) { - PyInt(ByteTag, 1, 7, 1) - PyInt(ShortTag, 2, 15, 2) - PyInt(IntTag, 4, 31, 3) - PyInt(LongTag, 8, 63, 4) + py::object PyIntCls = py::module::import("builtins").attr("int"); + PyInt(ByteTag, 1, 7, 0x80, 0x7F, 1) + PyInt(ShortTag, 2, 15, 0x8000, 0x7FFF, 2) + PyInt(IntTag, 4, 31, 0x80000000, 0x7FFFFFFF, 3) + PyInt(LongTag, 8, 63, 0x8000000000000000, 0x7FFFFFFFFFFFFFFF, 4) }; From d9ac1c1669d60f6f480931cdc6737125fb50def0 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 12 Jul 2024 14:11:16 +0100 Subject: [PATCH 089/121] Improved int tests --- tests/test_amulet_nbt/test_tag/test_int.py | 169 ++++++++++++++++++++- 1 file changed, 161 insertions(+), 8 deletions(-) diff --git a/tests/test_amulet_nbt/test_tag/test_int.py b/tests/test_amulet_nbt/test_tag/test_int.py index 11f41e4f..75fadd5f 100644 --- a/tests/test_amulet_nbt/test_tag/test_int.py +++ b/tests/test_amulet_nbt/test_tag/test_int.py @@ -35,17 +35,170 @@ def test_constructor(self) -> None: with self.assertRaises(TypeError): int_cls(None) # type: ignore + RangeByte = 2 ** 8 + RangeShort = 2 ** 16 + RangeInt = 2 ** 32 + RangeLong = 2 ** 64 + + MinByte = -(2 ** 7) + MinShort = -(2 ** 15) + MinInt = -(2 ** 31) + MinLong = -(2 ** 63) + + UnderflowByte = MinByte - 1 + UnderflowShort = MinShort - 1 + UnderflowInt = MinInt - 1 + UnderflowLong = MinLong - 1 + + MaxByte = 2 ** 7 - 1 + MaxShort = 2 ** 15 - 1 + MaxInt = 2 ** 31 - 1 + MaxLong = 2 ** 63 - 1 + + OverflowByte = MaxByte + 1 + OverflowShort = MaxShort + 1 + OverflowInt = MaxInt + 1 + OverflowLong = MaxLong + 1 + + # upper bound + self.assertEqual(MaxByte, int(ByteTag(MaxByte + 0 * RangeByte))) + self.assertEqual(MaxByte, int(ByteTag(MaxByte + 1 * RangeByte))) + self.assertEqual(MaxByte, int(ByteTag(MaxByte + 2 * RangeByte))) + self.assertEqual(MaxByte, int(ByteTag(MaxByte + 3 * RangeByte))) + self.assertEqual(MaxShort, int(ShortTag(MaxShort + 0 * RangeShort))) + self.assertEqual(MaxShort, int(ShortTag(MaxShort + 1 * RangeShort))) + self.assertEqual(MaxShort, int(ShortTag(MaxShort + 2 * RangeShort))) + self.assertEqual(MaxShort, int(ShortTag(MaxShort + 3 * RangeShort))) + self.assertEqual(MaxInt, int(IntTag(MaxInt + 0 * RangeInt))) + self.assertEqual(MaxInt, int(IntTag(MaxInt + 1 * RangeInt))) + self.assertEqual(MaxInt, int(IntTag(MaxInt + 2 * RangeInt))) + self.assertEqual(MaxInt, int(IntTag(MaxInt + 3 * RangeInt))) + self.assertEqual(MaxLong, int(LongTag(MaxLong + 0 * RangeLong))) + self.assertEqual(MaxLong, int(LongTag(MaxLong + 1 * RangeLong))) + self.assertEqual(MaxLong, int(LongTag(MaxLong + 2 * RangeLong))) + self.assertEqual(MaxLong, int(LongTag(MaxLong + 3 * RangeLong))) + # overflow - self.assertEqual(ByteTag(-(2**7)), ByteTag(2**7)) - self.assertEqual(ShortTag(-(2**15)), ShortTag(2**15)) - self.assertEqual(IntTag(-(2**31)), IntTag(2**31)) - self.assertEqual(LongTag(-(2**63)), LongTag(2**63)) + self.assertEqual(MinByte, int(ByteTag(OverflowByte + 1 * RangeByte))) + self.assertEqual(MinByte, int(ByteTag(OverflowByte + 2 * RangeByte))) + self.assertEqual(MinByte, int(ByteTag(OverflowByte + 3 * RangeByte))) + self.assertEqual(MinByte, int(ByteTag(OverflowByte + 4 * RangeByte))) + self.assertEqual(MinShort, int(ShortTag(OverflowShort + 1 * RangeShort))) + self.assertEqual(MinShort, int(ShortTag(OverflowShort + 2 * RangeShort))) + self.assertEqual(MinShort, int(ShortTag(OverflowShort + 3 * RangeShort))) + self.assertEqual(MinShort, int(ShortTag(OverflowShort + 4 * RangeShort))) + self.assertEqual(MinInt, int(IntTag(OverflowInt + 1 * RangeInt))) + self.assertEqual(MinInt, int(IntTag(OverflowInt + 2 * RangeInt))) + self.assertEqual(MinInt, int(IntTag(OverflowInt + 3 * RangeInt))) + self.assertEqual(MinInt, int(IntTag(OverflowInt + 4 * RangeInt))) + self.assertEqual(MinLong, int(LongTag(OverflowLong + 1 * RangeLong))) + self.assertEqual(MinLong, int(LongTag(OverflowLong + 2 * RangeLong))) + self.assertEqual(MinLong, int(LongTag(OverflowLong + 3 * RangeLong))) + self.assertEqual(MinLong, int(LongTag(OverflowLong + 4 * RangeLong))) + + # lower bound + self.assertEqual(MinByte, int(ByteTag(MinByte - 1 * RangeByte))) + self.assertEqual(MinByte, int(ByteTag(MinByte - 2 * RangeByte))) + self.assertEqual(MinByte, int(ByteTag(MinByte - 3 * RangeByte))) + self.assertEqual(MinByte, int(ByteTag(MinByte - 4 * RangeByte))) + self.assertEqual(MinShort, int(ShortTag(MinShort - 1 * RangeShort))) + self.assertEqual(MinShort, int(ShortTag(MinShort - 2 * RangeShort))) + self.assertEqual(MinShort, int(ShortTag(MinShort - 3 * RangeShort))) + self.assertEqual(MinShort, int(ShortTag(MinShort - 4 * RangeShort))) + self.assertEqual(MinInt, int(IntTag(MinInt - 1 * RangeInt))) + self.assertEqual(MinInt, int(IntTag(MinInt - 2 * RangeInt))) + self.assertEqual(MinInt, int(IntTag(MinInt - 3 * RangeInt))) + self.assertEqual(MinInt, int(IntTag(MinInt - 4 * RangeInt))) + self.assertEqual(MinLong, int(LongTag(MinLong - 1 * RangeLong))) + self.assertEqual(MinLong, int(LongTag(MinLong - 2 * RangeLong))) + self.assertEqual(MinLong, int(LongTag(MinLong - 3 * RangeLong))) + self.assertEqual(MinLong, int(LongTag(MinLong - 4 * RangeLong))) # underflow - self.assertEqual(ByteTag(2**7 - 1), ByteTag(-(2**7) - 1)) - self.assertEqual(ShortTag(2**15 - 1), ShortTag(-(2**15) - 1)) - self.assertEqual(IntTag(2**31 - 1), IntTag(-(2**31) - 1)) - self.assertEqual(LongTag(2**63 - 1), LongTag(-(2**63) - 1)) + self.assertEqual(MaxByte, int(ByteTag(UnderflowByte - 1 * RangeByte))) + self.assertEqual(MaxByte, int(ByteTag(UnderflowByte - 2 * RangeByte))) + self.assertEqual(MaxByte, int(ByteTag(UnderflowByte - 3 * RangeByte))) + self.assertEqual(MaxByte, int(ByteTag(UnderflowByte - 4 * RangeByte))) + self.assertEqual(MaxShort, int(ShortTag(UnderflowShort - 1 * RangeShort))) + self.assertEqual(MaxShort, int(ShortTag(UnderflowShort - 2 * RangeShort))) + self.assertEqual(MaxShort, int(ShortTag(UnderflowShort - 3 * RangeShort))) + self.assertEqual(MaxShort, int(ShortTag(UnderflowShort - 4 * RangeShort))) + self.assertEqual(MaxInt, int(IntTag(UnderflowInt - 1 * RangeInt))) + self.assertEqual(MaxInt, int(IntTag(UnderflowInt - 2 * RangeInt))) + self.assertEqual(MaxInt, int(IntTag(UnderflowInt - 3 * RangeInt))) + self.assertEqual(MaxInt, int(IntTag(UnderflowInt - 4 * RangeInt))) + self.assertEqual(MaxLong, int(LongTag(UnderflowLong - 1 * RangeLong))) + self.assertEqual(MaxLong, int(LongTag(UnderflowLong - 2 * RangeLong))) + self.assertEqual(MaxLong, int(LongTag(UnderflowLong - 3 * RangeLong))) + self.assertEqual(MaxLong, int(LongTag(UnderflowLong - 4 * RangeLong))) + + # 0 + self.assertEqual(0, int(ByteTag(0 + 1 * RangeByte))) + self.assertEqual(0, int(ByteTag(0 - 1 * RangeByte))) + self.assertEqual(0, int(ByteTag(0 + 2 * RangeByte))) + self.assertEqual(0, int(ByteTag(0 - 2 * RangeByte))) + self.assertEqual(0, int(ByteTag(0 + 3 * RangeByte))) + self.assertEqual(0, int(ByteTag(0 - 3 * RangeByte))) + self.assertEqual(0, int(ByteTag(0 + 4 * RangeByte))) + self.assertEqual(0, int(ByteTag(0 - 4 * RangeByte))) + self.assertEqual(0, int(ShortTag(0 + 1 * RangeShort))) + self.assertEqual(0, int(ShortTag(0 - 1 * RangeShort))) + self.assertEqual(0, int(ShortTag(0 + 2 * RangeShort))) + self.assertEqual(0, int(ShortTag(0 - 2 * RangeShort))) + self.assertEqual(0, int(ShortTag(0 + 3 * RangeShort))) + self.assertEqual(0, int(ShortTag(0 - 3 * RangeShort))) + self.assertEqual(0, int(ShortTag(0 + 4 * RangeShort))) + self.assertEqual(0, int(ShortTag(0 - 4 * RangeShort))) + self.assertEqual(0, int(IntTag(0 + 1 * RangeInt))) + self.assertEqual(0, int(IntTag(0 - 1 * RangeInt))) + self.assertEqual(0, int(IntTag(0 + 2 * RangeInt))) + self.assertEqual(0, int(IntTag(0 - 2 * RangeInt))) + self.assertEqual(0, int(IntTag(0 + 3 * RangeInt))) + self.assertEqual(0, int(IntTag(0 - 3 * RangeInt))) + self.assertEqual(0, int(IntTag(0 + 4 * RangeInt))) + self.assertEqual(0, int(IntTag(0 - 4 * RangeInt))) + self.assertEqual(0, int(LongTag(0 + 1 * RangeLong))) + self.assertEqual(0, int(LongTag(0 - 1 * RangeLong))) + self.assertEqual(0, int(LongTag(0 + 2 * RangeLong))) + self.assertEqual(0, int(LongTag(0 - 2 * RangeLong))) + self.assertEqual(0, int(LongTag(0 + 3 * RangeLong))) + self.assertEqual(0, int(LongTag(0 - 3 * RangeLong))) + self.assertEqual(0, int(LongTag(0 + 4 * RangeLong))) + self.assertEqual(0, int(LongTag(0 - 4 * RangeLong))) + + # -1 + self.assertEqual(-1, int(ByteTag(-1 + 1 * RangeByte))) + self.assertEqual(-1, int(ByteTag(-1 - 1 * RangeByte))) + self.assertEqual(-1, int(ByteTag(-1 + 2 * RangeByte))) + self.assertEqual(-1, int(ByteTag(-1 - 2 * RangeByte))) + self.assertEqual(-1, int(ByteTag(-1 + 3 * RangeByte))) + self.assertEqual(-1, int(ByteTag(-1 - 3 * RangeByte))) + self.assertEqual(-1, int(ByteTag(-1 + 4 * RangeByte))) + self.assertEqual(-1, int(ByteTag(-1 - 4 * RangeByte))) + self.assertEqual(-1, int(ShortTag(-1 + 1 * RangeShort))) + self.assertEqual(-1, int(ShortTag(-1 - 1 * RangeShort))) + self.assertEqual(-1, int(ShortTag(-1 + 2 * RangeShort))) + self.assertEqual(-1, int(ShortTag(-1 - 2 * RangeShort))) + self.assertEqual(-1, int(ShortTag(-1 + 3 * RangeShort))) + self.assertEqual(-1, int(ShortTag(-1 - 3 * RangeShort))) + self.assertEqual(-1, int(ShortTag(-1 + 4 * RangeShort))) + self.assertEqual(-1, int(ShortTag(-1 - 4 * RangeShort))) + self.assertEqual(-1, int(IntTag(-1 + 1 * RangeInt))) + self.assertEqual(-1, int(IntTag(-1 - 1 * RangeInt))) + self.assertEqual(-1, int(IntTag(-1 + 2 * RangeInt))) + self.assertEqual(-1, int(IntTag(-1 - 2 * RangeInt))) + self.assertEqual(-1, int(IntTag(-1 + 3 * RangeInt))) + self.assertEqual(-1, int(IntTag(-1 - 3 * RangeInt))) + self.assertEqual(-1, int(IntTag(-1 + 4 * RangeInt))) + self.assertEqual(-1, int(IntTag(-1 - 4 * RangeInt))) + self.assertEqual(-1, int(LongTag(-1 + 1 * RangeLong))) + self.assertEqual(-1, int(LongTag(-1 - 1 * RangeLong))) + self.assertEqual(-1, int(LongTag(-1 + 2 * RangeLong))) + self.assertEqual(-1, int(LongTag(-1 - 2 * RangeLong))) + self.assertEqual(-1, int(LongTag(-1 + 3 * RangeLong))) + self.assertEqual(-1, int(LongTag(-1 - 3 * RangeLong))) + self.assertEqual(-1, int(LongTag(-1 + 4 * RangeLong))) + self.assertEqual(-1, int(LongTag(-1 - 4 * RangeLong))) for cls in self.nbt_types: tag = cls() From 89e35bda82b7f03ea1ae2fe15ce2bc892e6da583 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 12 Jul 2024 15:37:37 +0100 Subject: [PATCH 090/121] Added type_error exception --- src/amulet_nbt/cpp/tag/list.cpp | 2 +- src/amulet_nbt/include/amulet_nbt/common.hpp | 8 ++++++++ src/amulet_nbt/include/amulet_nbt/tag/list.hpp | 8 ++++---- src/amulet_nbt/pybind/amulet_nbt.cpp | 13 +++++++++++++ src/amulet_nbt/pybind/tag/list.cpp | 10 +++++----- 5 files changed, 31 insertions(+), 10 deletions(-) diff --git a/src/amulet_nbt/cpp/tag/list.cpp b/src/amulet_nbt/cpp/tag/list.cpp index 59311c50..107a1283 100644 --- a/src/amulet_nbt/cpp/tag/list.cpp +++ b/src/amulet_nbt/cpp/tag/list.cpp @@ -21,7 +21,7 @@ namespace Amulet { ListTag_append(self, get(tag));\ break; case 0: - throw std::invalid_argument("Cannot append null TagNode"); + throw AmuletNBT::type_error("Cannot append null TagNode"); FOR_EACH_LIST_TAG(CASE) #undef CASE } diff --git a/src/amulet_nbt/include/amulet_nbt/common.hpp b/src/amulet_nbt/include/amulet_nbt/common.hpp index 37225472..56ee04b8 100644 --- a/src/amulet_nbt/include/amulet_nbt/common.hpp +++ b/src/amulet_nbt/include/amulet_nbt/common.hpp @@ -3,6 +3,7 @@ #include #include #include +#include template constexpr size_t variant_index() { @@ -19,3 +20,10 @@ struct is_shared_ptr : std::false_type {}; template struct is_shared_ptr> : std::true_type {}; + +namespace AmuletNBT { + class type_error : public std::runtime_error { + public: + using std::runtime_error::runtime_error; + }; +} diff --git a/src/amulet_nbt/include/amulet_nbt/tag/list.hpp b/src/amulet_nbt/include/amulet_nbt/tag/list.hpp index 6518ea86..ee901aa4 100644 --- a/src/amulet_nbt/include/amulet_nbt/tag/list.hpp +++ b/src/amulet_nbt/include/amulet_nbt/tag/list.hpp @@ -20,7 +20,7 @@ namespace Amulet { } else if (ListTag_size(self) == 0){ self.emplace>().push_back(tag); } else { - throw std::invalid_argument( + throw AmuletNBT::type_error( "ListTag has element type " + std::to_string(self.index()) + " but the tag has type " + @@ -74,7 +74,7 @@ namespace Amulet { return Amulet::TagNode(ListTag_get(self, index)); FOR_EACH_LIST_TAG(CASE) default: - throw std::invalid_argument("Cannot get from null ListTag."); + throw AmuletNBT::type_error("Cannot get from null ListTag."); #undef CASE } } @@ -91,7 +91,7 @@ namespace Amulet { // Overwriting the only value self.emplace>({tag}); } else { - throw std::invalid_argument("NBT ListTag item mismatch."); + throw AmuletNBT::type_error("NBT ListTag item mismatch."); } } @@ -135,7 +135,7 @@ namespace Amulet { if (ListTag_size(self) == 0) { self.emplace>(); } else { - throw std::invalid_argument( + throw AmuletNBT::type_error( "ListTag has element type " + std::to_string(self.index()) + " but the tag has type " + diff --git a/src/amulet_nbt/pybind/amulet_nbt.cpp b/src/amulet_nbt/pybind/amulet_nbt.cpp index 16c3f38f..90a23868 100644 --- a/src/amulet_nbt/pybind/amulet_nbt.cpp +++ b/src/amulet_nbt/pybind/amulet_nbt.cpp @@ -1,4 +1,7 @@ #include + +#include + namespace py = pybind11; void init_encoding(py::module&); @@ -29,6 +32,16 @@ PYBIND11_MODULE(_nbt, m) { } }); + py::register_exception_translator([](std::exception_ptr p) { + try { + if (p) { + std::rethrow_exception(p); + } + } catch (const AmuletNBT::type_error& e) { + py::set_error(PyExc_TypeError, e.what()); + } + }); + init_encoding(m); init_abc(m); init_int(m); diff --git a/src/amulet_nbt/pybind/tag/list.cpp b/src/amulet_nbt/pybind/tag/list.cpp index 0d069c53..c04f8666 100644 --- a/src/amulet_nbt/pybind/tag/list.cpp +++ b/src/amulet_nbt/pybind/tag/list.cpp @@ -26,7 +26,7 @@ void ListTag_extend(Amulet::ListTagPtr tag, py::object value){ Amulet::ListTag_append(*tag, get>(node).tag);\ break; case 0: - throw std::invalid_argument("Cannot append null TagNode"); + throw py::type_error("Cannot append null TagNode"); FOR_EACH_LIST_TAG(CASE) #undef CASE } @@ -407,7 +407,7 @@ void init_list(py::module& m) { FOR_EACH_LIST_TAG(CASE) #undef CASE default: - throw std::invalid_argument("Invalid tag to set."); + throw py::type_error("Invalid tag to set."); } } ); @@ -431,7 +431,7 @@ void init_list(py::module& m) { FOR_EACH_LIST_TAG(CASE) #undef CASE default: - throw std::invalid_argument("Values must all be the same NBT tag."); + throw py::type_error("Values must all be the same NBT tag."); } } else { // The value is empty @@ -478,7 +478,7 @@ void init_list(py::module& m) { Amulet::ListTag_insert(*self.tag, index, get>(tag).tag);\ break; case 0: - throw std::invalid_argument("Cannot append null TagNode"); + throw py::type_error("Cannot insert null TagNode"); FOR_EACH_LIST_TAG(CASE) #undef CASE } @@ -490,7 +490,7 @@ void init_list(py::module& m) { switch(tag.index()){ #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG) case ID: Amulet::ListTag_append(*self.tag, get>(tag).tag); break; case 0: - throw std::invalid_argument("Cannot append null TagNode"); + throw py::type_error("Cannot append null TagNode"); FOR_EACH_LIST_TAG(CASE) #undef CASE } From 587ff8f7e3829c69457090827607b451b3f100a0 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 12 Jul 2024 15:38:44 +0100 Subject: [PATCH 091/121] Modified count behaviour --- src/amulet_nbt/pybind/tag/list.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/amulet_nbt/pybind/tag/list.cpp b/src/amulet_nbt/pybind/tag/list.cpp index c04f8666..69465281 100644 --- a/src/amulet_nbt/pybind/tag/list.cpp +++ b/src/amulet_nbt/pybind/tag/list.cpp @@ -392,8 +392,9 @@ void init_list(py::module& m) { return Amulet::ListTag_count(*self.tag, get>(tag).tag); FOR_EACH_LIST_TAG(CASE) #undef CASE + default: + throw py::type_error("Null TagNode is invalid."); } - return 0; } ); ListTag.def( From 660c1c10f6ccdbf4656d41f2f3ee7013989a48c9 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 12 Jul 2024 15:39:00 +0100 Subject: [PATCH 092/121] Fixed ListTag_append --- src/amulet_nbt/cpp/tag/list.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/amulet_nbt/cpp/tag/list.cpp b/src/amulet_nbt/cpp/tag/list.cpp index 107a1283..a4252034 100644 --- a/src/amulet_nbt/cpp/tag/list.cpp +++ b/src/amulet_nbt/cpp/tag/list.cpp @@ -15,7 +15,7 @@ namespace Amulet { }; void ListTag_append(Amulet::ListTag& self, Amulet::TagNode tag){ - switch(self.index()){ + switch(tag.index()){ #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG)\ case ID:\ ListTag_append(self, get(tag));\ From 0d4bf77e7b9a9bc7679b516079e7e7ce84bc5a53 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 12 Jul 2024 15:40:37 +0100 Subject: [PATCH 093/121] Updated tests --- tests/test_amulet_nbt/test_tag/test_list.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/test_amulet_nbt/test_tag/test_list.py b/tests/test_amulet_nbt/test_tag/test_list.py index 164eee0a..a06d4cdd 100644 --- a/tests/test_amulet_nbt/test_tag/test_list.py +++ b/tests/test_amulet_nbt/test_tag/test_list.py @@ -578,7 +578,8 @@ def test_contains(self) -> None: self.assertIn(StringTag("val1"), tag) self.assertNotIn(StringTag("val4"), tag) for not_nbt in self.not_nbt: - self.assertNotIn(not_nbt, tag) + with self.assertRaises(TypeError): + self.assertNotIn(not_nbt, tag) for tag_cls1 in self.nbt_types: tag = ListTag([tag_cls1()]) for tag_cls2 in self.nbt_types: @@ -651,7 +652,7 @@ def test_count(self) -> None: self.assertEqual(1, tag.count(StringTag("val1"))) self.assertEqual(2, tag.count(StringTag("val2"))) for obj in self.not_nbt: - with self.subTest(val=obj): + with self.subTest(val=obj), self.assertRaises(TypeError): self.assertEqual(0, tag.count(obj)) def test_append(self) -> None: From 41f447810a4bfea66a3ac891c75aee6c6ed7550f Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 12 Jul 2024 15:40:53 +0100 Subject: [PATCH 094/121] Added sanity check exception This should not be reached --- src/amulet_nbt/cpp/nbt_encoding/string/read.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/amulet_nbt/cpp/nbt_encoding/string/read.cpp b/src/amulet_nbt/cpp/nbt_encoding/string/read.cpp index 1b858aea..32b6a41c 100644 --- a/src/amulet_nbt/cpp/nbt_encoding/string/read.cpp +++ b/src/amulet_nbt/cpp/nbt_encoding/string/read.cpp @@ -371,6 +371,7 @@ Amulet::TagNode _read_snbt(const Amulet::CodePointVector& snbt, size_t& index){ return Amulet::write_utf8(string); } } + throw std::runtime_error("Should have returned before now."); } From 00d6f3a0dca7e5ed26bf848795dfbe3326cedcb7 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 12 Jul 2024 16:07:08 +0100 Subject: [PATCH 095/121] Renamed files to give unique names --- .../cpp/nbt_encoding/binary/{read.cpp => read_binary.cpp} | 0 .../cpp/nbt_encoding/binary/{write.cpp => write_binary.cpp} | 0 .../cpp/nbt_encoding/string/{read.cpp => read_string.cpp} | 0 .../cpp/nbt_encoding/string/{write.cpp => write_string.cpp} | 0 src/amulet_nbt/pybind/tag/{abc.cpp => py_abc_tag.cpp} | 0 src/amulet_nbt/pybind/tag/{array.cpp => py_array_tag.cpp} | 0 src/amulet_nbt/pybind/tag/{compound.cpp => py_compound_tag.cpp} | 0 src/amulet_nbt/pybind/tag/{float.cpp => py_float_tag.cpp} | 0 src/amulet_nbt/pybind/tag/{int.cpp => py_int_tag.cpp} | 0 src/amulet_nbt/pybind/tag/{list.cpp => py_list_tag.cpp} | 0 src/amulet_nbt/pybind/tag/{named_tag.cpp => py_named_tag.cpp} | 0 src/amulet_nbt/pybind/tag/{string.cpp => py_string_tag.cpp} | 0 12 files changed, 0 insertions(+), 0 deletions(-) rename src/amulet_nbt/cpp/nbt_encoding/binary/{read.cpp => read_binary.cpp} (100%) rename src/amulet_nbt/cpp/nbt_encoding/binary/{write.cpp => write_binary.cpp} (100%) rename src/amulet_nbt/cpp/nbt_encoding/string/{read.cpp => read_string.cpp} (100%) rename src/amulet_nbt/cpp/nbt_encoding/string/{write.cpp => write_string.cpp} (100%) rename src/amulet_nbt/pybind/tag/{abc.cpp => py_abc_tag.cpp} (100%) rename src/amulet_nbt/pybind/tag/{array.cpp => py_array_tag.cpp} (100%) rename src/amulet_nbt/pybind/tag/{compound.cpp => py_compound_tag.cpp} (100%) rename src/amulet_nbt/pybind/tag/{float.cpp => py_float_tag.cpp} (100%) rename src/amulet_nbt/pybind/tag/{int.cpp => py_int_tag.cpp} (100%) rename src/amulet_nbt/pybind/tag/{list.cpp => py_list_tag.cpp} (100%) rename src/amulet_nbt/pybind/tag/{named_tag.cpp => py_named_tag.cpp} (100%) rename src/amulet_nbt/pybind/tag/{string.cpp => py_string_tag.cpp} (100%) diff --git a/src/amulet_nbt/cpp/nbt_encoding/binary/read.cpp b/src/amulet_nbt/cpp/nbt_encoding/binary/read_binary.cpp similarity index 100% rename from src/amulet_nbt/cpp/nbt_encoding/binary/read.cpp rename to src/amulet_nbt/cpp/nbt_encoding/binary/read_binary.cpp diff --git a/src/amulet_nbt/cpp/nbt_encoding/binary/write.cpp b/src/amulet_nbt/cpp/nbt_encoding/binary/write_binary.cpp similarity index 100% rename from src/amulet_nbt/cpp/nbt_encoding/binary/write.cpp rename to src/amulet_nbt/cpp/nbt_encoding/binary/write_binary.cpp diff --git a/src/amulet_nbt/cpp/nbt_encoding/string/read.cpp b/src/amulet_nbt/cpp/nbt_encoding/string/read_string.cpp similarity index 100% rename from src/amulet_nbt/cpp/nbt_encoding/string/read.cpp rename to src/amulet_nbt/cpp/nbt_encoding/string/read_string.cpp diff --git a/src/amulet_nbt/cpp/nbt_encoding/string/write.cpp b/src/amulet_nbt/cpp/nbt_encoding/string/write_string.cpp similarity index 100% rename from src/amulet_nbt/cpp/nbt_encoding/string/write.cpp rename to src/amulet_nbt/cpp/nbt_encoding/string/write_string.cpp diff --git a/src/amulet_nbt/pybind/tag/abc.cpp b/src/amulet_nbt/pybind/tag/py_abc_tag.cpp similarity index 100% rename from src/amulet_nbt/pybind/tag/abc.cpp rename to src/amulet_nbt/pybind/tag/py_abc_tag.cpp diff --git a/src/amulet_nbt/pybind/tag/array.cpp b/src/amulet_nbt/pybind/tag/py_array_tag.cpp similarity index 100% rename from src/amulet_nbt/pybind/tag/array.cpp rename to src/amulet_nbt/pybind/tag/py_array_tag.cpp diff --git a/src/amulet_nbt/pybind/tag/compound.cpp b/src/amulet_nbt/pybind/tag/py_compound_tag.cpp similarity index 100% rename from src/amulet_nbt/pybind/tag/compound.cpp rename to src/amulet_nbt/pybind/tag/py_compound_tag.cpp diff --git a/src/amulet_nbt/pybind/tag/float.cpp b/src/amulet_nbt/pybind/tag/py_float_tag.cpp similarity index 100% rename from src/amulet_nbt/pybind/tag/float.cpp rename to src/amulet_nbt/pybind/tag/py_float_tag.cpp diff --git a/src/amulet_nbt/pybind/tag/int.cpp b/src/amulet_nbt/pybind/tag/py_int_tag.cpp similarity index 100% rename from src/amulet_nbt/pybind/tag/int.cpp rename to src/amulet_nbt/pybind/tag/py_int_tag.cpp diff --git a/src/amulet_nbt/pybind/tag/list.cpp b/src/amulet_nbt/pybind/tag/py_list_tag.cpp similarity index 100% rename from src/amulet_nbt/pybind/tag/list.cpp rename to src/amulet_nbt/pybind/tag/py_list_tag.cpp diff --git a/src/amulet_nbt/pybind/tag/named_tag.cpp b/src/amulet_nbt/pybind/tag/py_named_tag.cpp similarity index 100% rename from src/amulet_nbt/pybind/tag/named_tag.cpp rename to src/amulet_nbt/pybind/tag/py_named_tag.cpp diff --git a/src/amulet_nbt/pybind/tag/string.cpp b/src/amulet_nbt/pybind/tag/py_string_tag.cpp similarity index 100% rename from src/amulet_nbt/pybind/tag/string.cpp rename to src/amulet_nbt/pybind/tag/py_string_tag.cpp From fcc5cc9f1b1b2189ecdc962672fc9d05c257c97a Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 12 Jul 2024 16:07:36 +0100 Subject: [PATCH 096/121] Handle null case in ListTag.__contains__ --- src/amulet_nbt/pybind/tag/py_list_tag.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/amulet_nbt/pybind/tag/py_list_tag.cpp b/src/amulet_nbt/pybind/tag/py_list_tag.cpp index 69465281..bbdb2559 100644 --- a/src/amulet_nbt/pybind/tag/py_list_tag.cpp +++ b/src/amulet_nbt/pybind/tag/py_list_tag.cpp @@ -343,12 +343,15 @@ void init_list(py::module& m) { ListTag.def( "__contains__", [](const Amulet::ListTagWrapper& self, Amulet::WrapperNode item){ + if (item.index() == 0) { + throw py::type_error("item cannot be None."); + } if (item.index() != self.tag->index()){ return false; } switch(item.index()){ case 0: - return false; + throw py::type_error("item cannot be None."); #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG)\ case ID:\ {\ From 1e56a9d234573ff9e87982f0b39cb664dadce0c0 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 12 Jul 2024 16:12:16 +0100 Subject: [PATCH 097/121] Changed exception type --- src/amulet_nbt/pybind/tag/py_list_tag.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/amulet_nbt/pybind/tag/py_list_tag.cpp b/src/amulet_nbt/pybind/tag/py_list_tag.cpp index bbdb2559..6e61f7d5 100644 --- a/src/amulet_nbt/pybind/tag/py_list_tag.cpp +++ b/src/amulet_nbt/pybind/tag/py_list_tag.cpp @@ -87,7 +87,7 @@ void ListTag_set_slice(Amulet::ListTagPtr self, const py::slice &slice, std::vec } self->emplace>(vec); } else { - throw std::invalid_argument("NBT ListTag item mismatch."); + throw py::type_error("NBT ListTag item mismatch."); } } } From 0476489f2d7e40e0b8af3a57570bf3d35177627d Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 12 Jul 2024 16:20:59 +0100 Subject: [PATCH 098/121] Seek past closing bracket --- src/amulet_nbt/cpp/nbt_encoding/string/read_string.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/amulet_nbt/cpp/nbt_encoding/string/read_string.cpp b/src/amulet_nbt/cpp/nbt_encoding/string/read_string.cpp index 32b6a41c..89e7607a 100644 --- a/src/amulet_nbt/cpp/nbt_encoding/string/read_string.cpp +++ b/src/amulet_nbt/cpp/nbt_encoding/string/read_string.cpp @@ -241,6 +241,7 @@ inline Amulet::TagNode read_array(const Amulet::CodePointVector& snbt, size_t& i // Read past the comma read_comma(snbt, index, ']'); } + index++; // seek past ']' return std::make_shared>(arr.begin(), arr.end()); } @@ -267,7 +268,7 @@ Amulet::TagNode _read_snbt(const Amulet::CodePointVector& snbt, size_t& index){ // Read past the comma read_comma(snbt, index, '}'); } - index++; // seek past '{' + index++; // seek past '}' return tag; } case '[': @@ -299,6 +300,7 @@ Amulet::TagNode _read_snbt(const Amulet::CodePointVector& snbt, size_t& index){ // Read past the comma read_comma(snbt, index, ']'); } + index++; // seek past ']' return tag; } } else if (read_code_point(snbt, index) == ']'){ From f9618ab2d5a42d147bacb8e8c6211fd9b88e81cd Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 12 Jul 2024 17:20:18 +0100 Subject: [PATCH 099/121] Updated tests --- tests/test_amulet_nbt/test_tag/test_list.py | 14 +++++++------- tests/test_amulet_nbt/test_tag/test_named_tag.py | 6 +++--- tests/test_amulet_nbt/test_tag/test_string.py | 10 +++++----- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/tests/test_amulet_nbt/test_tag/test_list.py b/tests/test_amulet_nbt/test_tag/test_list.py index a06d4cdd..97eb3a90 100644 --- a/tests/test_amulet_nbt/test_tag/test_list.py +++ b/tests/test_amulet_nbt/test_tag/test_list.py @@ -236,11 +236,11 @@ def test_repr(self) -> None: # string tag list self.assertEqual( - 'ListTag([StringTag("value")], 8)', + "ListTag([StringTag('value')], 8)", repr(ListTag([StringTag("value")])), ) self.assertEqual( - 'ListTag([StringTag("value"), StringTag("value")], 8)', + "ListTag([StringTag('value'), StringTag('value')], 8)", repr(ListTag([StringTag("value"), StringTag("value")])), ) @@ -574,7 +574,7 @@ def test_insert(self) -> None: tag.insert(1, obj) def test_contains(self) -> None: - tag = ListTag([StringTag("val1"), StringTag("val2"), StringTag("val3")]) + tag: ListTag = ListTag([StringTag("val1"), StringTag("val2"), StringTag("val3")]) self.assertIn(StringTag("val1"), tag) self.assertNotIn(StringTag("val4"), tag) for not_nbt in self.not_nbt: @@ -638,13 +638,13 @@ def test_index(self) -> None: str_list_tag.index(StringTag("val3")) for obj in self.not_nbt: - with self.subTest(val=obj), self.assertRaises(ValueError): + with self.subTest(val=obj), self.assertRaises(TypeError): str_list_tag.index(obj) byte_list_tag = ListTag([ByteTag(1), ByteTag(2), ByteTag(3)]) with self.assertRaises(ValueError): byte_list_tag.index(ShortTag(2)) - with self.assertRaises(ValueError): + with self.assertRaises(TypeError): byte_list_tag.index(True) def test_count(self) -> None: @@ -720,7 +720,7 @@ def test_remove(self) -> None: self.assertEqual(tag, ListTag([StringTag("val2")])) for obj in self.not_nbt: - with self.subTest(val=obj), self.assertRaises(ValueError): + with self.subTest(val=obj), self.assertRaises(TypeError): tag.remove(obj) def test_iadd(self) -> None: @@ -894,7 +894,7 @@ def test_from_snbt(self) -> None: read_snbt(f"[{tag.to_snbt()}, {tag.to_snbt()}]"), ) - with self.assertRaises(ValueError): + with self.assertRaises(IndexError): read_snbt("[") with self.assertRaises(ValueError): read_snbt("]") diff --git a/tests/test_amulet_nbt/test_tag/test_named_tag.py b/tests/test_amulet_nbt/test_tag/test_named_tag.py index 474b18d8..db213317 100644 --- a/tests/test_amulet_nbt/test_tag/test_named_tag.py +++ b/tests/test_amulet_nbt/test_tag/test_named_tag.py @@ -70,11 +70,11 @@ def test_equal(self) -> None: self.assertNotEqual(NamedTag(cls1(), "name"), NamedTag(cls1(), "name2")) def test_repr(self) -> None: - self.assertEqual('NamedTag(CompoundTag({}), "")', repr(NamedTag())) + self.assertEqual("NamedTag(CompoundTag({}), '')", repr(NamedTag())) self.assertEqual( - 'NamedTag(CompoundTag({}), "name")', repr(NamedTag(name="name")) + "NamedTag(CompoundTag({}), 'name')", repr(NamedTag(name="name")) ) - self.assertEqual('NamedTag(ByteTag(0), "")', repr(NamedTag(ByteTag()))) + self.assertEqual("NamedTag(ByteTag(0), '')", repr(NamedTag(ByteTag()))) def test_str(self) -> None: # undefined diff --git a/tests/test_amulet_nbt/test_tag/test_string.py b/tests/test_amulet_nbt/test_tag/test_string.py index 7c65574b..73cedbc1 100644 --- a/tests/test_amulet_nbt/test_tag/test_string.py +++ b/tests/test_amulet_nbt/test_tag/test_string.py @@ -42,10 +42,10 @@ def test_py_data(self) -> None: self.assertEqual(b"value", StringTag("value").py_bytes) def test_repr(self) -> None: - self.assertEqual('StringTag("")', repr(StringTag())) - self.assertEqual('StringTag("value")', repr(StringTag("value"))) - self.assertEqual('StringTag("quote\\"value")', repr(StringTag('quote"value'))) - self.assertEqual('StringTag("quote\'value")', repr(StringTag("quote'value"))) + self.assertEqual("StringTag('')", repr(StringTag())) + self.assertEqual("StringTag('value')", repr(StringTag("value"))) + self.assertEqual("StringTag('quote\"value')", repr(StringTag('quote"value'))) + self.assertEqual("StringTag(\"quote'value\")", repr(StringTag("quote'value"))) def test_str(self) -> None: self.assertEqual("hello world", str(StringTag("hello world"))) @@ -274,7 +274,7 @@ def test_from_snbt(self) -> None: read_snbt(f'"{ascii_uppercase + ascii_lowercase + digits + "._+-"}"'), ) - with self.assertRaises(ValueError): + with self.assertRaises(IndexError): read_snbt("") From 01b6c0144a7ac04fb967b1fe1ebd1769b89bc11c Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 12 Jul 2024 17:20:29 +0100 Subject: [PATCH 100/121] Improved string construction --- src/amulet_nbt/pybind/tag/py_string_tag.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/amulet_nbt/pybind/tag/py_string_tag.cpp b/src/amulet_nbt/pybind/tag/py_string_tag.cpp index 2dc781f6..a0ce3544 100644 --- a/src/amulet_nbt/pybind/tag/py_string_tag.cpp +++ b/src/amulet_nbt/pybind/tag/py_string_tag.cpp @@ -13,7 +13,13 @@ void init_string(py::module& m) { StringTag.def_property_readonly_static("tag_id", [](py::object) {return 8;}); StringTag.def( py::init([](py::object value) { - return Amulet::StringTagWrapper(value.cast()); + if (py::isinstance(value)){ + return value.cast(); + } else if (py::isinstance(value) || py::isinstance(value)){ + return Amulet::StringTagWrapper(value.cast()); + } else { + return Amulet::StringTagWrapper(py::str(value).cast()); + } }), py::arg("value") = "", py::doc("__init__(self: amulet_nbt.StringTag, value: str | bytes) -> None") From 27e8047daecbb9ddbd180c822ccd79c851c079a7 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 12 Jul 2024 17:20:52 +0100 Subject: [PATCH 101/121] Added filepath_or_writable default argument --- src/amulet_nbt/pybind/tag/py_abc_tag.cpp | 4 ++-- src/amulet_nbt/pybind/tag/py_named_tag.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/amulet_nbt/pybind/tag/py_abc_tag.cpp b/src/amulet_nbt/pybind/tag/py_abc_tag.cpp index be3d3547..c7714c35 100644 --- a/src/amulet_nbt/pybind/tag/py_abc_tag.cpp +++ b/src/amulet_nbt/pybind/tag/py_abc_tag.cpp @@ -129,7 +129,7 @@ void init_abc(py::module& m) { preset.string_encoding.encode ); }, - py::arg("filepath_or_writable"), + py::arg("filepath_or_writable") = py::none(), py::pos_only(), py::kw_only(), py::arg("preset") = java_encoding, @@ -154,7 +154,7 @@ void init_abc(py::module& m) { string_encoding.encode ); }, - py::arg("filepath_or_writable"), + py::arg("filepath_or_writable") = py::none(), py::pos_only(), py::kw_only(), py::arg("compressed") = true, diff --git a/src/amulet_nbt/pybind/tag/py_named_tag.cpp b/src/amulet_nbt/pybind/tag/py_named_tag.cpp index c90d9478..a2fcae16 100644 --- a/src/amulet_nbt/pybind/tag/py_named_tag.cpp +++ b/src/amulet_nbt/pybind/tag/py_named_tag.cpp @@ -174,7 +174,7 @@ void init_named_tag(py::module& m) { preset.string_encoding.encode ); }, - py::arg("filepath_or_writable"), + py::arg("filepath_or_writable") = py::none(), py::pos_only(), py::kw_only(), py::arg("preset") = java_encoding @@ -196,7 +196,7 @@ void init_named_tag(py::module& m) { string_encoding.encode ); }, - py::arg("filepath_or_writable"), + py::arg("filepath_or_writable") = py::none(), py::pos_only(), py::kw_only(), py::arg("compressed") = true, From 15eaa017c8121902112e0a168584334da728f218 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 12 Jul 2024 17:23:22 +0100 Subject: [PATCH 102/121] Fixed list iterator --- src/amulet_nbt/cpp/tag/list.cpp | 4 +++- src/amulet_nbt/pybind/tag/py_list_tag.cpp | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/amulet_nbt/cpp/tag/list.cpp b/src/amulet_nbt/cpp/tag/list.cpp index a4252034..7606f4d9 100644 --- a/src/amulet_nbt/cpp/tag/list.cpp +++ b/src/amulet_nbt/cpp/tag/list.cpp @@ -29,7 +29,9 @@ namespace Amulet { ListTagIterator::ListTagIterator(Amulet::ListTagPtr tag, size_t start, std::ptrdiff_t step): tag(tag), index(start), step(step) {}; Amulet::TagNode ListTagIterator::next() { - return Amulet::ListTag_get_node(*tag, index++); + auto node = Amulet::ListTag_get_node(*tag, index); + index += step; + return node; } bool ListTagIterator::has_next(){ return index >= 0 && index < ListTag_size(*tag); diff --git a/src/amulet_nbt/pybind/tag/py_list_tag.cpp b/src/amulet_nbt/pybind/tag/py_list_tag.cpp index 6e61f7d5..290b7087 100644 --- a/src/amulet_nbt/pybind/tag/py_list_tag.cpp +++ b/src/amulet_nbt/pybind/tag/py_list_tag.cpp @@ -337,7 +337,7 @@ void init_list(py::module& m) { ListTag.def( "__reversed__", [](const Amulet::ListTagWrapper& self) { - return Amulet::ListTagIterator(self.tag, ListTag_size(*self.tag), -1); + return Amulet::ListTagIterator(self.tag, ListTag_size(*self.tag) - 1, -1); } ); ListTag.def( From d3d02e9bb4924c4135a33e6b2cd2b4339b91cb5f Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Fri, 12 Jul 2024 17:24:01 +0100 Subject: [PATCH 103/121] Fixed list methods --- .../include/amulet_nbt/tag/list.hpp | 2 +- src/amulet_nbt/pybind/tag/py_list_tag.cpp | 25 +++++++++++++++---- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/amulet_nbt/include/amulet_nbt/tag/list.hpp b/src/amulet_nbt/include/amulet_nbt/tag/list.hpp index ee901aa4..f89e9ec8 100644 --- a/src/amulet_nbt/include/amulet_nbt/tag/list.hpp +++ b/src/amulet_nbt/include/amulet_nbt/tag/list.hpp @@ -96,7 +96,7 @@ namespace Amulet { } template - void ListTag_remove(Amulet::ListTag& self, indexT index){ + void ListTag_del(Amulet::ListTag& self, indexT index){ switch(self.index()){ #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG)\ case ID:\ diff --git a/src/amulet_nbt/pybind/tag/py_list_tag.cpp b/src/amulet_nbt/pybind/tag/py_list_tag.cpp index 290b7087..91e6e6d0 100644 --- a/src/amulet_nbt/pybind/tag/py_list_tag.cpp +++ b/src/amulet_nbt/pybind/tag/py_list_tag.cpp @@ -381,8 +381,9 @@ void init_list(py::module& m) { return Amulet::ListTag_index(*self.tag, get>(tag).tag, start, stop); FOR_EACH_LIST_TAG(CASE) #undef CASE + default: + throw py::type_error("tag cannot be None"); } - throw std::invalid_argument("item is not in the ListTag"); }, py::arg("tag"), py::arg("start") = 0, py::arg("stop") = std::numeric_limits::max() ); @@ -456,7 +457,7 @@ void init_list(py::module& m) { ListTag.def( "__delitem__", [](const Amulet::ListTagWrapper& self, Py_ssize_t item){ - Amulet::ListTag_remove(*self.tag, item); + Amulet::ListTag_del(*self.tag, item); } ); ListTag.def( @@ -530,12 +531,26 @@ void init_list(py::module& m) { "pop", [](const Amulet::ListTagWrapper& self, Py_ssize_t item){ return Amulet::wrap_node(ListTag_pop(*self.tag, item)); - } + }, + py::arg("item") = -1 ); ListTag.def( "remove", - [](const Amulet::ListTagWrapper& self, Py_ssize_t item){ - ListTag_remove(*self.tag, item); + [](const Amulet::ListTagWrapper& self, Amulet::WrapperNode tag){ + switch(tag.index()){ + #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG)\ + case ID:\ + {\ + size_t index = Amulet::ListTag_index(*self.tag, std::get>(tag).tag);\ + std::vector& list_tag = std::get>(*self.tag);\ + list_tag.erase(list_tag.begin() + index);\ + break;\ + } + FOR_EACH_LIST_TAG(CASE) + #undef CASE + default: + throw py::type_error("tag cannot be None"); + } } ); ListTag.def( From c368ea66cb9f4afc5d217f4353907bd4086fd0cd Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Mon, 15 Jul 2024 09:56:01 +0100 Subject: [PATCH 104/121] Fixed list tag setitem --- src/amulet_nbt/pybind/tag/py_list_tag.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/amulet_nbt/pybind/tag/py_list_tag.cpp b/src/amulet_nbt/pybind/tag/py_list_tag.cpp index 91e6e6d0..128d05ec 100644 --- a/src/amulet_nbt/pybind/tag/py_list_tag.cpp +++ b/src/amulet_nbt/pybind/tag/py_list_tag.cpp @@ -429,14 +429,19 @@ void init_list(py::module& m) { #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG)\ case ID:{\ /* Cast to C++ objects. Also validate that they are all the same type. */\ - std::vector vec = list.cast>();\ + std::vector vec;\ + vec.push_back(std::get>(first).tag);\ + for (size_t i = 1; i < list.size(); i++){\ + Amulet::WrapperNode tag = list[i].cast();\ + vec.push_back(std::get>(tag).tag);\ + }\ ListTag_set_slice(self.tag, slice, vec);\ break;\ } FOR_EACH_LIST_TAG(CASE) #undef CASE default: - throw py::type_error("Values must all be the same NBT tag."); + throw py::type_error("Cannot set a null tag."); } } else { // The value is empty From 8ea927b1f81b1013ca9a2d343029eeca94c5ef73 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Mon, 15 Jul 2024 10:05:21 +0100 Subject: [PATCH 105/121] Reformatted --- setup.py | 16 +- src/amulet_nbt/__init__.py | 20 +- src/amulet_nbt/__init__.pyi | 8 +- tests/test_amulet_nbt/test_tag/test_float.py | 8255 ++++++++--------- tests/test_amulet_nbt/test_tag/test_int.py | 56 +- tests/test_amulet_nbt/test_tag/test_list.py | 4 +- tests/test_amulet_nbt/test_tag/test_string.py | 2 +- 7 files changed, 4193 insertions(+), 4168 deletions(-) diff --git a/setup.py b/setup.py index b69083b0..403235f4 100644 --- a/setup.py +++ b/setup.py @@ -22,11 +22,13 @@ cmdclass=versioneer.get_cmdclass(), libraries=[ ( - "amulet_nbt", dict( - sources=glob.glob("src/amulet_nbt/cpp/**/*.cpp", recursive=True), - include_dirs=["src/amulet_nbt/include"], - cflags=CompileArgs, - )) + "amulet_nbt", + dict( + sources=glob.glob("src/amulet_nbt/cpp/**/*.cpp", recursive=True), + include_dirs=["src/amulet_nbt/include"], + cflags=CompileArgs, + ), + ) ], ext_modules=[ Extension( @@ -35,7 +37,7 @@ include_dirs=["src/amulet_nbt/include", pybind11.get_include()], libraries=["amulet_nbt"], define_macros=[("PYBIND11_DETAILED_ERROR_MESSAGES", None)], - extra_compile_args=CompileArgs + extra_compile_args=CompileArgs, ) - ] + ], ) diff --git a/src/amulet_nbt/__init__.py b/src/amulet_nbt/__init__.py index e1b7fd25..803ffa76 100644 --- a/src/amulet_nbt/__init__.py +++ b/src/amulet_nbt/__init__.py @@ -11,6 +11,7 @@ def get_include() -> str: import os + return os.path.join(__path__[0], "include") @@ -23,7 +24,6 @@ def get_include() -> str: AbstractBaseIntTag, AbstractBaseFloatTag, AbstractBaseArrayTag, - # Tag classes ByteTag, ShortTag, @@ -37,7 +37,6 @@ def get_include() -> str: CompoundTag, IntArrayTag, LongArrayTag, - # Tag class aliases ByteTag as TAG_Byte, ShortTag as TAG_Short, @@ -51,9 +50,7 @@ def get_include() -> str: CompoundTag as TAG_Compound, IntArrayTag as TAG_Int_Array, LongArrayTag as TAG_Long_Array, - NamedTag, - read_nbt, read_nbt_array, ReadOffset, @@ -72,7 +69,20 @@ def get_include() -> str: FloatType: TypeAlias = FloatTag | DoubleTag NumberType: TypeAlias = ByteTag | ShortTag | IntTag | LongTag | FloatTag | DoubleTag ArrayType: TypeAlias = ByteArrayTag | IntArrayTag | LongArrayTag -AnyNBT: TypeAlias = ByteTag | ShortTag | IntTag | LongTag | FloatTag | DoubleTag | ByteArrayTag | StringTag | ListTag | CompoundTag | IntArrayTag | LongArrayTag +AnyNBT: TypeAlias = ( + ByteTag + | ShortTag + | IntTag + | LongTag + | FloatTag + | DoubleTag + | ByteArrayTag + | StringTag + | ListTag + | CompoundTag + | IntArrayTag + | LongArrayTag +) __all__ = [ diff --git a/src/amulet_nbt/__init__.pyi b/src/amulet_nbt/__init__.pyi index 333e86ca..5fe492b3 100644 --- a/src/amulet_nbt/__init__.pyi +++ b/src/amulet_nbt/__init__.pyi @@ -78,13 +78,10 @@ __all__ = [ ] class _Readable(Protocol): - def read(self) -> bytes: - ... + def read(self) -> bytes: ... class _Writeable(Protocol): - def write(self, s: bytes) -> Any: - ... - + def write(self, s: bytes) -> Any: ... class StringEncoding: def encode(self, data: bytes) -> bytes: ... @@ -100,7 +97,6 @@ class EncodingPreset: java_encoding: EncodingPreset bedrock_encoding: EncodingPreset - class AbstractBaseTag: """Abstract Base Class for all Tag classes""" diff --git a/tests/test_amulet_nbt/test_tag/test_float.py b/tests/test_amulet_nbt/test_tag/test_float.py index e8400d51..56759ee6 100644 --- a/tests/test_amulet_nbt/test_tag/test_float.py +++ b/tests/test_amulet_nbt/test_tag/test_float.py @@ -644,1179 +644,1178 @@ def test_from_snbt(self) -> None: (DoubleTag(0), "+.0E-2"), (DoubleTag(0), "+.0E-2d"), (DoubleTag(0), "+.0E-2D"), - # validate false cases - (StringTag('+'), "+"), - (StringTag('++'), "++"), - (StringTag('++.'), "++."), - (StringTag('++.1'), "++.1"), - (StringTag('++.1D'), "++.1D"), - (StringTag('++.1F'), "++.1F"), - (StringTag('++.1d'), "++.1d"), - (StringTag('++.1f'), "++.1f"), - (StringTag('++.D'), "++.D"), - (StringTag('++.F'), "++.F"), - (StringTag('++.d'), "++.d"), - (StringTag('++.f'), "++.f"), - (StringTag('++1'), "++1"), - (StringTag('++1.'), "++1."), - (StringTag('++1.1'), "++1.1"), - (StringTag('++1.1D'), "++1.1D"), - (StringTag('++1.1F'), "++1.1F"), - (StringTag('++1.1d'), "++1.1d"), - (StringTag('++1.1f'), "++1.1f"), - (StringTag('++1.D'), "++1.D"), - (StringTag('++1.F'), "++1.F"), - (StringTag('++1.d'), "++1.d"), - (StringTag('++1.f'), "++1.f"), - (StringTag('++1D'), "++1D"), - (StringTag('++1F'), "++1F"), - (StringTag('++1d'), "++1d"), - (StringTag('++1f'), "++1f"), - (StringTag('++D'), "++D"), - (StringTag('++F'), "++F"), - (StringTag('++d'), "++d"), - (StringTag('++f'), "++f"), - (StringTag('+-'), "+-"), - (StringTag('+-.'), "+-."), - (StringTag('+-.1'), "+-.1"), - (StringTag('+-.1D'), "+-.1D"), - (StringTag('+-.1F'), "+-.1F"), - (StringTag('+-.1d'), "+-.1d"), - (StringTag('+-.1f'), "+-.1f"), - (StringTag('+-.D'), "+-.D"), - (StringTag('+-.F'), "+-.F"), - (StringTag('+-.d'), "+-.d"), - (StringTag('+-.f'), "+-.f"), - (StringTag('+-1'), "+-1"), - (StringTag('+-1.'), "+-1."), - (StringTag('+-1.1'), "+-1.1"), - (StringTag('+-1.1D'), "+-1.1D"), - (StringTag('+-1.1F'), "+-1.1F"), - (StringTag('+-1.1d'), "+-1.1d"), - (StringTag('+-1.1f'), "+-1.1f"), - (StringTag('+-1.D'), "+-1.D"), - (StringTag('+-1.F'), "+-1.F"), - (StringTag('+-1.d'), "+-1.d"), - (StringTag('+-1.f'), "+-1.f"), - (StringTag('+-1D'), "+-1D"), - (StringTag('+-1F'), "+-1F"), - (StringTag('+-1d'), "+-1d"), - (StringTag('+-1f'), "+-1f"), - (StringTag('+-D'), "+-D"), - (StringTag('+-F'), "+-F"), - (StringTag('+-d'), "+-d"), - (StringTag('+-f'), "+-f"), - (StringTag('+.'), "+."), - (StringTag('+.+'), "+.+"), - (StringTag('+.+.'), "+.+."), - (StringTag('+.+.1'), "+.+.1"), - (StringTag('+.+.1D'), "+.+.1D"), - (StringTag('+.+.1F'), "+.+.1F"), - (StringTag('+.+.1d'), "+.+.1d"), - (StringTag('+.+.1f'), "+.+.1f"), - (StringTag('+.+.D'), "+.+.D"), - (StringTag('+.+.F'), "+.+.F"), - (StringTag('+.+.d'), "+.+.d"), - (StringTag('+.+.f'), "+.+.f"), - (StringTag('+.+1'), "+.+1"), - (StringTag('+.+1.'), "+.+1."), - (StringTag('+.+1.1'), "+.+1.1"), - (StringTag('+.+1.1D'), "+.+1.1D"), - (StringTag('+.+1.1F'), "+.+1.1F"), - (StringTag('+.+1.1d'), "+.+1.1d"), - (StringTag('+.+1.1f'), "+.+1.1f"), - (StringTag('+.+1.D'), "+.+1.D"), - (StringTag('+.+1.F'), "+.+1.F"), - (StringTag('+.+1.d'), "+.+1.d"), - (StringTag('+.+1.f'), "+.+1.f"), - (StringTag('+.+1D'), "+.+1D"), - (StringTag('+.+1F'), "+.+1F"), - (StringTag('+.+1d'), "+.+1d"), - (StringTag('+.+1f'), "+.+1f"), - (StringTag('+.+D'), "+.+D"), - (StringTag('+.+F'), "+.+F"), - (StringTag('+.+d'), "+.+d"), - (StringTag('+.+f'), "+.+f"), - (StringTag('+.-'), "+.-"), - (StringTag('+.-.'), "+.-."), - (StringTag('+.-.1'), "+.-.1"), - (StringTag('+.-.1D'), "+.-.1D"), - (StringTag('+.-.1F'), "+.-.1F"), - (StringTag('+.-.1d'), "+.-.1d"), - (StringTag('+.-.1f'), "+.-.1f"), - (StringTag('+.-.D'), "+.-.D"), - (StringTag('+.-.F'), "+.-.F"), - (StringTag('+.-.d'), "+.-.d"), - (StringTag('+.-.f'), "+.-.f"), - (StringTag('+.-1'), "+.-1"), - (StringTag('+.-1.'), "+.-1."), - (StringTag('+.-1.1'), "+.-1.1"), - (StringTag('+.-1.1D'), "+.-1.1D"), - (StringTag('+.-1.1F'), "+.-1.1F"), - (StringTag('+.-1.1d'), "+.-1.1d"), - (StringTag('+.-1.1f'), "+.-1.1f"), - (StringTag('+.-1.D'), "+.-1.D"), - (StringTag('+.-1.F'), "+.-1.F"), - (StringTag('+.-1.d'), "+.-1.d"), - (StringTag('+.-1.f'), "+.-1.f"), - (StringTag('+.-1D'), "+.-1D"), - (StringTag('+.-1F'), "+.-1F"), - (StringTag('+.-1d'), "+.-1d"), - (StringTag('+.-1f'), "+.-1f"), - (StringTag('+.-D'), "+.-D"), - (StringTag('+.-F'), "+.-F"), - (StringTag('+.-d'), "+.-d"), - (StringTag('+.-f'), "+.-f"), - (StringTag('+..'), "+.."), - (StringTag('+..1'), "+..1"), - (StringTag('+..1D'), "+..1D"), - (StringTag('+..1F'), "+..1F"), - (StringTag('+..1d'), "+..1d"), - (StringTag('+..1f'), "+..1f"), - (StringTag('+..D'), "+..D"), - (StringTag('+..F'), "+..F"), - (StringTag('+..d'), "+..d"), - (StringTag('+..f'), "+..f"), + (StringTag("+"), "+"), + (StringTag("++"), "++"), + (StringTag("++."), "++."), + (StringTag("++.1"), "++.1"), + (StringTag("++.1D"), "++.1D"), + (StringTag("++.1F"), "++.1F"), + (StringTag("++.1d"), "++.1d"), + (StringTag("++.1f"), "++.1f"), + (StringTag("++.D"), "++.D"), + (StringTag("++.F"), "++.F"), + (StringTag("++.d"), "++.d"), + (StringTag("++.f"), "++.f"), + (StringTag("++1"), "++1"), + (StringTag("++1."), "++1."), + (StringTag("++1.1"), "++1.1"), + (StringTag("++1.1D"), "++1.1D"), + (StringTag("++1.1F"), "++1.1F"), + (StringTag("++1.1d"), "++1.1d"), + (StringTag("++1.1f"), "++1.1f"), + (StringTag("++1.D"), "++1.D"), + (StringTag("++1.F"), "++1.F"), + (StringTag("++1.d"), "++1.d"), + (StringTag("++1.f"), "++1.f"), + (StringTag("++1D"), "++1D"), + (StringTag("++1F"), "++1F"), + (StringTag("++1d"), "++1d"), + (StringTag("++1f"), "++1f"), + (StringTag("++D"), "++D"), + (StringTag("++F"), "++F"), + (StringTag("++d"), "++d"), + (StringTag("++f"), "++f"), + (StringTag("+-"), "+-"), + (StringTag("+-."), "+-."), + (StringTag("+-.1"), "+-.1"), + (StringTag("+-.1D"), "+-.1D"), + (StringTag("+-.1F"), "+-.1F"), + (StringTag("+-.1d"), "+-.1d"), + (StringTag("+-.1f"), "+-.1f"), + (StringTag("+-.D"), "+-.D"), + (StringTag("+-.F"), "+-.F"), + (StringTag("+-.d"), "+-.d"), + (StringTag("+-.f"), "+-.f"), + (StringTag("+-1"), "+-1"), + (StringTag("+-1."), "+-1."), + (StringTag("+-1.1"), "+-1.1"), + (StringTag("+-1.1D"), "+-1.1D"), + (StringTag("+-1.1F"), "+-1.1F"), + (StringTag("+-1.1d"), "+-1.1d"), + (StringTag("+-1.1f"), "+-1.1f"), + (StringTag("+-1.D"), "+-1.D"), + (StringTag("+-1.F"), "+-1.F"), + (StringTag("+-1.d"), "+-1.d"), + (StringTag("+-1.f"), "+-1.f"), + (StringTag("+-1D"), "+-1D"), + (StringTag("+-1F"), "+-1F"), + (StringTag("+-1d"), "+-1d"), + (StringTag("+-1f"), "+-1f"), + (StringTag("+-D"), "+-D"), + (StringTag("+-F"), "+-F"), + (StringTag("+-d"), "+-d"), + (StringTag("+-f"), "+-f"), + (StringTag("+."), "+."), + (StringTag("+.+"), "+.+"), + (StringTag("+.+."), "+.+."), + (StringTag("+.+.1"), "+.+.1"), + (StringTag("+.+.1D"), "+.+.1D"), + (StringTag("+.+.1F"), "+.+.1F"), + (StringTag("+.+.1d"), "+.+.1d"), + (StringTag("+.+.1f"), "+.+.1f"), + (StringTag("+.+.D"), "+.+.D"), + (StringTag("+.+.F"), "+.+.F"), + (StringTag("+.+.d"), "+.+.d"), + (StringTag("+.+.f"), "+.+.f"), + (StringTag("+.+1"), "+.+1"), + (StringTag("+.+1."), "+.+1."), + (StringTag("+.+1.1"), "+.+1.1"), + (StringTag("+.+1.1D"), "+.+1.1D"), + (StringTag("+.+1.1F"), "+.+1.1F"), + (StringTag("+.+1.1d"), "+.+1.1d"), + (StringTag("+.+1.1f"), "+.+1.1f"), + (StringTag("+.+1.D"), "+.+1.D"), + (StringTag("+.+1.F"), "+.+1.F"), + (StringTag("+.+1.d"), "+.+1.d"), + (StringTag("+.+1.f"), "+.+1.f"), + (StringTag("+.+1D"), "+.+1D"), + (StringTag("+.+1F"), "+.+1F"), + (StringTag("+.+1d"), "+.+1d"), + (StringTag("+.+1f"), "+.+1f"), + (StringTag("+.+D"), "+.+D"), + (StringTag("+.+F"), "+.+F"), + (StringTag("+.+d"), "+.+d"), + (StringTag("+.+f"), "+.+f"), + (StringTag("+.-"), "+.-"), + (StringTag("+.-."), "+.-."), + (StringTag("+.-.1"), "+.-.1"), + (StringTag("+.-.1D"), "+.-.1D"), + (StringTag("+.-.1F"), "+.-.1F"), + (StringTag("+.-.1d"), "+.-.1d"), + (StringTag("+.-.1f"), "+.-.1f"), + (StringTag("+.-.D"), "+.-.D"), + (StringTag("+.-.F"), "+.-.F"), + (StringTag("+.-.d"), "+.-.d"), + (StringTag("+.-.f"), "+.-.f"), + (StringTag("+.-1"), "+.-1"), + (StringTag("+.-1."), "+.-1."), + (StringTag("+.-1.1"), "+.-1.1"), + (StringTag("+.-1.1D"), "+.-1.1D"), + (StringTag("+.-1.1F"), "+.-1.1F"), + (StringTag("+.-1.1d"), "+.-1.1d"), + (StringTag("+.-1.1f"), "+.-1.1f"), + (StringTag("+.-1.D"), "+.-1.D"), + (StringTag("+.-1.F"), "+.-1.F"), + (StringTag("+.-1.d"), "+.-1.d"), + (StringTag("+.-1.f"), "+.-1.f"), + (StringTag("+.-1D"), "+.-1D"), + (StringTag("+.-1F"), "+.-1F"), + (StringTag("+.-1d"), "+.-1d"), + (StringTag("+.-1f"), "+.-1f"), + (StringTag("+.-D"), "+.-D"), + (StringTag("+.-F"), "+.-F"), + (StringTag("+.-d"), "+.-d"), + (StringTag("+.-f"), "+.-f"), + (StringTag("+.."), "+.."), + (StringTag("+..1"), "+..1"), + (StringTag("+..1D"), "+..1D"), + (StringTag("+..1F"), "+..1F"), + (StringTag("+..1d"), "+..1d"), + (StringTag("+..1f"), "+..1f"), + (StringTag("+..D"), "+..D"), + (StringTag("+..F"), "+..F"), + (StringTag("+..d"), "+..d"), + (StringTag("+..f"), "+..f"), (DoubleTag(0.100000), "+.1"), - (StringTag('+.1+'), "+.1+"), - (StringTag('+.1+.'), "+.1+."), - (StringTag('+.1+.1'), "+.1+.1"), - (StringTag('+.1+.1D'), "+.1+.1D"), - (StringTag('+.1+.1F'), "+.1+.1F"), - (StringTag('+.1+.1d'), "+.1+.1d"), - (StringTag('+.1+.1f'), "+.1+.1f"), - (StringTag('+.1+.D'), "+.1+.D"), - (StringTag('+.1+.F'), "+.1+.F"), - (StringTag('+.1+.d'), "+.1+.d"), - (StringTag('+.1+.f'), "+.1+.f"), - (StringTag('+.1+1'), "+.1+1"), - (StringTag('+.1+1.'), "+.1+1."), - (StringTag('+.1+1.1'), "+.1+1.1"), - (StringTag('+.1+1.1D'), "+.1+1.1D"), - (StringTag('+.1+1.1F'), "+.1+1.1F"), - (StringTag('+.1+1.1d'), "+.1+1.1d"), - (StringTag('+.1+1.1f'), "+.1+1.1f"), - (StringTag('+.1+1.D'), "+.1+1.D"), - (StringTag('+.1+1.F'), "+.1+1.F"), - (StringTag('+.1+1.d'), "+.1+1.d"), - (StringTag('+.1+1.f'), "+.1+1.f"), - (StringTag('+.1+1D'), "+.1+1D"), - (StringTag('+.1+1F'), "+.1+1F"), - (StringTag('+.1+1d'), "+.1+1d"), - (StringTag('+.1+1f'), "+.1+1f"), - (StringTag('+.1+D'), "+.1+D"), - (StringTag('+.1+F'), "+.1+F"), - (StringTag('+.1+d'), "+.1+d"), - (StringTag('+.1+f'), "+.1+f"), - (StringTag('+.1-'), "+.1-"), - (StringTag('+.1-.'), "+.1-."), - (StringTag('+.1-.1'), "+.1-.1"), - (StringTag('+.1-.1D'), "+.1-.1D"), - (StringTag('+.1-.1F'), "+.1-.1F"), - (StringTag('+.1-.1d'), "+.1-.1d"), - (StringTag('+.1-.1f'), "+.1-.1f"), - (StringTag('+.1-.D'), "+.1-.D"), - (StringTag('+.1-.F'), "+.1-.F"), - (StringTag('+.1-.d'), "+.1-.d"), - (StringTag('+.1-.f'), "+.1-.f"), - (StringTag('+.1-1'), "+.1-1"), - (StringTag('+.1-1.'), "+.1-1."), - (StringTag('+.1-1.1'), "+.1-1.1"), - (StringTag('+.1-1.1D'), "+.1-1.1D"), - (StringTag('+.1-1.1F'), "+.1-1.1F"), - (StringTag('+.1-1.1d'), "+.1-1.1d"), - (StringTag('+.1-1.1f'), "+.1-1.1f"), - (StringTag('+.1-1.D'), "+.1-1.D"), - (StringTag('+.1-1.F'), "+.1-1.F"), - (StringTag('+.1-1.d'), "+.1-1.d"), - (StringTag('+.1-1.f'), "+.1-1.f"), - (StringTag('+.1-1D'), "+.1-1D"), - (StringTag('+.1-1F'), "+.1-1F"), - (StringTag('+.1-1d'), "+.1-1d"), - (StringTag('+.1-1f'), "+.1-1f"), - (StringTag('+.1-D'), "+.1-D"), - (StringTag('+.1-F'), "+.1-F"), - (StringTag('+.1-d'), "+.1-d"), - (StringTag('+.1-f'), "+.1-f"), - (StringTag('+.1.'), "+.1."), - (StringTag('+.1.1'), "+.1.1"), - (StringTag('+.1.1D'), "+.1.1D"), - (StringTag('+.1.1F'), "+.1.1F"), - (StringTag('+.1.1d'), "+.1.1d"), - (StringTag('+.1.1f'), "+.1.1f"), - (StringTag('+.1.D'), "+.1.D"), - (StringTag('+.1.F'), "+.1.F"), - (StringTag('+.1.d'), "+.1.d"), - (StringTag('+.1.f'), "+.1.f"), + (StringTag("+.1+"), "+.1+"), + (StringTag("+.1+."), "+.1+."), + (StringTag("+.1+.1"), "+.1+.1"), + (StringTag("+.1+.1D"), "+.1+.1D"), + (StringTag("+.1+.1F"), "+.1+.1F"), + (StringTag("+.1+.1d"), "+.1+.1d"), + (StringTag("+.1+.1f"), "+.1+.1f"), + (StringTag("+.1+.D"), "+.1+.D"), + (StringTag("+.1+.F"), "+.1+.F"), + (StringTag("+.1+.d"), "+.1+.d"), + (StringTag("+.1+.f"), "+.1+.f"), + (StringTag("+.1+1"), "+.1+1"), + (StringTag("+.1+1."), "+.1+1."), + (StringTag("+.1+1.1"), "+.1+1.1"), + (StringTag("+.1+1.1D"), "+.1+1.1D"), + (StringTag("+.1+1.1F"), "+.1+1.1F"), + (StringTag("+.1+1.1d"), "+.1+1.1d"), + (StringTag("+.1+1.1f"), "+.1+1.1f"), + (StringTag("+.1+1.D"), "+.1+1.D"), + (StringTag("+.1+1.F"), "+.1+1.F"), + (StringTag("+.1+1.d"), "+.1+1.d"), + (StringTag("+.1+1.f"), "+.1+1.f"), + (StringTag("+.1+1D"), "+.1+1D"), + (StringTag("+.1+1F"), "+.1+1F"), + (StringTag("+.1+1d"), "+.1+1d"), + (StringTag("+.1+1f"), "+.1+1f"), + (StringTag("+.1+D"), "+.1+D"), + (StringTag("+.1+F"), "+.1+F"), + (StringTag("+.1+d"), "+.1+d"), + (StringTag("+.1+f"), "+.1+f"), + (StringTag("+.1-"), "+.1-"), + (StringTag("+.1-."), "+.1-."), + (StringTag("+.1-.1"), "+.1-.1"), + (StringTag("+.1-.1D"), "+.1-.1D"), + (StringTag("+.1-.1F"), "+.1-.1F"), + (StringTag("+.1-.1d"), "+.1-.1d"), + (StringTag("+.1-.1f"), "+.1-.1f"), + (StringTag("+.1-.D"), "+.1-.D"), + (StringTag("+.1-.F"), "+.1-.F"), + (StringTag("+.1-.d"), "+.1-.d"), + (StringTag("+.1-.f"), "+.1-.f"), + (StringTag("+.1-1"), "+.1-1"), + (StringTag("+.1-1."), "+.1-1."), + (StringTag("+.1-1.1"), "+.1-1.1"), + (StringTag("+.1-1.1D"), "+.1-1.1D"), + (StringTag("+.1-1.1F"), "+.1-1.1F"), + (StringTag("+.1-1.1d"), "+.1-1.1d"), + (StringTag("+.1-1.1f"), "+.1-1.1f"), + (StringTag("+.1-1.D"), "+.1-1.D"), + (StringTag("+.1-1.F"), "+.1-1.F"), + (StringTag("+.1-1.d"), "+.1-1.d"), + (StringTag("+.1-1.f"), "+.1-1.f"), + (StringTag("+.1-1D"), "+.1-1D"), + (StringTag("+.1-1F"), "+.1-1F"), + (StringTag("+.1-1d"), "+.1-1d"), + (StringTag("+.1-1f"), "+.1-1f"), + (StringTag("+.1-D"), "+.1-D"), + (StringTag("+.1-F"), "+.1-F"), + (StringTag("+.1-d"), "+.1-d"), + (StringTag("+.1-f"), "+.1-f"), + (StringTag("+.1."), "+.1."), + (StringTag("+.1.1"), "+.1.1"), + (StringTag("+.1.1D"), "+.1.1D"), + (StringTag("+.1.1F"), "+.1.1F"), + (StringTag("+.1.1d"), "+.1.1d"), + (StringTag("+.1.1f"), "+.1.1f"), + (StringTag("+.1.D"), "+.1.D"), + (StringTag("+.1.F"), "+.1.F"), + (StringTag("+.1.d"), "+.1.d"), + (StringTag("+.1.f"), "+.1.f"), (DoubleTag(0.110000), "+.11"), - (StringTag('+.11.'), "+.11."), - (StringTag('+.11.1'), "+.11.1"), - (StringTag('+.11.1D'), "+.11.1D"), - (StringTag('+.11.1F'), "+.11.1F"), - (StringTag('+.11.1d'), "+.11.1d"), - (StringTag('+.11.1f'), "+.11.1f"), - (StringTag('+.11.D'), "+.11.D"), - (StringTag('+.11.F'), "+.11.F"), - (StringTag('+.11.d'), "+.11.d"), - (StringTag('+.11.f'), "+.11.f"), + (StringTag("+.11."), "+.11."), + (StringTag("+.11.1"), "+.11.1"), + (StringTag("+.11.1D"), "+.11.1D"), + (StringTag("+.11.1F"), "+.11.1F"), + (StringTag("+.11.1d"), "+.11.1d"), + (StringTag("+.11.1f"), "+.11.1f"), + (StringTag("+.11.D"), "+.11.D"), + (StringTag("+.11.F"), "+.11.F"), + (StringTag("+.11.d"), "+.11.d"), + (StringTag("+.11.f"), "+.11.f"), (DoubleTag(0.110000), "+.11D"), (FloatTag(0.110000), "+.11F"), (DoubleTag(0.110000), "+.11d"), (FloatTag(0.110000), "+.11f"), (DoubleTag(0.100000), "+.1D"), - (StringTag('+.1E'), "+.1E"), - (StringTag('+.1E+'), "+.1E+"), - (StringTag('+.1E+.'), "+.1E+."), - (StringTag('+.1E+.1'), "+.1E+.1"), - (StringTag('+.1E+.1D'), "+.1E+.1D"), - (StringTag('+.1E+.1F'), "+.1E+.1F"), - (StringTag('+.1E+.1d'), "+.1E+.1d"), - (StringTag('+.1E+.1f'), "+.1E+.1f"), - (StringTag('+.1E+.D'), "+.1E+.D"), - (StringTag('+.1E+.F'), "+.1E+.F"), - (StringTag('+.1E+.d'), "+.1E+.d"), - (StringTag('+.1E+.f'), "+.1E+.f"), + (StringTag("+.1E"), "+.1E"), + (StringTag("+.1E+"), "+.1E+"), + (StringTag("+.1E+."), "+.1E+."), + (StringTag("+.1E+.1"), "+.1E+.1"), + (StringTag("+.1E+.1D"), "+.1E+.1D"), + (StringTag("+.1E+.1F"), "+.1E+.1F"), + (StringTag("+.1E+.1d"), "+.1E+.1d"), + (StringTag("+.1E+.1f"), "+.1E+.1f"), + (StringTag("+.1E+.D"), "+.1E+.D"), + (StringTag("+.1E+.F"), "+.1E+.F"), + (StringTag("+.1E+.d"), "+.1E+.d"), + (StringTag("+.1E+.f"), "+.1E+.f"), (DoubleTag(1.000000), "+.1E+1"), - (StringTag('+.1E+1.'), "+.1E+1."), - (StringTag('+.1E+1.1'), "+.1E+1.1"), - (StringTag('+.1E+1.1D'), "+.1E+1.1D"), - (StringTag('+.1E+1.1F'), "+.1E+1.1F"), - (StringTag('+.1E+1.1d'), "+.1E+1.1d"), - (StringTag('+.1E+1.1f'), "+.1E+1.1f"), - (StringTag('+.1E+1.D'), "+.1E+1.D"), - (StringTag('+.1E+1.F'), "+.1E+1.F"), - (StringTag('+.1E+1.d'), "+.1E+1.d"), - (StringTag('+.1E+1.f'), "+.1E+1.f"), + (StringTag("+.1E+1."), "+.1E+1."), + (StringTag("+.1E+1.1"), "+.1E+1.1"), + (StringTag("+.1E+1.1D"), "+.1E+1.1D"), + (StringTag("+.1E+1.1F"), "+.1E+1.1F"), + (StringTag("+.1E+1.1d"), "+.1E+1.1d"), + (StringTag("+.1E+1.1f"), "+.1E+1.1f"), + (StringTag("+.1E+1.D"), "+.1E+1.D"), + (StringTag("+.1E+1.F"), "+.1E+1.F"), + (StringTag("+.1E+1.d"), "+.1E+1.d"), + (StringTag("+.1E+1.f"), "+.1E+1.f"), (DoubleTag(1.000000), "+.1E+1D"), (FloatTag(1.000000), "+.1E+1F"), (DoubleTag(1.000000), "+.1E+1d"), (FloatTag(1.000000), "+.1E+1f"), - (StringTag('+.1E+D'), "+.1E+D"), - (StringTag('+.1E+F'), "+.1E+F"), - (StringTag('+.1E+d'), "+.1E+d"), - (StringTag('+.1E+f'), "+.1E+f"), - (StringTag('+.1E-'), "+.1E-"), - (StringTag('+.1E-.'), "+.1E-."), - (StringTag('+.1E-.1'), "+.1E-.1"), - (StringTag('+.1E-.1D'), "+.1E-.1D"), - (StringTag('+.1E-.1F'), "+.1E-.1F"), - (StringTag('+.1E-.1d'), "+.1E-.1d"), - (StringTag('+.1E-.1f'), "+.1E-.1f"), - (StringTag('+.1E-.D'), "+.1E-.D"), - (StringTag('+.1E-.F'), "+.1E-.F"), - (StringTag('+.1E-.d'), "+.1E-.d"), - (StringTag('+.1E-.f'), "+.1E-.f"), + (StringTag("+.1E+D"), "+.1E+D"), + (StringTag("+.1E+F"), "+.1E+F"), + (StringTag("+.1E+d"), "+.1E+d"), + (StringTag("+.1E+f"), "+.1E+f"), + (StringTag("+.1E-"), "+.1E-"), + (StringTag("+.1E-."), "+.1E-."), + (StringTag("+.1E-.1"), "+.1E-.1"), + (StringTag("+.1E-.1D"), "+.1E-.1D"), + (StringTag("+.1E-.1F"), "+.1E-.1F"), + (StringTag("+.1E-.1d"), "+.1E-.1d"), + (StringTag("+.1E-.1f"), "+.1E-.1f"), + (StringTag("+.1E-.D"), "+.1E-.D"), + (StringTag("+.1E-.F"), "+.1E-.F"), + (StringTag("+.1E-.d"), "+.1E-.d"), + (StringTag("+.1E-.f"), "+.1E-.f"), (DoubleTag(0.010000), "+.1E-1"), - (StringTag('+.1E-1.'), "+.1E-1."), - (StringTag('+.1E-1.1'), "+.1E-1.1"), - (StringTag('+.1E-1.1D'), "+.1E-1.1D"), - (StringTag('+.1E-1.1F'), "+.1E-1.1F"), - (StringTag('+.1E-1.1d'), "+.1E-1.1d"), - (StringTag('+.1E-1.1f'), "+.1E-1.1f"), - (StringTag('+.1E-1.D'), "+.1E-1.D"), - (StringTag('+.1E-1.F'), "+.1E-1.F"), - (StringTag('+.1E-1.d'), "+.1E-1.d"), - (StringTag('+.1E-1.f'), "+.1E-1.f"), + (StringTag("+.1E-1."), "+.1E-1."), + (StringTag("+.1E-1.1"), "+.1E-1.1"), + (StringTag("+.1E-1.1D"), "+.1E-1.1D"), + (StringTag("+.1E-1.1F"), "+.1E-1.1F"), + (StringTag("+.1E-1.1d"), "+.1E-1.1d"), + (StringTag("+.1E-1.1f"), "+.1E-1.1f"), + (StringTag("+.1E-1.D"), "+.1E-1.D"), + (StringTag("+.1E-1.F"), "+.1E-1.F"), + (StringTag("+.1E-1.d"), "+.1E-1.d"), + (StringTag("+.1E-1.f"), "+.1E-1.f"), (DoubleTag(0.010000), "+.1E-1D"), (FloatTag(0.010000), "+.1E-1F"), (DoubleTag(0.010000), "+.1E-1d"), (FloatTag(0.010000), "+.1E-1f"), - (StringTag('+.1E-D'), "+.1E-D"), - (StringTag('+.1E-F'), "+.1E-F"), - (StringTag('+.1E-d'), "+.1E-d"), - (StringTag('+.1E-f'), "+.1E-f"), - (StringTag('+.1E.'), "+.1E."), - (StringTag('+.1E.1'), "+.1E.1"), - (StringTag('+.1E.1D'), "+.1E.1D"), - (StringTag('+.1E.1F'), "+.1E.1F"), - (StringTag('+.1E.1d'), "+.1E.1d"), - (StringTag('+.1E.1f'), "+.1E.1f"), - (StringTag('+.1E.D'), "+.1E.D"), - (StringTag('+.1E.F'), "+.1E.F"), - (StringTag('+.1E.d'), "+.1E.d"), - (StringTag('+.1E.f'), "+.1E.f"), + (StringTag("+.1E-D"), "+.1E-D"), + (StringTag("+.1E-F"), "+.1E-F"), + (StringTag("+.1E-d"), "+.1E-d"), + (StringTag("+.1E-f"), "+.1E-f"), + (StringTag("+.1E."), "+.1E."), + (StringTag("+.1E.1"), "+.1E.1"), + (StringTag("+.1E.1D"), "+.1E.1D"), + (StringTag("+.1E.1F"), "+.1E.1F"), + (StringTag("+.1E.1d"), "+.1E.1d"), + (StringTag("+.1E.1f"), "+.1E.1f"), + (StringTag("+.1E.D"), "+.1E.D"), + (StringTag("+.1E.F"), "+.1E.F"), + (StringTag("+.1E.d"), "+.1E.d"), + (StringTag("+.1E.f"), "+.1E.f"), (DoubleTag(1.000000), "+.1E1"), - (StringTag('+.1E1.'), "+.1E1."), - (StringTag('+.1E1.1'), "+.1E1.1"), - (StringTag('+.1E1.1D'), "+.1E1.1D"), - (StringTag('+.1E1.1F'), "+.1E1.1F"), - (StringTag('+.1E1.1d'), "+.1E1.1d"), - (StringTag('+.1E1.1f'), "+.1E1.1f"), - (StringTag('+.1E1.D'), "+.1E1.D"), - (StringTag('+.1E1.F'), "+.1E1.F"), - (StringTag('+.1E1.d'), "+.1E1.d"), - (StringTag('+.1E1.f'), "+.1E1.f"), + (StringTag("+.1E1."), "+.1E1."), + (StringTag("+.1E1.1"), "+.1E1.1"), + (StringTag("+.1E1.1D"), "+.1E1.1D"), + (StringTag("+.1E1.1F"), "+.1E1.1F"), + (StringTag("+.1E1.1d"), "+.1E1.1d"), + (StringTag("+.1E1.1f"), "+.1E1.1f"), + (StringTag("+.1E1.D"), "+.1E1.D"), + (StringTag("+.1E1.F"), "+.1E1.F"), + (StringTag("+.1E1.d"), "+.1E1.d"), + (StringTag("+.1E1.f"), "+.1E1.f"), (DoubleTag(1.000000), "+.1E1D"), (FloatTag(1.000000), "+.1E1F"), (DoubleTag(1.000000), "+.1E1d"), (FloatTag(1.000000), "+.1E1f"), - (StringTag('+.1ED'), "+.1ED"), - (StringTag('+.1EF'), "+.1EF"), - (StringTag('+.1Ed'), "+.1Ed"), - (StringTag('+.1Ef'), "+.1Ef"), + (StringTag("+.1ED"), "+.1ED"), + (StringTag("+.1EF"), "+.1EF"), + (StringTag("+.1Ed"), "+.1Ed"), + (StringTag("+.1Ef"), "+.1Ef"), (FloatTag(0.100000), "+.1F"), (DoubleTag(0.100000), "+.1d"), - (StringTag('+.1e'), "+.1e"), - (StringTag('+.1e+'), "+.1e+"), - (StringTag('+.1e+.'), "+.1e+."), - (StringTag('+.1e+.1'), "+.1e+.1"), - (StringTag('+.1e+.1D'), "+.1e+.1D"), - (StringTag('+.1e+.1F'), "+.1e+.1F"), - (StringTag('+.1e+.1d'), "+.1e+.1d"), - (StringTag('+.1e+.1f'), "+.1e+.1f"), - (StringTag('+.1e+.D'), "+.1e+.D"), - (StringTag('+.1e+.F'), "+.1e+.F"), - (StringTag('+.1e+.d'), "+.1e+.d"), - (StringTag('+.1e+.f'), "+.1e+.f"), + (StringTag("+.1e"), "+.1e"), + (StringTag("+.1e+"), "+.1e+"), + (StringTag("+.1e+."), "+.1e+."), + (StringTag("+.1e+.1"), "+.1e+.1"), + (StringTag("+.1e+.1D"), "+.1e+.1D"), + (StringTag("+.1e+.1F"), "+.1e+.1F"), + (StringTag("+.1e+.1d"), "+.1e+.1d"), + (StringTag("+.1e+.1f"), "+.1e+.1f"), + (StringTag("+.1e+.D"), "+.1e+.D"), + (StringTag("+.1e+.F"), "+.1e+.F"), + (StringTag("+.1e+.d"), "+.1e+.d"), + (StringTag("+.1e+.f"), "+.1e+.f"), (DoubleTag(1.000000), "+.1e+1"), - (StringTag('+.1e+1.'), "+.1e+1."), - (StringTag('+.1e+1.1'), "+.1e+1.1"), - (StringTag('+.1e+1.1D'), "+.1e+1.1D"), - (StringTag('+.1e+1.1F'), "+.1e+1.1F"), - (StringTag('+.1e+1.1d'), "+.1e+1.1d"), - (StringTag('+.1e+1.1f'), "+.1e+1.1f"), - (StringTag('+.1e+1.D'), "+.1e+1.D"), - (StringTag('+.1e+1.F'), "+.1e+1.F"), - (StringTag('+.1e+1.d'), "+.1e+1.d"), - (StringTag('+.1e+1.f'), "+.1e+1.f"), + (StringTag("+.1e+1."), "+.1e+1."), + (StringTag("+.1e+1.1"), "+.1e+1.1"), + (StringTag("+.1e+1.1D"), "+.1e+1.1D"), + (StringTag("+.1e+1.1F"), "+.1e+1.1F"), + (StringTag("+.1e+1.1d"), "+.1e+1.1d"), + (StringTag("+.1e+1.1f"), "+.1e+1.1f"), + (StringTag("+.1e+1.D"), "+.1e+1.D"), + (StringTag("+.1e+1.F"), "+.1e+1.F"), + (StringTag("+.1e+1.d"), "+.1e+1.d"), + (StringTag("+.1e+1.f"), "+.1e+1.f"), (DoubleTag(1.000000), "+.1e+1D"), (FloatTag(1.000000), "+.1e+1F"), (DoubleTag(1.000000), "+.1e+1d"), (FloatTag(1.000000), "+.1e+1f"), - (StringTag('+.1e+D'), "+.1e+D"), - (StringTag('+.1e+F'), "+.1e+F"), - (StringTag('+.1e+d'), "+.1e+d"), - (StringTag('+.1e+f'), "+.1e+f"), - (StringTag('+.1e-'), "+.1e-"), - (StringTag('+.1e-.'), "+.1e-."), - (StringTag('+.1e-.1'), "+.1e-.1"), - (StringTag('+.1e-.1D'), "+.1e-.1D"), - (StringTag('+.1e-.1F'), "+.1e-.1F"), - (StringTag('+.1e-.1d'), "+.1e-.1d"), - (StringTag('+.1e-.1f'), "+.1e-.1f"), - (StringTag('+.1e-.D'), "+.1e-.D"), - (StringTag('+.1e-.F'), "+.1e-.F"), - (StringTag('+.1e-.d'), "+.1e-.d"), - (StringTag('+.1e-.f'), "+.1e-.f"), + (StringTag("+.1e+D"), "+.1e+D"), + (StringTag("+.1e+F"), "+.1e+F"), + (StringTag("+.1e+d"), "+.1e+d"), + (StringTag("+.1e+f"), "+.1e+f"), + (StringTag("+.1e-"), "+.1e-"), + (StringTag("+.1e-."), "+.1e-."), + (StringTag("+.1e-.1"), "+.1e-.1"), + (StringTag("+.1e-.1D"), "+.1e-.1D"), + (StringTag("+.1e-.1F"), "+.1e-.1F"), + (StringTag("+.1e-.1d"), "+.1e-.1d"), + (StringTag("+.1e-.1f"), "+.1e-.1f"), + (StringTag("+.1e-.D"), "+.1e-.D"), + (StringTag("+.1e-.F"), "+.1e-.F"), + (StringTag("+.1e-.d"), "+.1e-.d"), + (StringTag("+.1e-.f"), "+.1e-.f"), (DoubleTag(0.010000), "+.1e-1"), - (StringTag('+.1e-1.'), "+.1e-1."), - (StringTag('+.1e-1.1'), "+.1e-1.1"), - (StringTag('+.1e-1.1D'), "+.1e-1.1D"), - (StringTag('+.1e-1.1F'), "+.1e-1.1F"), - (StringTag('+.1e-1.1d'), "+.1e-1.1d"), - (StringTag('+.1e-1.1f'), "+.1e-1.1f"), - (StringTag('+.1e-1.D'), "+.1e-1.D"), - (StringTag('+.1e-1.F'), "+.1e-1.F"), - (StringTag('+.1e-1.d'), "+.1e-1.d"), - (StringTag('+.1e-1.f'), "+.1e-1.f"), + (StringTag("+.1e-1."), "+.1e-1."), + (StringTag("+.1e-1.1"), "+.1e-1.1"), + (StringTag("+.1e-1.1D"), "+.1e-1.1D"), + (StringTag("+.1e-1.1F"), "+.1e-1.1F"), + (StringTag("+.1e-1.1d"), "+.1e-1.1d"), + (StringTag("+.1e-1.1f"), "+.1e-1.1f"), + (StringTag("+.1e-1.D"), "+.1e-1.D"), + (StringTag("+.1e-1.F"), "+.1e-1.F"), + (StringTag("+.1e-1.d"), "+.1e-1.d"), + (StringTag("+.1e-1.f"), "+.1e-1.f"), (DoubleTag(0.010000), "+.1e-1D"), (FloatTag(0.010000), "+.1e-1F"), (DoubleTag(0.010000), "+.1e-1d"), (FloatTag(0.010000), "+.1e-1f"), - (StringTag('+.1e-D'), "+.1e-D"), - (StringTag('+.1e-F'), "+.1e-F"), - (StringTag('+.1e-d'), "+.1e-d"), - (StringTag('+.1e-f'), "+.1e-f"), - (StringTag('+.1e.'), "+.1e."), - (StringTag('+.1e.1'), "+.1e.1"), - (StringTag('+.1e.1D'), "+.1e.1D"), - (StringTag('+.1e.1F'), "+.1e.1F"), - (StringTag('+.1e.1d'), "+.1e.1d"), - (StringTag('+.1e.1f'), "+.1e.1f"), - (StringTag('+.1e.D'), "+.1e.D"), - (StringTag('+.1e.F'), "+.1e.F"), - (StringTag('+.1e.d'), "+.1e.d"), - (StringTag('+.1e.f'), "+.1e.f"), + (StringTag("+.1e-D"), "+.1e-D"), + (StringTag("+.1e-F"), "+.1e-F"), + (StringTag("+.1e-d"), "+.1e-d"), + (StringTag("+.1e-f"), "+.1e-f"), + (StringTag("+.1e."), "+.1e."), + (StringTag("+.1e.1"), "+.1e.1"), + (StringTag("+.1e.1D"), "+.1e.1D"), + (StringTag("+.1e.1F"), "+.1e.1F"), + (StringTag("+.1e.1d"), "+.1e.1d"), + (StringTag("+.1e.1f"), "+.1e.1f"), + (StringTag("+.1e.D"), "+.1e.D"), + (StringTag("+.1e.F"), "+.1e.F"), + (StringTag("+.1e.d"), "+.1e.d"), + (StringTag("+.1e.f"), "+.1e.f"), (DoubleTag(1.000000), "+.1e1"), - (StringTag('+.1e1.'), "+.1e1."), - (StringTag('+.1e1.1'), "+.1e1.1"), - (StringTag('+.1e1.1D'), "+.1e1.1D"), - (StringTag('+.1e1.1F'), "+.1e1.1F"), - (StringTag('+.1e1.1d'), "+.1e1.1d"), - (StringTag('+.1e1.1f'), "+.1e1.1f"), - (StringTag('+.1e1.D'), "+.1e1.D"), - (StringTag('+.1e1.F'), "+.1e1.F"), - (StringTag('+.1e1.d'), "+.1e1.d"), - (StringTag('+.1e1.f'), "+.1e1.f"), + (StringTag("+.1e1."), "+.1e1."), + (StringTag("+.1e1.1"), "+.1e1.1"), + (StringTag("+.1e1.1D"), "+.1e1.1D"), + (StringTag("+.1e1.1F"), "+.1e1.1F"), + (StringTag("+.1e1.1d"), "+.1e1.1d"), + (StringTag("+.1e1.1f"), "+.1e1.1f"), + (StringTag("+.1e1.D"), "+.1e1.D"), + (StringTag("+.1e1.F"), "+.1e1.F"), + (StringTag("+.1e1.d"), "+.1e1.d"), + (StringTag("+.1e1.f"), "+.1e1.f"), (DoubleTag(1.000000), "+.1e1D"), (FloatTag(1.000000), "+.1e1F"), (DoubleTag(1.000000), "+.1e1d"), (FloatTag(1.000000), "+.1e1f"), - (StringTag('+.1eD'), "+.1eD"), - (StringTag('+.1eF'), "+.1eF"), - (StringTag('+.1ed'), "+.1ed"), - (StringTag('+.1ef'), "+.1ef"), + (StringTag("+.1eD"), "+.1eD"), + (StringTag("+.1eF"), "+.1eF"), + (StringTag("+.1ed"), "+.1ed"), + (StringTag("+.1ef"), "+.1ef"), (FloatTag(0.100000), "+.1f"), - (StringTag('+.D'), "+.D"), - (StringTag('+.E'), "+.E"), - (StringTag('+.E+'), "+.E+"), - (StringTag('+.E+.'), "+.E+."), - (StringTag('+.E+.1'), "+.E+.1"), - (StringTag('+.E+.1D'), "+.E+.1D"), - (StringTag('+.E+.1F'), "+.E+.1F"), - (StringTag('+.E+.1d'), "+.E+.1d"), - (StringTag('+.E+.1f'), "+.E+.1f"), - (StringTag('+.E+.D'), "+.E+.D"), - (StringTag('+.E+.F'), "+.E+.F"), - (StringTag('+.E+.d'), "+.E+.d"), - (StringTag('+.E+.f'), "+.E+.f"), - (StringTag('+.E+1'), "+.E+1"), - (StringTag('+.E+1.'), "+.E+1."), - (StringTag('+.E+1.1'), "+.E+1.1"), - (StringTag('+.E+1.1D'), "+.E+1.1D"), - (StringTag('+.E+1.1F'), "+.E+1.1F"), - (StringTag('+.E+1.1d'), "+.E+1.1d"), - (StringTag('+.E+1.1f'), "+.E+1.1f"), - (StringTag('+.E+1.D'), "+.E+1.D"), - (StringTag('+.E+1.F'), "+.E+1.F"), - (StringTag('+.E+1.d'), "+.E+1.d"), - (StringTag('+.E+1.f'), "+.E+1.f"), - (StringTag('+.E+1D'), "+.E+1D"), - (StringTag('+.E+1F'), "+.E+1F"), - (StringTag('+.E+1d'), "+.E+1d"), - (StringTag('+.E+1f'), "+.E+1f"), - (StringTag('+.E+D'), "+.E+D"), - (StringTag('+.E+F'), "+.E+F"), - (StringTag('+.E+d'), "+.E+d"), - (StringTag('+.E+f'), "+.E+f"), - (StringTag('+.E-'), "+.E-"), - (StringTag('+.E-.'), "+.E-."), - (StringTag('+.E-.1'), "+.E-.1"), - (StringTag('+.E-.1D'), "+.E-.1D"), - (StringTag('+.E-.1F'), "+.E-.1F"), - (StringTag('+.E-.1d'), "+.E-.1d"), - (StringTag('+.E-.1f'), "+.E-.1f"), - (StringTag('+.E-.D'), "+.E-.D"), - (StringTag('+.E-.F'), "+.E-.F"), - (StringTag('+.E-.d'), "+.E-.d"), - (StringTag('+.E-.f'), "+.E-.f"), - (StringTag('+.E-1'), "+.E-1"), - (StringTag('+.E-1.'), "+.E-1."), - (StringTag('+.E-1.1'), "+.E-1.1"), - (StringTag('+.E-1.1D'), "+.E-1.1D"), - (StringTag('+.E-1.1F'), "+.E-1.1F"), - (StringTag('+.E-1.1d'), "+.E-1.1d"), - (StringTag('+.E-1.1f'), "+.E-1.1f"), - (StringTag('+.E-1.D'), "+.E-1.D"), - (StringTag('+.E-1.F'), "+.E-1.F"), - (StringTag('+.E-1.d'), "+.E-1.d"), - (StringTag('+.E-1.f'), "+.E-1.f"), - (StringTag('+.E-1D'), "+.E-1D"), - (StringTag('+.E-1F'), "+.E-1F"), - (StringTag('+.E-1d'), "+.E-1d"), - (StringTag('+.E-1f'), "+.E-1f"), - (StringTag('+.E-D'), "+.E-D"), - (StringTag('+.E-F'), "+.E-F"), - (StringTag('+.E-d'), "+.E-d"), - (StringTag('+.E-f'), "+.E-f"), - (StringTag('+.E.'), "+.E."), - (StringTag('+.E.1'), "+.E.1"), - (StringTag('+.E.1D'), "+.E.1D"), - (StringTag('+.E.1F'), "+.E.1F"), - (StringTag('+.E.1d'), "+.E.1d"), - (StringTag('+.E.1f'), "+.E.1f"), - (StringTag('+.E.D'), "+.E.D"), - (StringTag('+.E.F'), "+.E.F"), - (StringTag('+.E.d'), "+.E.d"), - (StringTag('+.E.f'), "+.E.f"), - (StringTag('+.E1'), "+.E1"), - (StringTag('+.E1.'), "+.E1."), - (StringTag('+.E1.1'), "+.E1.1"), - (StringTag('+.E1.1D'), "+.E1.1D"), - (StringTag('+.E1.1F'), "+.E1.1F"), - (StringTag('+.E1.1d'), "+.E1.1d"), - (StringTag('+.E1.1f'), "+.E1.1f"), - (StringTag('+.E1.D'), "+.E1.D"), - (StringTag('+.E1.F'), "+.E1.F"), - (StringTag('+.E1.d'), "+.E1.d"), - (StringTag('+.E1.f'), "+.E1.f"), - (StringTag('+.E1D'), "+.E1D"), - (StringTag('+.E1F'), "+.E1F"), - (StringTag('+.E1d'), "+.E1d"), - (StringTag('+.E1f'), "+.E1f"), - (StringTag('+.ED'), "+.ED"), - (StringTag('+.EF'), "+.EF"), - (StringTag('+.Ed'), "+.Ed"), - (StringTag('+.Ef'), "+.Ef"), - (StringTag('+.F'), "+.F"), - (StringTag('+.d'), "+.d"), - (StringTag('+.e'), "+.e"), - (StringTag('+.e+'), "+.e+"), - (StringTag('+.e+.'), "+.e+."), - (StringTag('+.e+.1'), "+.e+.1"), - (StringTag('+.e+.1D'), "+.e+.1D"), - (StringTag('+.e+.1F'), "+.e+.1F"), - (StringTag('+.e+.1d'), "+.e+.1d"), - (StringTag('+.e+.1f'), "+.e+.1f"), - (StringTag('+.e+.D'), "+.e+.D"), - (StringTag('+.e+.F'), "+.e+.F"), - (StringTag('+.e+.d'), "+.e+.d"), - (StringTag('+.e+.f'), "+.e+.f"), - (StringTag('+.e+1'), "+.e+1"), - (StringTag('+.e+1.'), "+.e+1."), - (StringTag('+.e+1.1'), "+.e+1.1"), - (StringTag('+.e+1.1D'), "+.e+1.1D"), - (StringTag('+.e+1.1F'), "+.e+1.1F"), - (StringTag('+.e+1.1d'), "+.e+1.1d"), - (StringTag('+.e+1.1f'), "+.e+1.1f"), - (StringTag('+.e+1.D'), "+.e+1.D"), - (StringTag('+.e+1.F'), "+.e+1.F"), - (StringTag('+.e+1.d'), "+.e+1.d"), - (StringTag('+.e+1.f'), "+.e+1.f"), - (StringTag('+.e+1D'), "+.e+1D"), - (StringTag('+.e+1F'), "+.e+1F"), - (StringTag('+.e+1d'), "+.e+1d"), - (StringTag('+.e+1f'), "+.e+1f"), - (StringTag('+.e+D'), "+.e+D"), - (StringTag('+.e+F'), "+.e+F"), - (StringTag('+.e+d'), "+.e+d"), - (StringTag('+.e+f'), "+.e+f"), - (StringTag('+.e-'), "+.e-"), - (StringTag('+.e-.'), "+.e-."), - (StringTag('+.e-.1'), "+.e-.1"), - (StringTag('+.e-.1D'), "+.e-.1D"), - (StringTag('+.e-.1F'), "+.e-.1F"), - (StringTag('+.e-.1d'), "+.e-.1d"), - (StringTag('+.e-.1f'), "+.e-.1f"), - (StringTag('+.e-.D'), "+.e-.D"), - (StringTag('+.e-.F'), "+.e-.F"), - (StringTag('+.e-.d'), "+.e-.d"), - (StringTag('+.e-.f'), "+.e-.f"), - (StringTag('+.e-1'), "+.e-1"), - (StringTag('+.e-1.'), "+.e-1."), - (StringTag('+.e-1.1'), "+.e-1.1"), - (StringTag('+.e-1.1D'), "+.e-1.1D"), - (StringTag('+.e-1.1F'), "+.e-1.1F"), - (StringTag('+.e-1.1d'), "+.e-1.1d"), - (StringTag('+.e-1.1f'), "+.e-1.1f"), - (StringTag('+.e-1.D'), "+.e-1.D"), - (StringTag('+.e-1.F'), "+.e-1.F"), - (StringTag('+.e-1.d'), "+.e-1.d"), - (StringTag('+.e-1.f'), "+.e-1.f"), - (StringTag('+.e-1D'), "+.e-1D"), - (StringTag('+.e-1F'), "+.e-1F"), - (StringTag('+.e-1d'), "+.e-1d"), - (StringTag('+.e-1f'), "+.e-1f"), - (StringTag('+.e-D'), "+.e-D"), - (StringTag('+.e-F'), "+.e-F"), - (StringTag('+.e-d'), "+.e-d"), - (StringTag('+.e-f'), "+.e-f"), - (StringTag('+.e.'), "+.e."), - (StringTag('+.e.1'), "+.e.1"), - (StringTag('+.e.1D'), "+.e.1D"), - (StringTag('+.e.1F'), "+.e.1F"), - (StringTag('+.e.1d'), "+.e.1d"), - (StringTag('+.e.1f'), "+.e.1f"), - (StringTag('+.e.D'), "+.e.D"), - (StringTag('+.e.F'), "+.e.F"), - (StringTag('+.e.d'), "+.e.d"), - (StringTag('+.e.f'), "+.e.f"), - (StringTag('+.e1'), "+.e1"), - (StringTag('+.e1.'), "+.e1."), - (StringTag('+.e1.1'), "+.e1.1"), - (StringTag('+.e1.1D'), "+.e1.1D"), - (StringTag('+.e1.1F'), "+.e1.1F"), - (StringTag('+.e1.1d'), "+.e1.1d"), - (StringTag('+.e1.1f'), "+.e1.1f"), - (StringTag('+.e1.D'), "+.e1.D"), - (StringTag('+.e1.F'), "+.e1.F"), - (StringTag('+.e1.d'), "+.e1.d"), - (StringTag('+.e1.f'), "+.e1.f"), - (StringTag('+.e1D'), "+.e1D"), - (StringTag('+.e1F'), "+.e1F"), - (StringTag('+.e1d'), "+.e1d"), - (StringTag('+.e1f'), "+.e1f"), - (StringTag('+.eD'), "+.eD"), - (StringTag('+.eF'), "+.eF"), - (StringTag('+.ed'), "+.ed"), - (StringTag('+.ef'), "+.ef"), - (StringTag('+.f'), "+.f"), + (StringTag("+.D"), "+.D"), + (StringTag("+.E"), "+.E"), + (StringTag("+.E+"), "+.E+"), + (StringTag("+.E+."), "+.E+."), + (StringTag("+.E+.1"), "+.E+.1"), + (StringTag("+.E+.1D"), "+.E+.1D"), + (StringTag("+.E+.1F"), "+.E+.1F"), + (StringTag("+.E+.1d"), "+.E+.1d"), + (StringTag("+.E+.1f"), "+.E+.1f"), + (StringTag("+.E+.D"), "+.E+.D"), + (StringTag("+.E+.F"), "+.E+.F"), + (StringTag("+.E+.d"), "+.E+.d"), + (StringTag("+.E+.f"), "+.E+.f"), + (StringTag("+.E+1"), "+.E+1"), + (StringTag("+.E+1."), "+.E+1."), + (StringTag("+.E+1.1"), "+.E+1.1"), + (StringTag("+.E+1.1D"), "+.E+1.1D"), + (StringTag("+.E+1.1F"), "+.E+1.1F"), + (StringTag("+.E+1.1d"), "+.E+1.1d"), + (StringTag("+.E+1.1f"), "+.E+1.1f"), + (StringTag("+.E+1.D"), "+.E+1.D"), + (StringTag("+.E+1.F"), "+.E+1.F"), + (StringTag("+.E+1.d"), "+.E+1.d"), + (StringTag("+.E+1.f"), "+.E+1.f"), + (StringTag("+.E+1D"), "+.E+1D"), + (StringTag("+.E+1F"), "+.E+1F"), + (StringTag("+.E+1d"), "+.E+1d"), + (StringTag("+.E+1f"), "+.E+1f"), + (StringTag("+.E+D"), "+.E+D"), + (StringTag("+.E+F"), "+.E+F"), + (StringTag("+.E+d"), "+.E+d"), + (StringTag("+.E+f"), "+.E+f"), + (StringTag("+.E-"), "+.E-"), + (StringTag("+.E-."), "+.E-."), + (StringTag("+.E-.1"), "+.E-.1"), + (StringTag("+.E-.1D"), "+.E-.1D"), + (StringTag("+.E-.1F"), "+.E-.1F"), + (StringTag("+.E-.1d"), "+.E-.1d"), + (StringTag("+.E-.1f"), "+.E-.1f"), + (StringTag("+.E-.D"), "+.E-.D"), + (StringTag("+.E-.F"), "+.E-.F"), + (StringTag("+.E-.d"), "+.E-.d"), + (StringTag("+.E-.f"), "+.E-.f"), + (StringTag("+.E-1"), "+.E-1"), + (StringTag("+.E-1."), "+.E-1."), + (StringTag("+.E-1.1"), "+.E-1.1"), + (StringTag("+.E-1.1D"), "+.E-1.1D"), + (StringTag("+.E-1.1F"), "+.E-1.1F"), + (StringTag("+.E-1.1d"), "+.E-1.1d"), + (StringTag("+.E-1.1f"), "+.E-1.1f"), + (StringTag("+.E-1.D"), "+.E-1.D"), + (StringTag("+.E-1.F"), "+.E-1.F"), + (StringTag("+.E-1.d"), "+.E-1.d"), + (StringTag("+.E-1.f"), "+.E-1.f"), + (StringTag("+.E-1D"), "+.E-1D"), + (StringTag("+.E-1F"), "+.E-1F"), + (StringTag("+.E-1d"), "+.E-1d"), + (StringTag("+.E-1f"), "+.E-1f"), + (StringTag("+.E-D"), "+.E-D"), + (StringTag("+.E-F"), "+.E-F"), + (StringTag("+.E-d"), "+.E-d"), + (StringTag("+.E-f"), "+.E-f"), + (StringTag("+.E."), "+.E."), + (StringTag("+.E.1"), "+.E.1"), + (StringTag("+.E.1D"), "+.E.1D"), + (StringTag("+.E.1F"), "+.E.1F"), + (StringTag("+.E.1d"), "+.E.1d"), + (StringTag("+.E.1f"), "+.E.1f"), + (StringTag("+.E.D"), "+.E.D"), + (StringTag("+.E.F"), "+.E.F"), + (StringTag("+.E.d"), "+.E.d"), + (StringTag("+.E.f"), "+.E.f"), + (StringTag("+.E1"), "+.E1"), + (StringTag("+.E1."), "+.E1."), + (StringTag("+.E1.1"), "+.E1.1"), + (StringTag("+.E1.1D"), "+.E1.1D"), + (StringTag("+.E1.1F"), "+.E1.1F"), + (StringTag("+.E1.1d"), "+.E1.1d"), + (StringTag("+.E1.1f"), "+.E1.1f"), + (StringTag("+.E1.D"), "+.E1.D"), + (StringTag("+.E1.F"), "+.E1.F"), + (StringTag("+.E1.d"), "+.E1.d"), + (StringTag("+.E1.f"), "+.E1.f"), + (StringTag("+.E1D"), "+.E1D"), + (StringTag("+.E1F"), "+.E1F"), + (StringTag("+.E1d"), "+.E1d"), + (StringTag("+.E1f"), "+.E1f"), + (StringTag("+.ED"), "+.ED"), + (StringTag("+.EF"), "+.EF"), + (StringTag("+.Ed"), "+.Ed"), + (StringTag("+.Ef"), "+.Ef"), + (StringTag("+.F"), "+.F"), + (StringTag("+.d"), "+.d"), + (StringTag("+.e"), "+.e"), + (StringTag("+.e+"), "+.e+"), + (StringTag("+.e+."), "+.e+."), + (StringTag("+.e+.1"), "+.e+.1"), + (StringTag("+.e+.1D"), "+.e+.1D"), + (StringTag("+.e+.1F"), "+.e+.1F"), + (StringTag("+.e+.1d"), "+.e+.1d"), + (StringTag("+.e+.1f"), "+.e+.1f"), + (StringTag("+.e+.D"), "+.e+.D"), + (StringTag("+.e+.F"), "+.e+.F"), + (StringTag("+.e+.d"), "+.e+.d"), + (StringTag("+.e+.f"), "+.e+.f"), + (StringTag("+.e+1"), "+.e+1"), + (StringTag("+.e+1."), "+.e+1."), + (StringTag("+.e+1.1"), "+.e+1.1"), + (StringTag("+.e+1.1D"), "+.e+1.1D"), + (StringTag("+.e+1.1F"), "+.e+1.1F"), + (StringTag("+.e+1.1d"), "+.e+1.1d"), + (StringTag("+.e+1.1f"), "+.e+1.1f"), + (StringTag("+.e+1.D"), "+.e+1.D"), + (StringTag("+.e+1.F"), "+.e+1.F"), + (StringTag("+.e+1.d"), "+.e+1.d"), + (StringTag("+.e+1.f"), "+.e+1.f"), + (StringTag("+.e+1D"), "+.e+1D"), + (StringTag("+.e+1F"), "+.e+1F"), + (StringTag("+.e+1d"), "+.e+1d"), + (StringTag("+.e+1f"), "+.e+1f"), + (StringTag("+.e+D"), "+.e+D"), + (StringTag("+.e+F"), "+.e+F"), + (StringTag("+.e+d"), "+.e+d"), + (StringTag("+.e+f"), "+.e+f"), + (StringTag("+.e-"), "+.e-"), + (StringTag("+.e-."), "+.e-."), + (StringTag("+.e-.1"), "+.e-.1"), + (StringTag("+.e-.1D"), "+.e-.1D"), + (StringTag("+.e-.1F"), "+.e-.1F"), + (StringTag("+.e-.1d"), "+.e-.1d"), + (StringTag("+.e-.1f"), "+.e-.1f"), + (StringTag("+.e-.D"), "+.e-.D"), + (StringTag("+.e-.F"), "+.e-.F"), + (StringTag("+.e-.d"), "+.e-.d"), + (StringTag("+.e-.f"), "+.e-.f"), + (StringTag("+.e-1"), "+.e-1"), + (StringTag("+.e-1."), "+.e-1."), + (StringTag("+.e-1.1"), "+.e-1.1"), + (StringTag("+.e-1.1D"), "+.e-1.1D"), + (StringTag("+.e-1.1F"), "+.e-1.1F"), + (StringTag("+.e-1.1d"), "+.e-1.1d"), + (StringTag("+.e-1.1f"), "+.e-1.1f"), + (StringTag("+.e-1.D"), "+.e-1.D"), + (StringTag("+.e-1.F"), "+.e-1.F"), + (StringTag("+.e-1.d"), "+.e-1.d"), + (StringTag("+.e-1.f"), "+.e-1.f"), + (StringTag("+.e-1D"), "+.e-1D"), + (StringTag("+.e-1F"), "+.e-1F"), + (StringTag("+.e-1d"), "+.e-1d"), + (StringTag("+.e-1f"), "+.e-1f"), + (StringTag("+.e-D"), "+.e-D"), + (StringTag("+.e-F"), "+.e-F"), + (StringTag("+.e-d"), "+.e-d"), + (StringTag("+.e-f"), "+.e-f"), + (StringTag("+.e."), "+.e."), + (StringTag("+.e.1"), "+.e.1"), + (StringTag("+.e.1D"), "+.e.1D"), + (StringTag("+.e.1F"), "+.e.1F"), + (StringTag("+.e.1d"), "+.e.1d"), + (StringTag("+.e.1f"), "+.e.1f"), + (StringTag("+.e.D"), "+.e.D"), + (StringTag("+.e.F"), "+.e.F"), + (StringTag("+.e.d"), "+.e.d"), + (StringTag("+.e.f"), "+.e.f"), + (StringTag("+.e1"), "+.e1"), + (StringTag("+.e1."), "+.e1."), + (StringTag("+.e1.1"), "+.e1.1"), + (StringTag("+.e1.1D"), "+.e1.1D"), + (StringTag("+.e1.1F"), "+.e1.1F"), + (StringTag("+.e1.1d"), "+.e1.1d"), + (StringTag("+.e1.1f"), "+.e1.1f"), + (StringTag("+.e1.D"), "+.e1.D"), + (StringTag("+.e1.F"), "+.e1.F"), + (StringTag("+.e1.d"), "+.e1.d"), + (StringTag("+.e1.f"), "+.e1.f"), + (StringTag("+.e1D"), "+.e1D"), + (StringTag("+.e1F"), "+.e1F"), + (StringTag("+.e1d"), "+.e1d"), + (StringTag("+.e1f"), "+.e1f"), + (StringTag("+.eD"), "+.eD"), + (StringTag("+.eF"), "+.eF"), + (StringTag("+.ed"), "+.ed"), + (StringTag("+.ef"), "+.ef"), + (StringTag("+.f"), "+.f"), (IntTag(1), "+1"), - (StringTag('+1+'), "+1+"), - (StringTag('+1+.'), "+1+."), - (StringTag('+1+.1'), "+1+.1"), - (StringTag('+1+.1D'), "+1+.1D"), - (StringTag('+1+.1F'), "+1+.1F"), - (StringTag('+1+.1d'), "+1+.1d"), - (StringTag('+1+.1f'), "+1+.1f"), - (StringTag('+1+.D'), "+1+.D"), - (StringTag('+1+.F'), "+1+.F"), - (StringTag('+1+.d'), "+1+.d"), - (StringTag('+1+.f'), "+1+.f"), - (StringTag('+1+1'), "+1+1"), - (StringTag('+1+1.'), "+1+1."), - (StringTag('+1+1.1'), "+1+1.1"), - (StringTag('+1+1.1D'), "+1+1.1D"), - (StringTag('+1+1.1F'), "+1+1.1F"), - (StringTag('+1+1.1d'), "+1+1.1d"), - (StringTag('+1+1.1f'), "+1+1.1f"), - (StringTag('+1+1.D'), "+1+1.D"), - (StringTag('+1+1.F'), "+1+1.F"), - (StringTag('+1+1.d'), "+1+1.d"), - (StringTag('+1+1.f'), "+1+1.f"), - (StringTag('+1+1D'), "+1+1D"), - (StringTag('+1+1F'), "+1+1F"), - (StringTag('+1+1d'), "+1+1d"), - (StringTag('+1+1f'), "+1+1f"), - (StringTag('+1+D'), "+1+D"), - (StringTag('+1+F'), "+1+F"), - (StringTag('+1+d'), "+1+d"), - (StringTag('+1+f'), "+1+f"), - (StringTag('+1-'), "+1-"), - (StringTag('+1-.'), "+1-."), - (StringTag('+1-.1'), "+1-.1"), - (StringTag('+1-.1D'), "+1-.1D"), - (StringTag('+1-.1F'), "+1-.1F"), - (StringTag('+1-.1d'), "+1-.1d"), - (StringTag('+1-.1f'), "+1-.1f"), - (StringTag('+1-.D'), "+1-.D"), - (StringTag('+1-.F'), "+1-.F"), - (StringTag('+1-.d'), "+1-.d"), - (StringTag('+1-.f'), "+1-.f"), - (StringTag('+1-1'), "+1-1"), - (StringTag('+1-1.'), "+1-1."), - (StringTag('+1-1.1'), "+1-1.1"), - (StringTag('+1-1.1D'), "+1-1.1D"), - (StringTag('+1-1.1F'), "+1-1.1F"), - (StringTag('+1-1.1d'), "+1-1.1d"), - (StringTag('+1-1.1f'), "+1-1.1f"), - (StringTag('+1-1.D'), "+1-1.D"), - (StringTag('+1-1.F'), "+1-1.F"), - (StringTag('+1-1.d'), "+1-1.d"), - (StringTag('+1-1.f'), "+1-1.f"), - (StringTag('+1-1D'), "+1-1D"), - (StringTag('+1-1F'), "+1-1F"), - (StringTag('+1-1d'), "+1-1d"), - (StringTag('+1-1f'), "+1-1f"), - (StringTag('+1-D'), "+1-D"), - (StringTag('+1-F'), "+1-F"), - (StringTag('+1-d'), "+1-d"), - (StringTag('+1-f'), "+1-f"), + (StringTag("+1+"), "+1+"), + (StringTag("+1+."), "+1+."), + (StringTag("+1+.1"), "+1+.1"), + (StringTag("+1+.1D"), "+1+.1D"), + (StringTag("+1+.1F"), "+1+.1F"), + (StringTag("+1+.1d"), "+1+.1d"), + (StringTag("+1+.1f"), "+1+.1f"), + (StringTag("+1+.D"), "+1+.D"), + (StringTag("+1+.F"), "+1+.F"), + (StringTag("+1+.d"), "+1+.d"), + (StringTag("+1+.f"), "+1+.f"), + (StringTag("+1+1"), "+1+1"), + (StringTag("+1+1."), "+1+1."), + (StringTag("+1+1.1"), "+1+1.1"), + (StringTag("+1+1.1D"), "+1+1.1D"), + (StringTag("+1+1.1F"), "+1+1.1F"), + (StringTag("+1+1.1d"), "+1+1.1d"), + (StringTag("+1+1.1f"), "+1+1.1f"), + (StringTag("+1+1.D"), "+1+1.D"), + (StringTag("+1+1.F"), "+1+1.F"), + (StringTag("+1+1.d"), "+1+1.d"), + (StringTag("+1+1.f"), "+1+1.f"), + (StringTag("+1+1D"), "+1+1D"), + (StringTag("+1+1F"), "+1+1F"), + (StringTag("+1+1d"), "+1+1d"), + (StringTag("+1+1f"), "+1+1f"), + (StringTag("+1+D"), "+1+D"), + (StringTag("+1+F"), "+1+F"), + (StringTag("+1+d"), "+1+d"), + (StringTag("+1+f"), "+1+f"), + (StringTag("+1-"), "+1-"), + (StringTag("+1-."), "+1-."), + (StringTag("+1-.1"), "+1-.1"), + (StringTag("+1-.1D"), "+1-.1D"), + (StringTag("+1-.1F"), "+1-.1F"), + (StringTag("+1-.1d"), "+1-.1d"), + (StringTag("+1-.1f"), "+1-.1f"), + (StringTag("+1-.D"), "+1-.D"), + (StringTag("+1-.F"), "+1-.F"), + (StringTag("+1-.d"), "+1-.d"), + (StringTag("+1-.f"), "+1-.f"), + (StringTag("+1-1"), "+1-1"), + (StringTag("+1-1."), "+1-1."), + (StringTag("+1-1.1"), "+1-1.1"), + (StringTag("+1-1.1D"), "+1-1.1D"), + (StringTag("+1-1.1F"), "+1-1.1F"), + (StringTag("+1-1.1d"), "+1-1.1d"), + (StringTag("+1-1.1f"), "+1-1.1f"), + (StringTag("+1-1.D"), "+1-1.D"), + (StringTag("+1-1.F"), "+1-1.F"), + (StringTag("+1-1.d"), "+1-1.d"), + (StringTag("+1-1.f"), "+1-1.f"), + (StringTag("+1-1D"), "+1-1D"), + (StringTag("+1-1F"), "+1-1F"), + (StringTag("+1-1d"), "+1-1d"), + (StringTag("+1-1f"), "+1-1f"), + (StringTag("+1-D"), "+1-D"), + (StringTag("+1-F"), "+1-F"), + (StringTag("+1-d"), "+1-d"), + (StringTag("+1-f"), "+1-f"), (DoubleTag(1.000000), "+1."), - (StringTag('+1.+'), "+1.+"), - (StringTag('+1.+.'), "+1.+."), - (StringTag('+1.+.1'), "+1.+.1"), - (StringTag('+1.+.1D'), "+1.+.1D"), - (StringTag('+1.+.1F'), "+1.+.1F"), - (StringTag('+1.+.1d'), "+1.+.1d"), - (StringTag('+1.+.1f'), "+1.+.1f"), - (StringTag('+1.+.D'), "+1.+.D"), - (StringTag('+1.+.F'), "+1.+.F"), - (StringTag('+1.+.d'), "+1.+.d"), - (StringTag('+1.+.f'), "+1.+.f"), - (StringTag('+1.+1'), "+1.+1"), - (StringTag('+1.+1.'), "+1.+1."), - (StringTag('+1.+1.1'), "+1.+1.1"), - (StringTag('+1.+1.1D'), "+1.+1.1D"), - (StringTag('+1.+1.1F'), "+1.+1.1F"), - (StringTag('+1.+1.1d'), "+1.+1.1d"), - (StringTag('+1.+1.1f'), "+1.+1.1f"), - (StringTag('+1.+1.D'), "+1.+1.D"), - (StringTag('+1.+1.F'), "+1.+1.F"), - (StringTag('+1.+1.d'), "+1.+1.d"), - (StringTag('+1.+1.f'), "+1.+1.f"), - (StringTag('+1.+1D'), "+1.+1D"), - (StringTag('+1.+1F'), "+1.+1F"), - (StringTag('+1.+1d'), "+1.+1d"), - (StringTag('+1.+1f'), "+1.+1f"), - (StringTag('+1.+D'), "+1.+D"), - (StringTag('+1.+F'), "+1.+F"), - (StringTag('+1.+d'), "+1.+d"), - (StringTag('+1.+f'), "+1.+f"), - (StringTag('+1.-'), "+1.-"), - (StringTag('+1.-.'), "+1.-."), - (StringTag('+1.-.1'), "+1.-.1"), - (StringTag('+1.-.1D'), "+1.-.1D"), - (StringTag('+1.-.1F'), "+1.-.1F"), - (StringTag('+1.-.1d'), "+1.-.1d"), - (StringTag('+1.-.1f'), "+1.-.1f"), - (StringTag('+1.-.D'), "+1.-.D"), - (StringTag('+1.-.F'), "+1.-.F"), - (StringTag('+1.-.d'), "+1.-.d"), - (StringTag('+1.-.f'), "+1.-.f"), - (StringTag('+1.-1'), "+1.-1"), - (StringTag('+1.-1.'), "+1.-1."), - (StringTag('+1.-1.1'), "+1.-1.1"), - (StringTag('+1.-1.1D'), "+1.-1.1D"), - (StringTag('+1.-1.1F'), "+1.-1.1F"), - (StringTag('+1.-1.1d'), "+1.-1.1d"), - (StringTag('+1.-1.1f'), "+1.-1.1f"), - (StringTag('+1.-1.D'), "+1.-1.D"), - (StringTag('+1.-1.F'), "+1.-1.F"), - (StringTag('+1.-1.d'), "+1.-1.d"), - (StringTag('+1.-1.f'), "+1.-1.f"), - (StringTag('+1.-1D'), "+1.-1D"), - (StringTag('+1.-1F'), "+1.-1F"), - (StringTag('+1.-1d'), "+1.-1d"), - (StringTag('+1.-1f'), "+1.-1f"), - (StringTag('+1.-D'), "+1.-D"), - (StringTag('+1.-F'), "+1.-F"), - (StringTag('+1.-d'), "+1.-d"), - (StringTag('+1.-f'), "+1.-f"), - (StringTag('+1..'), "+1.."), - (StringTag('+1..1'), "+1..1"), - (StringTag('+1..1D'), "+1..1D"), - (StringTag('+1..1F'), "+1..1F"), - (StringTag('+1..1d'), "+1..1d"), - (StringTag('+1..1f'), "+1..1f"), - (StringTag('+1..D'), "+1..D"), - (StringTag('+1..F'), "+1..F"), - (StringTag('+1..d'), "+1..d"), - (StringTag('+1..f'), "+1..f"), + (StringTag("+1.+"), "+1.+"), + (StringTag("+1.+."), "+1.+."), + (StringTag("+1.+.1"), "+1.+.1"), + (StringTag("+1.+.1D"), "+1.+.1D"), + (StringTag("+1.+.1F"), "+1.+.1F"), + (StringTag("+1.+.1d"), "+1.+.1d"), + (StringTag("+1.+.1f"), "+1.+.1f"), + (StringTag("+1.+.D"), "+1.+.D"), + (StringTag("+1.+.F"), "+1.+.F"), + (StringTag("+1.+.d"), "+1.+.d"), + (StringTag("+1.+.f"), "+1.+.f"), + (StringTag("+1.+1"), "+1.+1"), + (StringTag("+1.+1."), "+1.+1."), + (StringTag("+1.+1.1"), "+1.+1.1"), + (StringTag("+1.+1.1D"), "+1.+1.1D"), + (StringTag("+1.+1.1F"), "+1.+1.1F"), + (StringTag("+1.+1.1d"), "+1.+1.1d"), + (StringTag("+1.+1.1f"), "+1.+1.1f"), + (StringTag("+1.+1.D"), "+1.+1.D"), + (StringTag("+1.+1.F"), "+1.+1.F"), + (StringTag("+1.+1.d"), "+1.+1.d"), + (StringTag("+1.+1.f"), "+1.+1.f"), + (StringTag("+1.+1D"), "+1.+1D"), + (StringTag("+1.+1F"), "+1.+1F"), + (StringTag("+1.+1d"), "+1.+1d"), + (StringTag("+1.+1f"), "+1.+1f"), + (StringTag("+1.+D"), "+1.+D"), + (StringTag("+1.+F"), "+1.+F"), + (StringTag("+1.+d"), "+1.+d"), + (StringTag("+1.+f"), "+1.+f"), + (StringTag("+1.-"), "+1.-"), + (StringTag("+1.-."), "+1.-."), + (StringTag("+1.-.1"), "+1.-.1"), + (StringTag("+1.-.1D"), "+1.-.1D"), + (StringTag("+1.-.1F"), "+1.-.1F"), + (StringTag("+1.-.1d"), "+1.-.1d"), + (StringTag("+1.-.1f"), "+1.-.1f"), + (StringTag("+1.-.D"), "+1.-.D"), + (StringTag("+1.-.F"), "+1.-.F"), + (StringTag("+1.-.d"), "+1.-.d"), + (StringTag("+1.-.f"), "+1.-.f"), + (StringTag("+1.-1"), "+1.-1"), + (StringTag("+1.-1."), "+1.-1."), + (StringTag("+1.-1.1"), "+1.-1.1"), + (StringTag("+1.-1.1D"), "+1.-1.1D"), + (StringTag("+1.-1.1F"), "+1.-1.1F"), + (StringTag("+1.-1.1d"), "+1.-1.1d"), + (StringTag("+1.-1.1f"), "+1.-1.1f"), + (StringTag("+1.-1.D"), "+1.-1.D"), + (StringTag("+1.-1.F"), "+1.-1.F"), + (StringTag("+1.-1.d"), "+1.-1.d"), + (StringTag("+1.-1.f"), "+1.-1.f"), + (StringTag("+1.-1D"), "+1.-1D"), + (StringTag("+1.-1F"), "+1.-1F"), + (StringTag("+1.-1d"), "+1.-1d"), + (StringTag("+1.-1f"), "+1.-1f"), + (StringTag("+1.-D"), "+1.-D"), + (StringTag("+1.-F"), "+1.-F"), + (StringTag("+1.-d"), "+1.-d"), + (StringTag("+1.-f"), "+1.-f"), + (StringTag("+1.."), "+1.."), + (StringTag("+1..1"), "+1..1"), + (StringTag("+1..1D"), "+1..1D"), + (StringTag("+1..1F"), "+1..1F"), + (StringTag("+1..1d"), "+1..1d"), + (StringTag("+1..1f"), "+1..1f"), + (StringTag("+1..D"), "+1..D"), + (StringTag("+1..F"), "+1..F"), + (StringTag("+1..d"), "+1..d"), + (StringTag("+1..f"), "+1..f"), (DoubleTag(1.100000), "+1.1"), - (StringTag('+1.1+'), "+1.1+"), - (StringTag('+1.1+.'), "+1.1+."), - (StringTag('+1.1+.1'), "+1.1+.1"), - (StringTag('+1.1+.1D'), "+1.1+.1D"), - (StringTag('+1.1+.1F'), "+1.1+.1F"), - (StringTag('+1.1+.1d'), "+1.1+.1d"), - (StringTag('+1.1+.1f'), "+1.1+.1f"), - (StringTag('+1.1+.D'), "+1.1+.D"), - (StringTag('+1.1+.F'), "+1.1+.F"), - (StringTag('+1.1+.d'), "+1.1+.d"), - (StringTag('+1.1+.f'), "+1.1+.f"), - (StringTag('+1.1+1'), "+1.1+1"), - (StringTag('+1.1+1.'), "+1.1+1."), - (StringTag('+1.1+1.1'), "+1.1+1.1"), - (StringTag('+1.1+1.1D'), "+1.1+1.1D"), - (StringTag('+1.1+1.1F'), "+1.1+1.1F"), - (StringTag('+1.1+1.1d'), "+1.1+1.1d"), - (StringTag('+1.1+1.1f'), "+1.1+1.1f"), - (StringTag('+1.1+1.D'), "+1.1+1.D"), - (StringTag('+1.1+1.F'), "+1.1+1.F"), - (StringTag('+1.1+1.d'), "+1.1+1.d"), - (StringTag('+1.1+1.f'), "+1.1+1.f"), - (StringTag('+1.1+1D'), "+1.1+1D"), - (StringTag('+1.1+1F'), "+1.1+1F"), - (StringTag('+1.1+1d'), "+1.1+1d"), - (StringTag('+1.1+1f'), "+1.1+1f"), - (StringTag('+1.1+D'), "+1.1+D"), - (StringTag('+1.1+F'), "+1.1+F"), - (StringTag('+1.1+d'), "+1.1+d"), - (StringTag('+1.1+f'), "+1.1+f"), - (StringTag('+1.1-'), "+1.1-"), - (StringTag('+1.1-.'), "+1.1-."), - (StringTag('+1.1-.1'), "+1.1-.1"), - (StringTag('+1.1-.1D'), "+1.1-.1D"), - (StringTag('+1.1-.1F'), "+1.1-.1F"), - (StringTag('+1.1-.1d'), "+1.1-.1d"), - (StringTag('+1.1-.1f'), "+1.1-.1f"), - (StringTag('+1.1-.D'), "+1.1-.D"), - (StringTag('+1.1-.F'), "+1.1-.F"), - (StringTag('+1.1-.d'), "+1.1-.d"), - (StringTag('+1.1-.f'), "+1.1-.f"), - (StringTag('+1.1-1'), "+1.1-1"), - (StringTag('+1.1-1.'), "+1.1-1."), - (StringTag('+1.1-1.1'), "+1.1-1.1"), - (StringTag('+1.1-1.1D'), "+1.1-1.1D"), - (StringTag('+1.1-1.1F'), "+1.1-1.1F"), - (StringTag('+1.1-1.1d'), "+1.1-1.1d"), - (StringTag('+1.1-1.1f'), "+1.1-1.1f"), - (StringTag('+1.1-1.D'), "+1.1-1.D"), - (StringTag('+1.1-1.F'), "+1.1-1.F"), - (StringTag('+1.1-1.d'), "+1.1-1.d"), - (StringTag('+1.1-1.f'), "+1.1-1.f"), - (StringTag('+1.1-1D'), "+1.1-1D"), - (StringTag('+1.1-1F'), "+1.1-1F"), - (StringTag('+1.1-1d'), "+1.1-1d"), - (StringTag('+1.1-1f'), "+1.1-1f"), - (StringTag('+1.1-D'), "+1.1-D"), - (StringTag('+1.1-F'), "+1.1-F"), - (StringTag('+1.1-d'), "+1.1-d"), - (StringTag('+1.1-f'), "+1.1-f"), - (StringTag('+1.1.'), "+1.1."), - (StringTag('+1.1.1'), "+1.1.1"), - (StringTag('+1.1.1D'), "+1.1.1D"), - (StringTag('+1.1.1F'), "+1.1.1F"), - (StringTag('+1.1.1d'), "+1.1.1d"), - (StringTag('+1.1.1f'), "+1.1.1f"), - (StringTag('+1.1.D'), "+1.1.D"), - (StringTag('+1.1.F'), "+1.1.F"), - (StringTag('+1.1.d'), "+1.1.d"), - (StringTag('+1.1.f'), "+1.1.f"), + (StringTag("+1.1+"), "+1.1+"), + (StringTag("+1.1+."), "+1.1+."), + (StringTag("+1.1+.1"), "+1.1+.1"), + (StringTag("+1.1+.1D"), "+1.1+.1D"), + (StringTag("+1.1+.1F"), "+1.1+.1F"), + (StringTag("+1.1+.1d"), "+1.1+.1d"), + (StringTag("+1.1+.1f"), "+1.1+.1f"), + (StringTag("+1.1+.D"), "+1.1+.D"), + (StringTag("+1.1+.F"), "+1.1+.F"), + (StringTag("+1.1+.d"), "+1.1+.d"), + (StringTag("+1.1+.f"), "+1.1+.f"), + (StringTag("+1.1+1"), "+1.1+1"), + (StringTag("+1.1+1."), "+1.1+1."), + (StringTag("+1.1+1.1"), "+1.1+1.1"), + (StringTag("+1.1+1.1D"), "+1.1+1.1D"), + (StringTag("+1.1+1.1F"), "+1.1+1.1F"), + (StringTag("+1.1+1.1d"), "+1.1+1.1d"), + (StringTag("+1.1+1.1f"), "+1.1+1.1f"), + (StringTag("+1.1+1.D"), "+1.1+1.D"), + (StringTag("+1.1+1.F"), "+1.1+1.F"), + (StringTag("+1.1+1.d"), "+1.1+1.d"), + (StringTag("+1.1+1.f"), "+1.1+1.f"), + (StringTag("+1.1+1D"), "+1.1+1D"), + (StringTag("+1.1+1F"), "+1.1+1F"), + (StringTag("+1.1+1d"), "+1.1+1d"), + (StringTag("+1.1+1f"), "+1.1+1f"), + (StringTag("+1.1+D"), "+1.1+D"), + (StringTag("+1.1+F"), "+1.1+F"), + (StringTag("+1.1+d"), "+1.1+d"), + (StringTag("+1.1+f"), "+1.1+f"), + (StringTag("+1.1-"), "+1.1-"), + (StringTag("+1.1-."), "+1.1-."), + (StringTag("+1.1-.1"), "+1.1-.1"), + (StringTag("+1.1-.1D"), "+1.1-.1D"), + (StringTag("+1.1-.1F"), "+1.1-.1F"), + (StringTag("+1.1-.1d"), "+1.1-.1d"), + (StringTag("+1.1-.1f"), "+1.1-.1f"), + (StringTag("+1.1-.D"), "+1.1-.D"), + (StringTag("+1.1-.F"), "+1.1-.F"), + (StringTag("+1.1-.d"), "+1.1-.d"), + (StringTag("+1.1-.f"), "+1.1-.f"), + (StringTag("+1.1-1"), "+1.1-1"), + (StringTag("+1.1-1."), "+1.1-1."), + (StringTag("+1.1-1.1"), "+1.1-1.1"), + (StringTag("+1.1-1.1D"), "+1.1-1.1D"), + (StringTag("+1.1-1.1F"), "+1.1-1.1F"), + (StringTag("+1.1-1.1d"), "+1.1-1.1d"), + (StringTag("+1.1-1.1f"), "+1.1-1.1f"), + (StringTag("+1.1-1.D"), "+1.1-1.D"), + (StringTag("+1.1-1.F"), "+1.1-1.F"), + (StringTag("+1.1-1.d"), "+1.1-1.d"), + (StringTag("+1.1-1.f"), "+1.1-1.f"), + (StringTag("+1.1-1D"), "+1.1-1D"), + (StringTag("+1.1-1F"), "+1.1-1F"), + (StringTag("+1.1-1d"), "+1.1-1d"), + (StringTag("+1.1-1f"), "+1.1-1f"), + (StringTag("+1.1-D"), "+1.1-D"), + (StringTag("+1.1-F"), "+1.1-F"), + (StringTag("+1.1-d"), "+1.1-d"), + (StringTag("+1.1-f"), "+1.1-f"), + (StringTag("+1.1."), "+1.1."), + (StringTag("+1.1.1"), "+1.1.1"), + (StringTag("+1.1.1D"), "+1.1.1D"), + (StringTag("+1.1.1F"), "+1.1.1F"), + (StringTag("+1.1.1d"), "+1.1.1d"), + (StringTag("+1.1.1f"), "+1.1.1f"), + (StringTag("+1.1.D"), "+1.1.D"), + (StringTag("+1.1.F"), "+1.1.F"), + (StringTag("+1.1.d"), "+1.1.d"), + (StringTag("+1.1.f"), "+1.1.f"), (DoubleTag(1.110000), "+1.11"), - (StringTag('+1.11.'), "+1.11."), - (StringTag('+1.11.1'), "+1.11.1"), - (StringTag('+1.11.1D'), "+1.11.1D"), - (StringTag('+1.11.1F'), "+1.11.1F"), - (StringTag('+1.11.1d'), "+1.11.1d"), - (StringTag('+1.11.1f'), "+1.11.1f"), - (StringTag('+1.11.D'), "+1.11.D"), - (StringTag('+1.11.F'), "+1.11.F"), - (StringTag('+1.11.d'), "+1.11.d"), - (StringTag('+1.11.f'), "+1.11.f"), + (StringTag("+1.11."), "+1.11."), + (StringTag("+1.11.1"), "+1.11.1"), + (StringTag("+1.11.1D"), "+1.11.1D"), + (StringTag("+1.11.1F"), "+1.11.1F"), + (StringTag("+1.11.1d"), "+1.11.1d"), + (StringTag("+1.11.1f"), "+1.11.1f"), + (StringTag("+1.11.D"), "+1.11.D"), + (StringTag("+1.11.F"), "+1.11.F"), + (StringTag("+1.11.d"), "+1.11.d"), + (StringTag("+1.11.f"), "+1.11.f"), (DoubleTag(1.110000), "+1.11D"), (FloatTag(1.110000), "+1.11F"), (DoubleTag(1.110000), "+1.11d"), (FloatTag(1.110000), "+1.11f"), (DoubleTag(1.100000), "+1.1D"), - (StringTag('+1.1E'), "+1.1E"), - (StringTag('+1.1E+'), "+1.1E+"), - (StringTag('+1.1E+.'), "+1.1E+."), - (StringTag('+1.1E+.1'), "+1.1E+.1"), - (StringTag('+1.1E+.1D'), "+1.1E+.1D"), - (StringTag('+1.1E+.1F'), "+1.1E+.1F"), - (StringTag('+1.1E+.1d'), "+1.1E+.1d"), - (StringTag('+1.1E+.1f'), "+1.1E+.1f"), - (StringTag('+1.1E+.D'), "+1.1E+.D"), - (StringTag('+1.1E+.F'), "+1.1E+.F"), - (StringTag('+1.1E+.d'), "+1.1E+.d"), - (StringTag('+1.1E+.f'), "+1.1E+.f"), + (StringTag("+1.1E"), "+1.1E"), + (StringTag("+1.1E+"), "+1.1E+"), + (StringTag("+1.1E+."), "+1.1E+."), + (StringTag("+1.1E+.1"), "+1.1E+.1"), + (StringTag("+1.1E+.1D"), "+1.1E+.1D"), + (StringTag("+1.1E+.1F"), "+1.1E+.1F"), + (StringTag("+1.1E+.1d"), "+1.1E+.1d"), + (StringTag("+1.1E+.1f"), "+1.1E+.1f"), + (StringTag("+1.1E+.D"), "+1.1E+.D"), + (StringTag("+1.1E+.F"), "+1.1E+.F"), + (StringTag("+1.1E+.d"), "+1.1E+.d"), + (StringTag("+1.1E+.f"), "+1.1E+.f"), (DoubleTag(11.000000), "+1.1E+1"), - (StringTag('+1.1E+1.'), "+1.1E+1."), - (StringTag('+1.1E+1.1'), "+1.1E+1.1"), - (StringTag('+1.1E+1.1D'), "+1.1E+1.1D"), - (StringTag('+1.1E+1.1F'), "+1.1E+1.1F"), - (StringTag('+1.1E+1.1d'), "+1.1E+1.1d"), - (StringTag('+1.1E+1.1f'), "+1.1E+1.1f"), - (StringTag('+1.1E+1.D'), "+1.1E+1.D"), - (StringTag('+1.1E+1.F'), "+1.1E+1.F"), - (StringTag('+1.1E+1.d'), "+1.1E+1.d"), - (StringTag('+1.1E+1.f'), "+1.1E+1.f"), + (StringTag("+1.1E+1."), "+1.1E+1."), + (StringTag("+1.1E+1.1"), "+1.1E+1.1"), + (StringTag("+1.1E+1.1D"), "+1.1E+1.1D"), + (StringTag("+1.1E+1.1F"), "+1.1E+1.1F"), + (StringTag("+1.1E+1.1d"), "+1.1E+1.1d"), + (StringTag("+1.1E+1.1f"), "+1.1E+1.1f"), + (StringTag("+1.1E+1.D"), "+1.1E+1.D"), + (StringTag("+1.1E+1.F"), "+1.1E+1.F"), + (StringTag("+1.1E+1.d"), "+1.1E+1.d"), + (StringTag("+1.1E+1.f"), "+1.1E+1.f"), (DoubleTag(11.000000), "+1.1E+1D"), (FloatTag(11.000000), "+1.1E+1F"), (DoubleTag(11.000000), "+1.1E+1d"), (FloatTag(11.000000), "+1.1E+1f"), - (StringTag('+1.1E+D'), "+1.1E+D"), - (StringTag('+1.1E+F'), "+1.1E+F"), - (StringTag('+1.1E+d'), "+1.1E+d"), - (StringTag('+1.1E+f'), "+1.1E+f"), - (StringTag('+1.1E-'), "+1.1E-"), - (StringTag('+1.1E-.'), "+1.1E-."), - (StringTag('+1.1E-.1'), "+1.1E-.1"), - (StringTag('+1.1E-.1D'), "+1.1E-.1D"), - (StringTag('+1.1E-.1F'), "+1.1E-.1F"), - (StringTag('+1.1E-.1d'), "+1.1E-.1d"), - (StringTag('+1.1E-.1f'), "+1.1E-.1f"), - (StringTag('+1.1E-.D'), "+1.1E-.D"), - (StringTag('+1.1E-.F'), "+1.1E-.F"), - (StringTag('+1.1E-.d'), "+1.1E-.d"), - (StringTag('+1.1E-.f'), "+1.1E-.f"), + (StringTag("+1.1E+D"), "+1.1E+D"), + (StringTag("+1.1E+F"), "+1.1E+F"), + (StringTag("+1.1E+d"), "+1.1E+d"), + (StringTag("+1.1E+f"), "+1.1E+f"), + (StringTag("+1.1E-"), "+1.1E-"), + (StringTag("+1.1E-."), "+1.1E-."), + (StringTag("+1.1E-.1"), "+1.1E-.1"), + (StringTag("+1.1E-.1D"), "+1.1E-.1D"), + (StringTag("+1.1E-.1F"), "+1.1E-.1F"), + (StringTag("+1.1E-.1d"), "+1.1E-.1d"), + (StringTag("+1.1E-.1f"), "+1.1E-.1f"), + (StringTag("+1.1E-.D"), "+1.1E-.D"), + (StringTag("+1.1E-.F"), "+1.1E-.F"), + (StringTag("+1.1E-.d"), "+1.1E-.d"), + (StringTag("+1.1E-.f"), "+1.1E-.f"), (DoubleTag(0.110000), "+1.1E-1"), - (StringTag('+1.1E-1.'), "+1.1E-1."), - (StringTag('+1.1E-1.1'), "+1.1E-1.1"), - (StringTag('+1.1E-1.1D'), "+1.1E-1.1D"), - (StringTag('+1.1E-1.1F'), "+1.1E-1.1F"), - (StringTag('+1.1E-1.1d'), "+1.1E-1.1d"), - (StringTag('+1.1E-1.1f'), "+1.1E-1.1f"), - (StringTag('+1.1E-1.D'), "+1.1E-1.D"), - (StringTag('+1.1E-1.F'), "+1.1E-1.F"), - (StringTag('+1.1E-1.d'), "+1.1E-1.d"), - (StringTag('+1.1E-1.f'), "+1.1E-1.f"), + (StringTag("+1.1E-1."), "+1.1E-1."), + (StringTag("+1.1E-1.1"), "+1.1E-1.1"), + (StringTag("+1.1E-1.1D"), "+1.1E-1.1D"), + (StringTag("+1.1E-1.1F"), "+1.1E-1.1F"), + (StringTag("+1.1E-1.1d"), "+1.1E-1.1d"), + (StringTag("+1.1E-1.1f"), "+1.1E-1.1f"), + (StringTag("+1.1E-1.D"), "+1.1E-1.D"), + (StringTag("+1.1E-1.F"), "+1.1E-1.F"), + (StringTag("+1.1E-1.d"), "+1.1E-1.d"), + (StringTag("+1.1E-1.f"), "+1.1E-1.f"), (DoubleTag(0.110000), "+1.1E-1D"), (FloatTag(0.110000), "+1.1E-1F"), (DoubleTag(0.110000), "+1.1E-1d"), (FloatTag(0.110000), "+1.1E-1f"), - (StringTag('+1.1E-D'), "+1.1E-D"), - (StringTag('+1.1E-F'), "+1.1E-F"), - (StringTag('+1.1E-d'), "+1.1E-d"), - (StringTag('+1.1E-f'), "+1.1E-f"), - (StringTag('+1.1E.'), "+1.1E."), - (StringTag('+1.1E.1'), "+1.1E.1"), - (StringTag('+1.1E.1D'), "+1.1E.1D"), - (StringTag('+1.1E.1F'), "+1.1E.1F"), - (StringTag('+1.1E.1d'), "+1.1E.1d"), - (StringTag('+1.1E.1f'), "+1.1E.1f"), - (StringTag('+1.1E.D'), "+1.1E.D"), - (StringTag('+1.1E.F'), "+1.1E.F"), - (StringTag('+1.1E.d'), "+1.1E.d"), - (StringTag('+1.1E.f'), "+1.1E.f"), + (StringTag("+1.1E-D"), "+1.1E-D"), + (StringTag("+1.1E-F"), "+1.1E-F"), + (StringTag("+1.1E-d"), "+1.1E-d"), + (StringTag("+1.1E-f"), "+1.1E-f"), + (StringTag("+1.1E."), "+1.1E."), + (StringTag("+1.1E.1"), "+1.1E.1"), + (StringTag("+1.1E.1D"), "+1.1E.1D"), + (StringTag("+1.1E.1F"), "+1.1E.1F"), + (StringTag("+1.1E.1d"), "+1.1E.1d"), + (StringTag("+1.1E.1f"), "+1.1E.1f"), + (StringTag("+1.1E.D"), "+1.1E.D"), + (StringTag("+1.1E.F"), "+1.1E.F"), + (StringTag("+1.1E.d"), "+1.1E.d"), + (StringTag("+1.1E.f"), "+1.1E.f"), (DoubleTag(11.000000), "+1.1E1"), - (StringTag('+1.1E1.'), "+1.1E1."), - (StringTag('+1.1E1.1'), "+1.1E1.1"), - (StringTag('+1.1E1.1D'), "+1.1E1.1D"), - (StringTag('+1.1E1.1F'), "+1.1E1.1F"), - (StringTag('+1.1E1.1d'), "+1.1E1.1d"), - (StringTag('+1.1E1.1f'), "+1.1E1.1f"), - (StringTag('+1.1E1.D'), "+1.1E1.D"), - (StringTag('+1.1E1.F'), "+1.1E1.F"), - (StringTag('+1.1E1.d'), "+1.1E1.d"), - (StringTag('+1.1E1.f'), "+1.1E1.f"), + (StringTag("+1.1E1."), "+1.1E1."), + (StringTag("+1.1E1.1"), "+1.1E1.1"), + (StringTag("+1.1E1.1D"), "+1.1E1.1D"), + (StringTag("+1.1E1.1F"), "+1.1E1.1F"), + (StringTag("+1.1E1.1d"), "+1.1E1.1d"), + (StringTag("+1.1E1.1f"), "+1.1E1.1f"), + (StringTag("+1.1E1.D"), "+1.1E1.D"), + (StringTag("+1.1E1.F"), "+1.1E1.F"), + (StringTag("+1.1E1.d"), "+1.1E1.d"), + (StringTag("+1.1E1.f"), "+1.1E1.f"), (DoubleTag(11.000000), "+1.1E1D"), (FloatTag(11.000000), "+1.1E1F"), (DoubleTag(11.000000), "+1.1E1d"), (FloatTag(11.000000), "+1.1E1f"), - (StringTag('+1.1ED'), "+1.1ED"), - (StringTag('+1.1EF'), "+1.1EF"), - (StringTag('+1.1Ed'), "+1.1Ed"), - (StringTag('+1.1Ef'), "+1.1Ef"), + (StringTag("+1.1ED"), "+1.1ED"), + (StringTag("+1.1EF"), "+1.1EF"), + (StringTag("+1.1Ed"), "+1.1Ed"), + (StringTag("+1.1Ef"), "+1.1Ef"), (FloatTag(1.100000), "+1.1F"), (DoubleTag(1.100000), "+1.1d"), - (StringTag('+1.1e'), "+1.1e"), - (StringTag('+1.1e+'), "+1.1e+"), - (StringTag('+1.1e+.'), "+1.1e+."), - (StringTag('+1.1e+.1'), "+1.1e+.1"), - (StringTag('+1.1e+.1D'), "+1.1e+.1D"), - (StringTag('+1.1e+.1F'), "+1.1e+.1F"), - (StringTag('+1.1e+.1d'), "+1.1e+.1d"), - (StringTag('+1.1e+.1f'), "+1.1e+.1f"), - (StringTag('+1.1e+.D'), "+1.1e+.D"), - (StringTag('+1.1e+.F'), "+1.1e+.F"), - (StringTag('+1.1e+.d'), "+1.1e+.d"), - (StringTag('+1.1e+.f'), "+1.1e+.f"), + (StringTag("+1.1e"), "+1.1e"), + (StringTag("+1.1e+"), "+1.1e+"), + (StringTag("+1.1e+."), "+1.1e+."), + (StringTag("+1.1e+.1"), "+1.1e+.1"), + (StringTag("+1.1e+.1D"), "+1.1e+.1D"), + (StringTag("+1.1e+.1F"), "+1.1e+.1F"), + (StringTag("+1.1e+.1d"), "+1.1e+.1d"), + (StringTag("+1.1e+.1f"), "+1.1e+.1f"), + (StringTag("+1.1e+.D"), "+1.1e+.D"), + (StringTag("+1.1e+.F"), "+1.1e+.F"), + (StringTag("+1.1e+.d"), "+1.1e+.d"), + (StringTag("+1.1e+.f"), "+1.1e+.f"), (DoubleTag(11.000000), "+1.1e+1"), - (StringTag('+1.1e+1.'), "+1.1e+1."), - (StringTag('+1.1e+1.1'), "+1.1e+1.1"), - (StringTag('+1.1e+1.1D'), "+1.1e+1.1D"), - (StringTag('+1.1e+1.1F'), "+1.1e+1.1F"), - (StringTag('+1.1e+1.1d'), "+1.1e+1.1d"), - (StringTag('+1.1e+1.1f'), "+1.1e+1.1f"), - (StringTag('+1.1e+1.D'), "+1.1e+1.D"), - (StringTag('+1.1e+1.F'), "+1.1e+1.F"), - (StringTag('+1.1e+1.d'), "+1.1e+1.d"), - (StringTag('+1.1e+1.f'), "+1.1e+1.f"), + (StringTag("+1.1e+1."), "+1.1e+1."), + (StringTag("+1.1e+1.1"), "+1.1e+1.1"), + (StringTag("+1.1e+1.1D"), "+1.1e+1.1D"), + (StringTag("+1.1e+1.1F"), "+1.1e+1.1F"), + (StringTag("+1.1e+1.1d"), "+1.1e+1.1d"), + (StringTag("+1.1e+1.1f"), "+1.1e+1.1f"), + (StringTag("+1.1e+1.D"), "+1.1e+1.D"), + (StringTag("+1.1e+1.F"), "+1.1e+1.F"), + (StringTag("+1.1e+1.d"), "+1.1e+1.d"), + (StringTag("+1.1e+1.f"), "+1.1e+1.f"), (DoubleTag(11.000000), "+1.1e+1D"), (FloatTag(11.000000), "+1.1e+1F"), (DoubleTag(11.000000), "+1.1e+1d"), (FloatTag(11.000000), "+1.1e+1f"), - (StringTag('+1.1e+D'), "+1.1e+D"), - (StringTag('+1.1e+F'), "+1.1e+F"), - (StringTag('+1.1e+d'), "+1.1e+d"), - (StringTag('+1.1e+f'), "+1.1e+f"), - (StringTag('+1.1e-'), "+1.1e-"), - (StringTag('+1.1e-.'), "+1.1e-."), - (StringTag('+1.1e-.1'), "+1.1e-.1"), - (StringTag('+1.1e-.1D'), "+1.1e-.1D"), - (StringTag('+1.1e-.1F'), "+1.1e-.1F"), - (StringTag('+1.1e-.1d'), "+1.1e-.1d"), - (StringTag('+1.1e-.1f'), "+1.1e-.1f"), - (StringTag('+1.1e-.D'), "+1.1e-.D"), - (StringTag('+1.1e-.F'), "+1.1e-.F"), - (StringTag('+1.1e-.d'), "+1.1e-.d"), - (StringTag('+1.1e-.f'), "+1.1e-.f"), + (StringTag("+1.1e+D"), "+1.1e+D"), + (StringTag("+1.1e+F"), "+1.1e+F"), + (StringTag("+1.1e+d"), "+1.1e+d"), + (StringTag("+1.1e+f"), "+1.1e+f"), + (StringTag("+1.1e-"), "+1.1e-"), + (StringTag("+1.1e-."), "+1.1e-."), + (StringTag("+1.1e-.1"), "+1.1e-.1"), + (StringTag("+1.1e-.1D"), "+1.1e-.1D"), + (StringTag("+1.1e-.1F"), "+1.1e-.1F"), + (StringTag("+1.1e-.1d"), "+1.1e-.1d"), + (StringTag("+1.1e-.1f"), "+1.1e-.1f"), + (StringTag("+1.1e-.D"), "+1.1e-.D"), + (StringTag("+1.1e-.F"), "+1.1e-.F"), + (StringTag("+1.1e-.d"), "+1.1e-.d"), + (StringTag("+1.1e-.f"), "+1.1e-.f"), (DoubleTag(0.110000), "+1.1e-1"), - (StringTag('+1.1e-1.'), "+1.1e-1."), - (StringTag('+1.1e-1.1'), "+1.1e-1.1"), - (StringTag('+1.1e-1.1D'), "+1.1e-1.1D"), - (StringTag('+1.1e-1.1F'), "+1.1e-1.1F"), - (StringTag('+1.1e-1.1d'), "+1.1e-1.1d"), - (StringTag('+1.1e-1.1f'), "+1.1e-1.1f"), - (StringTag('+1.1e-1.D'), "+1.1e-1.D"), - (StringTag('+1.1e-1.F'), "+1.1e-1.F"), - (StringTag('+1.1e-1.d'), "+1.1e-1.d"), - (StringTag('+1.1e-1.f'), "+1.1e-1.f"), + (StringTag("+1.1e-1."), "+1.1e-1."), + (StringTag("+1.1e-1.1"), "+1.1e-1.1"), + (StringTag("+1.1e-1.1D"), "+1.1e-1.1D"), + (StringTag("+1.1e-1.1F"), "+1.1e-1.1F"), + (StringTag("+1.1e-1.1d"), "+1.1e-1.1d"), + (StringTag("+1.1e-1.1f"), "+1.1e-1.1f"), + (StringTag("+1.1e-1.D"), "+1.1e-1.D"), + (StringTag("+1.1e-1.F"), "+1.1e-1.F"), + (StringTag("+1.1e-1.d"), "+1.1e-1.d"), + (StringTag("+1.1e-1.f"), "+1.1e-1.f"), (DoubleTag(0.110000), "+1.1e-1D"), (FloatTag(0.110000), "+1.1e-1F"), (DoubleTag(0.110000), "+1.1e-1d"), (FloatTag(0.110000), "+1.1e-1f"), - (StringTag('+1.1e-D'), "+1.1e-D"), - (StringTag('+1.1e-F'), "+1.1e-F"), - (StringTag('+1.1e-d'), "+1.1e-d"), - (StringTag('+1.1e-f'), "+1.1e-f"), - (StringTag('+1.1e.'), "+1.1e."), - (StringTag('+1.1e.1'), "+1.1e.1"), - (StringTag('+1.1e.1D'), "+1.1e.1D"), - (StringTag('+1.1e.1F'), "+1.1e.1F"), - (StringTag('+1.1e.1d'), "+1.1e.1d"), - (StringTag('+1.1e.1f'), "+1.1e.1f"), - (StringTag('+1.1e.D'), "+1.1e.D"), - (StringTag('+1.1e.F'), "+1.1e.F"), - (StringTag('+1.1e.d'), "+1.1e.d"), - (StringTag('+1.1e.f'), "+1.1e.f"), + (StringTag("+1.1e-D"), "+1.1e-D"), + (StringTag("+1.1e-F"), "+1.1e-F"), + (StringTag("+1.1e-d"), "+1.1e-d"), + (StringTag("+1.1e-f"), "+1.1e-f"), + (StringTag("+1.1e."), "+1.1e."), + (StringTag("+1.1e.1"), "+1.1e.1"), + (StringTag("+1.1e.1D"), "+1.1e.1D"), + (StringTag("+1.1e.1F"), "+1.1e.1F"), + (StringTag("+1.1e.1d"), "+1.1e.1d"), + (StringTag("+1.1e.1f"), "+1.1e.1f"), + (StringTag("+1.1e.D"), "+1.1e.D"), + (StringTag("+1.1e.F"), "+1.1e.F"), + (StringTag("+1.1e.d"), "+1.1e.d"), + (StringTag("+1.1e.f"), "+1.1e.f"), (DoubleTag(11.000000), "+1.1e1"), - (StringTag('+1.1e1.'), "+1.1e1."), - (StringTag('+1.1e1.1'), "+1.1e1.1"), - (StringTag('+1.1e1.1D'), "+1.1e1.1D"), - (StringTag('+1.1e1.1F'), "+1.1e1.1F"), - (StringTag('+1.1e1.1d'), "+1.1e1.1d"), - (StringTag('+1.1e1.1f'), "+1.1e1.1f"), - (StringTag('+1.1e1.D'), "+1.1e1.D"), - (StringTag('+1.1e1.F'), "+1.1e1.F"), - (StringTag('+1.1e1.d'), "+1.1e1.d"), - (StringTag('+1.1e1.f'), "+1.1e1.f"), + (StringTag("+1.1e1."), "+1.1e1."), + (StringTag("+1.1e1.1"), "+1.1e1.1"), + (StringTag("+1.1e1.1D"), "+1.1e1.1D"), + (StringTag("+1.1e1.1F"), "+1.1e1.1F"), + (StringTag("+1.1e1.1d"), "+1.1e1.1d"), + (StringTag("+1.1e1.1f"), "+1.1e1.1f"), + (StringTag("+1.1e1.D"), "+1.1e1.D"), + (StringTag("+1.1e1.F"), "+1.1e1.F"), + (StringTag("+1.1e1.d"), "+1.1e1.d"), + (StringTag("+1.1e1.f"), "+1.1e1.f"), (DoubleTag(11.000000), "+1.1e1D"), (FloatTag(11.000000), "+1.1e1F"), (DoubleTag(11.000000), "+1.1e1d"), (FloatTag(11.000000), "+1.1e1f"), - (StringTag('+1.1eD'), "+1.1eD"), - (StringTag('+1.1eF'), "+1.1eF"), - (StringTag('+1.1ed'), "+1.1ed"), - (StringTag('+1.1ef'), "+1.1ef"), + (StringTag("+1.1eD"), "+1.1eD"), + (StringTag("+1.1eF"), "+1.1eF"), + (StringTag("+1.1ed"), "+1.1ed"), + (StringTag("+1.1ef"), "+1.1ef"), (FloatTag(1.100000), "+1.1f"), (DoubleTag(1.000000), "+1.D"), - (StringTag('+1.E'), "+1.E"), - (StringTag('+1.E+'), "+1.E+"), - (StringTag('+1.E+.'), "+1.E+."), - (StringTag('+1.E+.1'), "+1.E+.1"), - (StringTag('+1.E+.1D'), "+1.E+.1D"), - (StringTag('+1.E+.1F'), "+1.E+.1F"), - (StringTag('+1.E+.1d'), "+1.E+.1d"), - (StringTag('+1.E+.1f'), "+1.E+.1f"), - (StringTag('+1.E+.D'), "+1.E+.D"), - (StringTag('+1.E+.F'), "+1.E+.F"), - (StringTag('+1.E+.d'), "+1.E+.d"), - (StringTag('+1.E+.f'), "+1.E+.f"), + (StringTag("+1.E"), "+1.E"), + (StringTag("+1.E+"), "+1.E+"), + (StringTag("+1.E+."), "+1.E+."), + (StringTag("+1.E+.1"), "+1.E+.1"), + (StringTag("+1.E+.1D"), "+1.E+.1D"), + (StringTag("+1.E+.1F"), "+1.E+.1F"), + (StringTag("+1.E+.1d"), "+1.E+.1d"), + (StringTag("+1.E+.1f"), "+1.E+.1f"), + (StringTag("+1.E+.D"), "+1.E+.D"), + (StringTag("+1.E+.F"), "+1.E+.F"), + (StringTag("+1.E+.d"), "+1.E+.d"), + (StringTag("+1.E+.f"), "+1.E+.f"), (DoubleTag(10.000000), "+1.E+1"), - (StringTag('+1.E+1.'), "+1.E+1."), - (StringTag('+1.E+1.1'), "+1.E+1.1"), - (StringTag('+1.E+1.1D'), "+1.E+1.1D"), - (StringTag('+1.E+1.1F'), "+1.E+1.1F"), - (StringTag('+1.E+1.1d'), "+1.E+1.1d"), - (StringTag('+1.E+1.1f'), "+1.E+1.1f"), - (StringTag('+1.E+1.D'), "+1.E+1.D"), - (StringTag('+1.E+1.F'), "+1.E+1.F"), - (StringTag('+1.E+1.d'), "+1.E+1.d"), - (StringTag('+1.E+1.f'), "+1.E+1.f"), + (StringTag("+1.E+1."), "+1.E+1."), + (StringTag("+1.E+1.1"), "+1.E+1.1"), + (StringTag("+1.E+1.1D"), "+1.E+1.1D"), + (StringTag("+1.E+1.1F"), "+1.E+1.1F"), + (StringTag("+1.E+1.1d"), "+1.E+1.1d"), + (StringTag("+1.E+1.1f"), "+1.E+1.1f"), + (StringTag("+1.E+1.D"), "+1.E+1.D"), + (StringTag("+1.E+1.F"), "+1.E+1.F"), + (StringTag("+1.E+1.d"), "+1.E+1.d"), + (StringTag("+1.E+1.f"), "+1.E+1.f"), (DoubleTag(10.000000), "+1.E+1D"), (FloatTag(10.000000), "+1.E+1F"), (DoubleTag(10.000000), "+1.E+1d"), (FloatTag(10.000000), "+1.E+1f"), - (StringTag('+1.E+D'), "+1.E+D"), - (StringTag('+1.E+F'), "+1.E+F"), - (StringTag('+1.E+d'), "+1.E+d"), - (StringTag('+1.E+f'), "+1.E+f"), - (StringTag('+1.E-'), "+1.E-"), - (StringTag('+1.E-.'), "+1.E-."), - (StringTag('+1.E-.1'), "+1.E-.1"), - (StringTag('+1.E-.1D'), "+1.E-.1D"), - (StringTag('+1.E-.1F'), "+1.E-.1F"), - (StringTag('+1.E-.1d'), "+1.E-.1d"), - (StringTag('+1.E-.1f'), "+1.E-.1f"), - (StringTag('+1.E-.D'), "+1.E-.D"), - (StringTag('+1.E-.F'), "+1.E-.F"), - (StringTag('+1.E-.d'), "+1.E-.d"), - (StringTag('+1.E-.f'), "+1.E-.f"), + (StringTag("+1.E+D"), "+1.E+D"), + (StringTag("+1.E+F"), "+1.E+F"), + (StringTag("+1.E+d"), "+1.E+d"), + (StringTag("+1.E+f"), "+1.E+f"), + (StringTag("+1.E-"), "+1.E-"), + (StringTag("+1.E-."), "+1.E-."), + (StringTag("+1.E-.1"), "+1.E-.1"), + (StringTag("+1.E-.1D"), "+1.E-.1D"), + (StringTag("+1.E-.1F"), "+1.E-.1F"), + (StringTag("+1.E-.1d"), "+1.E-.1d"), + (StringTag("+1.E-.1f"), "+1.E-.1f"), + (StringTag("+1.E-.D"), "+1.E-.D"), + (StringTag("+1.E-.F"), "+1.E-.F"), + (StringTag("+1.E-.d"), "+1.E-.d"), + (StringTag("+1.E-.f"), "+1.E-.f"), (DoubleTag(0.100000), "+1.E-1"), - (StringTag('+1.E-1.'), "+1.E-1."), - (StringTag('+1.E-1.1'), "+1.E-1.1"), - (StringTag('+1.E-1.1D'), "+1.E-1.1D"), - (StringTag('+1.E-1.1F'), "+1.E-1.1F"), - (StringTag('+1.E-1.1d'), "+1.E-1.1d"), - (StringTag('+1.E-1.1f'), "+1.E-1.1f"), - (StringTag('+1.E-1.D'), "+1.E-1.D"), - (StringTag('+1.E-1.F'), "+1.E-1.F"), - (StringTag('+1.E-1.d'), "+1.E-1.d"), - (StringTag('+1.E-1.f'), "+1.E-1.f"), + (StringTag("+1.E-1."), "+1.E-1."), + (StringTag("+1.E-1.1"), "+1.E-1.1"), + (StringTag("+1.E-1.1D"), "+1.E-1.1D"), + (StringTag("+1.E-1.1F"), "+1.E-1.1F"), + (StringTag("+1.E-1.1d"), "+1.E-1.1d"), + (StringTag("+1.E-1.1f"), "+1.E-1.1f"), + (StringTag("+1.E-1.D"), "+1.E-1.D"), + (StringTag("+1.E-1.F"), "+1.E-1.F"), + (StringTag("+1.E-1.d"), "+1.E-1.d"), + (StringTag("+1.E-1.f"), "+1.E-1.f"), (DoubleTag(0.100000), "+1.E-1D"), (FloatTag(0.100000), "+1.E-1F"), (DoubleTag(0.100000), "+1.E-1d"), (FloatTag(0.100000), "+1.E-1f"), - (StringTag('+1.E-D'), "+1.E-D"), - (StringTag('+1.E-F'), "+1.E-F"), - (StringTag('+1.E-d'), "+1.E-d"), - (StringTag('+1.E-f'), "+1.E-f"), - (StringTag('+1.E.'), "+1.E."), - (StringTag('+1.E.1'), "+1.E.1"), - (StringTag('+1.E.1D'), "+1.E.1D"), - (StringTag('+1.E.1F'), "+1.E.1F"), - (StringTag('+1.E.1d'), "+1.E.1d"), - (StringTag('+1.E.1f'), "+1.E.1f"), - (StringTag('+1.E.D'), "+1.E.D"), - (StringTag('+1.E.F'), "+1.E.F"), - (StringTag('+1.E.d'), "+1.E.d"), - (StringTag('+1.E.f'), "+1.E.f"), + (StringTag("+1.E-D"), "+1.E-D"), + (StringTag("+1.E-F"), "+1.E-F"), + (StringTag("+1.E-d"), "+1.E-d"), + (StringTag("+1.E-f"), "+1.E-f"), + (StringTag("+1.E."), "+1.E."), + (StringTag("+1.E.1"), "+1.E.1"), + (StringTag("+1.E.1D"), "+1.E.1D"), + (StringTag("+1.E.1F"), "+1.E.1F"), + (StringTag("+1.E.1d"), "+1.E.1d"), + (StringTag("+1.E.1f"), "+1.E.1f"), + (StringTag("+1.E.D"), "+1.E.D"), + (StringTag("+1.E.F"), "+1.E.F"), + (StringTag("+1.E.d"), "+1.E.d"), + (StringTag("+1.E.f"), "+1.E.f"), (DoubleTag(10.000000), "+1.E1"), - (StringTag('+1.E1.'), "+1.E1."), - (StringTag('+1.E1.1'), "+1.E1.1"), - (StringTag('+1.E1.1D'), "+1.E1.1D"), - (StringTag('+1.E1.1F'), "+1.E1.1F"), - (StringTag('+1.E1.1d'), "+1.E1.1d"), - (StringTag('+1.E1.1f'), "+1.E1.1f"), - (StringTag('+1.E1.D'), "+1.E1.D"), - (StringTag('+1.E1.F'), "+1.E1.F"), - (StringTag('+1.E1.d'), "+1.E1.d"), - (StringTag('+1.E1.f'), "+1.E1.f"), + (StringTag("+1.E1."), "+1.E1."), + (StringTag("+1.E1.1"), "+1.E1.1"), + (StringTag("+1.E1.1D"), "+1.E1.1D"), + (StringTag("+1.E1.1F"), "+1.E1.1F"), + (StringTag("+1.E1.1d"), "+1.E1.1d"), + (StringTag("+1.E1.1f"), "+1.E1.1f"), + (StringTag("+1.E1.D"), "+1.E1.D"), + (StringTag("+1.E1.F"), "+1.E1.F"), + (StringTag("+1.E1.d"), "+1.E1.d"), + (StringTag("+1.E1.f"), "+1.E1.f"), (DoubleTag(10.000000), "+1.E1D"), (FloatTag(10.000000), "+1.E1F"), (DoubleTag(10.000000), "+1.E1d"), (FloatTag(10.000000), "+1.E1f"), - (StringTag('+1.ED'), "+1.ED"), - (StringTag('+1.EF'), "+1.EF"), - (StringTag('+1.Ed'), "+1.Ed"), - (StringTag('+1.Ef'), "+1.Ef"), + (StringTag("+1.ED"), "+1.ED"), + (StringTag("+1.EF"), "+1.EF"), + (StringTag("+1.Ed"), "+1.Ed"), + (StringTag("+1.Ef"), "+1.Ef"), (FloatTag(1.000000), "+1.F"), (DoubleTag(1.000000), "+1.d"), - (StringTag('+1.e'), "+1.e"), - (StringTag('+1.e+'), "+1.e+"), - (StringTag('+1.e+.'), "+1.e+."), - (StringTag('+1.e+.1'), "+1.e+.1"), - (StringTag('+1.e+.1D'), "+1.e+.1D"), - (StringTag('+1.e+.1F'), "+1.e+.1F"), - (StringTag('+1.e+.1d'), "+1.e+.1d"), - (StringTag('+1.e+.1f'), "+1.e+.1f"), - (StringTag('+1.e+.D'), "+1.e+.D"), - (StringTag('+1.e+.F'), "+1.e+.F"), - (StringTag('+1.e+.d'), "+1.e+.d"), - (StringTag('+1.e+.f'), "+1.e+.f"), + (StringTag("+1.e"), "+1.e"), + (StringTag("+1.e+"), "+1.e+"), + (StringTag("+1.e+."), "+1.e+."), + (StringTag("+1.e+.1"), "+1.e+.1"), + (StringTag("+1.e+.1D"), "+1.e+.1D"), + (StringTag("+1.e+.1F"), "+1.e+.1F"), + (StringTag("+1.e+.1d"), "+1.e+.1d"), + (StringTag("+1.e+.1f"), "+1.e+.1f"), + (StringTag("+1.e+.D"), "+1.e+.D"), + (StringTag("+1.e+.F"), "+1.e+.F"), + (StringTag("+1.e+.d"), "+1.e+.d"), + (StringTag("+1.e+.f"), "+1.e+.f"), (DoubleTag(10.000000), "+1.e+1"), - (StringTag('+1.e+1.'), "+1.e+1."), - (StringTag('+1.e+1.1'), "+1.e+1.1"), - (StringTag('+1.e+1.1D'), "+1.e+1.1D"), - (StringTag('+1.e+1.1F'), "+1.e+1.1F"), - (StringTag('+1.e+1.1d'), "+1.e+1.1d"), - (StringTag('+1.e+1.1f'), "+1.e+1.1f"), - (StringTag('+1.e+1.D'), "+1.e+1.D"), - (StringTag('+1.e+1.F'), "+1.e+1.F"), - (StringTag('+1.e+1.d'), "+1.e+1.d"), - (StringTag('+1.e+1.f'), "+1.e+1.f"), + (StringTag("+1.e+1."), "+1.e+1."), + (StringTag("+1.e+1.1"), "+1.e+1.1"), + (StringTag("+1.e+1.1D"), "+1.e+1.1D"), + (StringTag("+1.e+1.1F"), "+1.e+1.1F"), + (StringTag("+1.e+1.1d"), "+1.e+1.1d"), + (StringTag("+1.e+1.1f"), "+1.e+1.1f"), + (StringTag("+1.e+1.D"), "+1.e+1.D"), + (StringTag("+1.e+1.F"), "+1.e+1.F"), + (StringTag("+1.e+1.d"), "+1.e+1.d"), + (StringTag("+1.e+1.f"), "+1.e+1.f"), (DoubleTag(10.000000), "+1.e+1D"), (FloatTag(10.000000), "+1.e+1F"), (DoubleTag(10.000000), "+1.e+1d"), (FloatTag(10.000000), "+1.e+1f"), - (StringTag('+1.e+D'), "+1.e+D"), - (StringTag('+1.e+F'), "+1.e+F"), - (StringTag('+1.e+d'), "+1.e+d"), - (StringTag('+1.e+f'), "+1.e+f"), - (StringTag('+1.e-'), "+1.e-"), - (StringTag('+1.e-.'), "+1.e-."), - (StringTag('+1.e-.1'), "+1.e-.1"), - (StringTag('+1.e-.1D'), "+1.e-.1D"), - (StringTag('+1.e-.1F'), "+1.e-.1F"), - (StringTag('+1.e-.1d'), "+1.e-.1d"), - (StringTag('+1.e-.1f'), "+1.e-.1f"), - (StringTag('+1.e-.D'), "+1.e-.D"), - (StringTag('+1.e-.F'), "+1.e-.F"), - (StringTag('+1.e-.d'), "+1.e-.d"), - (StringTag('+1.e-.f'), "+1.e-.f"), + (StringTag("+1.e+D"), "+1.e+D"), + (StringTag("+1.e+F"), "+1.e+F"), + (StringTag("+1.e+d"), "+1.e+d"), + (StringTag("+1.e+f"), "+1.e+f"), + (StringTag("+1.e-"), "+1.e-"), + (StringTag("+1.e-."), "+1.e-."), + (StringTag("+1.e-.1"), "+1.e-.1"), + (StringTag("+1.e-.1D"), "+1.e-.1D"), + (StringTag("+1.e-.1F"), "+1.e-.1F"), + (StringTag("+1.e-.1d"), "+1.e-.1d"), + (StringTag("+1.e-.1f"), "+1.e-.1f"), + (StringTag("+1.e-.D"), "+1.e-.D"), + (StringTag("+1.e-.F"), "+1.e-.F"), + (StringTag("+1.e-.d"), "+1.e-.d"), + (StringTag("+1.e-.f"), "+1.e-.f"), (DoubleTag(0.100000), "+1.e-1"), - (StringTag('+1.e-1.'), "+1.e-1."), - (StringTag('+1.e-1.1'), "+1.e-1.1"), - (StringTag('+1.e-1.1D'), "+1.e-1.1D"), - (StringTag('+1.e-1.1F'), "+1.e-1.1F"), - (StringTag('+1.e-1.1d'), "+1.e-1.1d"), - (StringTag('+1.e-1.1f'), "+1.e-1.1f"), - (StringTag('+1.e-1.D'), "+1.e-1.D"), - (StringTag('+1.e-1.F'), "+1.e-1.F"), - (StringTag('+1.e-1.d'), "+1.e-1.d"), - (StringTag('+1.e-1.f'), "+1.e-1.f"), + (StringTag("+1.e-1."), "+1.e-1."), + (StringTag("+1.e-1.1"), "+1.e-1.1"), + (StringTag("+1.e-1.1D"), "+1.e-1.1D"), + (StringTag("+1.e-1.1F"), "+1.e-1.1F"), + (StringTag("+1.e-1.1d"), "+1.e-1.1d"), + (StringTag("+1.e-1.1f"), "+1.e-1.1f"), + (StringTag("+1.e-1.D"), "+1.e-1.D"), + (StringTag("+1.e-1.F"), "+1.e-1.F"), + (StringTag("+1.e-1.d"), "+1.e-1.d"), + (StringTag("+1.e-1.f"), "+1.e-1.f"), (DoubleTag(0.100000), "+1.e-1D"), (FloatTag(0.100000), "+1.e-1F"), (DoubleTag(0.100000), "+1.e-1d"), (FloatTag(0.100000), "+1.e-1f"), - (StringTag('+1.e-D'), "+1.e-D"), - (StringTag('+1.e-F'), "+1.e-F"), - (StringTag('+1.e-d'), "+1.e-d"), - (StringTag('+1.e-f'), "+1.e-f"), - (StringTag('+1.e.'), "+1.e."), - (StringTag('+1.e.1'), "+1.e.1"), - (StringTag('+1.e.1D'), "+1.e.1D"), - (StringTag('+1.e.1F'), "+1.e.1F"), - (StringTag('+1.e.1d'), "+1.e.1d"), - (StringTag('+1.e.1f'), "+1.e.1f"), - (StringTag('+1.e.D'), "+1.e.D"), - (StringTag('+1.e.F'), "+1.e.F"), - (StringTag('+1.e.d'), "+1.e.d"), - (StringTag('+1.e.f'), "+1.e.f"), + (StringTag("+1.e-D"), "+1.e-D"), + (StringTag("+1.e-F"), "+1.e-F"), + (StringTag("+1.e-d"), "+1.e-d"), + (StringTag("+1.e-f"), "+1.e-f"), + (StringTag("+1.e."), "+1.e."), + (StringTag("+1.e.1"), "+1.e.1"), + (StringTag("+1.e.1D"), "+1.e.1D"), + (StringTag("+1.e.1F"), "+1.e.1F"), + (StringTag("+1.e.1d"), "+1.e.1d"), + (StringTag("+1.e.1f"), "+1.e.1f"), + (StringTag("+1.e.D"), "+1.e.D"), + (StringTag("+1.e.F"), "+1.e.F"), + (StringTag("+1.e.d"), "+1.e.d"), + (StringTag("+1.e.f"), "+1.e.f"), (DoubleTag(10.000000), "+1.e1"), - (StringTag('+1.e1.'), "+1.e1."), - (StringTag('+1.e1.1'), "+1.e1.1"), - (StringTag('+1.e1.1D'), "+1.e1.1D"), - (StringTag('+1.e1.1F'), "+1.e1.1F"), - (StringTag('+1.e1.1d'), "+1.e1.1d"), - (StringTag('+1.e1.1f'), "+1.e1.1f"), - (StringTag('+1.e1.D'), "+1.e1.D"), - (StringTag('+1.e1.F'), "+1.e1.F"), - (StringTag('+1.e1.d'), "+1.e1.d"), - (StringTag('+1.e1.f'), "+1.e1.f"), + (StringTag("+1.e1."), "+1.e1."), + (StringTag("+1.e1.1"), "+1.e1.1"), + (StringTag("+1.e1.1D"), "+1.e1.1D"), + (StringTag("+1.e1.1F"), "+1.e1.1F"), + (StringTag("+1.e1.1d"), "+1.e1.1d"), + (StringTag("+1.e1.1f"), "+1.e1.1f"), + (StringTag("+1.e1.D"), "+1.e1.D"), + (StringTag("+1.e1.F"), "+1.e1.F"), + (StringTag("+1.e1.d"), "+1.e1.d"), + (StringTag("+1.e1.f"), "+1.e1.f"), (DoubleTag(10.000000), "+1.e1D"), (FloatTag(10.000000), "+1.e1F"), (DoubleTag(10.000000), "+1.e1d"), (FloatTag(10.000000), "+1.e1f"), - (StringTag('+1.eD'), "+1.eD"), - (StringTag('+1.eF'), "+1.eF"), - (StringTag('+1.ed'), "+1.ed"), - (StringTag('+1.ef'), "+1.ef"), + (StringTag("+1.eD"), "+1.eD"), + (StringTag("+1.eF"), "+1.eF"), + (StringTag("+1.ed"), "+1.ed"), + (StringTag("+1.ef"), "+1.ef"), (FloatTag(1.000000), "+1.f"), (IntTag(11), "+11"), (DoubleTag(11.000000), "+11."), @@ -1834,1544 +1833,1544 @@ def test_from_snbt(self) -> None: (DoubleTag(11.000000), "+11d"), (FloatTag(11.000000), "+11f"), (DoubleTag(1.000000), "+1D"), - (StringTag('+1E'), "+1E"), - (StringTag('+1E+'), "+1E+"), - (StringTag('+1E+.'), "+1E+."), - (StringTag('+1E+.1'), "+1E+.1"), - (StringTag('+1E+.1D'), "+1E+.1D"), - (StringTag('+1E+.1F'), "+1E+.1F"), - (StringTag('+1E+.1d'), "+1E+.1d"), - (StringTag('+1E+.1f'), "+1E+.1f"), - (StringTag('+1E+.D'), "+1E+.D"), - (StringTag('+1E+.F'), "+1E+.F"), - (StringTag('+1E+.d'), "+1E+.d"), - (StringTag('+1E+.f'), "+1E+.f"), - (StringTag('+1E+1'), "+1E+1"), - (StringTag('+1E+1.'), "+1E+1."), - (StringTag('+1E+1.1'), "+1E+1.1"), - (StringTag('+1E+1.1D'), "+1E+1.1D"), - (StringTag('+1E+1.1F'), "+1E+1.1F"), - (StringTag('+1E+1.1d'), "+1E+1.1d"), - (StringTag('+1E+1.1f'), "+1E+1.1f"), - (StringTag('+1E+1.D'), "+1E+1.D"), - (StringTag('+1E+1.F'), "+1E+1.F"), - (StringTag('+1E+1.d'), "+1E+1.d"), - (StringTag('+1E+1.f'), "+1E+1.f"), + (StringTag("+1E"), "+1E"), + (StringTag("+1E+"), "+1E+"), + (StringTag("+1E+."), "+1E+."), + (StringTag("+1E+.1"), "+1E+.1"), + (StringTag("+1E+.1D"), "+1E+.1D"), + (StringTag("+1E+.1F"), "+1E+.1F"), + (StringTag("+1E+.1d"), "+1E+.1d"), + (StringTag("+1E+.1f"), "+1E+.1f"), + (StringTag("+1E+.D"), "+1E+.D"), + (StringTag("+1E+.F"), "+1E+.F"), + (StringTag("+1E+.d"), "+1E+.d"), + (StringTag("+1E+.f"), "+1E+.f"), + (StringTag("+1E+1"), "+1E+1"), + (StringTag("+1E+1."), "+1E+1."), + (StringTag("+1E+1.1"), "+1E+1.1"), + (StringTag("+1E+1.1D"), "+1E+1.1D"), + (StringTag("+1E+1.1F"), "+1E+1.1F"), + (StringTag("+1E+1.1d"), "+1E+1.1d"), + (StringTag("+1E+1.1f"), "+1E+1.1f"), + (StringTag("+1E+1.D"), "+1E+1.D"), + (StringTag("+1E+1.F"), "+1E+1.F"), + (StringTag("+1E+1.d"), "+1E+1.d"), + (StringTag("+1E+1.f"), "+1E+1.f"), (DoubleTag(10.000000), "+1E+1D"), (FloatTag(10.000000), "+1E+1F"), (DoubleTag(10.000000), "+1E+1d"), (FloatTag(10.000000), "+1E+1f"), - (StringTag('+1E+D'), "+1E+D"), - (StringTag('+1E+F'), "+1E+F"), - (StringTag('+1E+d'), "+1E+d"), - (StringTag('+1E+f'), "+1E+f"), - (StringTag('+1E-'), "+1E-"), - (StringTag('+1E-.'), "+1E-."), - (StringTag('+1E-.1'), "+1E-.1"), - (StringTag('+1E-.1D'), "+1E-.1D"), - (StringTag('+1E-.1F'), "+1E-.1F"), - (StringTag('+1E-.1d'), "+1E-.1d"), - (StringTag('+1E-.1f'), "+1E-.1f"), - (StringTag('+1E-.D'), "+1E-.D"), - (StringTag('+1E-.F'), "+1E-.F"), - (StringTag('+1E-.d'), "+1E-.d"), - (StringTag('+1E-.f'), "+1E-.f"), - (StringTag('+1E-1'), "+1E-1"), - (StringTag('+1E-1.'), "+1E-1."), - (StringTag('+1E-1.1'), "+1E-1.1"), - (StringTag('+1E-1.1D'), "+1E-1.1D"), - (StringTag('+1E-1.1F'), "+1E-1.1F"), - (StringTag('+1E-1.1d'), "+1E-1.1d"), - (StringTag('+1E-1.1f'), "+1E-1.1f"), - (StringTag('+1E-1.D'), "+1E-1.D"), - (StringTag('+1E-1.F'), "+1E-1.F"), - (StringTag('+1E-1.d'), "+1E-1.d"), - (StringTag('+1E-1.f'), "+1E-1.f"), + (StringTag("+1E+D"), "+1E+D"), + (StringTag("+1E+F"), "+1E+F"), + (StringTag("+1E+d"), "+1E+d"), + (StringTag("+1E+f"), "+1E+f"), + (StringTag("+1E-"), "+1E-"), + (StringTag("+1E-."), "+1E-."), + (StringTag("+1E-.1"), "+1E-.1"), + (StringTag("+1E-.1D"), "+1E-.1D"), + (StringTag("+1E-.1F"), "+1E-.1F"), + (StringTag("+1E-.1d"), "+1E-.1d"), + (StringTag("+1E-.1f"), "+1E-.1f"), + (StringTag("+1E-.D"), "+1E-.D"), + (StringTag("+1E-.F"), "+1E-.F"), + (StringTag("+1E-.d"), "+1E-.d"), + (StringTag("+1E-.f"), "+1E-.f"), + (StringTag("+1E-1"), "+1E-1"), + (StringTag("+1E-1."), "+1E-1."), + (StringTag("+1E-1.1"), "+1E-1.1"), + (StringTag("+1E-1.1D"), "+1E-1.1D"), + (StringTag("+1E-1.1F"), "+1E-1.1F"), + (StringTag("+1E-1.1d"), "+1E-1.1d"), + (StringTag("+1E-1.1f"), "+1E-1.1f"), + (StringTag("+1E-1.D"), "+1E-1.D"), + (StringTag("+1E-1.F"), "+1E-1.F"), + (StringTag("+1E-1.d"), "+1E-1.d"), + (StringTag("+1E-1.f"), "+1E-1.f"), (DoubleTag(0.100000), "+1E-1D"), (FloatTag(0.100000), "+1E-1F"), (DoubleTag(0.100000), "+1E-1d"), (FloatTag(0.100000), "+1E-1f"), - (StringTag('+1E-D'), "+1E-D"), - (StringTag('+1E-F'), "+1E-F"), - (StringTag('+1E-d'), "+1E-d"), - (StringTag('+1E-f'), "+1E-f"), - (StringTag('+1E.'), "+1E."), - (StringTag('+1E.1'), "+1E.1"), - (StringTag('+1E.1D'), "+1E.1D"), - (StringTag('+1E.1F'), "+1E.1F"), - (StringTag('+1E.1d'), "+1E.1d"), - (StringTag('+1E.1f'), "+1E.1f"), - (StringTag('+1E.D'), "+1E.D"), - (StringTag('+1E.F'), "+1E.F"), - (StringTag('+1E.d'), "+1E.d"), - (StringTag('+1E.f'), "+1E.f"), - (StringTag('+1E1'), "+1E1"), - (StringTag('+1E1.'), "+1E1."), - (StringTag('+1E1.1'), "+1E1.1"), - (StringTag('+1E1.1D'), "+1E1.1D"), - (StringTag('+1E1.1F'), "+1E1.1F"), - (StringTag('+1E1.1d'), "+1E1.1d"), - (StringTag('+1E1.1f'), "+1E1.1f"), - (StringTag('+1E1.D'), "+1E1.D"), - (StringTag('+1E1.F'), "+1E1.F"), - (StringTag('+1E1.d'), "+1E1.d"), - (StringTag('+1E1.f'), "+1E1.f"), + (StringTag("+1E-D"), "+1E-D"), + (StringTag("+1E-F"), "+1E-F"), + (StringTag("+1E-d"), "+1E-d"), + (StringTag("+1E-f"), "+1E-f"), + (StringTag("+1E."), "+1E."), + (StringTag("+1E.1"), "+1E.1"), + (StringTag("+1E.1D"), "+1E.1D"), + (StringTag("+1E.1F"), "+1E.1F"), + (StringTag("+1E.1d"), "+1E.1d"), + (StringTag("+1E.1f"), "+1E.1f"), + (StringTag("+1E.D"), "+1E.D"), + (StringTag("+1E.F"), "+1E.F"), + (StringTag("+1E.d"), "+1E.d"), + (StringTag("+1E.f"), "+1E.f"), + (StringTag("+1E1"), "+1E1"), + (StringTag("+1E1."), "+1E1."), + (StringTag("+1E1.1"), "+1E1.1"), + (StringTag("+1E1.1D"), "+1E1.1D"), + (StringTag("+1E1.1F"), "+1E1.1F"), + (StringTag("+1E1.1d"), "+1E1.1d"), + (StringTag("+1E1.1f"), "+1E1.1f"), + (StringTag("+1E1.D"), "+1E1.D"), + (StringTag("+1E1.F"), "+1E1.F"), + (StringTag("+1E1.d"), "+1E1.d"), + (StringTag("+1E1.f"), "+1E1.f"), (DoubleTag(10.000000), "+1E1D"), (FloatTag(10.000000), "+1E1F"), (DoubleTag(10.000000), "+1E1d"), (FloatTag(10.000000), "+1E1f"), - (StringTag('+1ED'), "+1ED"), - (StringTag('+1EF'), "+1EF"), - (StringTag('+1Ed'), "+1Ed"), - (StringTag('+1Ef'), "+1Ef"), + (StringTag("+1ED"), "+1ED"), + (StringTag("+1EF"), "+1EF"), + (StringTag("+1Ed"), "+1Ed"), + (StringTag("+1Ef"), "+1Ef"), (FloatTag(1.000000), "+1F"), (DoubleTag(1.000000), "+1d"), - (StringTag('+1e'), "+1e"), - (StringTag('+1e+'), "+1e+"), - (StringTag('+1e+.'), "+1e+."), - (StringTag('+1e+.1'), "+1e+.1"), - (StringTag('+1e+.1D'), "+1e+.1D"), - (StringTag('+1e+.1F'), "+1e+.1F"), - (StringTag('+1e+.1d'), "+1e+.1d"), - (StringTag('+1e+.1f'), "+1e+.1f"), - (StringTag('+1e+.D'), "+1e+.D"), - (StringTag('+1e+.F'), "+1e+.F"), - (StringTag('+1e+.d'), "+1e+.d"), - (StringTag('+1e+.f'), "+1e+.f"), - (StringTag('+1e+1'), "+1e+1"), - (StringTag('+1e+1.'), "+1e+1."), - (StringTag('+1e+1.1'), "+1e+1.1"), - (StringTag('+1e+1.1D'), "+1e+1.1D"), - (StringTag('+1e+1.1F'), "+1e+1.1F"), - (StringTag('+1e+1.1d'), "+1e+1.1d"), - (StringTag('+1e+1.1f'), "+1e+1.1f"), - (StringTag('+1e+1.D'), "+1e+1.D"), - (StringTag('+1e+1.F'), "+1e+1.F"), - (StringTag('+1e+1.d'), "+1e+1.d"), - (StringTag('+1e+1.f'), "+1e+1.f"), + (StringTag("+1e"), "+1e"), + (StringTag("+1e+"), "+1e+"), + (StringTag("+1e+."), "+1e+."), + (StringTag("+1e+.1"), "+1e+.1"), + (StringTag("+1e+.1D"), "+1e+.1D"), + (StringTag("+1e+.1F"), "+1e+.1F"), + (StringTag("+1e+.1d"), "+1e+.1d"), + (StringTag("+1e+.1f"), "+1e+.1f"), + (StringTag("+1e+.D"), "+1e+.D"), + (StringTag("+1e+.F"), "+1e+.F"), + (StringTag("+1e+.d"), "+1e+.d"), + (StringTag("+1e+.f"), "+1e+.f"), + (StringTag("+1e+1"), "+1e+1"), + (StringTag("+1e+1."), "+1e+1."), + (StringTag("+1e+1.1"), "+1e+1.1"), + (StringTag("+1e+1.1D"), "+1e+1.1D"), + (StringTag("+1e+1.1F"), "+1e+1.1F"), + (StringTag("+1e+1.1d"), "+1e+1.1d"), + (StringTag("+1e+1.1f"), "+1e+1.1f"), + (StringTag("+1e+1.D"), "+1e+1.D"), + (StringTag("+1e+1.F"), "+1e+1.F"), + (StringTag("+1e+1.d"), "+1e+1.d"), + (StringTag("+1e+1.f"), "+1e+1.f"), (DoubleTag(10.000000), "+1e+1D"), (FloatTag(10.000000), "+1e+1F"), (DoubleTag(10.000000), "+1e+1d"), (FloatTag(10.000000), "+1e+1f"), - (StringTag('+1e+D'), "+1e+D"), - (StringTag('+1e+F'), "+1e+F"), - (StringTag('+1e+d'), "+1e+d"), - (StringTag('+1e+f'), "+1e+f"), - (StringTag('+1e-'), "+1e-"), - (StringTag('+1e-.'), "+1e-."), - (StringTag('+1e-.1'), "+1e-.1"), - (StringTag('+1e-.1D'), "+1e-.1D"), - (StringTag('+1e-.1F'), "+1e-.1F"), - (StringTag('+1e-.1d'), "+1e-.1d"), - (StringTag('+1e-.1f'), "+1e-.1f"), - (StringTag('+1e-.D'), "+1e-.D"), - (StringTag('+1e-.F'), "+1e-.F"), - (StringTag('+1e-.d'), "+1e-.d"), - (StringTag('+1e-.f'), "+1e-.f"), - (StringTag('+1e-1'), "+1e-1"), - (StringTag('+1e-1.'), "+1e-1."), - (StringTag('+1e-1.1'), "+1e-1.1"), - (StringTag('+1e-1.1D'), "+1e-1.1D"), - (StringTag('+1e-1.1F'), "+1e-1.1F"), - (StringTag('+1e-1.1d'), "+1e-1.1d"), - (StringTag('+1e-1.1f'), "+1e-1.1f"), - (StringTag('+1e-1.D'), "+1e-1.D"), - (StringTag('+1e-1.F'), "+1e-1.F"), - (StringTag('+1e-1.d'), "+1e-1.d"), - (StringTag('+1e-1.f'), "+1e-1.f"), + (StringTag("+1e+D"), "+1e+D"), + (StringTag("+1e+F"), "+1e+F"), + (StringTag("+1e+d"), "+1e+d"), + (StringTag("+1e+f"), "+1e+f"), + (StringTag("+1e-"), "+1e-"), + (StringTag("+1e-."), "+1e-."), + (StringTag("+1e-.1"), "+1e-.1"), + (StringTag("+1e-.1D"), "+1e-.1D"), + (StringTag("+1e-.1F"), "+1e-.1F"), + (StringTag("+1e-.1d"), "+1e-.1d"), + (StringTag("+1e-.1f"), "+1e-.1f"), + (StringTag("+1e-.D"), "+1e-.D"), + (StringTag("+1e-.F"), "+1e-.F"), + (StringTag("+1e-.d"), "+1e-.d"), + (StringTag("+1e-.f"), "+1e-.f"), + (StringTag("+1e-1"), "+1e-1"), + (StringTag("+1e-1."), "+1e-1."), + (StringTag("+1e-1.1"), "+1e-1.1"), + (StringTag("+1e-1.1D"), "+1e-1.1D"), + (StringTag("+1e-1.1F"), "+1e-1.1F"), + (StringTag("+1e-1.1d"), "+1e-1.1d"), + (StringTag("+1e-1.1f"), "+1e-1.1f"), + (StringTag("+1e-1.D"), "+1e-1.D"), + (StringTag("+1e-1.F"), "+1e-1.F"), + (StringTag("+1e-1.d"), "+1e-1.d"), + (StringTag("+1e-1.f"), "+1e-1.f"), (DoubleTag(0.100000), "+1e-1D"), (FloatTag(0.100000), "+1e-1F"), (DoubleTag(0.100000), "+1e-1d"), (FloatTag(0.100000), "+1e-1f"), - (StringTag('+1e-D'), "+1e-D"), - (StringTag('+1e-F'), "+1e-F"), - (StringTag('+1e-d'), "+1e-d"), - (StringTag('+1e-f'), "+1e-f"), - (StringTag('+1e.'), "+1e."), - (StringTag('+1e.1'), "+1e.1"), - (StringTag('+1e.1D'), "+1e.1D"), - (StringTag('+1e.1F'), "+1e.1F"), - (StringTag('+1e.1d'), "+1e.1d"), - (StringTag('+1e.1f'), "+1e.1f"), - (StringTag('+1e.D'), "+1e.D"), - (StringTag('+1e.F'), "+1e.F"), - (StringTag('+1e.d'), "+1e.d"), - (StringTag('+1e.f'), "+1e.f"), - (StringTag('+1e1'), "+1e1"), - (StringTag('+1e1.'), "+1e1."), - (StringTag('+1e1.1'), "+1e1.1"), - (StringTag('+1e1.1D'), "+1e1.1D"), - (StringTag('+1e1.1F'), "+1e1.1F"), - (StringTag('+1e1.1d'), "+1e1.1d"), - (StringTag('+1e1.1f'), "+1e1.1f"), - (StringTag('+1e1.D'), "+1e1.D"), - (StringTag('+1e1.F'), "+1e1.F"), - (StringTag('+1e1.d'), "+1e1.d"), - (StringTag('+1e1.f'), "+1e1.f"), + (StringTag("+1e-D"), "+1e-D"), + (StringTag("+1e-F"), "+1e-F"), + (StringTag("+1e-d"), "+1e-d"), + (StringTag("+1e-f"), "+1e-f"), + (StringTag("+1e."), "+1e."), + (StringTag("+1e.1"), "+1e.1"), + (StringTag("+1e.1D"), "+1e.1D"), + (StringTag("+1e.1F"), "+1e.1F"), + (StringTag("+1e.1d"), "+1e.1d"), + (StringTag("+1e.1f"), "+1e.1f"), + (StringTag("+1e.D"), "+1e.D"), + (StringTag("+1e.F"), "+1e.F"), + (StringTag("+1e.d"), "+1e.d"), + (StringTag("+1e.f"), "+1e.f"), + (StringTag("+1e1"), "+1e1"), + (StringTag("+1e1."), "+1e1."), + (StringTag("+1e1.1"), "+1e1.1"), + (StringTag("+1e1.1D"), "+1e1.1D"), + (StringTag("+1e1.1F"), "+1e1.1F"), + (StringTag("+1e1.1d"), "+1e1.1d"), + (StringTag("+1e1.1f"), "+1e1.1f"), + (StringTag("+1e1.D"), "+1e1.D"), + (StringTag("+1e1.F"), "+1e1.F"), + (StringTag("+1e1.d"), "+1e1.d"), + (StringTag("+1e1.f"), "+1e1.f"), (DoubleTag(10.000000), "+1e1D"), (FloatTag(10.000000), "+1e1F"), (DoubleTag(10.000000), "+1e1d"), (FloatTag(10.000000), "+1e1f"), - (StringTag('+1eD'), "+1eD"), - (StringTag('+1eF'), "+1eF"), - (StringTag('+1ed'), "+1ed"), - (StringTag('+1ef'), "+1ef"), + (StringTag("+1eD"), "+1eD"), + (StringTag("+1eF"), "+1eF"), + (StringTag("+1ed"), "+1ed"), + (StringTag("+1ef"), "+1ef"), (FloatTag(1.000000), "+1f"), - (StringTag('+D'), "+D"), - (StringTag('+E'), "+E"), - (StringTag('+E+'), "+E+"), - (StringTag('+E+.'), "+E+."), - (StringTag('+E+.1'), "+E+.1"), - (StringTag('+E+.1D'), "+E+.1D"), - (StringTag('+E+.1F'), "+E+.1F"), - (StringTag('+E+.1d'), "+E+.1d"), - (StringTag('+E+.1f'), "+E+.1f"), - (StringTag('+E+.D'), "+E+.D"), - (StringTag('+E+.F'), "+E+.F"), - (StringTag('+E+.d'), "+E+.d"), - (StringTag('+E+.f'), "+E+.f"), - (StringTag('+E+1'), "+E+1"), - (StringTag('+E+1.'), "+E+1."), - (StringTag('+E+1.1'), "+E+1.1"), - (StringTag('+E+1.1D'), "+E+1.1D"), - (StringTag('+E+1.1F'), "+E+1.1F"), - (StringTag('+E+1.1d'), "+E+1.1d"), - (StringTag('+E+1.1f'), "+E+1.1f"), - (StringTag('+E+1.D'), "+E+1.D"), - (StringTag('+E+1.F'), "+E+1.F"), - (StringTag('+E+1.d'), "+E+1.d"), - (StringTag('+E+1.f'), "+E+1.f"), - (StringTag('+E+1D'), "+E+1D"), - (StringTag('+E+1F'), "+E+1F"), - (StringTag('+E+1d'), "+E+1d"), - (StringTag('+E+1f'), "+E+1f"), - (StringTag('+E+D'), "+E+D"), - (StringTag('+E+F'), "+E+F"), - (StringTag('+E+d'), "+E+d"), - (StringTag('+E+f'), "+E+f"), - (StringTag('+E-'), "+E-"), - (StringTag('+E-.'), "+E-."), - (StringTag('+E-.1'), "+E-.1"), - (StringTag('+E-.1D'), "+E-.1D"), - (StringTag('+E-.1F'), "+E-.1F"), - (StringTag('+E-.1d'), "+E-.1d"), - (StringTag('+E-.1f'), "+E-.1f"), - (StringTag('+E-.D'), "+E-.D"), - (StringTag('+E-.F'), "+E-.F"), - (StringTag('+E-.d'), "+E-.d"), - (StringTag('+E-.f'), "+E-.f"), - (StringTag('+E-1'), "+E-1"), - (StringTag('+E-1.'), "+E-1."), - (StringTag('+E-1.1'), "+E-1.1"), - (StringTag('+E-1.1D'), "+E-1.1D"), - (StringTag('+E-1.1F'), "+E-1.1F"), - (StringTag('+E-1.1d'), "+E-1.1d"), - (StringTag('+E-1.1f'), "+E-1.1f"), - (StringTag('+E-1.D'), "+E-1.D"), - (StringTag('+E-1.F'), "+E-1.F"), - (StringTag('+E-1.d'), "+E-1.d"), - (StringTag('+E-1.f'), "+E-1.f"), - (StringTag('+E-1D'), "+E-1D"), - (StringTag('+E-1F'), "+E-1F"), - (StringTag('+E-1d'), "+E-1d"), - (StringTag('+E-1f'), "+E-1f"), - (StringTag('+E-D'), "+E-D"), - (StringTag('+E-F'), "+E-F"), - (StringTag('+E-d'), "+E-d"), - (StringTag('+E-f'), "+E-f"), - (StringTag('+E.'), "+E."), - (StringTag('+E.1'), "+E.1"), - (StringTag('+E.1D'), "+E.1D"), - (StringTag('+E.1F'), "+E.1F"), - (StringTag('+E.1d'), "+E.1d"), - (StringTag('+E.1f'), "+E.1f"), - (StringTag('+E.D'), "+E.D"), - (StringTag('+E.F'), "+E.F"), - (StringTag('+E.d'), "+E.d"), - (StringTag('+E.f'), "+E.f"), - (StringTag('+E1'), "+E1"), - (StringTag('+E1.'), "+E1."), - (StringTag('+E1.1'), "+E1.1"), - (StringTag('+E1.1D'), "+E1.1D"), - (StringTag('+E1.1F'), "+E1.1F"), - (StringTag('+E1.1d'), "+E1.1d"), - (StringTag('+E1.1f'), "+E1.1f"), - (StringTag('+E1.D'), "+E1.D"), - (StringTag('+E1.F'), "+E1.F"), - (StringTag('+E1.d'), "+E1.d"), - (StringTag('+E1.f'), "+E1.f"), - (StringTag('+E1D'), "+E1D"), - (StringTag('+E1F'), "+E1F"), - (StringTag('+E1d'), "+E1d"), - (StringTag('+E1f'), "+E1f"), - (StringTag('+ED'), "+ED"), - (StringTag('+EF'), "+EF"), - (StringTag('+Ed'), "+Ed"), - (StringTag('+Ef'), "+Ef"), - (StringTag('+F'), "+F"), - (StringTag('+d'), "+d"), - (StringTag('+e'), "+e"), - (StringTag('+e+'), "+e+"), - (StringTag('+e+.'), "+e+."), - (StringTag('+e+.1'), "+e+.1"), - (StringTag('+e+.1D'), "+e+.1D"), - (StringTag('+e+.1F'), "+e+.1F"), - (StringTag('+e+.1d'), "+e+.1d"), - (StringTag('+e+.1f'), "+e+.1f"), - (StringTag('+e+.D'), "+e+.D"), - (StringTag('+e+.F'), "+e+.F"), - (StringTag('+e+.d'), "+e+.d"), - (StringTag('+e+.f'), "+e+.f"), - (StringTag('+e+1'), "+e+1"), - (StringTag('+e+1.'), "+e+1."), - (StringTag('+e+1.1'), "+e+1.1"), - (StringTag('+e+1.1D'), "+e+1.1D"), - (StringTag('+e+1.1F'), "+e+1.1F"), - (StringTag('+e+1.1d'), "+e+1.1d"), - (StringTag('+e+1.1f'), "+e+1.1f"), - (StringTag('+e+1.D'), "+e+1.D"), - (StringTag('+e+1.F'), "+e+1.F"), - (StringTag('+e+1.d'), "+e+1.d"), - (StringTag('+e+1.f'), "+e+1.f"), - (StringTag('+e+1D'), "+e+1D"), - (StringTag('+e+1F'), "+e+1F"), - (StringTag('+e+1d'), "+e+1d"), - (StringTag('+e+1f'), "+e+1f"), - (StringTag('+e+D'), "+e+D"), - (StringTag('+e+F'), "+e+F"), - (StringTag('+e+d'), "+e+d"), - (StringTag('+e+f'), "+e+f"), - (StringTag('+e-'), "+e-"), - (StringTag('+e-.'), "+e-."), - (StringTag('+e-.1'), "+e-.1"), - (StringTag('+e-.1D'), "+e-.1D"), - (StringTag('+e-.1F'), "+e-.1F"), - (StringTag('+e-.1d'), "+e-.1d"), - (StringTag('+e-.1f'), "+e-.1f"), - (StringTag('+e-.D'), "+e-.D"), - (StringTag('+e-.F'), "+e-.F"), - (StringTag('+e-.d'), "+e-.d"), - (StringTag('+e-.f'), "+e-.f"), - (StringTag('+e-1'), "+e-1"), - (StringTag('+e-1.'), "+e-1."), - (StringTag('+e-1.1'), "+e-1.1"), - (StringTag('+e-1.1D'), "+e-1.1D"), - (StringTag('+e-1.1F'), "+e-1.1F"), - (StringTag('+e-1.1d'), "+e-1.1d"), - (StringTag('+e-1.1f'), "+e-1.1f"), - (StringTag('+e-1.D'), "+e-1.D"), - (StringTag('+e-1.F'), "+e-1.F"), - (StringTag('+e-1.d'), "+e-1.d"), - (StringTag('+e-1.f'), "+e-1.f"), - (StringTag('+e-1D'), "+e-1D"), - (StringTag('+e-1F'), "+e-1F"), - (StringTag('+e-1d'), "+e-1d"), - (StringTag('+e-1f'), "+e-1f"), - (StringTag('+e-D'), "+e-D"), - (StringTag('+e-F'), "+e-F"), - (StringTag('+e-d'), "+e-d"), - (StringTag('+e-f'), "+e-f"), - (StringTag('+e.'), "+e."), - (StringTag('+e.1'), "+e.1"), - (StringTag('+e.1D'), "+e.1D"), - (StringTag('+e.1F'), "+e.1F"), - (StringTag('+e.1d'), "+e.1d"), - (StringTag('+e.1f'), "+e.1f"), - (StringTag('+e.D'), "+e.D"), - (StringTag('+e.F'), "+e.F"), - (StringTag('+e.d'), "+e.d"), - (StringTag('+e.f'), "+e.f"), - (StringTag('+e1'), "+e1"), - (StringTag('+e1.'), "+e1."), - (StringTag('+e1.1'), "+e1.1"), - (StringTag('+e1.1D'), "+e1.1D"), - (StringTag('+e1.1F'), "+e1.1F"), - (StringTag('+e1.1d'), "+e1.1d"), - (StringTag('+e1.1f'), "+e1.1f"), - (StringTag('+e1.D'), "+e1.D"), - (StringTag('+e1.F'), "+e1.F"), - (StringTag('+e1.d'), "+e1.d"), - (StringTag('+e1.f'), "+e1.f"), - (StringTag('+e1D'), "+e1D"), - (StringTag('+e1F'), "+e1F"), - (StringTag('+e1d'), "+e1d"), - (StringTag('+e1f'), "+e1f"), - (StringTag('+eD'), "+eD"), - (StringTag('+eF'), "+eF"), - (StringTag('+ed'), "+ed"), - (StringTag('+ef'), "+ef"), - (StringTag('+f'), "+f"), - (StringTag('-'), "-"), - (StringTag('-+'), "-+"), - (StringTag('-+.'), "-+."), - (StringTag('-+.1'), "-+.1"), - (StringTag('-+.1D'), "-+.1D"), - (StringTag('-+.1F'), "-+.1F"), - (StringTag('-+.1d'), "-+.1d"), - (StringTag('-+.1f'), "-+.1f"), - (StringTag('-+.D'), "-+.D"), - (StringTag('-+.F'), "-+.F"), - (StringTag('-+.d'), "-+.d"), - (StringTag('-+.f'), "-+.f"), - (StringTag('-+1'), "-+1"), - (StringTag('-+1.'), "-+1."), - (StringTag('-+1.1'), "-+1.1"), - (StringTag('-+1.1D'), "-+1.1D"), - (StringTag('-+1.1F'), "-+1.1F"), - (StringTag('-+1.1d'), "-+1.1d"), - (StringTag('-+1.1f'), "-+1.1f"), - (StringTag('-+1.D'), "-+1.D"), - (StringTag('-+1.F'), "-+1.F"), - (StringTag('-+1.d'), "-+1.d"), - (StringTag('-+1.f'), "-+1.f"), - (StringTag('-+1D'), "-+1D"), - (StringTag('-+1F'), "-+1F"), - (StringTag('-+1d'), "-+1d"), - (StringTag('-+1f'), "-+1f"), - (StringTag('-+D'), "-+D"), - (StringTag('-+F'), "-+F"), - (StringTag('-+d'), "-+d"), - (StringTag('-+f'), "-+f"), - (StringTag('--'), "--"), - (StringTag('--.'), "--."), - (StringTag('--.1'), "--.1"), - (StringTag('--.1D'), "--.1D"), - (StringTag('--.1F'), "--.1F"), - (StringTag('--.1d'), "--.1d"), - (StringTag('--.1f'), "--.1f"), - (StringTag('--.D'), "--.D"), - (StringTag('--.F'), "--.F"), - (StringTag('--.d'), "--.d"), - (StringTag('--.f'), "--.f"), - (StringTag('--1'), "--1"), - (StringTag('--1.'), "--1."), - (StringTag('--1.1'), "--1.1"), - (StringTag('--1.1D'), "--1.1D"), - (StringTag('--1.1F'), "--1.1F"), - (StringTag('--1.1d'), "--1.1d"), - (StringTag('--1.1f'), "--1.1f"), - (StringTag('--1.D'), "--1.D"), - (StringTag('--1.F'), "--1.F"), - (StringTag('--1.d'), "--1.d"), - (StringTag('--1.f'), "--1.f"), - (StringTag('--1D'), "--1D"), - (StringTag('--1F'), "--1F"), - (StringTag('--1d'), "--1d"), - (StringTag('--1f'), "--1f"), - (StringTag('--D'), "--D"), - (StringTag('--F'), "--F"), - (StringTag('--d'), "--d"), - (StringTag('--f'), "--f"), - (StringTag('-.'), "-."), - (StringTag('-.+'), "-.+"), - (StringTag('-.+.'), "-.+."), - (StringTag('-.+.1'), "-.+.1"), - (StringTag('-.+.1D'), "-.+.1D"), - (StringTag('-.+.1F'), "-.+.1F"), - (StringTag('-.+.1d'), "-.+.1d"), - (StringTag('-.+.1f'), "-.+.1f"), - (StringTag('-.+.D'), "-.+.D"), - (StringTag('-.+.F'), "-.+.F"), - (StringTag('-.+.d'), "-.+.d"), - (StringTag('-.+.f'), "-.+.f"), - (StringTag('-.+1'), "-.+1"), - (StringTag('-.+1.'), "-.+1."), - (StringTag('-.+1.1'), "-.+1.1"), - (StringTag('-.+1.1D'), "-.+1.1D"), - (StringTag('-.+1.1F'), "-.+1.1F"), - (StringTag('-.+1.1d'), "-.+1.1d"), - (StringTag('-.+1.1f'), "-.+1.1f"), - (StringTag('-.+1.D'), "-.+1.D"), - (StringTag('-.+1.F'), "-.+1.F"), - (StringTag('-.+1.d'), "-.+1.d"), - (StringTag('-.+1.f'), "-.+1.f"), - (StringTag('-.+1D'), "-.+1D"), - (StringTag('-.+1F'), "-.+1F"), - (StringTag('-.+1d'), "-.+1d"), - (StringTag('-.+1f'), "-.+1f"), - (StringTag('-.+D'), "-.+D"), - (StringTag('-.+F'), "-.+F"), - (StringTag('-.+d'), "-.+d"), - (StringTag('-.+f'), "-.+f"), - (StringTag('-.-'), "-.-"), - (StringTag('-.-.'), "-.-."), - (StringTag('-.-.1'), "-.-.1"), - (StringTag('-.-.1D'), "-.-.1D"), - (StringTag('-.-.1F'), "-.-.1F"), - (StringTag('-.-.1d'), "-.-.1d"), - (StringTag('-.-.1f'), "-.-.1f"), - (StringTag('-.-.D'), "-.-.D"), - (StringTag('-.-.F'), "-.-.F"), - (StringTag('-.-.d'), "-.-.d"), - (StringTag('-.-.f'), "-.-.f"), - (StringTag('-.-1'), "-.-1"), - (StringTag('-.-1.'), "-.-1."), - (StringTag('-.-1.1'), "-.-1.1"), - (StringTag('-.-1.1D'), "-.-1.1D"), - (StringTag('-.-1.1F'), "-.-1.1F"), - (StringTag('-.-1.1d'), "-.-1.1d"), - (StringTag('-.-1.1f'), "-.-1.1f"), - (StringTag('-.-1.D'), "-.-1.D"), - (StringTag('-.-1.F'), "-.-1.F"), - (StringTag('-.-1.d'), "-.-1.d"), - (StringTag('-.-1.f'), "-.-1.f"), - (StringTag('-.-1D'), "-.-1D"), - (StringTag('-.-1F'), "-.-1F"), - (StringTag('-.-1d'), "-.-1d"), - (StringTag('-.-1f'), "-.-1f"), - (StringTag('-.-D'), "-.-D"), - (StringTag('-.-F'), "-.-F"), - (StringTag('-.-d'), "-.-d"), - (StringTag('-.-f'), "-.-f"), - (StringTag('-..'), "-.."), - (StringTag('-..1'), "-..1"), - (StringTag('-..1D'), "-..1D"), - (StringTag('-..1F'), "-..1F"), - (StringTag('-..1d'), "-..1d"), - (StringTag('-..1f'), "-..1f"), - (StringTag('-..D'), "-..D"), - (StringTag('-..F'), "-..F"), - (StringTag('-..d'), "-..d"), - (StringTag('-..f'), "-..f"), + (StringTag("+D"), "+D"), + (StringTag("+E"), "+E"), + (StringTag("+E+"), "+E+"), + (StringTag("+E+."), "+E+."), + (StringTag("+E+.1"), "+E+.1"), + (StringTag("+E+.1D"), "+E+.1D"), + (StringTag("+E+.1F"), "+E+.1F"), + (StringTag("+E+.1d"), "+E+.1d"), + (StringTag("+E+.1f"), "+E+.1f"), + (StringTag("+E+.D"), "+E+.D"), + (StringTag("+E+.F"), "+E+.F"), + (StringTag("+E+.d"), "+E+.d"), + (StringTag("+E+.f"), "+E+.f"), + (StringTag("+E+1"), "+E+1"), + (StringTag("+E+1."), "+E+1."), + (StringTag("+E+1.1"), "+E+1.1"), + (StringTag("+E+1.1D"), "+E+1.1D"), + (StringTag("+E+1.1F"), "+E+1.1F"), + (StringTag("+E+1.1d"), "+E+1.1d"), + (StringTag("+E+1.1f"), "+E+1.1f"), + (StringTag("+E+1.D"), "+E+1.D"), + (StringTag("+E+1.F"), "+E+1.F"), + (StringTag("+E+1.d"), "+E+1.d"), + (StringTag("+E+1.f"), "+E+1.f"), + (StringTag("+E+1D"), "+E+1D"), + (StringTag("+E+1F"), "+E+1F"), + (StringTag("+E+1d"), "+E+1d"), + (StringTag("+E+1f"), "+E+1f"), + (StringTag("+E+D"), "+E+D"), + (StringTag("+E+F"), "+E+F"), + (StringTag("+E+d"), "+E+d"), + (StringTag("+E+f"), "+E+f"), + (StringTag("+E-"), "+E-"), + (StringTag("+E-."), "+E-."), + (StringTag("+E-.1"), "+E-.1"), + (StringTag("+E-.1D"), "+E-.1D"), + (StringTag("+E-.1F"), "+E-.1F"), + (StringTag("+E-.1d"), "+E-.1d"), + (StringTag("+E-.1f"), "+E-.1f"), + (StringTag("+E-.D"), "+E-.D"), + (StringTag("+E-.F"), "+E-.F"), + (StringTag("+E-.d"), "+E-.d"), + (StringTag("+E-.f"), "+E-.f"), + (StringTag("+E-1"), "+E-1"), + (StringTag("+E-1."), "+E-1."), + (StringTag("+E-1.1"), "+E-1.1"), + (StringTag("+E-1.1D"), "+E-1.1D"), + (StringTag("+E-1.1F"), "+E-1.1F"), + (StringTag("+E-1.1d"), "+E-1.1d"), + (StringTag("+E-1.1f"), "+E-1.1f"), + (StringTag("+E-1.D"), "+E-1.D"), + (StringTag("+E-1.F"), "+E-1.F"), + (StringTag("+E-1.d"), "+E-1.d"), + (StringTag("+E-1.f"), "+E-1.f"), + (StringTag("+E-1D"), "+E-1D"), + (StringTag("+E-1F"), "+E-1F"), + (StringTag("+E-1d"), "+E-1d"), + (StringTag("+E-1f"), "+E-1f"), + (StringTag("+E-D"), "+E-D"), + (StringTag("+E-F"), "+E-F"), + (StringTag("+E-d"), "+E-d"), + (StringTag("+E-f"), "+E-f"), + (StringTag("+E."), "+E."), + (StringTag("+E.1"), "+E.1"), + (StringTag("+E.1D"), "+E.1D"), + (StringTag("+E.1F"), "+E.1F"), + (StringTag("+E.1d"), "+E.1d"), + (StringTag("+E.1f"), "+E.1f"), + (StringTag("+E.D"), "+E.D"), + (StringTag("+E.F"), "+E.F"), + (StringTag("+E.d"), "+E.d"), + (StringTag("+E.f"), "+E.f"), + (StringTag("+E1"), "+E1"), + (StringTag("+E1."), "+E1."), + (StringTag("+E1.1"), "+E1.1"), + (StringTag("+E1.1D"), "+E1.1D"), + (StringTag("+E1.1F"), "+E1.1F"), + (StringTag("+E1.1d"), "+E1.1d"), + (StringTag("+E1.1f"), "+E1.1f"), + (StringTag("+E1.D"), "+E1.D"), + (StringTag("+E1.F"), "+E1.F"), + (StringTag("+E1.d"), "+E1.d"), + (StringTag("+E1.f"), "+E1.f"), + (StringTag("+E1D"), "+E1D"), + (StringTag("+E1F"), "+E1F"), + (StringTag("+E1d"), "+E1d"), + (StringTag("+E1f"), "+E1f"), + (StringTag("+ED"), "+ED"), + (StringTag("+EF"), "+EF"), + (StringTag("+Ed"), "+Ed"), + (StringTag("+Ef"), "+Ef"), + (StringTag("+F"), "+F"), + (StringTag("+d"), "+d"), + (StringTag("+e"), "+e"), + (StringTag("+e+"), "+e+"), + (StringTag("+e+."), "+e+."), + (StringTag("+e+.1"), "+e+.1"), + (StringTag("+e+.1D"), "+e+.1D"), + (StringTag("+e+.1F"), "+e+.1F"), + (StringTag("+e+.1d"), "+e+.1d"), + (StringTag("+e+.1f"), "+e+.1f"), + (StringTag("+e+.D"), "+e+.D"), + (StringTag("+e+.F"), "+e+.F"), + (StringTag("+e+.d"), "+e+.d"), + (StringTag("+e+.f"), "+e+.f"), + (StringTag("+e+1"), "+e+1"), + (StringTag("+e+1."), "+e+1."), + (StringTag("+e+1.1"), "+e+1.1"), + (StringTag("+e+1.1D"), "+e+1.1D"), + (StringTag("+e+1.1F"), "+e+1.1F"), + (StringTag("+e+1.1d"), "+e+1.1d"), + (StringTag("+e+1.1f"), "+e+1.1f"), + (StringTag("+e+1.D"), "+e+1.D"), + (StringTag("+e+1.F"), "+e+1.F"), + (StringTag("+e+1.d"), "+e+1.d"), + (StringTag("+e+1.f"), "+e+1.f"), + (StringTag("+e+1D"), "+e+1D"), + (StringTag("+e+1F"), "+e+1F"), + (StringTag("+e+1d"), "+e+1d"), + (StringTag("+e+1f"), "+e+1f"), + (StringTag("+e+D"), "+e+D"), + (StringTag("+e+F"), "+e+F"), + (StringTag("+e+d"), "+e+d"), + (StringTag("+e+f"), "+e+f"), + (StringTag("+e-"), "+e-"), + (StringTag("+e-."), "+e-."), + (StringTag("+e-.1"), "+e-.1"), + (StringTag("+e-.1D"), "+e-.1D"), + (StringTag("+e-.1F"), "+e-.1F"), + (StringTag("+e-.1d"), "+e-.1d"), + (StringTag("+e-.1f"), "+e-.1f"), + (StringTag("+e-.D"), "+e-.D"), + (StringTag("+e-.F"), "+e-.F"), + (StringTag("+e-.d"), "+e-.d"), + (StringTag("+e-.f"), "+e-.f"), + (StringTag("+e-1"), "+e-1"), + (StringTag("+e-1."), "+e-1."), + (StringTag("+e-1.1"), "+e-1.1"), + (StringTag("+e-1.1D"), "+e-1.1D"), + (StringTag("+e-1.1F"), "+e-1.1F"), + (StringTag("+e-1.1d"), "+e-1.1d"), + (StringTag("+e-1.1f"), "+e-1.1f"), + (StringTag("+e-1.D"), "+e-1.D"), + (StringTag("+e-1.F"), "+e-1.F"), + (StringTag("+e-1.d"), "+e-1.d"), + (StringTag("+e-1.f"), "+e-1.f"), + (StringTag("+e-1D"), "+e-1D"), + (StringTag("+e-1F"), "+e-1F"), + (StringTag("+e-1d"), "+e-1d"), + (StringTag("+e-1f"), "+e-1f"), + (StringTag("+e-D"), "+e-D"), + (StringTag("+e-F"), "+e-F"), + (StringTag("+e-d"), "+e-d"), + (StringTag("+e-f"), "+e-f"), + (StringTag("+e."), "+e."), + (StringTag("+e.1"), "+e.1"), + (StringTag("+e.1D"), "+e.1D"), + (StringTag("+e.1F"), "+e.1F"), + (StringTag("+e.1d"), "+e.1d"), + (StringTag("+e.1f"), "+e.1f"), + (StringTag("+e.D"), "+e.D"), + (StringTag("+e.F"), "+e.F"), + (StringTag("+e.d"), "+e.d"), + (StringTag("+e.f"), "+e.f"), + (StringTag("+e1"), "+e1"), + (StringTag("+e1."), "+e1."), + (StringTag("+e1.1"), "+e1.1"), + (StringTag("+e1.1D"), "+e1.1D"), + (StringTag("+e1.1F"), "+e1.1F"), + (StringTag("+e1.1d"), "+e1.1d"), + (StringTag("+e1.1f"), "+e1.1f"), + (StringTag("+e1.D"), "+e1.D"), + (StringTag("+e1.F"), "+e1.F"), + (StringTag("+e1.d"), "+e1.d"), + (StringTag("+e1.f"), "+e1.f"), + (StringTag("+e1D"), "+e1D"), + (StringTag("+e1F"), "+e1F"), + (StringTag("+e1d"), "+e1d"), + (StringTag("+e1f"), "+e1f"), + (StringTag("+eD"), "+eD"), + (StringTag("+eF"), "+eF"), + (StringTag("+ed"), "+ed"), + (StringTag("+ef"), "+ef"), + (StringTag("+f"), "+f"), + (StringTag("-"), "-"), + (StringTag("-+"), "-+"), + (StringTag("-+."), "-+."), + (StringTag("-+.1"), "-+.1"), + (StringTag("-+.1D"), "-+.1D"), + (StringTag("-+.1F"), "-+.1F"), + (StringTag("-+.1d"), "-+.1d"), + (StringTag("-+.1f"), "-+.1f"), + (StringTag("-+.D"), "-+.D"), + (StringTag("-+.F"), "-+.F"), + (StringTag("-+.d"), "-+.d"), + (StringTag("-+.f"), "-+.f"), + (StringTag("-+1"), "-+1"), + (StringTag("-+1."), "-+1."), + (StringTag("-+1.1"), "-+1.1"), + (StringTag("-+1.1D"), "-+1.1D"), + (StringTag("-+1.1F"), "-+1.1F"), + (StringTag("-+1.1d"), "-+1.1d"), + (StringTag("-+1.1f"), "-+1.1f"), + (StringTag("-+1.D"), "-+1.D"), + (StringTag("-+1.F"), "-+1.F"), + (StringTag("-+1.d"), "-+1.d"), + (StringTag("-+1.f"), "-+1.f"), + (StringTag("-+1D"), "-+1D"), + (StringTag("-+1F"), "-+1F"), + (StringTag("-+1d"), "-+1d"), + (StringTag("-+1f"), "-+1f"), + (StringTag("-+D"), "-+D"), + (StringTag("-+F"), "-+F"), + (StringTag("-+d"), "-+d"), + (StringTag("-+f"), "-+f"), + (StringTag("--"), "--"), + (StringTag("--."), "--."), + (StringTag("--.1"), "--.1"), + (StringTag("--.1D"), "--.1D"), + (StringTag("--.1F"), "--.1F"), + (StringTag("--.1d"), "--.1d"), + (StringTag("--.1f"), "--.1f"), + (StringTag("--.D"), "--.D"), + (StringTag("--.F"), "--.F"), + (StringTag("--.d"), "--.d"), + (StringTag("--.f"), "--.f"), + (StringTag("--1"), "--1"), + (StringTag("--1."), "--1."), + (StringTag("--1.1"), "--1.1"), + (StringTag("--1.1D"), "--1.1D"), + (StringTag("--1.1F"), "--1.1F"), + (StringTag("--1.1d"), "--1.1d"), + (StringTag("--1.1f"), "--1.1f"), + (StringTag("--1.D"), "--1.D"), + (StringTag("--1.F"), "--1.F"), + (StringTag("--1.d"), "--1.d"), + (StringTag("--1.f"), "--1.f"), + (StringTag("--1D"), "--1D"), + (StringTag("--1F"), "--1F"), + (StringTag("--1d"), "--1d"), + (StringTag("--1f"), "--1f"), + (StringTag("--D"), "--D"), + (StringTag("--F"), "--F"), + (StringTag("--d"), "--d"), + (StringTag("--f"), "--f"), + (StringTag("-."), "-."), + (StringTag("-.+"), "-.+"), + (StringTag("-.+."), "-.+."), + (StringTag("-.+.1"), "-.+.1"), + (StringTag("-.+.1D"), "-.+.1D"), + (StringTag("-.+.1F"), "-.+.1F"), + (StringTag("-.+.1d"), "-.+.1d"), + (StringTag("-.+.1f"), "-.+.1f"), + (StringTag("-.+.D"), "-.+.D"), + (StringTag("-.+.F"), "-.+.F"), + (StringTag("-.+.d"), "-.+.d"), + (StringTag("-.+.f"), "-.+.f"), + (StringTag("-.+1"), "-.+1"), + (StringTag("-.+1."), "-.+1."), + (StringTag("-.+1.1"), "-.+1.1"), + (StringTag("-.+1.1D"), "-.+1.1D"), + (StringTag("-.+1.1F"), "-.+1.1F"), + (StringTag("-.+1.1d"), "-.+1.1d"), + (StringTag("-.+1.1f"), "-.+1.1f"), + (StringTag("-.+1.D"), "-.+1.D"), + (StringTag("-.+1.F"), "-.+1.F"), + (StringTag("-.+1.d"), "-.+1.d"), + (StringTag("-.+1.f"), "-.+1.f"), + (StringTag("-.+1D"), "-.+1D"), + (StringTag("-.+1F"), "-.+1F"), + (StringTag("-.+1d"), "-.+1d"), + (StringTag("-.+1f"), "-.+1f"), + (StringTag("-.+D"), "-.+D"), + (StringTag("-.+F"), "-.+F"), + (StringTag("-.+d"), "-.+d"), + (StringTag("-.+f"), "-.+f"), + (StringTag("-.-"), "-.-"), + (StringTag("-.-."), "-.-."), + (StringTag("-.-.1"), "-.-.1"), + (StringTag("-.-.1D"), "-.-.1D"), + (StringTag("-.-.1F"), "-.-.1F"), + (StringTag("-.-.1d"), "-.-.1d"), + (StringTag("-.-.1f"), "-.-.1f"), + (StringTag("-.-.D"), "-.-.D"), + (StringTag("-.-.F"), "-.-.F"), + (StringTag("-.-.d"), "-.-.d"), + (StringTag("-.-.f"), "-.-.f"), + (StringTag("-.-1"), "-.-1"), + (StringTag("-.-1."), "-.-1."), + (StringTag("-.-1.1"), "-.-1.1"), + (StringTag("-.-1.1D"), "-.-1.1D"), + (StringTag("-.-1.1F"), "-.-1.1F"), + (StringTag("-.-1.1d"), "-.-1.1d"), + (StringTag("-.-1.1f"), "-.-1.1f"), + (StringTag("-.-1.D"), "-.-1.D"), + (StringTag("-.-1.F"), "-.-1.F"), + (StringTag("-.-1.d"), "-.-1.d"), + (StringTag("-.-1.f"), "-.-1.f"), + (StringTag("-.-1D"), "-.-1D"), + (StringTag("-.-1F"), "-.-1F"), + (StringTag("-.-1d"), "-.-1d"), + (StringTag("-.-1f"), "-.-1f"), + (StringTag("-.-D"), "-.-D"), + (StringTag("-.-F"), "-.-F"), + (StringTag("-.-d"), "-.-d"), + (StringTag("-.-f"), "-.-f"), + (StringTag("-.."), "-.."), + (StringTag("-..1"), "-..1"), + (StringTag("-..1D"), "-..1D"), + (StringTag("-..1F"), "-..1F"), + (StringTag("-..1d"), "-..1d"), + (StringTag("-..1f"), "-..1f"), + (StringTag("-..D"), "-..D"), + (StringTag("-..F"), "-..F"), + (StringTag("-..d"), "-..d"), + (StringTag("-..f"), "-..f"), (DoubleTag(-0.100000), "-.1"), - (StringTag('-.1+'), "-.1+"), - (StringTag('-.1+.'), "-.1+."), - (StringTag('-.1+.1'), "-.1+.1"), - (StringTag('-.1+.1D'), "-.1+.1D"), - (StringTag('-.1+.1F'), "-.1+.1F"), - (StringTag('-.1+.1d'), "-.1+.1d"), - (StringTag('-.1+.1f'), "-.1+.1f"), - (StringTag('-.1+.D'), "-.1+.D"), - (StringTag('-.1+.F'), "-.1+.F"), - (StringTag('-.1+.d'), "-.1+.d"), - (StringTag('-.1+.f'), "-.1+.f"), - (StringTag('-.1+1'), "-.1+1"), - (StringTag('-.1+1.'), "-.1+1."), - (StringTag('-.1+1.1'), "-.1+1.1"), - (StringTag('-.1+1.1D'), "-.1+1.1D"), - (StringTag('-.1+1.1F'), "-.1+1.1F"), - (StringTag('-.1+1.1d'), "-.1+1.1d"), - (StringTag('-.1+1.1f'), "-.1+1.1f"), - (StringTag('-.1+1.D'), "-.1+1.D"), - (StringTag('-.1+1.F'), "-.1+1.F"), - (StringTag('-.1+1.d'), "-.1+1.d"), - (StringTag('-.1+1.f'), "-.1+1.f"), - (StringTag('-.1+1D'), "-.1+1D"), - (StringTag('-.1+1F'), "-.1+1F"), - (StringTag('-.1+1d'), "-.1+1d"), - (StringTag('-.1+1f'), "-.1+1f"), - (StringTag('-.1+D'), "-.1+D"), - (StringTag('-.1+F'), "-.1+F"), - (StringTag('-.1+d'), "-.1+d"), - (StringTag('-.1+f'), "-.1+f"), - (StringTag('-.1-'), "-.1-"), - (StringTag('-.1-.'), "-.1-."), - (StringTag('-.1-.1'), "-.1-.1"), - (StringTag('-.1-.1D'), "-.1-.1D"), - (StringTag('-.1-.1F'), "-.1-.1F"), - (StringTag('-.1-.1d'), "-.1-.1d"), - (StringTag('-.1-.1f'), "-.1-.1f"), - (StringTag('-.1-.D'), "-.1-.D"), - (StringTag('-.1-.F'), "-.1-.F"), - (StringTag('-.1-.d'), "-.1-.d"), - (StringTag('-.1-.f'), "-.1-.f"), - (StringTag('-.1-1'), "-.1-1"), - (StringTag('-.1-1.'), "-.1-1."), - (StringTag('-.1-1.1'), "-.1-1.1"), - (StringTag('-.1-1.1D'), "-.1-1.1D"), - (StringTag('-.1-1.1F'), "-.1-1.1F"), - (StringTag('-.1-1.1d'), "-.1-1.1d"), - (StringTag('-.1-1.1f'), "-.1-1.1f"), - (StringTag('-.1-1.D'), "-.1-1.D"), - (StringTag('-.1-1.F'), "-.1-1.F"), - (StringTag('-.1-1.d'), "-.1-1.d"), - (StringTag('-.1-1.f'), "-.1-1.f"), - (StringTag('-.1-1D'), "-.1-1D"), - (StringTag('-.1-1F'), "-.1-1F"), - (StringTag('-.1-1d'), "-.1-1d"), - (StringTag('-.1-1f'), "-.1-1f"), - (StringTag('-.1-D'), "-.1-D"), - (StringTag('-.1-F'), "-.1-F"), - (StringTag('-.1-d'), "-.1-d"), - (StringTag('-.1-f'), "-.1-f"), - (StringTag('-.1.'), "-.1."), - (StringTag('-.1.1'), "-.1.1"), - (StringTag('-.1.1D'), "-.1.1D"), - (StringTag('-.1.1F'), "-.1.1F"), - (StringTag('-.1.1d'), "-.1.1d"), - (StringTag('-.1.1f'), "-.1.1f"), - (StringTag('-.1.D'), "-.1.D"), - (StringTag('-.1.F'), "-.1.F"), - (StringTag('-.1.d'), "-.1.d"), - (StringTag('-.1.f'), "-.1.f"), + (StringTag("-.1+"), "-.1+"), + (StringTag("-.1+."), "-.1+."), + (StringTag("-.1+.1"), "-.1+.1"), + (StringTag("-.1+.1D"), "-.1+.1D"), + (StringTag("-.1+.1F"), "-.1+.1F"), + (StringTag("-.1+.1d"), "-.1+.1d"), + (StringTag("-.1+.1f"), "-.1+.1f"), + (StringTag("-.1+.D"), "-.1+.D"), + (StringTag("-.1+.F"), "-.1+.F"), + (StringTag("-.1+.d"), "-.1+.d"), + (StringTag("-.1+.f"), "-.1+.f"), + (StringTag("-.1+1"), "-.1+1"), + (StringTag("-.1+1."), "-.1+1."), + (StringTag("-.1+1.1"), "-.1+1.1"), + (StringTag("-.1+1.1D"), "-.1+1.1D"), + (StringTag("-.1+1.1F"), "-.1+1.1F"), + (StringTag("-.1+1.1d"), "-.1+1.1d"), + (StringTag("-.1+1.1f"), "-.1+1.1f"), + (StringTag("-.1+1.D"), "-.1+1.D"), + (StringTag("-.1+1.F"), "-.1+1.F"), + (StringTag("-.1+1.d"), "-.1+1.d"), + (StringTag("-.1+1.f"), "-.1+1.f"), + (StringTag("-.1+1D"), "-.1+1D"), + (StringTag("-.1+1F"), "-.1+1F"), + (StringTag("-.1+1d"), "-.1+1d"), + (StringTag("-.1+1f"), "-.1+1f"), + (StringTag("-.1+D"), "-.1+D"), + (StringTag("-.1+F"), "-.1+F"), + (StringTag("-.1+d"), "-.1+d"), + (StringTag("-.1+f"), "-.1+f"), + (StringTag("-.1-"), "-.1-"), + (StringTag("-.1-."), "-.1-."), + (StringTag("-.1-.1"), "-.1-.1"), + (StringTag("-.1-.1D"), "-.1-.1D"), + (StringTag("-.1-.1F"), "-.1-.1F"), + (StringTag("-.1-.1d"), "-.1-.1d"), + (StringTag("-.1-.1f"), "-.1-.1f"), + (StringTag("-.1-.D"), "-.1-.D"), + (StringTag("-.1-.F"), "-.1-.F"), + (StringTag("-.1-.d"), "-.1-.d"), + (StringTag("-.1-.f"), "-.1-.f"), + (StringTag("-.1-1"), "-.1-1"), + (StringTag("-.1-1."), "-.1-1."), + (StringTag("-.1-1.1"), "-.1-1.1"), + (StringTag("-.1-1.1D"), "-.1-1.1D"), + (StringTag("-.1-1.1F"), "-.1-1.1F"), + (StringTag("-.1-1.1d"), "-.1-1.1d"), + (StringTag("-.1-1.1f"), "-.1-1.1f"), + (StringTag("-.1-1.D"), "-.1-1.D"), + (StringTag("-.1-1.F"), "-.1-1.F"), + (StringTag("-.1-1.d"), "-.1-1.d"), + (StringTag("-.1-1.f"), "-.1-1.f"), + (StringTag("-.1-1D"), "-.1-1D"), + (StringTag("-.1-1F"), "-.1-1F"), + (StringTag("-.1-1d"), "-.1-1d"), + (StringTag("-.1-1f"), "-.1-1f"), + (StringTag("-.1-D"), "-.1-D"), + (StringTag("-.1-F"), "-.1-F"), + (StringTag("-.1-d"), "-.1-d"), + (StringTag("-.1-f"), "-.1-f"), + (StringTag("-.1."), "-.1."), + (StringTag("-.1.1"), "-.1.1"), + (StringTag("-.1.1D"), "-.1.1D"), + (StringTag("-.1.1F"), "-.1.1F"), + (StringTag("-.1.1d"), "-.1.1d"), + (StringTag("-.1.1f"), "-.1.1f"), + (StringTag("-.1.D"), "-.1.D"), + (StringTag("-.1.F"), "-.1.F"), + (StringTag("-.1.d"), "-.1.d"), + (StringTag("-.1.f"), "-.1.f"), (DoubleTag(-0.110000), "-.11"), - (StringTag('-.11.'), "-.11."), - (StringTag('-.11.1'), "-.11.1"), - (StringTag('-.11.1D'), "-.11.1D"), - (StringTag('-.11.1F'), "-.11.1F"), - (StringTag('-.11.1d'), "-.11.1d"), - (StringTag('-.11.1f'), "-.11.1f"), - (StringTag('-.11.D'), "-.11.D"), - (StringTag('-.11.F'), "-.11.F"), - (StringTag('-.11.d'), "-.11.d"), - (StringTag('-.11.f'), "-.11.f"), + (StringTag("-.11."), "-.11."), + (StringTag("-.11.1"), "-.11.1"), + (StringTag("-.11.1D"), "-.11.1D"), + (StringTag("-.11.1F"), "-.11.1F"), + (StringTag("-.11.1d"), "-.11.1d"), + (StringTag("-.11.1f"), "-.11.1f"), + (StringTag("-.11.D"), "-.11.D"), + (StringTag("-.11.F"), "-.11.F"), + (StringTag("-.11.d"), "-.11.d"), + (StringTag("-.11.f"), "-.11.f"), (DoubleTag(-0.110000), "-.11D"), (FloatTag(-0.110000), "-.11F"), (DoubleTag(-0.110000), "-.11d"), (FloatTag(-0.110000), "-.11f"), (DoubleTag(-0.100000), "-.1D"), - (StringTag('-.1E'), "-.1E"), - (StringTag('-.1E+'), "-.1E+"), - (StringTag('-.1E+.'), "-.1E+."), - (StringTag('-.1E+.1'), "-.1E+.1"), - (StringTag('-.1E+.1D'), "-.1E+.1D"), - (StringTag('-.1E+.1F'), "-.1E+.1F"), - (StringTag('-.1E+.1d'), "-.1E+.1d"), - (StringTag('-.1E+.1f'), "-.1E+.1f"), - (StringTag('-.1E+.D'), "-.1E+.D"), - (StringTag('-.1E+.F'), "-.1E+.F"), - (StringTag('-.1E+.d'), "-.1E+.d"), - (StringTag('-.1E+.f'), "-.1E+.f"), + (StringTag("-.1E"), "-.1E"), + (StringTag("-.1E+"), "-.1E+"), + (StringTag("-.1E+."), "-.1E+."), + (StringTag("-.1E+.1"), "-.1E+.1"), + (StringTag("-.1E+.1D"), "-.1E+.1D"), + (StringTag("-.1E+.1F"), "-.1E+.1F"), + (StringTag("-.1E+.1d"), "-.1E+.1d"), + (StringTag("-.1E+.1f"), "-.1E+.1f"), + (StringTag("-.1E+.D"), "-.1E+.D"), + (StringTag("-.1E+.F"), "-.1E+.F"), + (StringTag("-.1E+.d"), "-.1E+.d"), + (StringTag("-.1E+.f"), "-.1E+.f"), (DoubleTag(-1.000000), "-.1E+1"), - (StringTag('-.1E+1.'), "-.1E+1."), - (StringTag('-.1E+1.1'), "-.1E+1.1"), - (StringTag('-.1E+1.1D'), "-.1E+1.1D"), - (StringTag('-.1E+1.1F'), "-.1E+1.1F"), - (StringTag('-.1E+1.1d'), "-.1E+1.1d"), - (StringTag('-.1E+1.1f'), "-.1E+1.1f"), - (StringTag('-.1E+1.D'), "-.1E+1.D"), - (StringTag('-.1E+1.F'), "-.1E+1.F"), - (StringTag('-.1E+1.d'), "-.1E+1.d"), - (StringTag('-.1E+1.f'), "-.1E+1.f"), + (StringTag("-.1E+1."), "-.1E+1."), + (StringTag("-.1E+1.1"), "-.1E+1.1"), + (StringTag("-.1E+1.1D"), "-.1E+1.1D"), + (StringTag("-.1E+1.1F"), "-.1E+1.1F"), + (StringTag("-.1E+1.1d"), "-.1E+1.1d"), + (StringTag("-.1E+1.1f"), "-.1E+1.1f"), + (StringTag("-.1E+1.D"), "-.1E+1.D"), + (StringTag("-.1E+1.F"), "-.1E+1.F"), + (StringTag("-.1E+1.d"), "-.1E+1.d"), + (StringTag("-.1E+1.f"), "-.1E+1.f"), (DoubleTag(-1.000000), "-.1E+1D"), (FloatTag(-1.000000), "-.1E+1F"), (DoubleTag(-1.000000), "-.1E+1d"), (FloatTag(-1.000000), "-.1E+1f"), - (StringTag('-.1E+D'), "-.1E+D"), - (StringTag('-.1E+F'), "-.1E+F"), - (StringTag('-.1E+d'), "-.1E+d"), - (StringTag('-.1E+f'), "-.1E+f"), - (StringTag('-.1E-'), "-.1E-"), - (StringTag('-.1E-.'), "-.1E-."), - (StringTag('-.1E-.1'), "-.1E-.1"), - (StringTag('-.1E-.1D'), "-.1E-.1D"), - (StringTag('-.1E-.1F'), "-.1E-.1F"), - (StringTag('-.1E-.1d'), "-.1E-.1d"), - (StringTag('-.1E-.1f'), "-.1E-.1f"), - (StringTag('-.1E-.D'), "-.1E-.D"), - (StringTag('-.1E-.F'), "-.1E-.F"), - (StringTag('-.1E-.d'), "-.1E-.d"), - (StringTag('-.1E-.f'), "-.1E-.f"), + (StringTag("-.1E+D"), "-.1E+D"), + (StringTag("-.1E+F"), "-.1E+F"), + (StringTag("-.1E+d"), "-.1E+d"), + (StringTag("-.1E+f"), "-.1E+f"), + (StringTag("-.1E-"), "-.1E-"), + (StringTag("-.1E-."), "-.1E-."), + (StringTag("-.1E-.1"), "-.1E-.1"), + (StringTag("-.1E-.1D"), "-.1E-.1D"), + (StringTag("-.1E-.1F"), "-.1E-.1F"), + (StringTag("-.1E-.1d"), "-.1E-.1d"), + (StringTag("-.1E-.1f"), "-.1E-.1f"), + (StringTag("-.1E-.D"), "-.1E-.D"), + (StringTag("-.1E-.F"), "-.1E-.F"), + (StringTag("-.1E-.d"), "-.1E-.d"), + (StringTag("-.1E-.f"), "-.1E-.f"), (DoubleTag(-0.010000), "-.1E-1"), - (StringTag('-.1E-1.'), "-.1E-1."), - (StringTag('-.1E-1.1'), "-.1E-1.1"), - (StringTag('-.1E-1.1D'), "-.1E-1.1D"), - (StringTag('-.1E-1.1F'), "-.1E-1.1F"), - (StringTag('-.1E-1.1d'), "-.1E-1.1d"), - (StringTag('-.1E-1.1f'), "-.1E-1.1f"), - (StringTag('-.1E-1.D'), "-.1E-1.D"), - (StringTag('-.1E-1.F'), "-.1E-1.F"), - (StringTag('-.1E-1.d'), "-.1E-1.d"), - (StringTag('-.1E-1.f'), "-.1E-1.f"), + (StringTag("-.1E-1."), "-.1E-1."), + (StringTag("-.1E-1.1"), "-.1E-1.1"), + (StringTag("-.1E-1.1D"), "-.1E-1.1D"), + (StringTag("-.1E-1.1F"), "-.1E-1.1F"), + (StringTag("-.1E-1.1d"), "-.1E-1.1d"), + (StringTag("-.1E-1.1f"), "-.1E-1.1f"), + (StringTag("-.1E-1.D"), "-.1E-1.D"), + (StringTag("-.1E-1.F"), "-.1E-1.F"), + (StringTag("-.1E-1.d"), "-.1E-1.d"), + (StringTag("-.1E-1.f"), "-.1E-1.f"), (DoubleTag(-0.010000), "-.1E-1D"), (FloatTag(-0.010000), "-.1E-1F"), (DoubleTag(-0.010000), "-.1E-1d"), (FloatTag(-0.010000), "-.1E-1f"), - (StringTag('-.1E-D'), "-.1E-D"), - (StringTag('-.1E-F'), "-.1E-F"), - (StringTag('-.1E-d'), "-.1E-d"), - (StringTag('-.1E-f'), "-.1E-f"), - (StringTag('-.1E.'), "-.1E."), - (StringTag('-.1E.1'), "-.1E.1"), - (StringTag('-.1E.1D'), "-.1E.1D"), - (StringTag('-.1E.1F'), "-.1E.1F"), - (StringTag('-.1E.1d'), "-.1E.1d"), - (StringTag('-.1E.1f'), "-.1E.1f"), - (StringTag('-.1E.D'), "-.1E.D"), - (StringTag('-.1E.F'), "-.1E.F"), - (StringTag('-.1E.d'), "-.1E.d"), - (StringTag('-.1E.f'), "-.1E.f"), + (StringTag("-.1E-D"), "-.1E-D"), + (StringTag("-.1E-F"), "-.1E-F"), + (StringTag("-.1E-d"), "-.1E-d"), + (StringTag("-.1E-f"), "-.1E-f"), + (StringTag("-.1E."), "-.1E."), + (StringTag("-.1E.1"), "-.1E.1"), + (StringTag("-.1E.1D"), "-.1E.1D"), + (StringTag("-.1E.1F"), "-.1E.1F"), + (StringTag("-.1E.1d"), "-.1E.1d"), + (StringTag("-.1E.1f"), "-.1E.1f"), + (StringTag("-.1E.D"), "-.1E.D"), + (StringTag("-.1E.F"), "-.1E.F"), + (StringTag("-.1E.d"), "-.1E.d"), + (StringTag("-.1E.f"), "-.1E.f"), (DoubleTag(-1.000000), "-.1E1"), - (StringTag('-.1E1.'), "-.1E1."), - (StringTag('-.1E1.1'), "-.1E1.1"), - (StringTag('-.1E1.1D'), "-.1E1.1D"), - (StringTag('-.1E1.1F'), "-.1E1.1F"), - (StringTag('-.1E1.1d'), "-.1E1.1d"), - (StringTag('-.1E1.1f'), "-.1E1.1f"), - (StringTag('-.1E1.D'), "-.1E1.D"), - (StringTag('-.1E1.F'), "-.1E1.F"), - (StringTag('-.1E1.d'), "-.1E1.d"), - (StringTag('-.1E1.f'), "-.1E1.f"), + (StringTag("-.1E1."), "-.1E1."), + (StringTag("-.1E1.1"), "-.1E1.1"), + (StringTag("-.1E1.1D"), "-.1E1.1D"), + (StringTag("-.1E1.1F"), "-.1E1.1F"), + (StringTag("-.1E1.1d"), "-.1E1.1d"), + (StringTag("-.1E1.1f"), "-.1E1.1f"), + (StringTag("-.1E1.D"), "-.1E1.D"), + (StringTag("-.1E1.F"), "-.1E1.F"), + (StringTag("-.1E1.d"), "-.1E1.d"), + (StringTag("-.1E1.f"), "-.1E1.f"), (DoubleTag(-1.000000), "-.1E1D"), (FloatTag(-1.000000), "-.1E1F"), (DoubleTag(-1.000000), "-.1E1d"), (FloatTag(-1.000000), "-.1E1f"), - (StringTag('-.1ED'), "-.1ED"), - (StringTag('-.1EF'), "-.1EF"), - (StringTag('-.1Ed'), "-.1Ed"), - (StringTag('-.1Ef'), "-.1Ef"), + (StringTag("-.1ED"), "-.1ED"), + (StringTag("-.1EF"), "-.1EF"), + (StringTag("-.1Ed"), "-.1Ed"), + (StringTag("-.1Ef"), "-.1Ef"), (FloatTag(-0.100000), "-.1F"), (DoubleTag(-0.100000), "-.1d"), - (StringTag('-.1e'), "-.1e"), - (StringTag('-.1e+'), "-.1e+"), - (StringTag('-.1e+.'), "-.1e+."), - (StringTag('-.1e+.1'), "-.1e+.1"), - (StringTag('-.1e+.1D'), "-.1e+.1D"), - (StringTag('-.1e+.1F'), "-.1e+.1F"), - (StringTag('-.1e+.1d'), "-.1e+.1d"), - (StringTag('-.1e+.1f'), "-.1e+.1f"), - (StringTag('-.1e+.D'), "-.1e+.D"), - (StringTag('-.1e+.F'), "-.1e+.F"), - (StringTag('-.1e+.d'), "-.1e+.d"), - (StringTag('-.1e+.f'), "-.1e+.f"), + (StringTag("-.1e"), "-.1e"), + (StringTag("-.1e+"), "-.1e+"), + (StringTag("-.1e+."), "-.1e+."), + (StringTag("-.1e+.1"), "-.1e+.1"), + (StringTag("-.1e+.1D"), "-.1e+.1D"), + (StringTag("-.1e+.1F"), "-.1e+.1F"), + (StringTag("-.1e+.1d"), "-.1e+.1d"), + (StringTag("-.1e+.1f"), "-.1e+.1f"), + (StringTag("-.1e+.D"), "-.1e+.D"), + (StringTag("-.1e+.F"), "-.1e+.F"), + (StringTag("-.1e+.d"), "-.1e+.d"), + (StringTag("-.1e+.f"), "-.1e+.f"), (DoubleTag(-1.000000), "-.1e+1"), - (StringTag('-.1e+1.'), "-.1e+1."), - (StringTag('-.1e+1.1'), "-.1e+1.1"), - (StringTag('-.1e+1.1D'), "-.1e+1.1D"), - (StringTag('-.1e+1.1F'), "-.1e+1.1F"), - (StringTag('-.1e+1.1d'), "-.1e+1.1d"), - (StringTag('-.1e+1.1f'), "-.1e+1.1f"), - (StringTag('-.1e+1.D'), "-.1e+1.D"), - (StringTag('-.1e+1.F'), "-.1e+1.F"), - (StringTag('-.1e+1.d'), "-.1e+1.d"), - (StringTag('-.1e+1.f'), "-.1e+1.f"), + (StringTag("-.1e+1."), "-.1e+1."), + (StringTag("-.1e+1.1"), "-.1e+1.1"), + (StringTag("-.1e+1.1D"), "-.1e+1.1D"), + (StringTag("-.1e+1.1F"), "-.1e+1.1F"), + (StringTag("-.1e+1.1d"), "-.1e+1.1d"), + (StringTag("-.1e+1.1f"), "-.1e+1.1f"), + (StringTag("-.1e+1.D"), "-.1e+1.D"), + (StringTag("-.1e+1.F"), "-.1e+1.F"), + (StringTag("-.1e+1.d"), "-.1e+1.d"), + (StringTag("-.1e+1.f"), "-.1e+1.f"), (DoubleTag(-1.000000), "-.1e+1D"), (FloatTag(-1.000000), "-.1e+1F"), (DoubleTag(-1.000000), "-.1e+1d"), (FloatTag(-1.000000), "-.1e+1f"), - (StringTag('-.1e+D'), "-.1e+D"), - (StringTag('-.1e+F'), "-.1e+F"), - (StringTag('-.1e+d'), "-.1e+d"), - (StringTag('-.1e+f'), "-.1e+f"), - (StringTag('-.1e-'), "-.1e-"), - (StringTag('-.1e-.'), "-.1e-."), - (StringTag('-.1e-.1'), "-.1e-.1"), - (StringTag('-.1e-.1D'), "-.1e-.1D"), - (StringTag('-.1e-.1F'), "-.1e-.1F"), - (StringTag('-.1e-.1d'), "-.1e-.1d"), - (StringTag('-.1e-.1f'), "-.1e-.1f"), - (StringTag('-.1e-.D'), "-.1e-.D"), - (StringTag('-.1e-.F'), "-.1e-.F"), - (StringTag('-.1e-.d'), "-.1e-.d"), - (StringTag('-.1e-.f'), "-.1e-.f"), + (StringTag("-.1e+D"), "-.1e+D"), + (StringTag("-.1e+F"), "-.1e+F"), + (StringTag("-.1e+d"), "-.1e+d"), + (StringTag("-.1e+f"), "-.1e+f"), + (StringTag("-.1e-"), "-.1e-"), + (StringTag("-.1e-."), "-.1e-."), + (StringTag("-.1e-.1"), "-.1e-.1"), + (StringTag("-.1e-.1D"), "-.1e-.1D"), + (StringTag("-.1e-.1F"), "-.1e-.1F"), + (StringTag("-.1e-.1d"), "-.1e-.1d"), + (StringTag("-.1e-.1f"), "-.1e-.1f"), + (StringTag("-.1e-.D"), "-.1e-.D"), + (StringTag("-.1e-.F"), "-.1e-.F"), + (StringTag("-.1e-.d"), "-.1e-.d"), + (StringTag("-.1e-.f"), "-.1e-.f"), (DoubleTag(-0.010000), "-.1e-1"), - (StringTag('-.1e-1.'), "-.1e-1."), - (StringTag('-.1e-1.1'), "-.1e-1.1"), - (StringTag('-.1e-1.1D'), "-.1e-1.1D"), - (StringTag('-.1e-1.1F'), "-.1e-1.1F"), - (StringTag('-.1e-1.1d'), "-.1e-1.1d"), - (StringTag('-.1e-1.1f'), "-.1e-1.1f"), - (StringTag('-.1e-1.D'), "-.1e-1.D"), - (StringTag('-.1e-1.F'), "-.1e-1.F"), - (StringTag('-.1e-1.d'), "-.1e-1.d"), - (StringTag('-.1e-1.f'), "-.1e-1.f"), + (StringTag("-.1e-1."), "-.1e-1."), + (StringTag("-.1e-1.1"), "-.1e-1.1"), + (StringTag("-.1e-1.1D"), "-.1e-1.1D"), + (StringTag("-.1e-1.1F"), "-.1e-1.1F"), + (StringTag("-.1e-1.1d"), "-.1e-1.1d"), + (StringTag("-.1e-1.1f"), "-.1e-1.1f"), + (StringTag("-.1e-1.D"), "-.1e-1.D"), + (StringTag("-.1e-1.F"), "-.1e-1.F"), + (StringTag("-.1e-1.d"), "-.1e-1.d"), + (StringTag("-.1e-1.f"), "-.1e-1.f"), (DoubleTag(-0.010000), "-.1e-1D"), (FloatTag(-0.010000), "-.1e-1F"), (DoubleTag(-0.010000), "-.1e-1d"), (FloatTag(-0.010000), "-.1e-1f"), - (StringTag('-.1e-D'), "-.1e-D"), - (StringTag('-.1e-F'), "-.1e-F"), - (StringTag('-.1e-d'), "-.1e-d"), - (StringTag('-.1e-f'), "-.1e-f"), - (StringTag('-.1e.'), "-.1e."), - (StringTag('-.1e.1'), "-.1e.1"), - (StringTag('-.1e.1D'), "-.1e.1D"), - (StringTag('-.1e.1F'), "-.1e.1F"), - (StringTag('-.1e.1d'), "-.1e.1d"), - (StringTag('-.1e.1f'), "-.1e.1f"), - (StringTag('-.1e.D'), "-.1e.D"), - (StringTag('-.1e.F'), "-.1e.F"), - (StringTag('-.1e.d'), "-.1e.d"), - (StringTag('-.1e.f'), "-.1e.f"), + (StringTag("-.1e-D"), "-.1e-D"), + (StringTag("-.1e-F"), "-.1e-F"), + (StringTag("-.1e-d"), "-.1e-d"), + (StringTag("-.1e-f"), "-.1e-f"), + (StringTag("-.1e."), "-.1e."), + (StringTag("-.1e.1"), "-.1e.1"), + (StringTag("-.1e.1D"), "-.1e.1D"), + (StringTag("-.1e.1F"), "-.1e.1F"), + (StringTag("-.1e.1d"), "-.1e.1d"), + (StringTag("-.1e.1f"), "-.1e.1f"), + (StringTag("-.1e.D"), "-.1e.D"), + (StringTag("-.1e.F"), "-.1e.F"), + (StringTag("-.1e.d"), "-.1e.d"), + (StringTag("-.1e.f"), "-.1e.f"), (DoubleTag(-1.000000), "-.1e1"), - (StringTag('-.1e1.'), "-.1e1."), - (StringTag('-.1e1.1'), "-.1e1.1"), - (StringTag('-.1e1.1D'), "-.1e1.1D"), - (StringTag('-.1e1.1F'), "-.1e1.1F"), - (StringTag('-.1e1.1d'), "-.1e1.1d"), - (StringTag('-.1e1.1f'), "-.1e1.1f"), - (StringTag('-.1e1.D'), "-.1e1.D"), - (StringTag('-.1e1.F'), "-.1e1.F"), - (StringTag('-.1e1.d'), "-.1e1.d"), - (StringTag('-.1e1.f'), "-.1e1.f"), + (StringTag("-.1e1."), "-.1e1."), + (StringTag("-.1e1.1"), "-.1e1.1"), + (StringTag("-.1e1.1D"), "-.1e1.1D"), + (StringTag("-.1e1.1F"), "-.1e1.1F"), + (StringTag("-.1e1.1d"), "-.1e1.1d"), + (StringTag("-.1e1.1f"), "-.1e1.1f"), + (StringTag("-.1e1.D"), "-.1e1.D"), + (StringTag("-.1e1.F"), "-.1e1.F"), + (StringTag("-.1e1.d"), "-.1e1.d"), + (StringTag("-.1e1.f"), "-.1e1.f"), (DoubleTag(-1.000000), "-.1e1D"), (FloatTag(-1.000000), "-.1e1F"), (DoubleTag(-1.000000), "-.1e1d"), (FloatTag(-1.000000), "-.1e1f"), - (StringTag('-.1eD'), "-.1eD"), - (StringTag('-.1eF'), "-.1eF"), - (StringTag('-.1ed'), "-.1ed"), - (StringTag('-.1ef'), "-.1ef"), + (StringTag("-.1eD"), "-.1eD"), + (StringTag("-.1eF"), "-.1eF"), + (StringTag("-.1ed"), "-.1ed"), + (StringTag("-.1ef"), "-.1ef"), (FloatTag(-0.100000), "-.1f"), - (StringTag('-.D'), "-.D"), - (StringTag('-.E'), "-.E"), - (StringTag('-.E+'), "-.E+"), - (StringTag('-.E+.'), "-.E+."), - (StringTag('-.E+.1'), "-.E+.1"), - (StringTag('-.E+.1D'), "-.E+.1D"), - (StringTag('-.E+.1F'), "-.E+.1F"), - (StringTag('-.E+.1d'), "-.E+.1d"), - (StringTag('-.E+.1f'), "-.E+.1f"), - (StringTag('-.E+.D'), "-.E+.D"), - (StringTag('-.E+.F'), "-.E+.F"), - (StringTag('-.E+.d'), "-.E+.d"), - (StringTag('-.E+.f'), "-.E+.f"), - (StringTag('-.E+1'), "-.E+1"), - (StringTag('-.E+1.'), "-.E+1."), - (StringTag('-.E+1.1'), "-.E+1.1"), - (StringTag('-.E+1.1D'), "-.E+1.1D"), - (StringTag('-.E+1.1F'), "-.E+1.1F"), - (StringTag('-.E+1.1d'), "-.E+1.1d"), - (StringTag('-.E+1.1f'), "-.E+1.1f"), - (StringTag('-.E+1.D'), "-.E+1.D"), - (StringTag('-.E+1.F'), "-.E+1.F"), - (StringTag('-.E+1.d'), "-.E+1.d"), - (StringTag('-.E+1.f'), "-.E+1.f"), - (StringTag('-.E+1D'), "-.E+1D"), - (StringTag('-.E+1F'), "-.E+1F"), - (StringTag('-.E+1d'), "-.E+1d"), - (StringTag('-.E+1f'), "-.E+1f"), - (StringTag('-.E+D'), "-.E+D"), - (StringTag('-.E+F'), "-.E+F"), - (StringTag('-.E+d'), "-.E+d"), - (StringTag('-.E+f'), "-.E+f"), - (StringTag('-.E-'), "-.E-"), - (StringTag('-.E-.'), "-.E-."), - (StringTag('-.E-.1'), "-.E-.1"), - (StringTag('-.E-.1D'), "-.E-.1D"), - (StringTag('-.E-.1F'), "-.E-.1F"), - (StringTag('-.E-.1d'), "-.E-.1d"), - (StringTag('-.E-.1f'), "-.E-.1f"), - (StringTag('-.E-.D'), "-.E-.D"), - (StringTag('-.E-.F'), "-.E-.F"), - (StringTag('-.E-.d'), "-.E-.d"), - (StringTag('-.E-.f'), "-.E-.f"), - (StringTag('-.E-1'), "-.E-1"), - (StringTag('-.E-1.'), "-.E-1."), - (StringTag('-.E-1.1'), "-.E-1.1"), - (StringTag('-.E-1.1D'), "-.E-1.1D"), - (StringTag('-.E-1.1F'), "-.E-1.1F"), - (StringTag('-.E-1.1d'), "-.E-1.1d"), - (StringTag('-.E-1.1f'), "-.E-1.1f"), - (StringTag('-.E-1.D'), "-.E-1.D"), - (StringTag('-.E-1.F'), "-.E-1.F"), - (StringTag('-.E-1.d'), "-.E-1.d"), - (StringTag('-.E-1.f'), "-.E-1.f"), - (StringTag('-.E-1D'), "-.E-1D"), - (StringTag('-.E-1F'), "-.E-1F"), - (StringTag('-.E-1d'), "-.E-1d"), - (StringTag('-.E-1f'), "-.E-1f"), - (StringTag('-.E-D'), "-.E-D"), - (StringTag('-.E-F'), "-.E-F"), - (StringTag('-.E-d'), "-.E-d"), - (StringTag('-.E-f'), "-.E-f"), - (StringTag('-.E.'), "-.E."), - (StringTag('-.E.1'), "-.E.1"), - (StringTag('-.E.1D'), "-.E.1D"), - (StringTag('-.E.1F'), "-.E.1F"), - (StringTag('-.E.1d'), "-.E.1d"), - (StringTag('-.E.1f'), "-.E.1f"), - (StringTag('-.E.D'), "-.E.D"), - (StringTag('-.E.F'), "-.E.F"), - (StringTag('-.E.d'), "-.E.d"), - (StringTag('-.E.f'), "-.E.f"), - (StringTag('-.E1'), "-.E1"), - (StringTag('-.E1.'), "-.E1."), - (StringTag('-.E1.1'), "-.E1.1"), - (StringTag('-.E1.1D'), "-.E1.1D"), - (StringTag('-.E1.1F'), "-.E1.1F"), - (StringTag('-.E1.1d'), "-.E1.1d"), - (StringTag('-.E1.1f'), "-.E1.1f"), - (StringTag('-.E1.D'), "-.E1.D"), - (StringTag('-.E1.F'), "-.E1.F"), - (StringTag('-.E1.d'), "-.E1.d"), - (StringTag('-.E1.f'), "-.E1.f"), - (StringTag('-.E1D'), "-.E1D"), - (StringTag('-.E1F'), "-.E1F"), - (StringTag('-.E1d'), "-.E1d"), - (StringTag('-.E1f'), "-.E1f"), - (StringTag('-.ED'), "-.ED"), - (StringTag('-.EF'), "-.EF"), - (StringTag('-.Ed'), "-.Ed"), - (StringTag('-.Ef'), "-.Ef"), - (StringTag('-.F'), "-.F"), - (StringTag('-.d'), "-.d"), - (StringTag('-.e'), "-.e"), - (StringTag('-.e+'), "-.e+"), - (StringTag('-.e+.'), "-.e+."), - (StringTag('-.e+.1'), "-.e+.1"), - (StringTag('-.e+.1D'), "-.e+.1D"), - (StringTag('-.e+.1F'), "-.e+.1F"), - (StringTag('-.e+.1d'), "-.e+.1d"), - (StringTag('-.e+.1f'), "-.e+.1f"), - (StringTag('-.e+.D'), "-.e+.D"), - (StringTag('-.e+.F'), "-.e+.F"), - (StringTag('-.e+.d'), "-.e+.d"), - (StringTag('-.e+.f'), "-.e+.f"), - (StringTag('-.e+1'), "-.e+1"), - (StringTag('-.e+1.'), "-.e+1."), - (StringTag('-.e+1.1'), "-.e+1.1"), - (StringTag('-.e+1.1D'), "-.e+1.1D"), - (StringTag('-.e+1.1F'), "-.e+1.1F"), - (StringTag('-.e+1.1d'), "-.e+1.1d"), - (StringTag('-.e+1.1f'), "-.e+1.1f"), - (StringTag('-.e+1.D'), "-.e+1.D"), - (StringTag('-.e+1.F'), "-.e+1.F"), - (StringTag('-.e+1.d'), "-.e+1.d"), - (StringTag('-.e+1.f'), "-.e+1.f"), - (StringTag('-.e+1D'), "-.e+1D"), - (StringTag('-.e+1F'), "-.e+1F"), - (StringTag('-.e+1d'), "-.e+1d"), - (StringTag('-.e+1f'), "-.e+1f"), - (StringTag('-.e+D'), "-.e+D"), - (StringTag('-.e+F'), "-.e+F"), - (StringTag('-.e+d'), "-.e+d"), - (StringTag('-.e+f'), "-.e+f"), - (StringTag('-.e-'), "-.e-"), - (StringTag('-.e-.'), "-.e-."), - (StringTag('-.e-.1'), "-.e-.1"), - (StringTag('-.e-.1D'), "-.e-.1D"), - (StringTag('-.e-.1F'), "-.e-.1F"), - (StringTag('-.e-.1d'), "-.e-.1d"), - (StringTag('-.e-.1f'), "-.e-.1f"), - (StringTag('-.e-.D'), "-.e-.D"), - (StringTag('-.e-.F'), "-.e-.F"), - (StringTag('-.e-.d'), "-.e-.d"), - (StringTag('-.e-.f'), "-.e-.f"), - (StringTag('-.e-1'), "-.e-1"), - (StringTag('-.e-1.'), "-.e-1."), - (StringTag('-.e-1.1'), "-.e-1.1"), - (StringTag('-.e-1.1D'), "-.e-1.1D"), - (StringTag('-.e-1.1F'), "-.e-1.1F"), - (StringTag('-.e-1.1d'), "-.e-1.1d"), - (StringTag('-.e-1.1f'), "-.e-1.1f"), - (StringTag('-.e-1.D'), "-.e-1.D"), - (StringTag('-.e-1.F'), "-.e-1.F"), - (StringTag('-.e-1.d'), "-.e-1.d"), - (StringTag('-.e-1.f'), "-.e-1.f"), - (StringTag('-.e-1D'), "-.e-1D"), - (StringTag('-.e-1F'), "-.e-1F"), - (StringTag('-.e-1d'), "-.e-1d"), - (StringTag('-.e-1f'), "-.e-1f"), - (StringTag('-.e-D'), "-.e-D"), - (StringTag('-.e-F'), "-.e-F"), - (StringTag('-.e-d'), "-.e-d"), - (StringTag('-.e-f'), "-.e-f"), - (StringTag('-.e.'), "-.e."), - (StringTag('-.e.1'), "-.e.1"), - (StringTag('-.e.1D'), "-.e.1D"), - (StringTag('-.e.1F'), "-.e.1F"), - (StringTag('-.e.1d'), "-.e.1d"), - (StringTag('-.e.1f'), "-.e.1f"), - (StringTag('-.e.D'), "-.e.D"), - (StringTag('-.e.F'), "-.e.F"), - (StringTag('-.e.d'), "-.e.d"), - (StringTag('-.e.f'), "-.e.f"), - (StringTag('-.e1'), "-.e1"), - (StringTag('-.e1.'), "-.e1."), - (StringTag('-.e1.1'), "-.e1.1"), - (StringTag('-.e1.1D'), "-.e1.1D"), - (StringTag('-.e1.1F'), "-.e1.1F"), - (StringTag('-.e1.1d'), "-.e1.1d"), - (StringTag('-.e1.1f'), "-.e1.1f"), - (StringTag('-.e1.D'), "-.e1.D"), - (StringTag('-.e1.F'), "-.e1.F"), - (StringTag('-.e1.d'), "-.e1.d"), - (StringTag('-.e1.f'), "-.e1.f"), - (StringTag('-.e1D'), "-.e1D"), - (StringTag('-.e1F'), "-.e1F"), - (StringTag('-.e1d'), "-.e1d"), - (StringTag('-.e1f'), "-.e1f"), - (StringTag('-.eD'), "-.eD"), - (StringTag('-.eF'), "-.eF"), - (StringTag('-.ed'), "-.ed"), - (StringTag('-.ef'), "-.ef"), - (StringTag('-.f'), "-.f"), + (StringTag("-.D"), "-.D"), + (StringTag("-.E"), "-.E"), + (StringTag("-.E+"), "-.E+"), + (StringTag("-.E+."), "-.E+."), + (StringTag("-.E+.1"), "-.E+.1"), + (StringTag("-.E+.1D"), "-.E+.1D"), + (StringTag("-.E+.1F"), "-.E+.1F"), + (StringTag("-.E+.1d"), "-.E+.1d"), + (StringTag("-.E+.1f"), "-.E+.1f"), + (StringTag("-.E+.D"), "-.E+.D"), + (StringTag("-.E+.F"), "-.E+.F"), + (StringTag("-.E+.d"), "-.E+.d"), + (StringTag("-.E+.f"), "-.E+.f"), + (StringTag("-.E+1"), "-.E+1"), + (StringTag("-.E+1."), "-.E+1."), + (StringTag("-.E+1.1"), "-.E+1.1"), + (StringTag("-.E+1.1D"), "-.E+1.1D"), + (StringTag("-.E+1.1F"), "-.E+1.1F"), + (StringTag("-.E+1.1d"), "-.E+1.1d"), + (StringTag("-.E+1.1f"), "-.E+1.1f"), + (StringTag("-.E+1.D"), "-.E+1.D"), + (StringTag("-.E+1.F"), "-.E+1.F"), + (StringTag("-.E+1.d"), "-.E+1.d"), + (StringTag("-.E+1.f"), "-.E+1.f"), + (StringTag("-.E+1D"), "-.E+1D"), + (StringTag("-.E+1F"), "-.E+1F"), + (StringTag("-.E+1d"), "-.E+1d"), + (StringTag("-.E+1f"), "-.E+1f"), + (StringTag("-.E+D"), "-.E+D"), + (StringTag("-.E+F"), "-.E+F"), + (StringTag("-.E+d"), "-.E+d"), + (StringTag("-.E+f"), "-.E+f"), + (StringTag("-.E-"), "-.E-"), + (StringTag("-.E-."), "-.E-."), + (StringTag("-.E-.1"), "-.E-.1"), + (StringTag("-.E-.1D"), "-.E-.1D"), + (StringTag("-.E-.1F"), "-.E-.1F"), + (StringTag("-.E-.1d"), "-.E-.1d"), + (StringTag("-.E-.1f"), "-.E-.1f"), + (StringTag("-.E-.D"), "-.E-.D"), + (StringTag("-.E-.F"), "-.E-.F"), + (StringTag("-.E-.d"), "-.E-.d"), + (StringTag("-.E-.f"), "-.E-.f"), + (StringTag("-.E-1"), "-.E-1"), + (StringTag("-.E-1."), "-.E-1."), + (StringTag("-.E-1.1"), "-.E-1.1"), + (StringTag("-.E-1.1D"), "-.E-1.1D"), + (StringTag("-.E-1.1F"), "-.E-1.1F"), + (StringTag("-.E-1.1d"), "-.E-1.1d"), + (StringTag("-.E-1.1f"), "-.E-1.1f"), + (StringTag("-.E-1.D"), "-.E-1.D"), + (StringTag("-.E-1.F"), "-.E-1.F"), + (StringTag("-.E-1.d"), "-.E-1.d"), + (StringTag("-.E-1.f"), "-.E-1.f"), + (StringTag("-.E-1D"), "-.E-1D"), + (StringTag("-.E-1F"), "-.E-1F"), + (StringTag("-.E-1d"), "-.E-1d"), + (StringTag("-.E-1f"), "-.E-1f"), + (StringTag("-.E-D"), "-.E-D"), + (StringTag("-.E-F"), "-.E-F"), + (StringTag("-.E-d"), "-.E-d"), + (StringTag("-.E-f"), "-.E-f"), + (StringTag("-.E."), "-.E."), + (StringTag("-.E.1"), "-.E.1"), + (StringTag("-.E.1D"), "-.E.1D"), + (StringTag("-.E.1F"), "-.E.1F"), + (StringTag("-.E.1d"), "-.E.1d"), + (StringTag("-.E.1f"), "-.E.1f"), + (StringTag("-.E.D"), "-.E.D"), + (StringTag("-.E.F"), "-.E.F"), + (StringTag("-.E.d"), "-.E.d"), + (StringTag("-.E.f"), "-.E.f"), + (StringTag("-.E1"), "-.E1"), + (StringTag("-.E1."), "-.E1."), + (StringTag("-.E1.1"), "-.E1.1"), + (StringTag("-.E1.1D"), "-.E1.1D"), + (StringTag("-.E1.1F"), "-.E1.1F"), + (StringTag("-.E1.1d"), "-.E1.1d"), + (StringTag("-.E1.1f"), "-.E1.1f"), + (StringTag("-.E1.D"), "-.E1.D"), + (StringTag("-.E1.F"), "-.E1.F"), + (StringTag("-.E1.d"), "-.E1.d"), + (StringTag("-.E1.f"), "-.E1.f"), + (StringTag("-.E1D"), "-.E1D"), + (StringTag("-.E1F"), "-.E1F"), + (StringTag("-.E1d"), "-.E1d"), + (StringTag("-.E1f"), "-.E1f"), + (StringTag("-.ED"), "-.ED"), + (StringTag("-.EF"), "-.EF"), + (StringTag("-.Ed"), "-.Ed"), + (StringTag("-.Ef"), "-.Ef"), + (StringTag("-.F"), "-.F"), + (StringTag("-.d"), "-.d"), + (StringTag("-.e"), "-.e"), + (StringTag("-.e+"), "-.e+"), + (StringTag("-.e+."), "-.e+."), + (StringTag("-.e+.1"), "-.e+.1"), + (StringTag("-.e+.1D"), "-.e+.1D"), + (StringTag("-.e+.1F"), "-.e+.1F"), + (StringTag("-.e+.1d"), "-.e+.1d"), + (StringTag("-.e+.1f"), "-.e+.1f"), + (StringTag("-.e+.D"), "-.e+.D"), + (StringTag("-.e+.F"), "-.e+.F"), + (StringTag("-.e+.d"), "-.e+.d"), + (StringTag("-.e+.f"), "-.e+.f"), + (StringTag("-.e+1"), "-.e+1"), + (StringTag("-.e+1."), "-.e+1."), + (StringTag("-.e+1.1"), "-.e+1.1"), + (StringTag("-.e+1.1D"), "-.e+1.1D"), + (StringTag("-.e+1.1F"), "-.e+1.1F"), + (StringTag("-.e+1.1d"), "-.e+1.1d"), + (StringTag("-.e+1.1f"), "-.e+1.1f"), + (StringTag("-.e+1.D"), "-.e+1.D"), + (StringTag("-.e+1.F"), "-.e+1.F"), + (StringTag("-.e+1.d"), "-.e+1.d"), + (StringTag("-.e+1.f"), "-.e+1.f"), + (StringTag("-.e+1D"), "-.e+1D"), + (StringTag("-.e+1F"), "-.e+1F"), + (StringTag("-.e+1d"), "-.e+1d"), + (StringTag("-.e+1f"), "-.e+1f"), + (StringTag("-.e+D"), "-.e+D"), + (StringTag("-.e+F"), "-.e+F"), + (StringTag("-.e+d"), "-.e+d"), + (StringTag("-.e+f"), "-.e+f"), + (StringTag("-.e-"), "-.e-"), + (StringTag("-.e-."), "-.e-."), + (StringTag("-.e-.1"), "-.e-.1"), + (StringTag("-.e-.1D"), "-.e-.1D"), + (StringTag("-.e-.1F"), "-.e-.1F"), + (StringTag("-.e-.1d"), "-.e-.1d"), + (StringTag("-.e-.1f"), "-.e-.1f"), + (StringTag("-.e-.D"), "-.e-.D"), + (StringTag("-.e-.F"), "-.e-.F"), + (StringTag("-.e-.d"), "-.e-.d"), + (StringTag("-.e-.f"), "-.e-.f"), + (StringTag("-.e-1"), "-.e-1"), + (StringTag("-.e-1."), "-.e-1."), + (StringTag("-.e-1.1"), "-.e-1.1"), + (StringTag("-.e-1.1D"), "-.e-1.1D"), + (StringTag("-.e-1.1F"), "-.e-1.1F"), + (StringTag("-.e-1.1d"), "-.e-1.1d"), + (StringTag("-.e-1.1f"), "-.e-1.1f"), + (StringTag("-.e-1.D"), "-.e-1.D"), + (StringTag("-.e-1.F"), "-.e-1.F"), + (StringTag("-.e-1.d"), "-.e-1.d"), + (StringTag("-.e-1.f"), "-.e-1.f"), + (StringTag("-.e-1D"), "-.e-1D"), + (StringTag("-.e-1F"), "-.e-1F"), + (StringTag("-.e-1d"), "-.e-1d"), + (StringTag("-.e-1f"), "-.e-1f"), + (StringTag("-.e-D"), "-.e-D"), + (StringTag("-.e-F"), "-.e-F"), + (StringTag("-.e-d"), "-.e-d"), + (StringTag("-.e-f"), "-.e-f"), + (StringTag("-.e."), "-.e."), + (StringTag("-.e.1"), "-.e.1"), + (StringTag("-.e.1D"), "-.e.1D"), + (StringTag("-.e.1F"), "-.e.1F"), + (StringTag("-.e.1d"), "-.e.1d"), + (StringTag("-.e.1f"), "-.e.1f"), + (StringTag("-.e.D"), "-.e.D"), + (StringTag("-.e.F"), "-.e.F"), + (StringTag("-.e.d"), "-.e.d"), + (StringTag("-.e.f"), "-.e.f"), + (StringTag("-.e1"), "-.e1"), + (StringTag("-.e1."), "-.e1."), + (StringTag("-.e1.1"), "-.e1.1"), + (StringTag("-.e1.1D"), "-.e1.1D"), + (StringTag("-.e1.1F"), "-.e1.1F"), + (StringTag("-.e1.1d"), "-.e1.1d"), + (StringTag("-.e1.1f"), "-.e1.1f"), + (StringTag("-.e1.D"), "-.e1.D"), + (StringTag("-.e1.F"), "-.e1.F"), + (StringTag("-.e1.d"), "-.e1.d"), + (StringTag("-.e1.f"), "-.e1.f"), + (StringTag("-.e1D"), "-.e1D"), + (StringTag("-.e1F"), "-.e1F"), + (StringTag("-.e1d"), "-.e1d"), + (StringTag("-.e1f"), "-.e1f"), + (StringTag("-.eD"), "-.eD"), + (StringTag("-.eF"), "-.eF"), + (StringTag("-.ed"), "-.ed"), + (StringTag("-.ef"), "-.ef"), + (StringTag("-.f"), "-.f"), (IntTag(-1), "-1"), - (StringTag('-1+'), "-1+"), - (StringTag('-1+.'), "-1+."), - (StringTag('-1+.1'), "-1+.1"), - (StringTag('-1+.1D'), "-1+.1D"), - (StringTag('-1+.1F'), "-1+.1F"), - (StringTag('-1+.1d'), "-1+.1d"), - (StringTag('-1+.1f'), "-1+.1f"), - (StringTag('-1+.D'), "-1+.D"), - (StringTag('-1+.F'), "-1+.F"), - (StringTag('-1+.d'), "-1+.d"), - (StringTag('-1+.f'), "-1+.f"), - (StringTag('-1+1'), "-1+1"), - (StringTag('-1+1.'), "-1+1."), - (StringTag('-1+1.1'), "-1+1.1"), - (StringTag('-1+1.1D'), "-1+1.1D"), - (StringTag('-1+1.1F'), "-1+1.1F"), - (StringTag('-1+1.1d'), "-1+1.1d"), - (StringTag('-1+1.1f'), "-1+1.1f"), - (StringTag('-1+1.D'), "-1+1.D"), - (StringTag('-1+1.F'), "-1+1.F"), - (StringTag('-1+1.d'), "-1+1.d"), - (StringTag('-1+1.f'), "-1+1.f"), - (StringTag('-1+1D'), "-1+1D"), - (StringTag('-1+1F'), "-1+1F"), - (StringTag('-1+1d'), "-1+1d"), - (StringTag('-1+1f'), "-1+1f"), - (StringTag('-1+D'), "-1+D"), - (StringTag('-1+F'), "-1+F"), - (StringTag('-1+d'), "-1+d"), - (StringTag('-1+f'), "-1+f"), - (StringTag('-1-'), "-1-"), - (StringTag('-1-.'), "-1-."), - (StringTag('-1-.1'), "-1-.1"), - (StringTag('-1-.1D'), "-1-.1D"), - (StringTag('-1-.1F'), "-1-.1F"), - (StringTag('-1-.1d'), "-1-.1d"), - (StringTag('-1-.1f'), "-1-.1f"), - (StringTag('-1-.D'), "-1-.D"), - (StringTag('-1-.F'), "-1-.F"), - (StringTag('-1-.d'), "-1-.d"), - (StringTag('-1-.f'), "-1-.f"), - (StringTag('-1-1'), "-1-1"), - (StringTag('-1-1.'), "-1-1."), - (StringTag('-1-1.1'), "-1-1.1"), - (StringTag('-1-1.1D'), "-1-1.1D"), - (StringTag('-1-1.1F'), "-1-1.1F"), - (StringTag('-1-1.1d'), "-1-1.1d"), - (StringTag('-1-1.1f'), "-1-1.1f"), - (StringTag('-1-1.D'), "-1-1.D"), - (StringTag('-1-1.F'), "-1-1.F"), - (StringTag('-1-1.d'), "-1-1.d"), - (StringTag('-1-1.f'), "-1-1.f"), - (StringTag('-1-1D'), "-1-1D"), - (StringTag('-1-1F'), "-1-1F"), - (StringTag('-1-1d'), "-1-1d"), - (StringTag('-1-1f'), "-1-1f"), - (StringTag('-1-D'), "-1-D"), - (StringTag('-1-F'), "-1-F"), - (StringTag('-1-d'), "-1-d"), - (StringTag('-1-f'), "-1-f"), + (StringTag("-1+"), "-1+"), + (StringTag("-1+."), "-1+."), + (StringTag("-1+.1"), "-1+.1"), + (StringTag("-1+.1D"), "-1+.1D"), + (StringTag("-1+.1F"), "-1+.1F"), + (StringTag("-1+.1d"), "-1+.1d"), + (StringTag("-1+.1f"), "-1+.1f"), + (StringTag("-1+.D"), "-1+.D"), + (StringTag("-1+.F"), "-1+.F"), + (StringTag("-1+.d"), "-1+.d"), + (StringTag("-1+.f"), "-1+.f"), + (StringTag("-1+1"), "-1+1"), + (StringTag("-1+1."), "-1+1."), + (StringTag("-1+1.1"), "-1+1.1"), + (StringTag("-1+1.1D"), "-1+1.1D"), + (StringTag("-1+1.1F"), "-1+1.1F"), + (StringTag("-1+1.1d"), "-1+1.1d"), + (StringTag("-1+1.1f"), "-1+1.1f"), + (StringTag("-1+1.D"), "-1+1.D"), + (StringTag("-1+1.F"), "-1+1.F"), + (StringTag("-1+1.d"), "-1+1.d"), + (StringTag("-1+1.f"), "-1+1.f"), + (StringTag("-1+1D"), "-1+1D"), + (StringTag("-1+1F"), "-1+1F"), + (StringTag("-1+1d"), "-1+1d"), + (StringTag("-1+1f"), "-1+1f"), + (StringTag("-1+D"), "-1+D"), + (StringTag("-1+F"), "-1+F"), + (StringTag("-1+d"), "-1+d"), + (StringTag("-1+f"), "-1+f"), + (StringTag("-1-"), "-1-"), + (StringTag("-1-."), "-1-."), + (StringTag("-1-.1"), "-1-.1"), + (StringTag("-1-.1D"), "-1-.1D"), + (StringTag("-1-.1F"), "-1-.1F"), + (StringTag("-1-.1d"), "-1-.1d"), + (StringTag("-1-.1f"), "-1-.1f"), + (StringTag("-1-.D"), "-1-.D"), + (StringTag("-1-.F"), "-1-.F"), + (StringTag("-1-.d"), "-1-.d"), + (StringTag("-1-.f"), "-1-.f"), + (StringTag("-1-1"), "-1-1"), + (StringTag("-1-1."), "-1-1."), + (StringTag("-1-1.1"), "-1-1.1"), + (StringTag("-1-1.1D"), "-1-1.1D"), + (StringTag("-1-1.1F"), "-1-1.1F"), + (StringTag("-1-1.1d"), "-1-1.1d"), + (StringTag("-1-1.1f"), "-1-1.1f"), + (StringTag("-1-1.D"), "-1-1.D"), + (StringTag("-1-1.F"), "-1-1.F"), + (StringTag("-1-1.d"), "-1-1.d"), + (StringTag("-1-1.f"), "-1-1.f"), + (StringTag("-1-1D"), "-1-1D"), + (StringTag("-1-1F"), "-1-1F"), + (StringTag("-1-1d"), "-1-1d"), + (StringTag("-1-1f"), "-1-1f"), + (StringTag("-1-D"), "-1-D"), + (StringTag("-1-F"), "-1-F"), + (StringTag("-1-d"), "-1-d"), + (StringTag("-1-f"), "-1-f"), (DoubleTag(-1.000000), "-1."), - (StringTag('-1.+'), "-1.+"), - (StringTag('-1.+.'), "-1.+."), - (StringTag('-1.+.1'), "-1.+.1"), - (StringTag('-1.+.1D'), "-1.+.1D"), - (StringTag('-1.+.1F'), "-1.+.1F"), - (StringTag('-1.+.1d'), "-1.+.1d"), - (StringTag('-1.+.1f'), "-1.+.1f"), - (StringTag('-1.+.D'), "-1.+.D"), - (StringTag('-1.+.F'), "-1.+.F"), - (StringTag('-1.+.d'), "-1.+.d"), - (StringTag('-1.+.f'), "-1.+.f"), - (StringTag('-1.+1'), "-1.+1"), - (StringTag('-1.+1.'), "-1.+1."), - (StringTag('-1.+1.1'), "-1.+1.1"), - (StringTag('-1.+1.1D'), "-1.+1.1D"), - (StringTag('-1.+1.1F'), "-1.+1.1F"), - (StringTag('-1.+1.1d'), "-1.+1.1d"), - (StringTag('-1.+1.1f'), "-1.+1.1f"), - (StringTag('-1.+1.D'), "-1.+1.D"), - (StringTag('-1.+1.F'), "-1.+1.F"), - (StringTag('-1.+1.d'), "-1.+1.d"), - (StringTag('-1.+1.f'), "-1.+1.f"), - (StringTag('-1.+1D'), "-1.+1D"), - (StringTag('-1.+1F'), "-1.+1F"), - (StringTag('-1.+1d'), "-1.+1d"), - (StringTag('-1.+1f'), "-1.+1f"), - (StringTag('-1.+D'), "-1.+D"), - (StringTag('-1.+F'), "-1.+F"), - (StringTag('-1.+d'), "-1.+d"), - (StringTag('-1.+f'), "-1.+f"), - (StringTag('-1.-'), "-1.-"), - (StringTag('-1.-.'), "-1.-."), - (StringTag('-1.-.1'), "-1.-.1"), - (StringTag('-1.-.1D'), "-1.-.1D"), - (StringTag('-1.-.1F'), "-1.-.1F"), - (StringTag('-1.-.1d'), "-1.-.1d"), - (StringTag('-1.-.1f'), "-1.-.1f"), - (StringTag('-1.-.D'), "-1.-.D"), - (StringTag('-1.-.F'), "-1.-.F"), - (StringTag('-1.-.d'), "-1.-.d"), - (StringTag('-1.-.f'), "-1.-.f"), - (StringTag('-1.-1'), "-1.-1"), - (StringTag('-1.-1.'), "-1.-1."), - (StringTag('-1.-1.1'), "-1.-1.1"), - (StringTag('-1.-1.1D'), "-1.-1.1D"), - (StringTag('-1.-1.1F'), "-1.-1.1F"), - (StringTag('-1.-1.1d'), "-1.-1.1d"), - (StringTag('-1.-1.1f'), "-1.-1.1f"), - (StringTag('-1.-1.D'), "-1.-1.D"), - (StringTag('-1.-1.F'), "-1.-1.F"), - (StringTag('-1.-1.d'), "-1.-1.d"), - (StringTag('-1.-1.f'), "-1.-1.f"), - (StringTag('-1.-1D'), "-1.-1D"), - (StringTag('-1.-1F'), "-1.-1F"), - (StringTag('-1.-1d'), "-1.-1d"), - (StringTag('-1.-1f'), "-1.-1f"), - (StringTag('-1.-D'), "-1.-D"), - (StringTag('-1.-F'), "-1.-F"), - (StringTag('-1.-d'), "-1.-d"), - (StringTag('-1.-f'), "-1.-f"), - (StringTag('-1..'), "-1.."), - (StringTag('-1..1'), "-1..1"), - (StringTag('-1..1D'), "-1..1D"), - (StringTag('-1..1F'), "-1..1F"), - (StringTag('-1..1d'), "-1..1d"), - (StringTag('-1..1f'), "-1..1f"), - (StringTag('-1..D'), "-1..D"), - (StringTag('-1..F'), "-1..F"), - (StringTag('-1..d'), "-1..d"), - (StringTag('-1..f'), "-1..f"), + (StringTag("-1.+"), "-1.+"), + (StringTag("-1.+."), "-1.+."), + (StringTag("-1.+.1"), "-1.+.1"), + (StringTag("-1.+.1D"), "-1.+.1D"), + (StringTag("-1.+.1F"), "-1.+.1F"), + (StringTag("-1.+.1d"), "-1.+.1d"), + (StringTag("-1.+.1f"), "-1.+.1f"), + (StringTag("-1.+.D"), "-1.+.D"), + (StringTag("-1.+.F"), "-1.+.F"), + (StringTag("-1.+.d"), "-1.+.d"), + (StringTag("-1.+.f"), "-1.+.f"), + (StringTag("-1.+1"), "-1.+1"), + (StringTag("-1.+1."), "-1.+1."), + (StringTag("-1.+1.1"), "-1.+1.1"), + (StringTag("-1.+1.1D"), "-1.+1.1D"), + (StringTag("-1.+1.1F"), "-1.+1.1F"), + (StringTag("-1.+1.1d"), "-1.+1.1d"), + (StringTag("-1.+1.1f"), "-1.+1.1f"), + (StringTag("-1.+1.D"), "-1.+1.D"), + (StringTag("-1.+1.F"), "-1.+1.F"), + (StringTag("-1.+1.d"), "-1.+1.d"), + (StringTag("-1.+1.f"), "-1.+1.f"), + (StringTag("-1.+1D"), "-1.+1D"), + (StringTag("-1.+1F"), "-1.+1F"), + (StringTag("-1.+1d"), "-1.+1d"), + (StringTag("-1.+1f"), "-1.+1f"), + (StringTag("-1.+D"), "-1.+D"), + (StringTag("-1.+F"), "-1.+F"), + (StringTag("-1.+d"), "-1.+d"), + (StringTag("-1.+f"), "-1.+f"), + (StringTag("-1.-"), "-1.-"), + (StringTag("-1.-."), "-1.-."), + (StringTag("-1.-.1"), "-1.-.1"), + (StringTag("-1.-.1D"), "-1.-.1D"), + (StringTag("-1.-.1F"), "-1.-.1F"), + (StringTag("-1.-.1d"), "-1.-.1d"), + (StringTag("-1.-.1f"), "-1.-.1f"), + (StringTag("-1.-.D"), "-1.-.D"), + (StringTag("-1.-.F"), "-1.-.F"), + (StringTag("-1.-.d"), "-1.-.d"), + (StringTag("-1.-.f"), "-1.-.f"), + (StringTag("-1.-1"), "-1.-1"), + (StringTag("-1.-1."), "-1.-1."), + (StringTag("-1.-1.1"), "-1.-1.1"), + (StringTag("-1.-1.1D"), "-1.-1.1D"), + (StringTag("-1.-1.1F"), "-1.-1.1F"), + (StringTag("-1.-1.1d"), "-1.-1.1d"), + (StringTag("-1.-1.1f"), "-1.-1.1f"), + (StringTag("-1.-1.D"), "-1.-1.D"), + (StringTag("-1.-1.F"), "-1.-1.F"), + (StringTag("-1.-1.d"), "-1.-1.d"), + (StringTag("-1.-1.f"), "-1.-1.f"), + (StringTag("-1.-1D"), "-1.-1D"), + (StringTag("-1.-1F"), "-1.-1F"), + (StringTag("-1.-1d"), "-1.-1d"), + (StringTag("-1.-1f"), "-1.-1f"), + (StringTag("-1.-D"), "-1.-D"), + (StringTag("-1.-F"), "-1.-F"), + (StringTag("-1.-d"), "-1.-d"), + (StringTag("-1.-f"), "-1.-f"), + (StringTag("-1.."), "-1.."), + (StringTag("-1..1"), "-1..1"), + (StringTag("-1..1D"), "-1..1D"), + (StringTag("-1..1F"), "-1..1F"), + (StringTag("-1..1d"), "-1..1d"), + (StringTag("-1..1f"), "-1..1f"), + (StringTag("-1..D"), "-1..D"), + (StringTag("-1..F"), "-1..F"), + (StringTag("-1..d"), "-1..d"), + (StringTag("-1..f"), "-1..f"), (DoubleTag(-1.100000), "-1.1"), - (StringTag('-1.1+'), "-1.1+"), - (StringTag('-1.1+.'), "-1.1+."), - (StringTag('-1.1+.1'), "-1.1+.1"), - (StringTag('-1.1+.1D'), "-1.1+.1D"), - (StringTag('-1.1+.1F'), "-1.1+.1F"), - (StringTag('-1.1+.1d'), "-1.1+.1d"), - (StringTag('-1.1+.1f'), "-1.1+.1f"), - (StringTag('-1.1+.D'), "-1.1+.D"), - (StringTag('-1.1+.F'), "-1.1+.F"), - (StringTag('-1.1+.d'), "-1.1+.d"), - (StringTag('-1.1+.f'), "-1.1+.f"), - (StringTag('-1.1+1'), "-1.1+1"), - (StringTag('-1.1+1.'), "-1.1+1."), - (StringTag('-1.1+1.1'), "-1.1+1.1"), - (StringTag('-1.1+1.1D'), "-1.1+1.1D"), - (StringTag('-1.1+1.1F'), "-1.1+1.1F"), - (StringTag('-1.1+1.1d'), "-1.1+1.1d"), - (StringTag('-1.1+1.1f'), "-1.1+1.1f"), - (StringTag('-1.1+1.D'), "-1.1+1.D"), - (StringTag('-1.1+1.F'), "-1.1+1.F"), - (StringTag('-1.1+1.d'), "-1.1+1.d"), - (StringTag('-1.1+1.f'), "-1.1+1.f"), - (StringTag('-1.1+1D'), "-1.1+1D"), - (StringTag('-1.1+1F'), "-1.1+1F"), - (StringTag('-1.1+1d'), "-1.1+1d"), - (StringTag('-1.1+1f'), "-1.1+1f"), - (StringTag('-1.1+D'), "-1.1+D"), - (StringTag('-1.1+F'), "-1.1+F"), - (StringTag('-1.1+d'), "-1.1+d"), - (StringTag('-1.1+f'), "-1.1+f"), - (StringTag('-1.1-'), "-1.1-"), - (StringTag('-1.1-.'), "-1.1-."), - (StringTag('-1.1-.1'), "-1.1-.1"), - (StringTag('-1.1-.1D'), "-1.1-.1D"), - (StringTag('-1.1-.1F'), "-1.1-.1F"), - (StringTag('-1.1-.1d'), "-1.1-.1d"), - (StringTag('-1.1-.1f'), "-1.1-.1f"), - (StringTag('-1.1-.D'), "-1.1-.D"), - (StringTag('-1.1-.F'), "-1.1-.F"), - (StringTag('-1.1-.d'), "-1.1-.d"), - (StringTag('-1.1-.f'), "-1.1-.f"), - (StringTag('-1.1-1'), "-1.1-1"), - (StringTag('-1.1-1.'), "-1.1-1."), - (StringTag('-1.1-1.1'), "-1.1-1.1"), - (StringTag('-1.1-1.1D'), "-1.1-1.1D"), - (StringTag('-1.1-1.1F'), "-1.1-1.1F"), - (StringTag('-1.1-1.1d'), "-1.1-1.1d"), - (StringTag('-1.1-1.1f'), "-1.1-1.1f"), - (StringTag('-1.1-1.D'), "-1.1-1.D"), - (StringTag('-1.1-1.F'), "-1.1-1.F"), - (StringTag('-1.1-1.d'), "-1.1-1.d"), - (StringTag('-1.1-1.f'), "-1.1-1.f"), - (StringTag('-1.1-1D'), "-1.1-1D"), - (StringTag('-1.1-1F'), "-1.1-1F"), - (StringTag('-1.1-1d'), "-1.1-1d"), - (StringTag('-1.1-1f'), "-1.1-1f"), - (StringTag('-1.1-D'), "-1.1-D"), - (StringTag('-1.1-F'), "-1.1-F"), - (StringTag('-1.1-d'), "-1.1-d"), - (StringTag('-1.1-f'), "-1.1-f"), - (StringTag('-1.1.'), "-1.1."), - (StringTag('-1.1.1'), "-1.1.1"), - (StringTag('-1.1.1D'), "-1.1.1D"), - (StringTag('-1.1.1F'), "-1.1.1F"), - (StringTag('-1.1.1d'), "-1.1.1d"), - (StringTag('-1.1.1f'), "-1.1.1f"), - (StringTag('-1.1.D'), "-1.1.D"), - (StringTag('-1.1.F'), "-1.1.F"), - (StringTag('-1.1.d'), "-1.1.d"), - (StringTag('-1.1.f'), "-1.1.f"), + (StringTag("-1.1+"), "-1.1+"), + (StringTag("-1.1+."), "-1.1+."), + (StringTag("-1.1+.1"), "-1.1+.1"), + (StringTag("-1.1+.1D"), "-1.1+.1D"), + (StringTag("-1.1+.1F"), "-1.1+.1F"), + (StringTag("-1.1+.1d"), "-1.1+.1d"), + (StringTag("-1.1+.1f"), "-1.1+.1f"), + (StringTag("-1.1+.D"), "-1.1+.D"), + (StringTag("-1.1+.F"), "-1.1+.F"), + (StringTag("-1.1+.d"), "-1.1+.d"), + (StringTag("-1.1+.f"), "-1.1+.f"), + (StringTag("-1.1+1"), "-1.1+1"), + (StringTag("-1.1+1."), "-1.1+1."), + (StringTag("-1.1+1.1"), "-1.1+1.1"), + (StringTag("-1.1+1.1D"), "-1.1+1.1D"), + (StringTag("-1.1+1.1F"), "-1.1+1.1F"), + (StringTag("-1.1+1.1d"), "-1.1+1.1d"), + (StringTag("-1.1+1.1f"), "-1.1+1.1f"), + (StringTag("-1.1+1.D"), "-1.1+1.D"), + (StringTag("-1.1+1.F"), "-1.1+1.F"), + (StringTag("-1.1+1.d"), "-1.1+1.d"), + (StringTag("-1.1+1.f"), "-1.1+1.f"), + (StringTag("-1.1+1D"), "-1.1+1D"), + (StringTag("-1.1+1F"), "-1.1+1F"), + (StringTag("-1.1+1d"), "-1.1+1d"), + (StringTag("-1.1+1f"), "-1.1+1f"), + (StringTag("-1.1+D"), "-1.1+D"), + (StringTag("-1.1+F"), "-1.1+F"), + (StringTag("-1.1+d"), "-1.1+d"), + (StringTag("-1.1+f"), "-1.1+f"), + (StringTag("-1.1-"), "-1.1-"), + (StringTag("-1.1-."), "-1.1-."), + (StringTag("-1.1-.1"), "-1.1-.1"), + (StringTag("-1.1-.1D"), "-1.1-.1D"), + (StringTag("-1.1-.1F"), "-1.1-.1F"), + (StringTag("-1.1-.1d"), "-1.1-.1d"), + (StringTag("-1.1-.1f"), "-1.1-.1f"), + (StringTag("-1.1-.D"), "-1.1-.D"), + (StringTag("-1.1-.F"), "-1.1-.F"), + (StringTag("-1.1-.d"), "-1.1-.d"), + (StringTag("-1.1-.f"), "-1.1-.f"), + (StringTag("-1.1-1"), "-1.1-1"), + (StringTag("-1.1-1."), "-1.1-1."), + (StringTag("-1.1-1.1"), "-1.1-1.1"), + (StringTag("-1.1-1.1D"), "-1.1-1.1D"), + (StringTag("-1.1-1.1F"), "-1.1-1.1F"), + (StringTag("-1.1-1.1d"), "-1.1-1.1d"), + (StringTag("-1.1-1.1f"), "-1.1-1.1f"), + (StringTag("-1.1-1.D"), "-1.1-1.D"), + (StringTag("-1.1-1.F"), "-1.1-1.F"), + (StringTag("-1.1-1.d"), "-1.1-1.d"), + (StringTag("-1.1-1.f"), "-1.1-1.f"), + (StringTag("-1.1-1D"), "-1.1-1D"), + (StringTag("-1.1-1F"), "-1.1-1F"), + (StringTag("-1.1-1d"), "-1.1-1d"), + (StringTag("-1.1-1f"), "-1.1-1f"), + (StringTag("-1.1-D"), "-1.1-D"), + (StringTag("-1.1-F"), "-1.1-F"), + (StringTag("-1.1-d"), "-1.1-d"), + (StringTag("-1.1-f"), "-1.1-f"), + (StringTag("-1.1."), "-1.1."), + (StringTag("-1.1.1"), "-1.1.1"), + (StringTag("-1.1.1D"), "-1.1.1D"), + (StringTag("-1.1.1F"), "-1.1.1F"), + (StringTag("-1.1.1d"), "-1.1.1d"), + (StringTag("-1.1.1f"), "-1.1.1f"), + (StringTag("-1.1.D"), "-1.1.D"), + (StringTag("-1.1.F"), "-1.1.F"), + (StringTag("-1.1.d"), "-1.1.d"), + (StringTag("-1.1.f"), "-1.1.f"), (DoubleTag(-1.110000), "-1.11"), - (StringTag('-1.11.'), "-1.11."), - (StringTag('-1.11.1'), "-1.11.1"), - (StringTag('-1.11.1D'), "-1.11.1D"), - (StringTag('-1.11.1F'), "-1.11.1F"), - (StringTag('-1.11.1d'), "-1.11.1d"), - (StringTag('-1.11.1f'), "-1.11.1f"), - (StringTag('-1.11.D'), "-1.11.D"), - (StringTag('-1.11.F'), "-1.11.F"), - (StringTag('-1.11.d'), "-1.11.d"), - (StringTag('-1.11.f'), "-1.11.f"), + (StringTag("-1.11."), "-1.11."), + (StringTag("-1.11.1"), "-1.11.1"), + (StringTag("-1.11.1D"), "-1.11.1D"), + (StringTag("-1.11.1F"), "-1.11.1F"), + (StringTag("-1.11.1d"), "-1.11.1d"), + (StringTag("-1.11.1f"), "-1.11.1f"), + (StringTag("-1.11.D"), "-1.11.D"), + (StringTag("-1.11.F"), "-1.11.F"), + (StringTag("-1.11.d"), "-1.11.d"), + (StringTag("-1.11.f"), "-1.11.f"), (DoubleTag(-1.110000), "-1.11D"), (FloatTag(-1.110000), "-1.11F"), (DoubleTag(-1.110000), "-1.11d"), (FloatTag(-1.110000), "-1.11f"), (DoubleTag(-1.100000), "-1.1D"), - (StringTag('-1.1E'), "-1.1E"), - (StringTag('-1.1E+'), "-1.1E+"), - (StringTag('-1.1E+.'), "-1.1E+."), - (StringTag('-1.1E+.1'), "-1.1E+.1"), - (StringTag('-1.1E+.1D'), "-1.1E+.1D"), - (StringTag('-1.1E+.1F'), "-1.1E+.1F"), - (StringTag('-1.1E+.1d'), "-1.1E+.1d"), - (StringTag('-1.1E+.1f'), "-1.1E+.1f"), - (StringTag('-1.1E+.D'), "-1.1E+.D"), - (StringTag('-1.1E+.F'), "-1.1E+.F"), - (StringTag('-1.1E+.d'), "-1.1E+.d"), - (StringTag('-1.1E+.f'), "-1.1E+.f"), + (StringTag("-1.1E"), "-1.1E"), + (StringTag("-1.1E+"), "-1.1E+"), + (StringTag("-1.1E+."), "-1.1E+."), + (StringTag("-1.1E+.1"), "-1.1E+.1"), + (StringTag("-1.1E+.1D"), "-1.1E+.1D"), + (StringTag("-1.1E+.1F"), "-1.1E+.1F"), + (StringTag("-1.1E+.1d"), "-1.1E+.1d"), + (StringTag("-1.1E+.1f"), "-1.1E+.1f"), + (StringTag("-1.1E+.D"), "-1.1E+.D"), + (StringTag("-1.1E+.F"), "-1.1E+.F"), + (StringTag("-1.1E+.d"), "-1.1E+.d"), + (StringTag("-1.1E+.f"), "-1.1E+.f"), (DoubleTag(-11.000000), "-1.1E+1"), - (StringTag('-1.1E+1.'), "-1.1E+1."), - (StringTag('-1.1E+1.1'), "-1.1E+1.1"), - (StringTag('-1.1E+1.1D'), "-1.1E+1.1D"), - (StringTag('-1.1E+1.1F'), "-1.1E+1.1F"), - (StringTag('-1.1E+1.1d'), "-1.1E+1.1d"), - (StringTag('-1.1E+1.1f'), "-1.1E+1.1f"), - (StringTag('-1.1E+1.D'), "-1.1E+1.D"), - (StringTag('-1.1E+1.F'), "-1.1E+1.F"), - (StringTag('-1.1E+1.d'), "-1.1E+1.d"), - (StringTag('-1.1E+1.f'), "-1.1E+1.f"), + (StringTag("-1.1E+1."), "-1.1E+1."), + (StringTag("-1.1E+1.1"), "-1.1E+1.1"), + (StringTag("-1.1E+1.1D"), "-1.1E+1.1D"), + (StringTag("-1.1E+1.1F"), "-1.1E+1.1F"), + (StringTag("-1.1E+1.1d"), "-1.1E+1.1d"), + (StringTag("-1.1E+1.1f"), "-1.1E+1.1f"), + (StringTag("-1.1E+1.D"), "-1.1E+1.D"), + (StringTag("-1.1E+1.F"), "-1.1E+1.F"), + (StringTag("-1.1E+1.d"), "-1.1E+1.d"), + (StringTag("-1.1E+1.f"), "-1.1E+1.f"), (DoubleTag(-11.000000), "-1.1E+1D"), (FloatTag(-11.000000), "-1.1E+1F"), (DoubleTag(-11.000000), "-1.1E+1d"), (FloatTag(-11.000000), "-1.1E+1f"), - (StringTag('-1.1E+D'), "-1.1E+D"), - (StringTag('-1.1E+F'), "-1.1E+F"), - (StringTag('-1.1E+d'), "-1.1E+d"), - (StringTag('-1.1E+f'), "-1.1E+f"), - (StringTag('-1.1E-'), "-1.1E-"), - (StringTag('-1.1E-.'), "-1.1E-."), - (StringTag('-1.1E-.1'), "-1.1E-.1"), - (StringTag('-1.1E-.1D'), "-1.1E-.1D"), - (StringTag('-1.1E-.1F'), "-1.1E-.1F"), - (StringTag('-1.1E-.1d'), "-1.1E-.1d"), - (StringTag('-1.1E-.1f'), "-1.1E-.1f"), - (StringTag('-1.1E-.D'), "-1.1E-.D"), - (StringTag('-1.1E-.F'), "-1.1E-.F"), - (StringTag('-1.1E-.d'), "-1.1E-.d"), - (StringTag('-1.1E-.f'), "-1.1E-.f"), + (StringTag("-1.1E+D"), "-1.1E+D"), + (StringTag("-1.1E+F"), "-1.1E+F"), + (StringTag("-1.1E+d"), "-1.1E+d"), + (StringTag("-1.1E+f"), "-1.1E+f"), + (StringTag("-1.1E-"), "-1.1E-"), + (StringTag("-1.1E-."), "-1.1E-."), + (StringTag("-1.1E-.1"), "-1.1E-.1"), + (StringTag("-1.1E-.1D"), "-1.1E-.1D"), + (StringTag("-1.1E-.1F"), "-1.1E-.1F"), + (StringTag("-1.1E-.1d"), "-1.1E-.1d"), + (StringTag("-1.1E-.1f"), "-1.1E-.1f"), + (StringTag("-1.1E-.D"), "-1.1E-.D"), + (StringTag("-1.1E-.F"), "-1.1E-.F"), + (StringTag("-1.1E-.d"), "-1.1E-.d"), + (StringTag("-1.1E-.f"), "-1.1E-.f"), (DoubleTag(-0.110000), "-1.1E-1"), - (StringTag('-1.1E-1.'), "-1.1E-1."), - (StringTag('-1.1E-1.1'), "-1.1E-1.1"), - (StringTag('-1.1E-1.1D'), "-1.1E-1.1D"), - (StringTag('-1.1E-1.1F'), "-1.1E-1.1F"), - (StringTag('-1.1E-1.1d'), "-1.1E-1.1d"), - (StringTag('-1.1E-1.1f'), "-1.1E-1.1f"), - (StringTag('-1.1E-1.D'), "-1.1E-1.D"), - (StringTag('-1.1E-1.F'), "-1.1E-1.F"), - (StringTag('-1.1E-1.d'), "-1.1E-1.d"), - (StringTag('-1.1E-1.f'), "-1.1E-1.f"), + (StringTag("-1.1E-1."), "-1.1E-1."), + (StringTag("-1.1E-1.1"), "-1.1E-1.1"), + (StringTag("-1.1E-1.1D"), "-1.1E-1.1D"), + (StringTag("-1.1E-1.1F"), "-1.1E-1.1F"), + (StringTag("-1.1E-1.1d"), "-1.1E-1.1d"), + (StringTag("-1.1E-1.1f"), "-1.1E-1.1f"), + (StringTag("-1.1E-1.D"), "-1.1E-1.D"), + (StringTag("-1.1E-1.F"), "-1.1E-1.F"), + (StringTag("-1.1E-1.d"), "-1.1E-1.d"), + (StringTag("-1.1E-1.f"), "-1.1E-1.f"), (DoubleTag(-0.110000), "-1.1E-1D"), (FloatTag(-0.110000), "-1.1E-1F"), (DoubleTag(-0.110000), "-1.1E-1d"), (FloatTag(-0.110000), "-1.1E-1f"), - (StringTag('-1.1E-D'), "-1.1E-D"), - (StringTag('-1.1E-F'), "-1.1E-F"), - (StringTag('-1.1E-d'), "-1.1E-d"), - (StringTag('-1.1E-f'), "-1.1E-f"), - (StringTag('-1.1E.'), "-1.1E."), - (StringTag('-1.1E.1'), "-1.1E.1"), - (StringTag('-1.1E.1D'), "-1.1E.1D"), - (StringTag('-1.1E.1F'), "-1.1E.1F"), - (StringTag('-1.1E.1d'), "-1.1E.1d"), - (StringTag('-1.1E.1f'), "-1.1E.1f"), - (StringTag('-1.1E.D'), "-1.1E.D"), - (StringTag('-1.1E.F'), "-1.1E.F"), - (StringTag('-1.1E.d'), "-1.1E.d"), - (StringTag('-1.1E.f'), "-1.1E.f"), + (StringTag("-1.1E-D"), "-1.1E-D"), + (StringTag("-1.1E-F"), "-1.1E-F"), + (StringTag("-1.1E-d"), "-1.1E-d"), + (StringTag("-1.1E-f"), "-1.1E-f"), + (StringTag("-1.1E."), "-1.1E."), + (StringTag("-1.1E.1"), "-1.1E.1"), + (StringTag("-1.1E.1D"), "-1.1E.1D"), + (StringTag("-1.1E.1F"), "-1.1E.1F"), + (StringTag("-1.1E.1d"), "-1.1E.1d"), + (StringTag("-1.1E.1f"), "-1.1E.1f"), + (StringTag("-1.1E.D"), "-1.1E.D"), + (StringTag("-1.1E.F"), "-1.1E.F"), + (StringTag("-1.1E.d"), "-1.1E.d"), + (StringTag("-1.1E.f"), "-1.1E.f"), (DoubleTag(-11.000000), "-1.1E1"), - (StringTag('-1.1E1.'), "-1.1E1."), - (StringTag('-1.1E1.1'), "-1.1E1.1"), - (StringTag('-1.1E1.1D'), "-1.1E1.1D"), - (StringTag('-1.1E1.1F'), "-1.1E1.1F"), - (StringTag('-1.1E1.1d'), "-1.1E1.1d"), - (StringTag('-1.1E1.1f'), "-1.1E1.1f"), - (StringTag('-1.1E1.D'), "-1.1E1.D"), - (StringTag('-1.1E1.F'), "-1.1E1.F"), - (StringTag('-1.1E1.d'), "-1.1E1.d"), - (StringTag('-1.1E1.f'), "-1.1E1.f"), + (StringTag("-1.1E1."), "-1.1E1."), + (StringTag("-1.1E1.1"), "-1.1E1.1"), + (StringTag("-1.1E1.1D"), "-1.1E1.1D"), + (StringTag("-1.1E1.1F"), "-1.1E1.1F"), + (StringTag("-1.1E1.1d"), "-1.1E1.1d"), + (StringTag("-1.1E1.1f"), "-1.1E1.1f"), + (StringTag("-1.1E1.D"), "-1.1E1.D"), + (StringTag("-1.1E1.F"), "-1.1E1.F"), + (StringTag("-1.1E1.d"), "-1.1E1.d"), + (StringTag("-1.1E1.f"), "-1.1E1.f"), (DoubleTag(-11.000000), "-1.1E1D"), (FloatTag(-11.000000), "-1.1E1F"), (DoubleTag(-11.000000), "-1.1E1d"), (FloatTag(-11.000000), "-1.1E1f"), - (StringTag('-1.1ED'), "-1.1ED"), - (StringTag('-1.1EF'), "-1.1EF"), - (StringTag('-1.1Ed'), "-1.1Ed"), - (StringTag('-1.1Ef'), "-1.1Ef"), + (StringTag("-1.1ED"), "-1.1ED"), + (StringTag("-1.1EF"), "-1.1EF"), + (StringTag("-1.1Ed"), "-1.1Ed"), + (StringTag("-1.1Ef"), "-1.1Ef"), (FloatTag(-1.100000), "-1.1F"), (DoubleTag(-1.100000), "-1.1d"), - (StringTag('-1.1e'), "-1.1e"), - (StringTag('-1.1e+'), "-1.1e+"), - (StringTag('-1.1e+.'), "-1.1e+."), - (StringTag('-1.1e+.1'), "-1.1e+.1"), - (StringTag('-1.1e+.1D'), "-1.1e+.1D"), - (StringTag('-1.1e+.1F'), "-1.1e+.1F"), - (StringTag('-1.1e+.1d'), "-1.1e+.1d"), - (StringTag('-1.1e+.1f'), "-1.1e+.1f"), - (StringTag('-1.1e+.D'), "-1.1e+.D"), - (StringTag('-1.1e+.F'), "-1.1e+.F"), - (StringTag('-1.1e+.d'), "-1.1e+.d"), - (StringTag('-1.1e+.f'), "-1.1e+.f"), + (StringTag("-1.1e"), "-1.1e"), + (StringTag("-1.1e+"), "-1.1e+"), + (StringTag("-1.1e+."), "-1.1e+."), + (StringTag("-1.1e+.1"), "-1.1e+.1"), + (StringTag("-1.1e+.1D"), "-1.1e+.1D"), + (StringTag("-1.1e+.1F"), "-1.1e+.1F"), + (StringTag("-1.1e+.1d"), "-1.1e+.1d"), + (StringTag("-1.1e+.1f"), "-1.1e+.1f"), + (StringTag("-1.1e+.D"), "-1.1e+.D"), + (StringTag("-1.1e+.F"), "-1.1e+.F"), + (StringTag("-1.1e+.d"), "-1.1e+.d"), + (StringTag("-1.1e+.f"), "-1.1e+.f"), (DoubleTag(-11.000000), "-1.1e+1"), - (StringTag('-1.1e+1.'), "-1.1e+1."), - (StringTag('-1.1e+1.1'), "-1.1e+1.1"), - (StringTag('-1.1e+1.1D'), "-1.1e+1.1D"), - (StringTag('-1.1e+1.1F'), "-1.1e+1.1F"), - (StringTag('-1.1e+1.1d'), "-1.1e+1.1d"), - (StringTag('-1.1e+1.1f'), "-1.1e+1.1f"), - (StringTag('-1.1e+1.D'), "-1.1e+1.D"), - (StringTag('-1.1e+1.F'), "-1.1e+1.F"), - (StringTag('-1.1e+1.d'), "-1.1e+1.d"), - (StringTag('-1.1e+1.f'), "-1.1e+1.f"), + (StringTag("-1.1e+1."), "-1.1e+1."), + (StringTag("-1.1e+1.1"), "-1.1e+1.1"), + (StringTag("-1.1e+1.1D"), "-1.1e+1.1D"), + (StringTag("-1.1e+1.1F"), "-1.1e+1.1F"), + (StringTag("-1.1e+1.1d"), "-1.1e+1.1d"), + (StringTag("-1.1e+1.1f"), "-1.1e+1.1f"), + (StringTag("-1.1e+1.D"), "-1.1e+1.D"), + (StringTag("-1.1e+1.F"), "-1.1e+1.F"), + (StringTag("-1.1e+1.d"), "-1.1e+1.d"), + (StringTag("-1.1e+1.f"), "-1.1e+1.f"), (DoubleTag(-11.000000), "-1.1e+1D"), (FloatTag(-11.000000), "-1.1e+1F"), (DoubleTag(-11.000000), "-1.1e+1d"), (FloatTag(-11.000000), "-1.1e+1f"), - (StringTag('-1.1e+D'), "-1.1e+D"), - (StringTag('-1.1e+F'), "-1.1e+F"), - (StringTag('-1.1e+d'), "-1.1e+d"), - (StringTag('-1.1e+f'), "-1.1e+f"), - (StringTag('-1.1e-'), "-1.1e-"), - (StringTag('-1.1e-.'), "-1.1e-."), - (StringTag('-1.1e-.1'), "-1.1e-.1"), - (StringTag('-1.1e-.1D'), "-1.1e-.1D"), - (StringTag('-1.1e-.1F'), "-1.1e-.1F"), - (StringTag('-1.1e-.1d'), "-1.1e-.1d"), - (StringTag('-1.1e-.1f'), "-1.1e-.1f"), - (StringTag('-1.1e-.D'), "-1.1e-.D"), - (StringTag('-1.1e-.F'), "-1.1e-.F"), - (StringTag('-1.1e-.d'), "-1.1e-.d"), - (StringTag('-1.1e-.f'), "-1.1e-.f"), + (StringTag("-1.1e+D"), "-1.1e+D"), + (StringTag("-1.1e+F"), "-1.1e+F"), + (StringTag("-1.1e+d"), "-1.1e+d"), + (StringTag("-1.1e+f"), "-1.1e+f"), + (StringTag("-1.1e-"), "-1.1e-"), + (StringTag("-1.1e-."), "-1.1e-."), + (StringTag("-1.1e-.1"), "-1.1e-.1"), + (StringTag("-1.1e-.1D"), "-1.1e-.1D"), + (StringTag("-1.1e-.1F"), "-1.1e-.1F"), + (StringTag("-1.1e-.1d"), "-1.1e-.1d"), + (StringTag("-1.1e-.1f"), "-1.1e-.1f"), + (StringTag("-1.1e-.D"), "-1.1e-.D"), + (StringTag("-1.1e-.F"), "-1.1e-.F"), + (StringTag("-1.1e-.d"), "-1.1e-.d"), + (StringTag("-1.1e-.f"), "-1.1e-.f"), (DoubleTag(-0.110000), "-1.1e-1"), - (StringTag('-1.1e-1.'), "-1.1e-1."), - (StringTag('-1.1e-1.1'), "-1.1e-1.1"), - (StringTag('-1.1e-1.1D'), "-1.1e-1.1D"), - (StringTag('-1.1e-1.1F'), "-1.1e-1.1F"), - (StringTag('-1.1e-1.1d'), "-1.1e-1.1d"), - (StringTag('-1.1e-1.1f'), "-1.1e-1.1f"), - (StringTag('-1.1e-1.D'), "-1.1e-1.D"), - (StringTag('-1.1e-1.F'), "-1.1e-1.F"), - (StringTag('-1.1e-1.d'), "-1.1e-1.d"), - (StringTag('-1.1e-1.f'), "-1.1e-1.f"), + (StringTag("-1.1e-1."), "-1.1e-1."), + (StringTag("-1.1e-1.1"), "-1.1e-1.1"), + (StringTag("-1.1e-1.1D"), "-1.1e-1.1D"), + (StringTag("-1.1e-1.1F"), "-1.1e-1.1F"), + (StringTag("-1.1e-1.1d"), "-1.1e-1.1d"), + (StringTag("-1.1e-1.1f"), "-1.1e-1.1f"), + (StringTag("-1.1e-1.D"), "-1.1e-1.D"), + (StringTag("-1.1e-1.F"), "-1.1e-1.F"), + (StringTag("-1.1e-1.d"), "-1.1e-1.d"), + (StringTag("-1.1e-1.f"), "-1.1e-1.f"), (DoubleTag(-0.110000), "-1.1e-1D"), (FloatTag(-0.110000), "-1.1e-1F"), (DoubleTag(-0.110000), "-1.1e-1d"), (FloatTag(-0.110000), "-1.1e-1f"), - (StringTag('-1.1e-D'), "-1.1e-D"), - (StringTag('-1.1e-F'), "-1.1e-F"), - (StringTag('-1.1e-d'), "-1.1e-d"), - (StringTag('-1.1e-f'), "-1.1e-f"), - (StringTag('-1.1e.'), "-1.1e."), - (StringTag('-1.1e.1'), "-1.1e.1"), - (StringTag('-1.1e.1D'), "-1.1e.1D"), - (StringTag('-1.1e.1F'), "-1.1e.1F"), - (StringTag('-1.1e.1d'), "-1.1e.1d"), - (StringTag('-1.1e.1f'), "-1.1e.1f"), - (StringTag('-1.1e.D'), "-1.1e.D"), - (StringTag('-1.1e.F'), "-1.1e.F"), - (StringTag('-1.1e.d'), "-1.1e.d"), - (StringTag('-1.1e.f'), "-1.1e.f"), + (StringTag("-1.1e-D"), "-1.1e-D"), + (StringTag("-1.1e-F"), "-1.1e-F"), + (StringTag("-1.1e-d"), "-1.1e-d"), + (StringTag("-1.1e-f"), "-1.1e-f"), + (StringTag("-1.1e."), "-1.1e."), + (StringTag("-1.1e.1"), "-1.1e.1"), + (StringTag("-1.1e.1D"), "-1.1e.1D"), + (StringTag("-1.1e.1F"), "-1.1e.1F"), + (StringTag("-1.1e.1d"), "-1.1e.1d"), + (StringTag("-1.1e.1f"), "-1.1e.1f"), + (StringTag("-1.1e.D"), "-1.1e.D"), + (StringTag("-1.1e.F"), "-1.1e.F"), + (StringTag("-1.1e.d"), "-1.1e.d"), + (StringTag("-1.1e.f"), "-1.1e.f"), (DoubleTag(-11.000000), "-1.1e1"), - (StringTag('-1.1e1.'), "-1.1e1."), - (StringTag('-1.1e1.1'), "-1.1e1.1"), - (StringTag('-1.1e1.1D'), "-1.1e1.1D"), - (StringTag('-1.1e1.1F'), "-1.1e1.1F"), - (StringTag('-1.1e1.1d'), "-1.1e1.1d"), - (StringTag('-1.1e1.1f'), "-1.1e1.1f"), - (StringTag('-1.1e1.D'), "-1.1e1.D"), - (StringTag('-1.1e1.F'), "-1.1e1.F"), - (StringTag('-1.1e1.d'), "-1.1e1.d"), - (StringTag('-1.1e1.f'), "-1.1e1.f"), + (StringTag("-1.1e1."), "-1.1e1."), + (StringTag("-1.1e1.1"), "-1.1e1.1"), + (StringTag("-1.1e1.1D"), "-1.1e1.1D"), + (StringTag("-1.1e1.1F"), "-1.1e1.1F"), + (StringTag("-1.1e1.1d"), "-1.1e1.1d"), + (StringTag("-1.1e1.1f"), "-1.1e1.1f"), + (StringTag("-1.1e1.D"), "-1.1e1.D"), + (StringTag("-1.1e1.F"), "-1.1e1.F"), + (StringTag("-1.1e1.d"), "-1.1e1.d"), + (StringTag("-1.1e1.f"), "-1.1e1.f"), (DoubleTag(-11.000000), "-1.1e1D"), (FloatTag(-11.000000), "-1.1e1F"), (DoubleTag(-11.000000), "-1.1e1d"), (FloatTag(-11.000000), "-1.1e1f"), - (StringTag('-1.1eD'), "-1.1eD"), - (StringTag('-1.1eF'), "-1.1eF"), - (StringTag('-1.1ed'), "-1.1ed"), - (StringTag('-1.1ef'), "-1.1ef"), + (StringTag("-1.1eD"), "-1.1eD"), + (StringTag("-1.1eF"), "-1.1eF"), + (StringTag("-1.1ed"), "-1.1ed"), + (StringTag("-1.1ef"), "-1.1ef"), (FloatTag(-1.100000), "-1.1f"), (DoubleTag(-1.000000), "-1.D"), - (StringTag('-1.E'), "-1.E"), - (StringTag('-1.E+'), "-1.E+"), - (StringTag('-1.E+.'), "-1.E+."), - (StringTag('-1.E+.1'), "-1.E+.1"), - (StringTag('-1.E+.1D'), "-1.E+.1D"), - (StringTag('-1.E+.1F'), "-1.E+.1F"), - (StringTag('-1.E+.1d'), "-1.E+.1d"), - (StringTag('-1.E+.1f'), "-1.E+.1f"), - (StringTag('-1.E+.D'), "-1.E+.D"), - (StringTag('-1.E+.F'), "-1.E+.F"), - (StringTag('-1.E+.d'), "-1.E+.d"), - (StringTag('-1.E+.f'), "-1.E+.f"), + (StringTag("-1.E"), "-1.E"), + (StringTag("-1.E+"), "-1.E+"), + (StringTag("-1.E+."), "-1.E+."), + (StringTag("-1.E+.1"), "-1.E+.1"), + (StringTag("-1.E+.1D"), "-1.E+.1D"), + (StringTag("-1.E+.1F"), "-1.E+.1F"), + (StringTag("-1.E+.1d"), "-1.E+.1d"), + (StringTag("-1.E+.1f"), "-1.E+.1f"), + (StringTag("-1.E+.D"), "-1.E+.D"), + (StringTag("-1.E+.F"), "-1.E+.F"), + (StringTag("-1.E+.d"), "-1.E+.d"), + (StringTag("-1.E+.f"), "-1.E+.f"), (DoubleTag(-10.000000), "-1.E+1"), - (StringTag('-1.E+1.'), "-1.E+1."), - (StringTag('-1.E+1.1'), "-1.E+1.1"), - (StringTag('-1.E+1.1D'), "-1.E+1.1D"), - (StringTag('-1.E+1.1F'), "-1.E+1.1F"), - (StringTag('-1.E+1.1d'), "-1.E+1.1d"), - (StringTag('-1.E+1.1f'), "-1.E+1.1f"), - (StringTag('-1.E+1.D'), "-1.E+1.D"), - (StringTag('-1.E+1.F'), "-1.E+1.F"), - (StringTag('-1.E+1.d'), "-1.E+1.d"), - (StringTag('-1.E+1.f'), "-1.E+1.f"), + (StringTag("-1.E+1."), "-1.E+1."), + (StringTag("-1.E+1.1"), "-1.E+1.1"), + (StringTag("-1.E+1.1D"), "-1.E+1.1D"), + (StringTag("-1.E+1.1F"), "-1.E+1.1F"), + (StringTag("-1.E+1.1d"), "-1.E+1.1d"), + (StringTag("-1.E+1.1f"), "-1.E+1.1f"), + (StringTag("-1.E+1.D"), "-1.E+1.D"), + (StringTag("-1.E+1.F"), "-1.E+1.F"), + (StringTag("-1.E+1.d"), "-1.E+1.d"), + (StringTag("-1.E+1.f"), "-1.E+1.f"), (DoubleTag(-10.000000), "-1.E+1D"), (FloatTag(-10.000000), "-1.E+1F"), (DoubleTag(-10.000000), "-1.E+1d"), (FloatTag(-10.000000), "-1.E+1f"), - (StringTag('-1.E+D'), "-1.E+D"), - (StringTag('-1.E+F'), "-1.E+F"), - (StringTag('-1.E+d'), "-1.E+d"), - (StringTag('-1.E+f'), "-1.E+f"), - (StringTag('-1.E-'), "-1.E-"), - (StringTag('-1.E-.'), "-1.E-."), - (StringTag('-1.E-.1'), "-1.E-.1"), - (StringTag('-1.E-.1D'), "-1.E-.1D"), - (StringTag('-1.E-.1F'), "-1.E-.1F"), - (StringTag('-1.E-.1d'), "-1.E-.1d"), - (StringTag('-1.E-.1f'), "-1.E-.1f"), - (StringTag('-1.E-.D'), "-1.E-.D"), - (StringTag('-1.E-.F'), "-1.E-.F"), - (StringTag('-1.E-.d'), "-1.E-.d"), - (StringTag('-1.E-.f'), "-1.E-.f"), + (StringTag("-1.E+D"), "-1.E+D"), + (StringTag("-1.E+F"), "-1.E+F"), + (StringTag("-1.E+d"), "-1.E+d"), + (StringTag("-1.E+f"), "-1.E+f"), + (StringTag("-1.E-"), "-1.E-"), + (StringTag("-1.E-."), "-1.E-."), + (StringTag("-1.E-.1"), "-1.E-.1"), + (StringTag("-1.E-.1D"), "-1.E-.1D"), + (StringTag("-1.E-.1F"), "-1.E-.1F"), + (StringTag("-1.E-.1d"), "-1.E-.1d"), + (StringTag("-1.E-.1f"), "-1.E-.1f"), + (StringTag("-1.E-.D"), "-1.E-.D"), + (StringTag("-1.E-.F"), "-1.E-.F"), + (StringTag("-1.E-.d"), "-1.E-.d"), + (StringTag("-1.E-.f"), "-1.E-.f"), (DoubleTag(-0.100000), "-1.E-1"), - (StringTag('-1.E-1.'), "-1.E-1."), - (StringTag('-1.E-1.1'), "-1.E-1.1"), - (StringTag('-1.E-1.1D'), "-1.E-1.1D"), - (StringTag('-1.E-1.1F'), "-1.E-1.1F"), - (StringTag('-1.E-1.1d'), "-1.E-1.1d"), - (StringTag('-1.E-1.1f'), "-1.E-1.1f"), - (StringTag('-1.E-1.D'), "-1.E-1.D"), - (StringTag('-1.E-1.F'), "-1.E-1.F"), - (StringTag('-1.E-1.d'), "-1.E-1.d"), - (StringTag('-1.E-1.f'), "-1.E-1.f"), + (StringTag("-1.E-1."), "-1.E-1."), + (StringTag("-1.E-1.1"), "-1.E-1.1"), + (StringTag("-1.E-1.1D"), "-1.E-1.1D"), + (StringTag("-1.E-1.1F"), "-1.E-1.1F"), + (StringTag("-1.E-1.1d"), "-1.E-1.1d"), + (StringTag("-1.E-1.1f"), "-1.E-1.1f"), + (StringTag("-1.E-1.D"), "-1.E-1.D"), + (StringTag("-1.E-1.F"), "-1.E-1.F"), + (StringTag("-1.E-1.d"), "-1.E-1.d"), + (StringTag("-1.E-1.f"), "-1.E-1.f"), (DoubleTag(-0.100000), "-1.E-1D"), (FloatTag(-0.100000), "-1.E-1F"), (DoubleTag(-0.100000), "-1.E-1d"), (FloatTag(-0.100000), "-1.E-1f"), - (StringTag('-1.E-D'), "-1.E-D"), - (StringTag('-1.E-F'), "-1.E-F"), - (StringTag('-1.E-d'), "-1.E-d"), - (StringTag('-1.E-f'), "-1.E-f"), - (StringTag('-1.E.'), "-1.E."), - (StringTag('-1.E.1'), "-1.E.1"), - (StringTag('-1.E.1D'), "-1.E.1D"), - (StringTag('-1.E.1F'), "-1.E.1F"), - (StringTag('-1.E.1d'), "-1.E.1d"), - (StringTag('-1.E.1f'), "-1.E.1f"), - (StringTag('-1.E.D'), "-1.E.D"), - (StringTag('-1.E.F'), "-1.E.F"), - (StringTag('-1.E.d'), "-1.E.d"), - (StringTag('-1.E.f'), "-1.E.f"), + (StringTag("-1.E-D"), "-1.E-D"), + (StringTag("-1.E-F"), "-1.E-F"), + (StringTag("-1.E-d"), "-1.E-d"), + (StringTag("-1.E-f"), "-1.E-f"), + (StringTag("-1.E."), "-1.E."), + (StringTag("-1.E.1"), "-1.E.1"), + (StringTag("-1.E.1D"), "-1.E.1D"), + (StringTag("-1.E.1F"), "-1.E.1F"), + (StringTag("-1.E.1d"), "-1.E.1d"), + (StringTag("-1.E.1f"), "-1.E.1f"), + (StringTag("-1.E.D"), "-1.E.D"), + (StringTag("-1.E.F"), "-1.E.F"), + (StringTag("-1.E.d"), "-1.E.d"), + (StringTag("-1.E.f"), "-1.E.f"), (DoubleTag(-10.000000), "-1.E1"), - (StringTag('-1.E1.'), "-1.E1."), - (StringTag('-1.E1.1'), "-1.E1.1"), - (StringTag('-1.E1.1D'), "-1.E1.1D"), - (StringTag('-1.E1.1F'), "-1.E1.1F"), - (StringTag('-1.E1.1d'), "-1.E1.1d"), - (StringTag('-1.E1.1f'), "-1.E1.1f"), - (StringTag('-1.E1.D'), "-1.E1.D"), - (StringTag('-1.E1.F'), "-1.E1.F"), - (StringTag('-1.E1.d'), "-1.E1.d"), - (StringTag('-1.E1.f'), "-1.E1.f"), + (StringTag("-1.E1."), "-1.E1."), + (StringTag("-1.E1.1"), "-1.E1.1"), + (StringTag("-1.E1.1D"), "-1.E1.1D"), + (StringTag("-1.E1.1F"), "-1.E1.1F"), + (StringTag("-1.E1.1d"), "-1.E1.1d"), + (StringTag("-1.E1.1f"), "-1.E1.1f"), + (StringTag("-1.E1.D"), "-1.E1.D"), + (StringTag("-1.E1.F"), "-1.E1.F"), + (StringTag("-1.E1.d"), "-1.E1.d"), + (StringTag("-1.E1.f"), "-1.E1.f"), (DoubleTag(-10.000000), "-1.E1D"), (FloatTag(-10.000000), "-1.E1F"), (DoubleTag(-10.000000), "-1.E1d"), (FloatTag(-10.000000), "-1.E1f"), - (StringTag('-1.ED'), "-1.ED"), - (StringTag('-1.EF'), "-1.EF"), - (StringTag('-1.Ed'), "-1.Ed"), - (StringTag('-1.Ef'), "-1.Ef"), + (StringTag("-1.ED"), "-1.ED"), + (StringTag("-1.EF"), "-1.EF"), + (StringTag("-1.Ed"), "-1.Ed"), + (StringTag("-1.Ef"), "-1.Ef"), (FloatTag(-1.000000), "-1.F"), (DoubleTag(-1.000000), "-1.d"), - (StringTag('-1.e'), "-1.e"), - (StringTag('-1.e+'), "-1.e+"), - (StringTag('-1.e+.'), "-1.e+."), - (StringTag('-1.e+.1'), "-1.e+.1"), - (StringTag('-1.e+.1D'), "-1.e+.1D"), - (StringTag('-1.e+.1F'), "-1.e+.1F"), - (StringTag('-1.e+.1d'), "-1.e+.1d"), - (StringTag('-1.e+.1f'), "-1.e+.1f"), - (StringTag('-1.e+.D'), "-1.e+.D"), - (StringTag('-1.e+.F'), "-1.e+.F"), - (StringTag('-1.e+.d'), "-1.e+.d"), - (StringTag('-1.e+.f'), "-1.e+.f"), + (StringTag("-1.e"), "-1.e"), + (StringTag("-1.e+"), "-1.e+"), + (StringTag("-1.e+."), "-1.e+."), + (StringTag("-1.e+.1"), "-1.e+.1"), + (StringTag("-1.e+.1D"), "-1.e+.1D"), + (StringTag("-1.e+.1F"), "-1.e+.1F"), + (StringTag("-1.e+.1d"), "-1.e+.1d"), + (StringTag("-1.e+.1f"), "-1.e+.1f"), + (StringTag("-1.e+.D"), "-1.e+.D"), + (StringTag("-1.e+.F"), "-1.e+.F"), + (StringTag("-1.e+.d"), "-1.e+.d"), + (StringTag("-1.e+.f"), "-1.e+.f"), (DoubleTag(-10.000000), "-1.e+1"), - (StringTag('-1.e+1.'), "-1.e+1."), - (StringTag('-1.e+1.1'), "-1.e+1.1"), - (StringTag('-1.e+1.1D'), "-1.e+1.1D"), - (StringTag('-1.e+1.1F'), "-1.e+1.1F"), - (StringTag('-1.e+1.1d'), "-1.e+1.1d"), - (StringTag('-1.e+1.1f'), "-1.e+1.1f"), - (StringTag('-1.e+1.D'), "-1.e+1.D"), - (StringTag('-1.e+1.F'), "-1.e+1.F"), - (StringTag('-1.e+1.d'), "-1.e+1.d"), - (StringTag('-1.e+1.f'), "-1.e+1.f"), + (StringTag("-1.e+1."), "-1.e+1."), + (StringTag("-1.e+1.1"), "-1.e+1.1"), + (StringTag("-1.e+1.1D"), "-1.e+1.1D"), + (StringTag("-1.e+1.1F"), "-1.e+1.1F"), + (StringTag("-1.e+1.1d"), "-1.e+1.1d"), + (StringTag("-1.e+1.1f"), "-1.e+1.1f"), + (StringTag("-1.e+1.D"), "-1.e+1.D"), + (StringTag("-1.e+1.F"), "-1.e+1.F"), + (StringTag("-1.e+1.d"), "-1.e+1.d"), + (StringTag("-1.e+1.f"), "-1.e+1.f"), (DoubleTag(-10.000000), "-1.e+1D"), (FloatTag(-10.000000), "-1.e+1F"), (DoubleTag(-10.000000), "-1.e+1d"), (FloatTag(-10.000000), "-1.e+1f"), - (StringTag('-1.e+D'), "-1.e+D"), - (StringTag('-1.e+F'), "-1.e+F"), - (StringTag('-1.e+d'), "-1.e+d"), - (StringTag('-1.e+f'), "-1.e+f"), - (StringTag('-1.e-'), "-1.e-"), - (StringTag('-1.e-.'), "-1.e-."), - (StringTag('-1.e-.1'), "-1.e-.1"), - (StringTag('-1.e-.1D'), "-1.e-.1D"), - (StringTag('-1.e-.1F'), "-1.e-.1F"), - (StringTag('-1.e-.1d'), "-1.e-.1d"), - (StringTag('-1.e-.1f'), "-1.e-.1f"), - (StringTag('-1.e-.D'), "-1.e-.D"), - (StringTag('-1.e-.F'), "-1.e-.F"), - (StringTag('-1.e-.d'), "-1.e-.d"), - (StringTag('-1.e-.f'), "-1.e-.f"), + (StringTag("-1.e+D"), "-1.e+D"), + (StringTag("-1.e+F"), "-1.e+F"), + (StringTag("-1.e+d"), "-1.e+d"), + (StringTag("-1.e+f"), "-1.e+f"), + (StringTag("-1.e-"), "-1.e-"), + (StringTag("-1.e-."), "-1.e-."), + (StringTag("-1.e-.1"), "-1.e-.1"), + (StringTag("-1.e-.1D"), "-1.e-.1D"), + (StringTag("-1.e-.1F"), "-1.e-.1F"), + (StringTag("-1.e-.1d"), "-1.e-.1d"), + (StringTag("-1.e-.1f"), "-1.e-.1f"), + (StringTag("-1.e-.D"), "-1.e-.D"), + (StringTag("-1.e-.F"), "-1.e-.F"), + (StringTag("-1.e-.d"), "-1.e-.d"), + (StringTag("-1.e-.f"), "-1.e-.f"), (DoubleTag(-0.100000), "-1.e-1"), - (StringTag('-1.e-1.'), "-1.e-1."), - (StringTag('-1.e-1.1'), "-1.e-1.1"), - (StringTag('-1.e-1.1D'), "-1.e-1.1D"), - (StringTag('-1.e-1.1F'), "-1.e-1.1F"), - (StringTag('-1.e-1.1d'), "-1.e-1.1d"), - (StringTag('-1.e-1.1f'), "-1.e-1.1f"), - (StringTag('-1.e-1.D'), "-1.e-1.D"), - (StringTag('-1.e-1.F'), "-1.e-1.F"), - (StringTag('-1.e-1.d'), "-1.e-1.d"), - (StringTag('-1.e-1.f'), "-1.e-1.f"), + (StringTag("-1.e-1."), "-1.e-1."), + (StringTag("-1.e-1.1"), "-1.e-1.1"), + (StringTag("-1.e-1.1D"), "-1.e-1.1D"), + (StringTag("-1.e-1.1F"), "-1.e-1.1F"), + (StringTag("-1.e-1.1d"), "-1.e-1.1d"), + (StringTag("-1.e-1.1f"), "-1.e-1.1f"), + (StringTag("-1.e-1.D"), "-1.e-1.D"), + (StringTag("-1.e-1.F"), "-1.e-1.F"), + (StringTag("-1.e-1.d"), "-1.e-1.d"), + (StringTag("-1.e-1.f"), "-1.e-1.f"), (DoubleTag(-0.100000), "-1.e-1D"), (FloatTag(-0.100000), "-1.e-1F"), (DoubleTag(-0.100000), "-1.e-1d"), (FloatTag(-0.100000), "-1.e-1f"), - (StringTag('-1.e-D'), "-1.e-D"), - (StringTag('-1.e-F'), "-1.e-F"), - (StringTag('-1.e-d'), "-1.e-d"), - (StringTag('-1.e-f'), "-1.e-f"), - (StringTag('-1.e.'), "-1.e."), - (StringTag('-1.e.1'), "-1.e.1"), - (StringTag('-1.e.1D'), "-1.e.1D"), - (StringTag('-1.e.1F'), "-1.e.1F"), - (StringTag('-1.e.1d'), "-1.e.1d"), - (StringTag('-1.e.1f'), "-1.e.1f"), - (StringTag('-1.e.D'), "-1.e.D"), - (StringTag('-1.e.F'), "-1.e.F"), - (StringTag('-1.e.d'), "-1.e.d"), - (StringTag('-1.e.f'), "-1.e.f"), + (StringTag("-1.e-D"), "-1.e-D"), + (StringTag("-1.e-F"), "-1.e-F"), + (StringTag("-1.e-d"), "-1.e-d"), + (StringTag("-1.e-f"), "-1.e-f"), + (StringTag("-1.e."), "-1.e."), + (StringTag("-1.e.1"), "-1.e.1"), + (StringTag("-1.e.1D"), "-1.e.1D"), + (StringTag("-1.e.1F"), "-1.e.1F"), + (StringTag("-1.e.1d"), "-1.e.1d"), + (StringTag("-1.e.1f"), "-1.e.1f"), + (StringTag("-1.e.D"), "-1.e.D"), + (StringTag("-1.e.F"), "-1.e.F"), + (StringTag("-1.e.d"), "-1.e.d"), + (StringTag("-1.e.f"), "-1.e.f"), (DoubleTag(-10.000000), "-1.e1"), - (StringTag('-1.e1.'), "-1.e1."), - (StringTag('-1.e1.1'), "-1.e1.1"), - (StringTag('-1.e1.1D'), "-1.e1.1D"), - (StringTag('-1.e1.1F'), "-1.e1.1F"), - (StringTag('-1.e1.1d'), "-1.e1.1d"), - (StringTag('-1.e1.1f'), "-1.e1.1f"), - (StringTag('-1.e1.D'), "-1.e1.D"), - (StringTag('-1.e1.F'), "-1.e1.F"), - (StringTag('-1.e1.d'), "-1.e1.d"), - (StringTag('-1.e1.f'), "-1.e1.f"), + (StringTag("-1.e1."), "-1.e1."), + (StringTag("-1.e1.1"), "-1.e1.1"), + (StringTag("-1.e1.1D"), "-1.e1.1D"), + (StringTag("-1.e1.1F"), "-1.e1.1F"), + (StringTag("-1.e1.1d"), "-1.e1.1d"), + (StringTag("-1.e1.1f"), "-1.e1.1f"), + (StringTag("-1.e1.D"), "-1.e1.D"), + (StringTag("-1.e1.F"), "-1.e1.F"), + (StringTag("-1.e1.d"), "-1.e1.d"), + (StringTag("-1.e1.f"), "-1.e1.f"), (DoubleTag(-10.000000), "-1.e1D"), (FloatTag(-10.000000), "-1.e1F"), (DoubleTag(-10.000000), "-1.e1d"), (FloatTag(-10.000000), "-1.e1f"), - (StringTag('-1.eD'), "-1.eD"), - (StringTag('-1.eF'), "-1.eF"), - (StringTag('-1.ed'), "-1.ed"), - (StringTag('-1.ef'), "-1.ef"), + (StringTag("-1.eD"), "-1.eD"), + (StringTag("-1.eF"), "-1.eF"), + (StringTag("-1.ed"), "-1.ed"), + (StringTag("-1.ef"), "-1.ef"), (FloatTag(-1.000000), "-1.f"), (IntTag(-11), "-11"), (DoubleTag(-11.000000), "-11."), @@ -3389,1483 +3388,1483 @@ def test_from_snbt(self) -> None: (DoubleTag(-11.000000), "-11d"), (FloatTag(-11.000000), "-11f"), (DoubleTag(-1.000000), "-1D"), - (StringTag('-1E'), "-1E"), - (StringTag('-1E+'), "-1E+"), - (StringTag('-1E+.'), "-1E+."), - (StringTag('-1E+.1'), "-1E+.1"), - (StringTag('-1E+.1D'), "-1E+.1D"), - (StringTag('-1E+.1F'), "-1E+.1F"), - (StringTag('-1E+.1d'), "-1E+.1d"), - (StringTag('-1E+.1f'), "-1E+.1f"), - (StringTag('-1E+.D'), "-1E+.D"), - (StringTag('-1E+.F'), "-1E+.F"), - (StringTag('-1E+.d'), "-1E+.d"), - (StringTag('-1E+.f'), "-1E+.f"), - (StringTag('-1E+1'), "-1E+1"), - (StringTag('-1E+1.'), "-1E+1."), - (StringTag('-1E+1.1'), "-1E+1.1"), - (StringTag('-1E+1.1D'), "-1E+1.1D"), - (StringTag('-1E+1.1F'), "-1E+1.1F"), - (StringTag('-1E+1.1d'), "-1E+1.1d"), - (StringTag('-1E+1.1f'), "-1E+1.1f"), - (StringTag('-1E+1.D'), "-1E+1.D"), - (StringTag('-1E+1.F'), "-1E+1.F"), - (StringTag('-1E+1.d'), "-1E+1.d"), - (StringTag('-1E+1.f'), "-1E+1.f"), + (StringTag("-1E"), "-1E"), + (StringTag("-1E+"), "-1E+"), + (StringTag("-1E+."), "-1E+."), + (StringTag("-1E+.1"), "-1E+.1"), + (StringTag("-1E+.1D"), "-1E+.1D"), + (StringTag("-1E+.1F"), "-1E+.1F"), + (StringTag("-1E+.1d"), "-1E+.1d"), + (StringTag("-1E+.1f"), "-1E+.1f"), + (StringTag("-1E+.D"), "-1E+.D"), + (StringTag("-1E+.F"), "-1E+.F"), + (StringTag("-1E+.d"), "-1E+.d"), + (StringTag("-1E+.f"), "-1E+.f"), + (StringTag("-1E+1"), "-1E+1"), + (StringTag("-1E+1."), "-1E+1."), + (StringTag("-1E+1.1"), "-1E+1.1"), + (StringTag("-1E+1.1D"), "-1E+1.1D"), + (StringTag("-1E+1.1F"), "-1E+1.1F"), + (StringTag("-1E+1.1d"), "-1E+1.1d"), + (StringTag("-1E+1.1f"), "-1E+1.1f"), + (StringTag("-1E+1.D"), "-1E+1.D"), + (StringTag("-1E+1.F"), "-1E+1.F"), + (StringTag("-1E+1.d"), "-1E+1.d"), + (StringTag("-1E+1.f"), "-1E+1.f"), (DoubleTag(-10.000000), "-1E+1D"), (FloatTag(-10.000000), "-1E+1F"), (DoubleTag(-10.000000), "-1E+1d"), (FloatTag(-10.000000), "-1E+1f"), - (StringTag('-1E+D'), "-1E+D"), - (StringTag('-1E+F'), "-1E+F"), - (StringTag('-1E+d'), "-1E+d"), - (StringTag('-1E+f'), "-1E+f"), - (StringTag('-1E-'), "-1E-"), - (StringTag('-1E-.'), "-1E-."), - (StringTag('-1E-.1'), "-1E-.1"), - (StringTag('-1E-.1D'), "-1E-.1D"), - (StringTag('-1E-.1F'), "-1E-.1F"), - (StringTag('-1E-.1d'), "-1E-.1d"), - (StringTag('-1E-.1f'), "-1E-.1f"), - (StringTag('-1E-.D'), "-1E-.D"), - (StringTag('-1E-.F'), "-1E-.F"), - (StringTag('-1E-.d'), "-1E-.d"), - (StringTag('-1E-.f'), "-1E-.f"), - (StringTag('-1E-1'), "-1E-1"), - (StringTag('-1E-1.'), "-1E-1."), - (StringTag('-1E-1.1'), "-1E-1.1"), - (StringTag('-1E-1.1D'), "-1E-1.1D"), - (StringTag('-1E-1.1F'), "-1E-1.1F"), - (StringTag('-1E-1.1d'), "-1E-1.1d"), - (StringTag('-1E-1.1f'), "-1E-1.1f"), - (StringTag('-1E-1.D'), "-1E-1.D"), - (StringTag('-1E-1.F'), "-1E-1.F"), - (StringTag('-1E-1.d'), "-1E-1.d"), - (StringTag('-1E-1.f'), "-1E-1.f"), + (StringTag("-1E+D"), "-1E+D"), + (StringTag("-1E+F"), "-1E+F"), + (StringTag("-1E+d"), "-1E+d"), + (StringTag("-1E+f"), "-1E+f"), + (StringTag("-1E-"), "-1E-"), + (StringTag("-1E-."), "-1E-."), + (StringTag("-1E-.1"), "-1E-.1"), + (StringTag("-1E-.1D"), "-1E-.1D"), + (StringTag("-1E-.1F"), "-1E-.1F"), + (StringTag("-1E-.1d"), "-1E-.1d"), + (StringTag("-1E-.1f"), "-1E-.1f"), + (StringTag("-1E-.D"), "-1E-.D"), + (StringTag("-1E-.F"), "-1E-.F"), + (StringTag("-1E-.d"), "-1E-.d"), + (StringTag("-1E-.f"), "-1E-.f"), + (StringTag("-1E-1"), "-1E-1"), + (StringTag("-1E-1."), "-1E-1."), + (StringTag("-1E-1.1"), "-1E-1.1"), + (StringTag("-1E-1.1D"), "-1E-1.1D"), + (StringTag("-1E-1.1F"), "-1E-1.1F"), + (StringTag("-1E-1.1d"), "-1E-1.1d"), + (StringTag("-1E-1.1f"), "-1E-1.1f"), + (StringTag("-1E-1.D"), "-1E-1.D"), + (StringTag("-1E-1.F"), "-1E-1.F"), + (StringTag("-1E-1.d"), "-1E-1.d"), + (StringTag("-1E-1.f"), "-1E-1.f"), (DoubleTag(-0.100000), "-1E-1D"), (FloatTag(-0.100000), "-1E-1F"), (DoubleTag(-0.100000), "-1E-1d"), (FloatTag(-0.100000), "-1E-1f"), - (StringTag('-1E-D'), "-1E-D"), - (StringTag('-1E-F'), "-1E-F"), - (StringTag('-1E-d'), "-1E-d"), - (StringTag('-1E-f'), "-1E-f"), - (StringTag('-1E.'), "-1E."), - (StringTag('-1E.1'), "-1E.1"), - (StringTag('-1E.1D'), "-1E.1D"), - (StringTag('-1E.1F'), "-1E.1F"), - (StringTag('-1E.1d'), "-1E.1d"), - (StringTag('-1E.1f'), "-1E.1f"), - (StringTag('-1E.D'), "-1E.D"), - (StringTag('-1E.F'), "-1E.F"), - (StringTag('-1E.d'), "-1E.d"), - (StringTag('-1E.f'), "-1E.f"), - (StringTag('-1E1'), "-1E1"), - (StringTag('-1E1.'), "-1E1."), - (StringTag('-1E1.1'), "-1E1.1"), - (StringTag('-1E1.1D'), "-1E1.1D"), - (StringTag('-1E1.1F'), "-1E1.1F"), - (StringTag('-1E1.1d'), "-1E1.1d"), - (StringTag('-1E1.1f'), "-1E1.1f"), - (StringTag('-1E1.D'), "-1E1.D"), - (StringTag('-1E1.F'), "-1E1.F"), - (StringTag('-1E1.d'), "-1E1.d"), - (StringTag('-1E1.f'), "-1E1.f"), + (StringTag("-1E-D"), "-1E-D"), + (StringTag("-1E-F"), "-1E-F"), + (StringTag("-1E-d"), "-1E-d"), + (StringTag("-1E-f"), "-1E-f"), + (StringTag("-1E."), "-1E."), + (StringTag("-1E.1"), "-1E.1"), + (StringTag("-1E.1D"), "-1E.1D"), + (StringTag("-1E.1F"), "-1E.1F"), + (StringTag("-1E.1d"), "-1E.1d"), + (StringTag("-1E.1f"), "-1E.1f"), + (StringTag("-1E.D"), "-1E.D"), + (StringTag("-1E.F"), "-1E.F"), + (StringTag("-1E.d"), "-1E.d"), + (StringTag("-1E.f"), "-1E.f"), + (StringTag("-1E1"), "-1E1"), + (StringTag("-1E1."), "-1E1."), + (StringTag("-1E1.1"), "-1E1.1"), + (StringTag("-1E1.1D"), "-1E1.1D"), + (StringTag("-1E1.1F"), "-1E1.1F"), + (StringTag("-1E1.1d"), "-1E1.1d"), + (StringTag("-1E1.1f"), "-1E1.1f"), + (StringTag("-1E1.D"), "-1E1.D"), + (StringTag("-1E1.F"), "-1E1.F"), + (StringTag("-1E1.d"), "-1E1.d"), + (StringTag("-1E1.f"), "-1E1.f"), (DoubleTag(-10.000000), "-1E1D"), (FloatTag(-10.000000), "-1E1F"), (DoubleTag(-10.000000), "-1E1d"), (FloatTag(-10.000000), "-1E1f"), - (StringTag('-1ED'), "-1ED"), - (StringTag('-1EF'), "-1EF"), - (StringTag('-1Ed'), "-1Ed"), - (StringTag('-1Ef'), "-1Ef"), + (StringTag("-1ED"), "-1ED"), + (StringTag("-1EF"), "-1EF"), + (StringTag("-1Ed"), "-1Ed"), + (StringTag("-1Ef"), "-1Ef"), (FloatTag(-1.000000), "-1F"), (DoubleTag(-1.000000), "-1d"), - (StringTag('-1e'), "-1e"), - (StringTag('-1e+'), "-1e+"), - (StringTag('-1e+.'), "-1e+."), - (StringTag('-1e+.1'), "-1e+.1"), - (StringTag('-1e+.1D'), "-1e+.1D"), - (StringTag('-1e+.1F'), "-1e+.1F"), - (StringTag('-1e+.1d'), "-1e+.1d"), - (StringTag('-1e+.1f'), "-1e+.1f"), - (StringTag('-1e+.D'), "-1e+.D"), - (StringTag('-1e+.F'), "-1e+.F"), - (StringTag('-1e+.d'), "-1e+.d"), - (StringTag('-1e+.f'), "-1e+.f"), - (StringTag('-1e+1'), "-1e+1"), - (StringTag('-1e+1.'), "-1e+1."), - (StringTag('-1e+1.1'), "-1e+1.1"), - (StringTag('-1e+1.1D'), "-1e+1.1D"), - (StringTag('-1e+1.1F'), "-1e+1.1F"), - (StringTag('-1e+1.1d'), "-1e+1.1d"), - (StringTag('-1e+1.1f'), "-1e+1.1f"), - (StringTag('-1e+1.D'), "-1e+1.D"), - (StringTag('-1e+1.F'), "-1e+1.F"), - (StringTag('-1e+1.d'), "-1e+1.d"), - (StringTag('-1e+1.f'), "-1e+1.f"), + (StringTag("-1e"), "-1e"), + (StringTag("-1e+"), "-1e+"), + (StringTag("-1e+."), "-1e+."), + (StringTag("-1e+.1"), "-1e+.1"), + (StringTag("-1e+.1D"), "-1e+.1D"), + (StringTag("-1e+.1F"), "-1e+.1F"), + (StringTag("-1e+.1d"), "-1e+.1d"), + (StringTag("-1e+.1f"), "-1e+.1f"), + (StringTag("-1e+.D"), "-1e+.D"), + (StringTag("-1e+.F"), "-1e+.F"), + (StringTag("-1e+.d"), "-1e+.d"), + (StringTag("-1e+.f"), "-1e+.f"), + (StringTag("-1e+1"), "-1e+1"), + (StringTag("-1e+1."), "-1e+1."), + (StringTag("-1e+1.1"), "-1e+1.1"), + (StringTag("-1e+1.1D"), "-1e+1.1D"), + (StringTag("-1e+1.1F"), "-1e+1.1F"), + (StringTag("-1e+1.1d"), "-1e+1.1d"), + (StringTag("-1e+1.1f"), "-1e+1.1f"), + (StringTag("-1e+1.D"), "-1e+1.D"), + (StringTag("-1e+1.F"), "-1e+1.F"), + (StringTag("-1e+1.d"), "-1e+1.d"), + (StringTag("-1e+1.f"), "-1e+1.f"), (DoubleTag(-10.000000), "-1e+1D"), (FloatTag(-10.000000), "-1e+1F"), (DoubleTag(-10.000000), "-1e+1d"), (FloatTag(-10.000000), "-1e+1f"), - (StringTag('-1e+D'), "-1e+D"), - (StringTag('-1e+F'), "-1e+F"), - (StringTag('-1e+d'), "-1e+d"), - (StringTag('-1e+f'), "-1e+f"), - (StringTag('-1e-'), "-1e-"), - (StringTag('-1e-.'), "-1e-."), - (StringTag('-1e-.1'), "-1e-.1"), - (StringTag('-1e-.1D'), "-1e-.1D"), - (StringTag('-1e-.1F'), "-1e-.1F"), - (StringTag('-1e-.1d'), "-1e-.1d"), - (StringTag('-1e-.1f'), "-1e-.1f"), - (StringTag('-1e-.D'), "-1e-.D"), - (StringTag('-1e-.F'), "-1e-.F"), - (StringTag('-1e-.d'), "-1e-.d"), - (StringTag('-1e-.f'), "-1e-.f"), - (StringTag('-1e-1'), "-1e-1"), - (StringTag('-1e-1.'), "-1e-1."), - (StringTag('-1e-1.1'), "-1e-1.1"), - (StringTag('-1e-1.1D'), "-1e-1.1D"), - (StringTag('-1e-1.1F'), "-1e-1.1F"), - (StringTag('-1e-1.1d'), "-1e-1.1d"), - (StringTag('-1e-1.1f'), "-1e-1.1f"), - (StringTag('-1e-1.D'), "-1e-1.D"), - (StringTag('-1e-1.F'), "-1e-1.F"), - (StringTag('-1e-1.d'), "-1e-1.d"), - (StringTag('-1e-1.f'), "-1e-1.f"), + (StringTag("-1e+D"), "-1e+D"), + (StringTag("-1e+F"), "-1e+F"), + (StringTag("-1e+d"), "-1e+d"), + (StringTag("-1e+f"), "-1e+f"), + (StringTag("-1e-"), "-1e-"), + (StringTag("-1e-."), "-1e-."), + (StringTag("-1e-.1"), "-1e-.1"), + (StringTag("-1e-.1D"), "-1e-.1D"), + (StringTag("-1e-.1F"), "-1e-.1F"), + (StringTag("-1e-.1d"), "-1e-.1d"), + (StringTag("-1e-.1f"), "-1e-.1f"), + (StringTag("-1e-.D"), "-1e-.D"), + (StringTag("-1e-.F"), "-1e-.F"), + (StringTag("-1e-.d"), "-1e-.d"), + (StringTag("-1e-.f"), "-1e-.f"), + (StringTag("-1e-1"), "-1e-1"), + (StringTag("-1e-1."), "-1e-1."), + (StringTag("-1e-1.1"), "-1e-1.1"), + (StringTag("-1e-1.1D"), "-1e-1.1D"), + (StringTag("-1e-1.1F"), "-1e-1.1F"), + (StringTag("-1e-1.1d"), "-1e-1.1d"), + (StringTag("-1e-1.1f"), "-1e-1.1f"), + (StringTag("-1e-1.D"), "-1e-1.D"), + (StringTag("-1e-1.F"), "-1e-1.F"), + (StringTag("-1e-1.d"), "-1e-1.d"), + (StringTag("-1e-1.f"), "-1e-1.f"), (DoubleTag(-0.100000), "-1e-1D"), (FloatTag(-0.100000), "-1e-1F"), (DoubleTag(-0.100000), "-1e-1d"), (FloatTag(-0.100000), "-1e-1f"), - (StringTag('-1e-D'), "-1e-D"), - (StringTag('-1e-F'), "-1e-F"), - (StringTag('-1e-d'), "-1e-d"), - (StringTag('-1e-f'), "-1e-f"), - (StringTag('-1e.'), "-1e."), - (StringTag('-1e.1'), "-1e.1"), - (StringTag('-1e.1D'), "-1e.1D"), - (StringTag('-1e.1F'), "-1e.1F"), - (StringTag('-1e.1d'), "-1e.1d"), - (StringTag('-1e.1f'), "-1e.1f"), - (StringTag('-1e.D'), "-1e.D"), - (StringTag('-1e.F'), "-1e.F"), - (StringTag('-1e.d'), "-1e.d"), - (StringTag('-1e.f'), "-1e.f"), - (StringTag('-1e1'), "-1e1"), - (StringTag('-1e1.'), "-1e1."), - (StringTag('-1e1.1'), "-1e1.1"), - (StringTag('-1e1.1D'), "-1e1.1D"), - (StringTag('-1e1.1F'), "-1e1.1F"), - (StringTag('-1e1.1d'), "-1e1.1d"), - (StringTag('-1e1.1f'), "-1e1.1f"), - (StringTag('-1e1.D'), "-1e1.D"), - (StringTag('-1e1.F'), "-1e1.F"), - (StringTag('-1e1.d'), "-1e1.d"), - (StringTag('-1e1.f'), "-1e1.f"), + (StringTag("-1e-D"), "-1e-D"), + (StringTag("-1e-F"), "-1e-F"), + (StringTag("-1e-d"), "-1e-d"), + (StringTag("-1e-f"), "-1e-f"), + (StringTag("-1e."), "-1e."), + (StringTag("-1e.1"), "-1e.1"), + (StringTag("-1e.1D"), "-1e.1D"), + (StringTag("-1e.1F"), "-1e.1F"), + (StringTag("-1e.1d"), "-1e.1d"), + (StringTag("-1e.1f"), "-1e.1f"), + (StringTag("-1e.D"), "-1e.D"), + (StringTag("-1e.F"), "-1e.F"), + (StringTag("-1e.d"), "-1e.d"), + (StringTag("-1e.f"), "-1e.f"), + (StringTag("-1e1"), "-1e1"), + (StringTag("-1e1."), "-1e1."), + (StringTag("-1e1.1"), "-1e1.1"), + (StringTag("-1e1.1D"), "-1e1.1D"), + (StringTag("-1e1.1F"), "-1e1.1F"), + (StringTag("-1e1.1d"), "-1e1.1d"), + (StringTag("-1e1.1f"), "-1e1.1f"), + (StringTag("-1e1.D"), "-1e1.D"), + (StringTag("-1e1.F"), "-1e1.F"), + (StringTag("-1e1.d"), "-1e1.d"), + (StringTag("-1e1.f"), "-1e1.f"), (DoubleTag(-10.000000), "-1e1D"), (FloatTag(-10.000000), "-1e1F"), (DoubleTag(-10.000000), "-1e1d"), (FloatTag(-10.000000), "-1e1f"), - (StringTag('-1eD'), "-1eD"), - (StringTag('-1eF'), "-1eF"), - (StringTag('-1ed'), "-1ed"), - (StringTag('-1ef'), "-1ef"), + (StringTag("-1eD"), "-1eD"), + (StringTag("-1eF"), "-1eF"), + (StringTag("-1ed"), "-1ed"), + (StringTag("-1ef"), "-1ef"), (FloatTag(-1.000000), "-1f"), - (StringTag('-D'), "-D"), - (StringTag('-E'), "-E"), - (StringTag('-E+'), "-E+"), - (StringTag('-E+.'), "-E+."), - (StringTag('-E+.1'), "-E+.1"), - (StringTag('-E+.1D'), "-E+.1D"), - (StringTag('-E+.1F'), "-E+.1F"), - (StringTag('-E+.1d'), "-E+.1d"), - (StringTag('-E+.1f'), "-E+.1f"), - (StringTag('-E+.D'), "-E+.D"), - (StringTag('-E+.F'), "-E+.F"), - (StringTag('-E+.d'), "-E+.d"), - (StringTag('-E+.f'), "-E+.f"), - (StringTag('-E+1'), "-E+1"), - (StringTag('-E+1.'), "-E+1."), - (StringTag('-E+1.1'), "-E+1.1"), - (StringTag('-E+1.1D'), "-E+1.1D"), - (StringTag('-E+1.1F'), "-E+1.1F"), - (StringTag('-E+1.1d'), "-E+1.1d"), - (StringTag('-E+1.1f'), "-E+1.1f"), - (StringTag('-E+1.D'), "-E+1.D"), - (StringTag('-E+1.F'), "-E+1.F"), - (StringTag('-E+1.d'), "-E+1.d"), - (StringTag('-E+1.f'), "-E+1.f"), - (StringTag('-E+1D'), "-E+1D"), - (StringTag('-E+1F'), "-E+1F"), - (StringTag('-E+1d'), "-E+1d"), - (StringTag('-E+1f'), "-E+1f"), - (StringTag('-E+D'), "-E+D"), - (StringTag('-E+F'), "-E+F"), - (StringTag('-E+d'), "-E+d"), - (StringTag('-E+f'), "-E+f"), - (StringTag('-E-'), "-E-"), - (StringTag('-E-.'), "-E-."), - (StringTag('-E-.1'), "-E-.1"), - (StringTag('-E-.1D'), "-E-.1D"), - (StringTag('-E-.1F'), "-E-.1F"), - (StringTag('-E-.1d'), "-E-.1d"), - (StringTag('-E-.1f'), "-E-.1f"), - (StringTag('-E-.D'), "-E-.D"), - (StringTag('-E-.F'), "-E-.F"), - (StringTag('-E-.d'), "-E-.d"), - (StringTag('-E-.f'), "-E-.f"), - (StringTag('-E-1'), "-E-1"), - (StringTag('-E-1.'), "-E-1."), - (StringTag('-E-1.1'), "-E-1.1"), - (StringTag('-E-1.1D'), "-E-1.1D"), - (StringTag('-E-1.1F'), "-E-1.1F"), - (StringTag('-E-1.1d'), "-E-1.1d"), - (StringTag('-E-1.1f'), "-E-1.1f"), - (StringTag('-E-1.D'), "-E-1.D"), - (StringTag('-E-1.F'), "-E-1.F"), - (StringTag('-E-1.d'), "-E-1.d"), - (StringTag('-E-1.f'), "-E-1.f"), - (StringTag('-E-1D'), "-E-1D"), - (StringTag('-E-1F'), "-E-1F"), - (StringTag('-E-1d'), "-E-1d"), - (StringTag('-E-1f'), "-E-1f"), - (StringTag('-E-D'), "-E-D"), - (StringTag('-E-F'), "-E-F"), - (StringTag('-E-d'), "-E-d"), - (StringTag('-E-f'), "-E-f"), - (StringTag('-E.'), "-E."), - (StringTag('-E.1'), "-E.1"), - (StringTag('-E.1D'), "-E.1D"), - (StringTag('-E.1F'), "-E.1F"), - (StringTag('-E.1d'), "-E.1d"), - (StringTag('-E.1f'), "-E.1f"), - (StringTag('-E.D'), "-E.D"), - (StringTag('-E.F'), "-E.F"), - (StringTag('-E.d'), "-E.d"), - (StringTag('-E.f'), "-E.f"), - (StringTag('-E1'), "-E1"), - (StringTag('-E1.'), "-E1."), - (StringTag('-E1.1'), "-E1.1"), - (StringTag('-E1.1D'), "-E1.1D"), - (StringTag('-E1.1F'), "-E1.1F"), - (StringTag('-E1.1d'), "-E1.1d"), - (StringTag('-E1.1f'), "-E1.1f"), - (StringTag('-E1.D'), "-E1.D"), - (StringTag('-E1.F'), "-E1.F"), - (StringTag('-E1.d'), "-E1.d"), - (StringTag('-E1.f'), "-E1.f"), - (StringTag('-E1D'), "-E1D"), - (StringTag('-E1F'), "-E1F"), - (StringTag('-E1d'), "-E1d"), - (StringTag('-E1f'), "-E1f"), - (StringTag('-ED'), "-ED"), - (StringTag('-EF'), "-EF"), - (StringTag('-Ed'), "-Ed"), - (StringTag('-Ef'), "-Ef"), - (StringTag('-F'), "-F"), - (StringTag('-d'), "-d"), - (StringTag('-e'), "-e"), - (StringTag('-e+'), "-e+"), - (StringTag('-e+.'), "-e+."), - (StringTag('-e+.1'), "-e+.1"), - (StringTag('-e+.1D'), "-e+.1D"), - (StringTag('-e+.1F'), "-e+.1F"), - (StringTag('-e+.1d'), "-e+.1d"), - (StringTag('-e+.1f'), "-e+.1f"), - (StringTag('-e+.D'), "-e+.D"), - (StringTag('-e+.F'), "-e+.F"), - (StringTag('-e+.d'), "-e+.d"), - (StringTag('-e+.f'), "-e+.f"), - (StringTag('-e+1'), "-e+1"), - (StringTag('-e+1.'), "-e+1."), - (StringTag('-e+1.1'), "-e+1.1"), - (StringTag('-e+1.1D'), "-e+1.1D"), - (StringTag('-e+1.1F'), "-e+1.1F"), - (StringTag('-e+1.1d'), "-e+1.1d"), - (StringTag('-e+1.1f'), "-e+1.1f"), - (StringTag('-e+1.D'), "-e+1.D"), - (StringTag('-e+1.F'), "-e+1.F"), - (StringTag('-e+1.d'), "-e+1.d"), - (StringTag('-e+1.f'), "-e+1.f"), - (StringTag('-e+1D'), "-e+1D"), - (StringTag('-e+1F'), "-e+1F"), - (StringTag('-e+1d'), "-e+1d"), - (StringTag('-e+1f'), "-e+1f"), - (StringTag('-e+D'), "-e+D"), - (StringTag('-e+F'), "-e+F"), - (StringTag('-e+d'), "-e+d"), - (StringTag('-e+f'), "-e+f"), - (StringTag('-e-'), "-e-"), - (StringTag('-e-.'), "-e-."), - (StringTag('-e-.1'), "-e-.1"), - (StringTag('-e-.1D'), "-e-.1D"), - (StringTag('-e-.1F'), "-e-.1F"), - (StringTag('-e-.1d'), "-e-.1d"), - (StringTag('-e-.1f'), "-e-.1f"), - (StringTag('-e-.D'), "-e-.D"), - (StringTag('-e-.F'), "-e-.F"), - (StringTag('-e-.d'), "-e-.d"), - (StringTag('-e-.f'), "-e-.f"), - (StringTag('-e-1'), "-e-1"), - (StringTag('-e-1.'), "-e-1."), - (StringTag('-e-1.1'), "-e-1.1"), - (StringTag('-e-1.1D'), "-e-1.1D"), - (StringTag('-e-1.1F'), "-e-1.1F"), - (StringTag('-e-1.1d'), "-e-1.1d"), - (StringTag('-e-1.1f'), "-e-1.1f"), - (StringTag('-e-1.D'), "-e-1.D"), - (StringTag('-e-1.F'), "-e-1.F"), - (StringTag('-e-1.d'), "-e-1.d"), - (StringTag('-e-1.f'), "-e-1.f"), - (StringTag('-e-1D'), "-e-1D"), - (StringTag('-e-1F'), "-e-1F"), - (StringTag('-e-1d'), "-e-1d"), - (StringTag('-e-1f'), "-e-1f"), - (StringTag('-e-D'), "-e-D"), - (StringTag('-e-F'), "-e-F"), - (StringTag('-e-d'), "-e-d"), - (StringTag('-e-f'), "-e-f"), - (StringTag('-e.'), "-e."), - (StringTag('-e.1'), "-e.1"), - (StringTag('-e.1D'), "-e.1D"), - (StringTag('-e.1F'), "-e.1F"), - (StringTag('-e.1d'), "-e.1d"), - (StringTag('-e.1f'), "-e.1f"), - (StringTag('-e.D'), "-e.D"), - (StringTag('-e.F'), "-e.F"), - (StringTag('-e.d'), "-e.d"), - (StringTag('-e.f'), "-e.f"), - (StringTag('-e1'), "-e1"), - (StringTag('-e1.'), "-e1."), - (StringTag('-e1.1'), "-e1.1"), - (StringTag('-e1.1D'), "-e1.1D"), - (StringTag('-e1.1F'), "-e1.1F"), - (StringTag('-e1.1d'), "-e1.1d"), - (StringTag('-e1.1f'), "-e1.1f"), - (StringTag('-e1.D'), "-e1.D"), - (StringTag('-e1.F'), "-e1.F"), - (StringTag('-e1.d'), "-e1.d"), - (StringTag('-e1.f'), "-e1.f"), - (StringTag('-e1D'), "-e1D"), - (StringTag('-e1F'), "-e1F"), - (StringTag('-e1d'), "-e1d"), - (StringTag('-e1f'), "-e1f"), - (StringTag('-eD'), "-eD"), - (StringTag('-eF'), "-eF"), - (StringTag('-ed'), "-ed"), - (StringTag('-ef'), "-ef"), - (StringTag('-f'), "-f"), - (StringTag('.'), "."), - (StringTag('.+'), ".+"), - (StringTag('.+.'), ".+."), - (StringTag('.+.1'), ".+.1"), - (StringTag('.+.1D'), ".+.1D"), - (StringTag('.+.1F'), ".+.1F"), - (StringTag('.+.1d'), ".+.1d"), - (StringTag('.+.1f'), ".+.1f"), - (StringTag('.+.D'), ".+.D"), - (StringTag('.+.F'), ".+.F"), - (StringTag('.+.d'), ".+.d"), - (StringTag('.+.f'), ".+.f"), - (StringTag('.+1'), ".+1"), - (StringTag('.+1.'), ".+1."), - (StringTag('.+1.1'), ".+1.1"), - (StringTag('.+1.1D'), ".+1.1D"), - (StringTag('.+1.1F'), ".+1.1F"), - (StringTag('.+1.1d'), ".+1.1d"), - (StringTag('.+1.1f'), ".+1.1f"), - (StringTag('.+1.D'), ".+1.D"), - (StringTag('.+1.F'), ".+1.F"), - (StringTag('.+1.d'), ".+1.d"), - (StringTag('.+1.f'), ".+1.f"), - (StringTag('.+1D'), ".+1D"), - (StringTag('.+1F'), ".+1F"), - (StringTag('.+1d'), ".+1d"), - (StringTag('.+1f'), ".+1f"), - (StringTag('.+D'), ".+D"), - (StringTag('.+F'), ".+F"), - (StringTag('.+d'), ".+d"), - (StringTag('.+f'), ".+f"), - (StringTag('.-'), ".-"), - (StringTag('.-.'), ".-."), - (StringTag('.-.1'), ".-.1"), - (StringTag('.-.1D'), ".-.1D"), - (StringTag('.-.1F'), ".-.1F"), - (StringTag('.-.1d'), ".-.1d"), - (StringTag('.-.1f'), ".-.1f"), - (StringTag('.-.D'), ".-.D"), - (StringTag('.-.F'), ".-.F"), - (StringTag('.-.d'), ".-.d"), - (StringTag('.-.f'), ".-.f"), - (StringTag('.-1'), ".-1"), - (StringTag('.-1.'), ".-1."), - (StringTag('.-1.1'), ".-1.1"), - (StringTag('.-1.1D'), ".-1.1D"), - (StringTag('.-1.1F'), ".-1.1F"), - (StringTag('.-1.1d'), ".-1.1d"), - (StringTag('.-1.1f'), ".-1.1f"), - (StringTag('.-1.D'), ".-1.D"), - (StringTag('.-1.F'), ".-1.F"), - (StringTag('.-1.d'), ".-1.d"), - (StringTag('.-1.f'), ".-1.f"), - (StringTag('.-1D'), ".-1D"), - (StringTag('.-1F'), ".-1F"), - (StringTag('.-1d'), ".-1d"), - (StringTag('.-1f'), ".-1f"), - (StringTag('.-D'), ".-D"), - (StringTag('.-F'), ".-F"), - (StringTag('.-d'), ".-d"), - (StringTag('.-f'), ".-f"), - (StringTag('..'), ".."), - (StringTag('..1'), "..1"), - (StringTag('..1D'), "..1D"), - (StringTag('..1F'), "..1F"), - (StringTag('..1d'), "..1d"), - (StringTag('..1f'), "..1f"), - (StringTag('..D'), "..D"), - (StringTag('..F'), "..F"), - (StringTag('..d'), "..d"), - (StringTag('..f'), "..f"), + (StringTag("-D"), "-D"), + (StringTag("-E"), "-E"), + (StringTag("-E+"), "-E+"), + (StringTag("-E+."), "-E+."), + (StringTag("-E+.1"), "-E+.1"), + (StringTag("-E+.1D"), "-E+.1D"), + (StringTag("-E+.1F"), "-E+.1F"), + (StringTag("-E+.1d"), "-E+.1d"), + (StringTag("-E+.1f"), "-E+.1f"), + (StringTag("-E+.D"), "-E+.D"), + (StringTag("-E+.F"), "-E+.F"), + (StringTag("-E+.d"), "-E+.d"), + (StringTag("-E+.f"), "-E+.f"), + (StringTag("-E+1"), "-E+1"), + (StringTag("-E+1."), "-E+1."), + (StringTag("-E+1.1"), "-E+1.1"), + (StringTag("-E+1.1D"), "-E+1.1D"), + (StringTag("-E+1.1F"), "-E+1.1F"), + (StringTag("-E+1.1d"), "-E+1.1d"), + (StringTag("-E+1.1f"), "-E+1.1f"), + (StringTag("-E+1.D"), "-E+1.D"), + (StringTag("-E+1.F"), "-E+1.F"), + (StringTag("-E+1.d"), "-E+1.d"), + (StringTag("-E+1.f"), "-E+1.f"), + (StringTag("-E+1D"), "-E+1D"), + (StringTag("-E+1F"), "-E+1F"), + (StringTag("-E+1d"), "-E+1d"), + (StringTag("-E+1f"), "-E+1f"), + (StringTag("-E+D"), "-E+D"), + (StringTag("-E+F"), "-E+F"), + (StringTag("-E+d"), "-E+d"), + (StringTag("-E+f"), "-E+f"), + (StringTag("-E-"), "-E-"), + (StringTag("-E-."), "-E-."), + (StringTag("-E-.1"), "-E-.1"), + (StringTag("-E-.1D"), "-E-.1D"), + (StringTag("-E-.1F"), "-E-.1F"), + (StringTag("-E-.1d"), "-E-.1d"), + (StringTag("-E-.1f"), "-E-.1f"), + (StringTag("-E-.D"), "-E-.D"), + (StringTag("-E-.F"), "-E-.F"), + (StringTag("-E-.d"), "-E-.d"), + (StringTag("-E-.f"), "-E-.f"), + (StringTag("-E-1"), "-E-1"), + (StringTag("-E-1."), "-E-1."), + (StringTag("-E-1.1"), "-E-1.1"), + (StringTag("-E-1.1D"), "-E-1.1D"), + (StringTag("-E-1.1F"), "-E-1.1F"), + (StringTag("-E-1.1d"), "-E-1.1d"), + (StringTag("-E-1.1f"), "-E-1.1f"), + (StringTag("-E-1.D"), "-E-1.D"), + (StringTag("-E-1.F"), "-E-1.F"), + (StringTag("-E-1.d"), "-E-1.d"), + (StringTag("-E-1.f"), "-E-1.f"), + (StringTag("-E-1D"), "-E-1D"), + (StringTag("-E-1F"), "-E-1F"), + (StringTag("-E-1d"), "-E-1d"), + (StringTag("-E-1f"), "-E-1f"), + (StringTag("-E-D"), "-E-D"), + (StringTag("-E-F"), "-E-F"), + (StringTag("-E-d"), "-E-d"), + (StringTag("-E-f"), "-E-f"), + (StringTag("-E."), "-E."), + (StringTag("-E.1"), "-E.1"), + (StringTag("-E.1D"), "-E.1D"), + (StringTag("-E.1F"), "-E.1F"), + (StringTag("-E.1d"), "-E.1d"), + (StringTag("-E.1f"), "-E.1f"), + (StringTag("-E.D"), "-E.D"), + (StringTag("-E.F"), "-E.F"), + (StringTag("-E.d"), "-E.d"), + (StringTag("-E.f"), "-E.f"), + (StringTag("-E1"), "-E1"), + (StringTag("-E1."), "-E1."), + (StringTag("-E1.1"), "-E1.1"), + (StringTag("-E1.1D"), "-E1.1D"), + (StringTag("-E1.1F"), "-E1.1F"), + (StringTag("-E1.1d"), "-E1.1d"), + (StringTag("-E1.1f"), "-E1.1f"), + (StringTag("-E1.D"), "-E1.D"), + (StringTag("-E1.F"), "-E1.F"), + (StringTag("-E1.d"), "-E1.d"), + (StringTag("-E1.f"), "-E1.f"), + (StringTag("-E1D"), "-E1D"), + (StringTag("-E1F"), "-E1F"), + (StringTag("-E1d"), "-E1d"), + (StringTag("-E1f"), "-E1f"), + (StringTag("-ED"), "-ED"), + (StringTag("-EF"), "-EF"), + (StringTag("-Ed"), "-Ed"), + (StringTag("-Ef"), "-Ef"), + (StringTag("-F"), "-F"), + (StringTag("-d"), "-d"), + (StringTag("-e"), "-e"), + (StringTag("-e+"), "-e+"), + (StringTag("-e+."), "-e+."), + (StringTag("-e+.1"), "-e+.1"), + (StringTag("-e+.1D"), "-e+.1D"), + (StringTag("-e+.1F"), "-e+.1F"), + (StringTag("-e+.1d"), "-e+.1d"), + (StringTag("-e+.1f"), "-e+.1f"), + (StringTag("-e+.D"), "-e+.D"), + (StringTag("-e+.F"), "-e+.F"), + (StringTag("-e+.d"), "-e+.d"), + (StringTag("-e+.f"), "-e+.f"), + (StringTag("-e+1"), "-e+1"), + (StringTag("-e+1."), "-e+1."), + (StringTag("-e+1.1"), "-e+1.1"), + (StringTag("-e+1.1D"), "-e+1.1D"), + (StringTag("-e+1.1F"), "-e+1.1F"), + (StringTag("-e+1.1d"), "-e+1.1d"), + (StringTag("-e+1.1f"), "-e+1.1f"), + (StringTag("-e+1.D"), "-e+1.D"), + (StringTag("-e+1.F"), "-e+1.F"), + (StringTag("-e+1.d"), "-e+1.d"), + (StringTag("-e+1.f"), "-e+1.f"), + (StringTag("-e+1D"), "-e+1D"), + (StringTag("-e+1F"), "-e+1F"), + (StringTag("-e+1d"), "-e+1d"), + (StringTag("-e+1f"), "-e+1f"), + (StringTag("-e+D"), "-e+D"), + (StringTag("-e+F"), "-e+F"), + (StringTag("-e+d"), "-e+d"), + (StringTag("-e+f"), "-e+f"), + (StringTag("-e-"), "-e-"), + (StringTag("-e-."), "-e-."), + (StringTag("-e-.1"), "-e-.1"), + (StringTag("-e-.1D"), "-e-.1D"), + (StringTag("-e-.1F"), "-e-.1F"), + (StringTag("-e-.1d"), "-e-.1d"), + (StringTag("-e-.1f"), "-e-.1f"), + (StringTag("-e-.D"), "-e-.D"), + (StringTag("-e-.F"), "-e-.F"), + (StringTag("-e-.d"), "-e-.d"), + (StringTag("-e-.f"), "-e-.f"), + (StringTag("-e-1"), "-e-1"), + (StringTag("-e-1."), "-e-1."), + (StringTag("-e-1.1"), "-e-1.1"), + (StringTag("-e-1.1D"), "-e-1.1D"), + (StringTag("-e-1.1F"), "-e-1.1F"), + (StringTag("-e-1.1d"), "-e-1.1d"), + (StringTag("-e-1.1f"), "-e-1.1f"), + (StringTag("-e-1.D"), "-e-1.D"), + (StringTag("-e-1.F"), "-e-1.F"), + (StringTag("-e-1.d"), "-e-1.d"), + (StringTag("-e-1.f"), "-e-1.f"), + (StringTag("-e-1D"), "-e-1D"), + (StringTag("-e-1F"), "-e-1F"), + (StringTag("-e-1d"), "-e-1d"), + (StringTag("-e-1f"), "-e-1f"), + (StringTag("-e-D"), "-e-D"), + (StringTag("-e-F"), "-e-F"), + (StringTag("-e-d"), "-e-d"), + (StringTag("-e-f"), "-e-f"), + (StringTag("-e."), "-e."), + (StringTag("-e.1"), "-e.1"), + (StringTag("-e.1D"), "-e.1D"), + (StringTag("-e.1F"), "-e.1F"), + (StringTag("-e.1d"), "-e.1d"), + (StringTag("-e.1f"), "-e.1f"), + (StringTag("-e.D"), "-e.D"), + (StringTag("-e.F"), "-e.F"), + (StringTag("-e.d"), "-e.d"), + (StringTag("-e.f"), "-e.f"), + (StringTag("-e1"), "-e1"), + (StringTag("-e1."), "-e1."), + (StringTag("-e1.1"), "-e1.1"), + (StringTag("-e1.1D"), "-e1.1D"), + (StringTag("-e1.1F"), "-e1.1F"), + (StringTag("-e1.1d"), "-e1.1d"), + (StringTag("-e1.1f"), "-e1.1f"), + (StringTag("-e1.D"), "-e1.D"), + (StringTag("-e1.F"), "-e1.F"), + (StringTag("-e1.d"), "-e1.d"), + (StringTag("-e1.f"), "-e1.f"), + (StringTag("-e1D"), "-e1D"), + (StringTag("-e1F"), "-e1F"), + (StringTag("-e1d"), "-e1d"), + (StringTag("-e1f"), "-e1f"), + (StringTag("-eD"), "-eD"), + (StringTag("-eF"), "-eF"), + (StringTag("-ed"), "-ed"), + (StringTag("-ef"), "-ef"), + (StringTag("-f"), "-f"), + (StringTag("."), "."), + (StringTag(".+"), ".+"), + (StringTag(".+."), ".+."), + (StringTag(".+.1"), ".+.1"), + (StringTag(".+.1D"), ".+.1D"), + (StringTag(".+.1F"), ".+.1F"), + (StringTag(".+.1d"), ".+.1d"), + (StringTag(".+.1f"), ".+.1f"), + (StringTag(".+.D"), ".+.D"), + (StringTag(".+.F"), ".+.F"), + (StringTag(".+.d"), ".+.d"), + (StringTag(".+.f"), ".+.f"), + (StringTag(".+1"), ".+1"), + (StringTag(".+1."), ".+1."), + (StringTag(".+1.1"), ".+1.1"), + (StringTag(".+1.1D"), ".+1.1D"), + (StringTag(".+1.1F"), ".+1.1F"), + (StringTag(".+1.1d"), ".+1.1d"), + (StringTag(".+1.1f"), ".+1.1f"), + (StringTag(".+1.D"), ".+1.D"), + (StringTag(".+1.F"), ".+1.F"), + (StringTag(".+1.d"), ".+1.d"), + (StringTag(".+1.f"), ".+1.f"), + (StringTag(".+1D"), ".+1D"), + (StringTag(".+1F"), ".+1F"), + (StringTag(".+1d"), ".+1d"), + (StringTag(".+1f"), ".+1f"), + (StringTag(".+D"), ".+D"), + (StringTag(".+F"), ".+F"), + (StringTag(".+d"), ".+d"), + (StringTag(".+f"), ".+f"), + (StringTag(".-"), ".-"), + (StringTag(".-."), ".-."), + (StringTag(".-.1"), ".-.1"), + (StringTag(".-.1D"), ".-.1D"), + (StringTag(".-.1F"), ".-.1F"), + (StringTag(".-.1d"), ".-.1d"), + (StringTag(".-.1f"), ".-.1f"), + (StringTag(".-.D"), ".-.D"), + (StringTag(".-.F"), ".-.F"), + (StringTag(".-.d"), ".-.d"), + (StringTag(".-.f"), ".-.f"), + (StringTag(".-1"), ".-1"), + (StringTag(".-1."), ".-1."), + (StringTag(".-1.1"), ".-1.1"), + (StringTag(".-1.1D"), ".-1.1D"), + (StringTag(".-1.1F"), ".-1.1F"), + (StringTag(".-1.1d"), ".-1.1d"), + (StringTag(".-1.1f"), ".-1.1f"), + (StringTag(".-1.D"), ".-1.D"), + (StringTag(".-1.F"), ".-1.F"), + (StringTag(".-1.d"), ".-1.d"), + (StringTag(".-1.f"), ".-1.f"), + (StringTag(".-1D"), ".-1D"), + (StringTag(".-1F"), ".-1F"), + (StringTag(".-1d"), ".-1d"), + (StringTag(".-1f"), ".-1f"), + (StringTag(".-D"), ".-D"), + (StringTag(".-F"), ".-F"), + (StringTag(".-d"), ".-d"), + (StringTag(".-f"), ".-f"), + (StringTag(".."), ".."), + (StringTag("..1"), "..1"), + (StringTag("..1D"), "..1D"), + (StringTag("..1F"), "..1F"), + (StringTag("..1d"), "..1d"), + (StringTag("..1f"), "..1f"), + (StringTag("..D"), "..D"), + (StringTag("..F"), "..F"), + (StringTag("..d"), "..d"), + (StringTag("..f"), "..f"), (DoubleTag(0.100000), ".1"), - (StringTag('.1+'), ".1+"), - (StringTag('.1+.'), ".1+."), - (StringTag('.1+.1'), ".1+.1"), - (StringTag('.1+.1D'), ".1+.1D"), - (StringTag('.1+.1F'), ".1+.1F"), - (StringTag('.1+.1d'), ".1+.1d"), - (StringTag('.1+.1f'), ".1+.1f"), - (StringTag('.1+.D'), ".1+.D"), - (StringTag('.1+.F'), ".1+.F"), - (StringTag('.1+.d'), ".1+.d"), - (StringTag('.1+.f'), ".1+.f"), - (StringTag('.1+1'), ".1+1"), - (StringTag('.1+1.'), ".1+1."), - (StringTag('.1+1.1'), ".1+1.1"), - (StringTag('.1+1.1D'), ".1+1.1D"), - (StringTag('.1+1.1F'), ".1+1.1F"), - (StringTag('.1+1.1d'), ".1+1.1d"), - (StringTag('.1+1.1f'), ".1+1.1f"), - (StringTag('.1+1.D'), ".1+1.D"), - (StringTag('.1+1.F'), ".1+1.F"), - (StringTag('.1+1.d'), ".1+1.d"), - (StringTag('.1+1.f'), ".1+1.f"), - (StringTag('.1+1D'), ".1+1D"), - (StringTag('.1+1F'), ".1+1F"), - (StringTag('.1+1d'), ".1+1d"), - (StringTag('.1+1f'), ".1+1f"), - (StringTag('.1+D'), ".1+D"), - (StringTag('.1+F'), ".1+F"), - (StringTag('.1+d'), ".1+d"), - (StringTag('.1+f'), ".1+f"), - (StringTag('.1-'), ".1-"), - (StringTag('.1-.'), ".1-."), - (StringTag('.1-.1'), ".1-.1"), - (StringTag('.1-.1D'), ".1-.1D"), - (StringTag('.1-.1F'), ".1-.1F"), - (StringTag('.1-.1d'), ".1-.1d"), - (StringTag('.1-.1f'), ".1-.1f"), - (StringTag('.1-.D'), ".1-.D"), - (StringTag('.1-.F'), ".1-.F"), - (StringTag('.1-.d'), ".1-.d"), - (StringTag('.1-.f'), ".1-.f"), - (StringTag('.1-1'), ".1-1"), - (StringTag('.1-1.'), ".1-1."), - (StringTag('.1-1.1'), ".1-1.1"), - (StringTag('.1-1.1D'), ".1-1.1D"), - (StringTag('.1-1.1F'), ".1-1.1F"), - (StringTag('.1-1.1d'), ".1-1.1d"), - (StringTag('.1-1.1f'), ".1-1.1f"), - (StringTag('.1-1.D'), ".1-1.D"), - (StringTag('.1-1.F'), ".1-1.F"), - (StringTag('.1-1.d'), ".1-1.d"), - (StringTag('.1-1.f'), ".1-1.f"), - (StringTag('.1-1D'), ".1-1D"), - (StringTag('.1-1F'), ".1-1F"), - (StringTag('.1-1d'), ".1-1d"), - (StringTag('.1-1f'), ".1-1f"), - (StringTag('.1-D'), ".1-D"), - (StringTag('.1-F'), ".1-F"), - (StringTag('.1-d'), ".1-d"), - (StringTag('.1-f'), ".1-f"), - (StringTag('.1.'), ".1."), - (StringTag('.1.1'), ".1.1"), - (StringTag('.1.1D'), ".1.1D"), - (StringTag('.1.1F'), ".1.1F"), - (StringTag('.1.1d'), ".1.1d"), - (StringTag('.1.1f'), ".1.1f"), - (StringTag('.1.D'), ".1.D"), - (StringTag('.1.F'), ".1.F"), - (StringTag('.1.d'), ".1.d"), - (StringTag('.1.f'), ".1.f"), + (StringTag(".1+"), ".1+"), + (StringTag(".1+."), ".1+."), + (StringTag(".1+.1"), ".1+.1"), + (StringTag(".1+.1D"), ".1+.1D"), + (StringTag(".1+.1F"), ".1+.1F"), + (StringTag(".1+.1d"), ".1+.1d"), + (StringTag(".1+.1f"), ".1+.1f"), + (StringTag(".1+.D"), ".1+.D"), + (StringTag(".1+.F"), ".1+.F"), + (StringTag(".1+.d"), ".1+.d"), + (StringTag(".1+.f"), ".1+.f"), + (StringTag(".1+1"), ".1+1"), + (StringTag(".1+1."), ".1+1."), + (StringTag(".1+1.1"), ".1+1.1"), + (StringTag(".1+1.1D"), ".1+1.1D"), + (StringTag(".1+1.1F"), ".1+1.1F"), + (StringTag(".1+1.1d"), ".1+1.1d"), + (StringTag(".1+1.1f"), ".1+1.1f"), + (StringTag(".1+1.D"), ".1+1.D"), + (StringTag(".1+1.F"), ".1+1.F"), + (StringTag(".1+1.d"), ".1+1.d"), + (StringTag(".1+1.f"), ".1+1.f"), + (StringTag(".1+1D"), ".1+1D"), + (StringTag(".1+1F"), ".1+1F"), + (StringTag(".1+1d"), ".1+1d"), + (StringTag(".1+1f"), ".1+1f"), + (StringTag(".1+D"), ".1+D"), + (StringTag(".1+F"), ".1+F"), + (StringTag(".1+d"), ".1+d"), + (StringTag(".1+f"), ".1+f"), + (StringTag(".1-"), ".1-"), + (StringTag(".1-."), ".1-."), + (StringTag(".1-.1"), ".1-.1"), + (StringTag(".1-.1D"), ".1-.1D"), + (StringTag(".1-.1F"), ".1-.1F"), + (StringTag(".1-.1d"), ".1-.1d"), + (StringTag(".1-.1f"), ".1-.1f"), + (StringTag(".1-.D"), ".1-.D"), + (StringTag(".1-.F"), ".1-.F"), + (StringTag(".1-.d"), ".1-.d"), + (StringTag(".1-.f"), ".1-.f"), + (StringTag(".1-1"), ".1-1"), + (StringTag(".1-1."), ".1-1."), + (StringTag(".1-1.1"), ".1-1.1"), + (StringTag(".1-1.1D"), ".1-1.1D"), + (StringTag(".1-1.1F"), ".1-1.1F"), + (StringTag(".1-1.1d"), ".1-1.1d"), + (StringTag(".1-1.1f"), ".1-1.1f"), + (StringTag(".1-1.D"), ".1-1.D"), + (StringTag(".1-1.F"), ".1-1.F"), + (StringTag(".1-1.d"), ".1-1.d"), + (StringTag(".1-1.f"), ".1-1.f"), + (StringTag(".1-1D"), ".1-1D"), + (StringTag(".1-1F"), ".1-1F"), + (StringTag(".1-1d"), ".1-1d"), + (StringTag(".1-1f"), ".1-1f"), + (StringTag(".1-D"), ".1-D"), + (StringTag(".1-F"), ".1-F"), + (StringTag(".1-d"), ".1-d"), + (StringTag(".1-f"), ".1-f"), + (StringTag(".1."), ".1."), + (StringTag(".1.1"), ".1.1"), + (StringTag(".1.1D"), ".1.1D"), + (StringTag(".1.1F"), ".1.1F"), + (StringTag(".1.1d"), ".1.1d"), + (StringTag(".1.1f"), ".1.1f"), + (StringTag(".1.D"), ".1.D"), + (StringTag(".1.F"), ".1.F"), + (StringTag(".1.d"), ".1.d"), + (StringTag(".1.f"), ".1.f"), (DoubleTag(0.110000), ".11"), - (StringTag('.11.'), ".11."), - (StringTag('.11.1'), ".11.1"), - (StringTag('.11.1D'), ".11.1D"), - (StringTag('.11.1F'), ".11.1F"), - (StringTag('.11.1d'), ".11.1d"), - (StringTag('.11.1f'), ".11.1f"), - (StringTag('.11.D'), ".11.D"), - (StringTag('.11.F'), ".11.F"), - (StringTag('.11.d'), ".11.d"), - (StringTag('.11.f'), ".11.f"), + (StringTag(".11."), ".11."), + (StringTag(".11.1"), ".11.1"), + (StringTag(".11.1D"), ".11.1D"), + (StringTag(".11.1F"), ".11.1F"), + (StringTag(".11.1d"), ".11.1d"), + (StringTag(".11.1f"), ".11.1f"), + (StringTag(".11.D"), ".11.D"), + (StringTag(".11.F"), ".11.F"), + (StringTag(".11.d"), ".11.d"), + (StringTag(".11.f"), ".11.f"), (DoubleTag(0.110000), ".11D"), (FloatTag(0.110000), ".11F"), (DoubleTag(0.110000), ".11d"), (FloatTag(0.110000), ".11f"), (DoubleTag(0.100000), ".1D"), - (StringTag('.1E'), ".1E"), - (StringTag('.1E+'), ".1E+"), - (StringTag('.1E+.'), ".1E+."), - (StringTag('.1E+.1'), ".1E+.1"), - (StringTag('.1E+.1D'), ".1E+.1D"), - (StringTag('.1E+.1F'), ".1E+.1F"), - (StringTag('.1E+.1d'), ".1E+.1d"), - (StringTag('.1E+.1f'), ".1E+.1f"), - (StringTag('.1E+.D'), ".1E+.D"), - (StringTag('.1E+.F'), ".1E+.F"), - (StringTag('.1E+.d'), ".1E+.d"), - (StringTag('.1E+.f'), ".1E+.f"), + (StringTag(".1E"), ".1E"), + (StringTag(".1E+"), ".1E+"), + (StringTag(".1E+."), ".1E+."), + (StringTag(".1E+.1"), ".1E+.1"), + (StringTag(".1E+.1D"), ".1E+.1D"), + (StringTag(".1E+.1F"), ".1E+.1F"), + (StringTag(".1E+.1d"), ".1E+.1d"), + (StringTag(".1E+.1f"), ".1E+.1f"), + (StringTag(".1E+.D"), ".1E+.D"), + (StringTag(".1E+.F"), ".1E+.F"), + (StringTag(".1E+.d"), ".1E+.d"), + (StringTag(".1E+.f"), ".1E+.f"), (DoubleTag(1.000000), ".1E+1"), - (StringTag('.1E+1.'), ".1E+1."), - (StringTag('.1E+1.1'), ".1E+1.1"), - (StringTag('.1E+1.1D'), ".1E+1.1D"), - (StringTag('.1E+1.1F'), ".1E+1.1F"), - (StringTag('.1E+1.1d'), ".1E+1.1d"), - (StringTag('.1E+1.1f'), ".1E+1.1f"), - (StringTag('.1E+1.D'), ".1E+1.D"), - (StringTag('.1E+1.F'), ".1E+1.F"), - (StringTag('.1E+1.d'), ".1E+1.d"), - (StringTag('.1E+1.f'), ".1E+1.f"), + (StringTag(".1E+1."), ".1E+1."), + (StringTag(".1E+1.1"), ".1E+1.1"), + (StringTag(".1E+1.1D"), ".1E+1.1D"), + (StringTag(".1E+1.1F"), ".1E+1.1F"), + (StringTag(".1E+1.1d"), ".1E+1.1d"), + (StringTag(".1E+1.1f"), ".1E+1.1f"), + (StringTag(".1E+1.D"), ".1E+1.D"), + (StringTag(".1E+1.F"), ".1E+1.F"), + (StringTag(".1E+1.d"), ".1E+1.d"), + (StringTag(".1E+1.f"), ".1E+1.f"), (DoubleTag(1.000000), ".1E+1D"), (FloatTag(1.000000), ".1E+1F"), (DoubleTag(1.000000), ".1E+1d"), (FloatTag(1.000000), ".1E+1f"), - (StringTag('.1E+D'), ".1E+D"), - (StringTag('.1E+F'), ".1E+F"), - (StringTag('.1E+d'), ".1E+d"), - (StringTag('.1E+f'), ".1E+f"), - (StringTag('.1E-'), ".1E-"), - (StringTag('.1E-.'), ".1E-."), - (StringTag('.1E-.1'), ".1E-.1"), - (StringTag('.1E-.1D'), ".1E-.1D"), - (StringTag('.1E-.1F'), ".1E-.1F"), - (StringTag('.1E-.1d'), ".1E-.1d"), - (StringTag('.1E-.1f'), ".1E-.1f"), - (StringTag('.1E-.D'), ".1E-.D"), - (StringTag('.1E-.F'), ".1E-.F"), - (StringTag('.1E-.d'), ".1E-.d"), - (StringTag('.1E-.f'), ".1E-.f"), + (StringTag(".1E+D"), ".1E+D"), + (StringTag(".1E+F"), ".1E+F"), + (StringTag(".1E+d"), ".1E+d"), + (StringTag(".1E+f"), ".1E+f"), + (StringTag(".1E-"), ".1E-"), + (StringTag(".1E-."), ".1E-."), + (StringTag(".1E-.1"), ".1E-.1"), + (StringTag(".1E-.1D"), ".1E-.1D"), + (StringTag(".1E-.1F"), ".1E-.1F"), + (StringTag(".1E-.1d"), ".1E-.1d"), + (StringTag(".1E-.1f"), ".1E-.1f"), + (StringTag(".1E-.D"), ".1E-.D"), + (StringTag(".1E-.F"), ".1E-.F"), + (StringTag(".1E-.d"), ".1E-.d"), + (StringTag(".1E-.f"), ".1E-.f"), (DoubleTag(0.010000), ".1E-1"), - (StringTag('.1E-1.'), ".1E-1."), - (StringTag('.1E-1.1'), ".1E-1.1"), - (StringTag('.1E-1.1D'), ".1E-1.1D"), - (StringTag('.1E-1.1F'), ".1E-1.1F"), - (StringTag('.1E-1.1d'), ".1E-1.1d"), - (StringTag('.1E-1.1f'), ".1E-1.1f"), - (StringTag('.1E-1.D'), ".1E-1.D"), - (StringTag('.1E-1.F'), ".1E-1.F"), - (StringTag('.1E-1.d'), ".1E-1.d"), - (StringTag('.1E-1.f'), ".1E-1.f"), + (StringTag(".1E-1."), ".1E-1."), + (StringTag(".1E-1.1"), ".1E-1.1"), + (StringTag(".1E-1.1D"), ".1E-1.1D"), + (StringTag(".1E-1.1F"), ".1E-1.1F"), + (StringTag(".1E-1.1d"), ".1E-1.1d"), + (StringTag(".1E-1.1f"), ".1E-1.1f"), + (StringTag(".1E-1.D"), ".1E-1.D"), + (StringTag(".1E-1.F"), ".1E-1.F"), + (StringTag(".1E-1.d"), ".1E-1.d"), + (StringTag(".1E-1.f"), ".1E-1.f"), (DoubleTag(0.010000), ".1E-1D"), (FloatTag(0.010000), ".1E-1F"), (DoubleTag(0.010000), ".1E-1d"), (FloatTag(0.010000), ".1E-1f"), - (StringTag('.1E-D'), ".1E-D"), - (StringTag('.1E-F'), ".1E-F"), - (StringTag('.1E-d'), ".1E-d"), - (StringTag('.1E-f'), ".1E-f"), - (StringTag('.1E.'), ".1E."), - (StringTag('.1E.1'), ".1E.1"), - (StringTag('.1E.1D'), ".1E.1D"), - (StringTag('.1E.1F'), ".1E.1F"), - (StringTag('.1E.1d'), ".1E.1d"), - (StringTag('.1E.1f'), ".1E.1f"), - (StringTag('.1E.D'), ".1E.D"), - (StringTag('.1E.F'), ".1E.F"), - (StringTag('.1E.d'), ".1E.d"), - (StringTag('.1E.f'), ".1E.f"), + (StringTag(".1E-D"), ".1E-D"), + (StringTag(".1E-F"), ".1E-F"), + (StringTag(".1E-d"), ".1E-d"), + (StringTag(".1E-f"), ".1E-f"), + (StringTag(".1E."), ".1E."), + (StringTag(".1E.1"), ".1E.1"), + (StringTag(".1E.1D"), ".1E.1D"), + (StringTag(".1E.1F"), ".1E.1F"), + (StringTag(".1E.1d"), ".1E.1d"), + (StringTag(".1E.1f"), ".1E.1f"), + (StringTag(".1E.D"), ".1E.D"), + (StringTag(".1E.F"), ".1E.F"), + (StringTag(".1E.d"), ".1E.d"), + (StringTag(".1E.f"), ".1E.f"), (DoubleTag(1.000000), ".1E1"), - (StringTag('.1E1.'), ".1E1."), - (StringTag('.1E1.1'), ".1E1.1"), - (StringTag('.1E1.1D'), ".1E1.1D"), - (StringTag('.1E1.1F'), ".1E1.1F"), - (StringTag('.1E1.1d'), ".1E1.1d"), - (StringTag('.1E1.1f'), ".1E1.1f"), - (StringTag('.1E1.D'), ".1E1.D"), - (StringTag('.1E1.F'), ".1E1.F"), - (StringTag('.1E1.d'), ".1E1.d"), - (StringTag('.1E1.f'), ".1E1.f"), + (StringTag(".1E1."), ".1E1."), + (StringTag(".1E1.1"), ".1E1.1"), + (StringTag(".1E1.1D"), ".1E1.1D"), + (StringTag(".1E1.1F"), ".1E1.1F"), + (StringTag(".1E1.1d"), ".1E1.1d"), + (StringTag(".1E1.1f"), ".1E1.1f"), + (StringTag(".1E1.D"), ".1E1.D"), + (StringTag(".1E1.F"), ".1E1.F"), + (StringTag(".1E1.d"), ".1E1.d"), + (StringTag(".1E1.f"), ".1E1.f"), (DoubleTag(1.000000), ".1E1D"), (FloatTag(1.000000), ".1E1F"), (DoubleTag(1.000000), ".1E1d"), (FloatTag(1.000000), ".1E1f"), - (StringTag('.1ED'), ".1ED"), - (StringTag('.1EF'), ".1EF"), - (StringTag('.1Ed'), ".1Ed"), - (StringTag('.1Ef'), ".1Ef"), + (StringTag(".1ED"), ".1ED"), + (StringTag(".1EF"), ".1EF"), + (StringTag(".1Ed"), ".1Ed"), + (StringTag(".1Ef"), ".1Ef"), (FloatTag(0.100000), ".1F"), (DoubleTag(0.100000), ".1d"), - (StringTag('.1e'), ".1e"), - (StringTag('.1e+'), ".1e+"), - (StringTag('.1e+.'), ".1e+."), - (StringTag('.1e+.1'), ".1e+.1"), - (StringTag('.1e+.1D'), ".1e+.1D"), - (StringTag('.1e+.1F'), ".1e+.1F"), - (StringTag('.1e+.1d'), ".1e+.1d"), - (StringTag('.1e+.1f'), ".1e+.1f"), - (StringTag('.1e+.D'), ".1e+.D"), - (StringTag('.1e+.F'), ".1e+.F"), - (StringTag('.1e+.d'), ".1e+.d"), - (StringTag('.1e+.f'), ".1e+.f"), + (StringTag(".1e"), ".1e"), + (StringTag(".1e+"), ".1e+"), + (StringTag(".1e+."), ".1e+."), + (StringTag(".1e+.1"), ".1e+.1"), + (StringTag(".1e+.1D"), ".1e+.1D"), + (StringTag(".1e+.1F"), ".1e+.1F"), + (StringTag(".1e+.1d"), ".1e+.1d"), + (StringTag(".1e+.1f"), ".1e+.1f"), + (StringTag(".1e+.D"), ".1e+.D"), + (StringTag(".1e+.F"), ".1e+.F"), + (StringTag(".1e+.d"), ".1e+.d"), + (StringTag(".1e+.f"), ".1e+.f"), (DoubleTag(1.000000), ".1e+1"), - (StringTag('.1e+1.'), ".1e+1."), - (StringTag('.1e+1.1'), ".1e+1.1"), - (StringTag('.1e+1.1D'), ".1e+1.1D"), - (StringTag('.1e+1.1F'), ".1e+1.1F"), - (StringTag('.1e+1.1d'), ".1e+1.1d"), - (StringTag('.1e+1.1f'), ".1e+1.1f"), - (StringTag('.1e+1.D'), ".1e+1.D"), - (StringTag('.1e+1.F'), ".1e+1.F"), - (StringTag('.1e+1.d'), ".1e+1.d"), - (StringTag('.1e+1.f'), ".1e+1.f"), + (StringTag(".1e+1."), ".1e+1."), + (StringTag(".1e+1.1"), ".1e+1.1"), + (StringTag(".1e+1.1D"), ".1e+1.1D"), + (StringTag(".1e+1.1F"), ".1e+1.1F"), + (StringTag(".1e+1.1d"), ".1e+1.1d"), + (StringTag(".1e+1.1f"), ".1e+1.1f"), + (StringTag(".1e+1.D"), ".1e+1.D"), + (StringTag(".1e+1.F"), ".1e+1.F"), + (StringTag(".1e+1.d"), ".1e+1.d"), + (StringTag(".1e+1.f"), ".1e+1.f"), (DoubleTag(1.000000), ".1e+1D"), (FloatTag(1.000000), ".1e+1F"), (DoubleTag(1.000000), ".1e+1d"), (FloatTag(1.000000), ".1e+1f"), - (StringTag('.1e+D'), ".1e+D"), - (StringTag('.1e+F'), ".1e+F"), - (StringTag('.1e+d'), ".1e+d"), - (StringTag('.1e+f'), ".1e+f"), - (StringTag('.1e-'), ".1e-"), - (StringTag('.1e-.'), ".1e-."), - (StringTag('.1e-.1'), ".1e-.1"), - (StringTag('.1e-.1D'), ".1e-.1D"), - (StringTag('.1e-.1F'), ".1e-.1F"), - (StringTag('.1e-.1d'), ".1e-.1d"), - (StringTag('.1e-.1f'), ".1e-.1f"), - (StringTag('.1e-.D'), ".1e-.D"), - (StringTag('.1e-.F'), ".1e-.F"), - (StringTag('.1e-.d'), ".1e-.d"), - (StringTag('.1e-.f'), ".1e-.f"), + (StringTag(".1e+D"), ".1e+D"), + (StringTag(".1e+F"), ".1e+F"), + (StringTag(".1e+d"), ".1e+d"), + (StringTag(".1e+f"), ".1e+f"), + (StringTag(".1e-"), ".1e-"), + (StringTag(".1e-."), ".1e-."), + (StringTag(".1e-.1"), ".1e-.1"), + (StringTag(".1e-.1D"), ".1e-.1D"), + (StringTag(".1e-.1F"), ".1e-.1F"), + (StringTag(".1e-.1d"), ".1e-.1d"), + (StringTag(".1e-.1f"), ".1e-.1f"), + (StringTag(".1e-.D"), ".1e-.D"), + (StringTag(".1e-.F"), ".1e-.F"), + (StringTag(".1e-.d"), ".1e-.d"), + (StringTag(".1e-.f"), ".1e-.f"), (DoubleTag(0.010000), ".1e-1"), - (StringTag('.1e-1.'), ".1e-1."), - (StringTag('.1e-1.1'), ".1e-1.1"), - (StringTag('.1e-1.1D'), ".1e-1.1D"), - (StringTag('.1e-1.1F'), ".1e-1.1F"), - (StringTag('.1e-1.1d'), ".1e-1.1d"), - (StringTag('.1e-1.1f'), ".1e-1.1f"), - (StringTag('.1e-1.D'), ".1e-1.D"), - (StringTag('.1e-1.F'), ".1e-1.F"), - (StringTag('.1e-1.d'), ".1e-1.d"), - (StringTag('.1e-1.f'), ".1e-1.f"), + (StringTag(".1e-1."), ".1e-1."), + (StringTag(".1e-1.1"), ".1e-1.1"), + (StringTag(".1e-1.1D"), ".1e-1.1D"), + (StringTag(".1e-1.1F"), ".1e-1.1F"), + (StringTag(".1e-1.1d"), ".1e-1.1d"), + (StringTag(".1e-1.1f"), ".1e-1.1f"), + (StringTag(".1e-1.D"), ".1e-1.D"), + (StringTag(".1e-1.F"), ".1e-1.F"), + (StringTag(".1e-1.d"), ".1e-1.d"), + (StringTag(".1e-1.f"), ".1e-1.f"), (DoubleTag(0.010000), ".1e-1D"), (FloatTag(0.010000), ".1e-1F"), (DoubleTag(0.010000), ".1e-1d"), (FloatTag(0.010000), ".1e-1f"), - (StringTag('.1e-D'), ".1e-D"), - (StringTag('.1e-F'), ".1e-F"), - (StringTag('.1e-d'), ".1e-d"), - (StringTag('.1e-f'), ".1e-f"), - (StringTag('.1e.'), ".1e."), - (StringTag('.1e.1'), ".1e.1"), - (StringTag('.1e.1D'), ".1e.1D"), - (StringTag('.1e.1F'), ".1e.1F"), - (StringTag('.1e.1d'), ".1e.1d"), - (StringTag('.1e.1f'), ".1e.1f"), - (StringTag('.1e.D'), ".1e.D"), - (StringTag('.1e.F'), ".1e.F"), - (StringTag('.1e.d'), ".1e.d"), - (StringTag('.1e.f'), ".1e.f"), + (StringTag(".1e-D"), ".1e-D"), + (StringTag(".1e-F"), ".1e-F"), + (StringTag(".1e-d"), ".1e-d"), + (StringTag(".1e-f"), ".1e-f"), + (StringTag(".1e."), ".1e."), + (StringTag(".1e.1"), ".1e.1"), + (StringTag(".1e.1D"), ".1e.1D"), + (StringTag(".1e.1F"), ".1e.1F"), + (StringTag(".1e.1d"), ".1e.1d"), + (StringTag(".1e.1f"), ".1e.1f"), + (StringTag(".1e.D"), ".1e.D"), + (StringTag(".1e.F"), ".1e.F"), + (StringTag(".1e.d"), ".1e.d"), + (StringTag(".1e.f"), ".1e.f"), (DoubleTag(1.000000), ".1e1"), - (StringTag('.1e1.'), ".1e1."), - (StringTag('.1e1.1'), ".1e1.1"), - (StringTag('.1e1.1D'), ".1e1.1D"), - (StringTag('.1e1.1F'), ".1e1.1F"), - (StringTag('.1e1.1d'), ".1e1.1d"), - (StringTag('.1e1.1f'), ".1e1.1f"), - (StringTag('.1e1.D'), ".1e1.D"), - (StringTag('.1e1.F'), ".1e1.F"), - (StringTag('.1e1.d'), ".1e1.d"), - (StringTag('.1e1.f'), ".1e1.f"), + (StringTag(".1e1."), ".1e1."), + (StringTag(".1e1.1"), ".1e1.1"), + (StringTag(".1e1.1D"), ".1e1.1D"), + (StringTag(".1e1.1F"), ".1e1.1F"), + (StringTag(".1e1.1d"), ".1e1.1d"), + (StringTag(".1e1.1f"), ".1e1.1f"), + (StringTag(".1e1.D"), ".1e1.D"), + (StringTag(".1e1.F"), ".1e1.F"), + (StringTag(".1e1.d"), ".1e1.d"), + (StringTag(".1e1.f"), ".1e1.f"), (DoubleTag(1.000000), ".1e1D"), (FloatTag(1.000000), ".1e1F"), (DoubleTag(1.000000), ".1e1d"), (FloatTag(1.000000), ".1e1f"), - (StringTag('.1eD'), ".1eD"), - (StringTag('.1eF'), ".1eF"), - (StringTag('.1ed'), ".1ed"), - (StringTag('.1ef'), ".1ef"), + (StringTag(".1eD"), ".1eD"), + (StringTag(".1eF"), ".1eF"), + (StringTag(".1ed"), ".1ed"), + (StringTag(".1ef"), ".1ef"), (FloatTag(0.100000), ".1f"), - (StringTag('.D'), ".D"), - (StringTag('.E'), ".E"), - (StringTag('.E+'), ".E+"), - (StringTag('.E+.'), ".E+."), - (StringTag('.E+.1'), ".E+.1"), - (StringTag('.E+.1D'), ".E+.1D"), - (StringTag('.E+.1F'), ".E+.1F"), - (StringTag('.E+.1d'), ".E+.1d"), - (StringTag('.E+.1f'), ".E+.1f"), - (StringTag('.E+.D'), ".E+.D"), - (StringTag('.E+.F'), ".E+.F"), - (StringTag('.E+.d'), ".E+.d"), - (StringTag('.E+.f'), ".E+.f"), - (StringTag('.E+1'), ".E+1"), - (StringTag('.E+1.'), ".E+1."), - (StringTag('.E+1.1'), ".E+1.1"), - (StringTag('.E+1.1D'), ".E+1.1D"), - (StringTag('.E+1.1F'), ".E+1.1F"), - (StringTag('.E+1.1d'), ".E+1.1d"), - (StringTag('.E+1.1f'), ".E+1.1f"), - (StringTag('.E+1.D'), ".E+1.D"), - (StringTag('.E+1.F'), ".E+1.F"), - (StringTag('.E+1.d'), ".E+1.d"), - (StringTag('.E+1.f'), ".E+1.f"), - (StringTag('.E+1D'), ".E+1D"), - (StringTag('.E+1F'), ".E+1F"), - (StringTag('.E+1d'), ".E+1d"), - (StringTag('.E+1f'), ".E+1f"), - (StringTag('.E+D'), ".E+D"), - (StringTag('.E+F'), ".E+F"), - (StringTag('.E+d'), ".E+d"), - (StringTag('.E+f'), ".E+f"), - (StringTag('.E-'), ".E-"), - (StringTag('.E-.'), ".E-."), - (StringTag('.E-.1'), ".E-.1"), - (StringTag('.E-.1D'), ".E-.1D"), - (StringTag('.E-.1F'), ".E-.1F"), - (StringTag('.E-.1d'), ".E-.1d"), - (StringTag('.E-.1f'), ".E-.1f"), - (StringTag('.E-.D'), ".E-.D"), - (StringTag('.E-.F'), ".E-.F"), - (StringTag('.E-.d'), ".E-.d"), - (StringTag('.E-.f'), ".E-.f"), - (StringTag('.E-1'), ".E-1"), - (StringTag('.E-1.'), ".E-1."), - (StringTag('.E-1.1'), ".E-1.1"), - (StringTag('.E-1.1D'), ".E-1.1D"), - (StringTag('.E-1.1F'), ".E-1.1F"), - (StringTag('.E-1.1d'), ".E-1.1d"), - (StringTag('.E-1.1f'), ".E-1.1f"), - (StringTag('.E-1.D'), ".E-1.D"), - (StringTag('.E-1.F'), ".E-1.F"), - (StringTag('.E-1.d'), ".E-1.d"), - (StringTag('.E-1.f'), ".E-1.f"), - (StringTag('.E-1D'), ".E-1D"), - (StringTag('.E-1F'), ".E-1F"), - (StringTag('.E-1d'), ".E-1d"), - (StringTag('.E-1f'), ".E-1f"), - (StringTag('.E-D'), ".E-D"), - (StringTag('.E-F'), ".E-F"), - (StringTag('.E-d'), ".E-d"), - (StringTag('.E-f'), ".E-f"), - (StringTag('.E.'), ".E."), - (StringTag('.E.1'), ".E.1"), - (StringTag('.E.1D'), ".E.1D"), - (StringTag('.E.1F'), ".E.1F"), - (StringTag('.E.1d'), ".E.1d"), - (StringTag('.E.1f'), ".E.1f"), - (StringTag('.E.D'), ".E.D"), - (StringTag('.E.F'), ".E.F"), - (StringTag('.E.d'), ".E.d"), - (StringTag('.E.f'), ".E.f"), - (StringTag('.E1'), ".E1"), - (StringTag('.E1.'), ".E1."), - (StringTag('.E1.1'), ".E1.1"), - (StringTag('.E1.1D'), ".E1.1D"), - (StringTag('.E1.1F'), ".E1.1F"), - (StringTag('.E1.1d'), ".E1.1d"), - (StringTag('.E1.1f'), ".E1.1f"), - (StringTag('.E1.D'), ".E1.D"), - (StringTag('.E1.F'), ".E1.F"), - (StringTag('.E1.d'), ".E1.d"), - (StringTag('.E1.f'), ".E1.f"), - (StringTag('.E1D'), ".E1D"), - (StringTag('.E1F'), ".E1F"), - (StringTag('.E1d'), ".E1d"), - (StringTag('.E1f'), ".E1f"), - (StringTag('.ED'), ".ED"), - (StringTag('.EF'), ".EF"), - (StringTag('.Ed'), ".Ed"), - (StringTag('.Ef'), ".Ef"), - (StringTag('.F'), ".F"), - (StringTag('.d'), ".d"), - (StringTag('.e'), ".e"), - (StringTag('.e+'), ".e+"), - (StringTag('.e+.'), ".e+."), - (StringTag('.e+.1'), ".e+.1"), - (StringTag('.e+.1D'), ".e+.1D"), - (StringTag('.e+.1F'), ".e+.1F"), - (StringTag('.e+.1d'), ".e+.1d"), - (StringTag('.e+.1f'), ".e+.1f"), - (StringTag('.e+.D'), ".e+.D"), - (StringTag('.e+.F'), ".e+.F"), - (StringTag('.e+.d'), ".e+.d"), - (StringTag('.e+.f'), ".e+.f"), - (StringTag('.e+1'), ".e+1"), - (StringTag('.e+1.'), ".e+1."), - (StringTag('.e+1.1'), ".e+1.1"), - (StringTag('.e+1.1D'), ".e+1.1D"), - (StringTag('.e+1.1F'), ".e+1.1F"), - (StringTag('.e+1.1d'), ".e+1.1d"), - (StringTag('.e+1.1f'), ".e+1.1f"), - (StringTag('.e+1.D'), ".e+1.D"), - (StringTag('.e+1.F'), ".e+1.F"), - (StringTag('.e+1.d'), ".e+1.d"), - (StringTag('.e+1.f'), ".e+1.f"), - (StringTag('.e+1D'), ".e+1D"), - (StringTag('.e+1F'), ".e+1F"), - (StringTag('.e+1d'), ".e+1d"), - (StringTag('.e+1f'), ".e+1f"), - (StringTag('.e+D'), ".e+D"), - (StringTag('.e+F'), ".e+F"), - (StringTag('.e+d'), ".e+d"), - (StringTag('.e+f'), ".e+f"), - (StringTag('.e-'), ".e-"), - (StringTag('.e-.'), ".e-."), - (StringTag('.e-.1'), ".e-.1"), - (StringTag('.e-.1D'), ".e-.1D"), - (StringTag('.e-.1F'), ".e-.1F"), - (StringTag('.e-.1d'), ".e-.1d"), - (StringTag('.e-.1f'), ".e-.1f"), - (StringTag('.e-.D'), ".e-.D"), - (StringTag('.e-.F'), ".e-.F"), - (StringTag('.e-.d'), ".e-.d"), - (StringTag('.e-.f'), ".e-.f"), - (StringTag('.e-1'), ".e-1"), - (StringTag('.e-1.'), ".e-1."), - (StringTag('.e-1.1'), ".e-1.1"), - (StringTag('.e-1.1D'), ".e-1.1D"), - (StringTag('.e-1.1F'), ".e-1.1F"), - (StringTag('.e-1.1d'), ".e-1.1d"), - (StringTag('.e-1.1f'), ".e-1.1f"), - (StringTag('.e-1.D'), ".e-1.D"), - (StringTag('.e-1.F'), ".e-1.F"), - (StringTag('.e-1.d'), ".e-1.d"), - (StringTag('.e-1.f'), ".e-1.f"), - (StringTag('.e-1D'), ".e-1D"), - (StringTag('.e-1F'), ".e-1F"), - (StringTag('.e-1d'), ".e-1d"), - (StringTag('.e-1f'), ".e-1f"), - (StringTag('.e-D'), ".e-D"), - (StringTag('.e-F'), ".e-F"), - (StringTag('.e-d'), ".e-d"), - (StringTag('.e-f'), ".e-f"), - (StringTag('.e.'), ".e."), - (StringTag('.e.1'), ".e.1"), - (StringTag('.e.1D'), ".e.1D"), - (StringTag('.e.1F'), ".e.1F"), - (StringTag('.e.1d'), ".e.1d"), - (StringTag('.e.1f'), ".e.1f"), - (StringTag('.e.D'), ".e.D"), - (StringTag('.e.F'), ".e.F"), - (StringTag('.e.d'), ".e.d"), - (StringTag('.e.f'), ".e.f"), - (StringTag('.e1'), ".e1"), - (StringTag('.e1.'), ".e1."), - (StringTag('.e1.1'), ".e1.1"), - (StringTag('.e1.1D'), ".e1.1D"), - (StringTag('.e1.1F'), ".e1.1F"), - (StringTag('.e1.1d'), ".e1.1d"), - (StringTag('.e1.1f'), ".e1.1f"), - (StringTag('.e1.D'), ".e1.D"), - (StringTag('.e1.F'), ".e1.F"), - (StringTag('.e1.d'), ".e1.d"), - (StringTag('.e1.f'), ".e1.f"), - (StringTag('.e1D'), ".e1D"), - (StringTag('.e1F'), ".e1F"), - (StringTag('.e1d'), ".e1d"), - (StringTag('.e1f'), ".e1f"), - (StringTag('.eD'), ".eD"), - (StringTag('.eF'), ".eF"), - (StringTag('.ed'), ".ed"), - (StringTag('.ef'), ".ef"), - (StringTag('.f'), ".f"), + (StringTag(".D"), ".D"), + (StringTag(".E"), ".E"), + (StringTag(".E+"), ".E+"), + (StringTag(".E+."), ".E+."), + (StringTag(".E+.1"), ".E+.1"), + (StringTag(".E+.1D"), ".E+.1D"), + (StringTag(".E+.1F"), ".E+.1F"), + (StringTag(".E+.1d"), ".E+.1d"), + (StringTag(".E+.1f"), ".E+.1f"), + (StringTag(".E+.D"), ".E+.D"), + (StringTag(".E+.F"), ".E+.F"), + (StringTag(".E+.d"), ".E+.d"), + (StringTag(".E+.f"), ".E+.f"), + (StringTag(".E+1"), ".E+1"), + (StringTag(".E+1."), ".E+1."), + (StringTag(".E+1.1"), ".E+1.1"), + (StringTag(".E+1.1D"), ".E+1.1D"), + (StringTag(".E+1.1F"), ".E+1.1F"), + (StringTag(".E+1.1d"), ".E+1.1d"), + (StringTag(".E+1.1f"), ".E+1.1f"), + (StringTag(".E+1.D"), ".E+1.D"), + (StringTag(".E+1.F"), ".E+1.F"), + (StringTag(".E+1.d"), ".E+1.d"), + (StringTag(".E+1.f"), ".E+1.f"), + (StringTag(".E+1D"), ".E+1D"), + (StringTag(".E+1F"), ".E+1F"), + (StringTag(".E+1d"), ".E+1d"), + (StringTag(".E+1f"), ".E+1f"), + (StringTag(".E+D"), ".E+D"), + (StringTag(".E+F"), ".E+F"), + (StringTag(".E+d"), ".E+d"), + (StringTag(".E+f"), ".E+f"), + (StringTag(".E-"), ".E-"), + (StringTag(".E-."), ".E-."), + (StringTag(".E-.1"), ".E-.1"), + (StringTag(".E-.1D"), ".E-.1D"), + (StringTag(".E-.1F"), ".E-.1F"), + (StringTag(".E-.1d"), ".E-.1d"), + (StringTag(".E-.1f"), ".E-.1f"), + (StringTag(".E-.D"), ".E-.D"), + (StringTag(".E-.F"), ".E-.F"), + (StringTag(".E-.d"), ".E-.d"), + (StringTag(".E-.f"), ".E-.f"), + (StringTag(".E-1"), ".E-1"), + (StringTag(".E-1."), ".E-1."), + (StringTag(".E-1.1"), ".E-1.1"), + (StringTag(".E-1.1D"), ".E-1.1D"), + (StringTag(".E-1.1F"), ".E-1.1F"), + (StringTag(".E-1.1d"), ".E-1.1d"), + (StringTag(".E-1.1f"), ".E-1.1f"), + (StringTag(".E-1.D"), ".E-1.D"), + (StringTag(".E-1.F"), ".E-1.F"), + (StringTag(".E-1.d"), ".E-1.d"), + (StringTag(".E-1.f"), ".E-1.f"), + (StringTag(".E-1D"), ".E-1D"), + (StringTag(".E-1F"), ".E-1F"), + (StringTag(".E-1d"), ".E-1d"), + (StringTag(".E-1f"), ".E-1f"), + (StringTag(".E-D"), ".E-D"), + (StringTag(".E-F"), ".E-F"), + (StringTag(".E-d"), ".E-d"), + (StringTag(".E-f"), ".E-f"), + (StringTag(".E."), ".E."), + (StringTag(".E.1"), ".E.1"), + (StringTag(".E.1D"), ".E.1D"), + (StringTag(".E.1F"), ".E.1F"), + (StringTag(".E.1d"), ".E.1d"), + (StringTag(".E.1f"), ".E.1f"), + (StringTag(".E.D"), ".E.D"), + (StringTag(".E.F"), ".E.F"), + (StringTag(".E.d"), ".E.d"), + (StringTag(".E.f"), ".E.f"), + (StringTag(".E1"), ".E1"), + (StringTag(".E1."), ".E1."), + (StringTag(".E1.1"), ".E1.1"), + (StringTag(".E1.1D"), ".E1.1D"), + (StringTag(".E1.1F"), ".E1.1F"), + (StringTag(".E1.1d"), ".E1.1d"), + (StringTag(".E1.1f"), ".E1.1f"), + (StringTag(".E1.D"), ".E1.D"), + (StringTag(".E1.F"), ".E1.F"), + (StringTag(".E1.d"), ".E1.d"), + (StringTag(".E1.f"), ".E1.f"), + (StringTag(".E1D"), ".E1D"), + (StringTag(".E1F"), ".E1F"), + (StringTag(".E1d"), ".E1d"), + (StringTag(".E1f"), ".E1f"), + (StringTag(".ED"), ".ED"), + (StringTag(".EF"), ".EF"), + (StringTag(".Ed"), ".Ed"), + (StringTag(".Ef"), ".Ef"), + (StringTag(".F"), ".F"), + (StringTag(".d"), ".d"), + (StringTag(".e"), ".e"), + (StringTag(".e+"), ".e+"), + (StringTag(".e+."), ".e+."), + (StringTag(".e+.1"), ".e+.1"), + (StringTag(".e+.1D"), ".e+.1D"), + (StringTag(".e+.1F"), ".e+.1F"), + (StringTag(".e+.1d"), ".e+.1d"), + (StringTag(".e+.1f"), ".e+.1f"), + (StringTag(".e+.D"), ".e+.D"), + (StringTag(".e+.F"), ".e+.F"), + (StringTag(".e+.d"), ".e+.d"), + (StringTag(".e+.f"), ".e+.f"), + (StringTag(".e+1"), ".e+1"), + (StringTag(".e+1."), ".e+1."), + (StringTag(".e+1.1"), ".e+1.1"), + (StringTag(".e+1.1D"), ".e+1.1D"), + (StringTag(".e+1.1F"), ".e+1.1F"), + (StringTag(".e+1.1d"), ".e+1.1d"), + (StringTag(".e+1.1f"), ".e+1.1f"), + (StringTag(".e+1.D"), ".e+1.D"), + (StringTag(".e+1.F"), ".e+1.F"), + (StringTag(".e+1.d"), ".e+1.d"), + (StringTag(".e+1.f"), ".e+1.f"), + (StringTag(".e+1D"), ".e+1D"), + (StringTag(".e+1F"), ".e+1F"), + (StringTag(".e+1d"), ".e+1d"), + (StringTag(".e+1f"), ".e+1f"), + (StringTag(".e+D"), ".e+D"), + (StringTag(".e+F"), ".e+F"), + (StringTag(".e+d"), ".e+d"), + (StringTag(".e+f"), ".e+f"), + (StringTag(".e-"), ".e-"), + (StringTag(".e-."), ".e-."), + (StringTag(".e-.1"), ".e-.1"), + (StringTag(".e-.1D"), ".e-.1D"), + (StringTag(".e-.1F"), ".e-.1F"), + (StringTag(".e-.1d"), ".e-.1d"), + (StringTag(".e-.1f"), ".e-.1f"), + (StringTag(".e-.D"), ".e-.D"), + (StringTag(".e-.F"), ".e-.F"), + (StringTag(".e-.d"), ".e-.d"), + (StringTag(".e-.f"), ".e-.f"), + (StringTag(".e-1"), ".e-1"), + (StringTag(".e-1."), ".e-1."), + (StringTag(".e-1.1"), ".e-1.1"), + (StringTag(".e-1.1D"), ".e-1.1D"), + (StringTag(".e-1.1F"), ".e-1.1F"), + (StringTag(".e-1.1d"), ".e-1.1d"), + (StringTag(".e-1.1f"), ".e-1.1f"), + (StringTag(".e-1.D"), ".e-1.D"), + (StringTag(".e-1.F"), ".e-1.F"), + (StringTag(".e-1.d"), ".e-1.d"), + (StringTag(".e-1.f"), ".e-1.f"), + (StringTag(".e-1D"), ".e-1D"), + (StringTag(".e-1F"), ".e-1F"), + (StringTag(".e-1d"), ".e-1d"), + (StringTag(".e-1f"), ".e-1f"), + (StringTag(".e-D"), ".e-D"), + (StringTag(".e-F"), ".e-F"), + (StringTag(".e-d"), ".e-d"), + (StringTag(".e-f"), ".e-f"), + (StringTag(".e."), ".e."), + (StringTag(".e.1"), ".e.1"), + (StringTag(".e.1D"), ".e.1D"), + (StringTag(".e.1F"), ".e.1F"), + (StringTag(".e.1d"), ".e.1d"), + (StringTag(".e.1f"), ".e.1f"), + (StringTag(".e.D"), ".e.D"), + (StringTag(".e.F"), ".e.F"), + (StringTag(".e.d"), ".e.d"), + (StringTag(".e.f"), ".e.f"), + (StringTag(".e1"), ".e1"), + (StringTag(".e1."), ".e1."), + (StringTag(".e1.1"), ".e1.1"), + (StringTag(".e1.1D"), ".e1.1D"), + (StringTag(".e1.1F"), ".e1.1F"), + (StringTag(".e1.1d"), ".e1.1d"), + (StringTag(".e1.1f"), ".e1.1f"), + (StringTag(".e1.D"), ".e1.D"), + (StringTag(".e1.F"), ".e1.F"), + (StringTag(".e1.d"), ".e1.d"), + (StringTag(".e1.f"), ".e1.f"), + (StringTag(".e1D"), ".e1D"), + (StringTag(".e1F"), ".e1F"), + (StringTag(".e1d"), ".e1d"), + (StringTag(".e1f"), ".e1f"), + (StringTag(".eD"), ".eD"), + (StringTag(".eF"), ".eF"), + (StringTag(".ed"), ".ed"), + (StringTag(".ef"), ".ef"), + (StringTag(".f"), ".f"), (IntTag(1), "1"), - (StringTag('1+'), "1+"), - (StringTag('1+.'), "1+."), - (StringTag('1+.1'), "1+.1"), - (StringTag('1+.1D'), "1+.1D"), - (StringTag('1+.1F'), "1+.1F"), - (StringTag('1+.1d'), "1+.1d"), - (StringTag('1+.1f'), "1+.1f"), - (StringTag('1+.D'), "1+.D"), - (StringTag('1+.F'), "1+.F"), - (StringTag('1+.d'), "1+.d"), - (StringTag('1+.f'), "1+.f"), - (StringTag('1+1'), "1+1"), - (StringTag('1+1.'), "1+1."), - (StringTag('1+1.1'), "1+1.1"), - (StringTag('1+1.1D'), "1+1.1D"), - (StringTag('1+1.1F'), "1+1.1F"), - (StringTag('1+1.1d'), "1+1.1d"), - (StringTag('1+1.1f'), "1+1.1f"), - (StringTag('1+1.D'), "1+1.D"), - (StringTag('1+1.F'), "1+1.F"), - (StringTag('1+1.d'), "1+1.d"), - (StringTag('1+1.f'), "1+1.f"), - (StringTag('1+1D'), "1+1D"), - (StringTag('1+1F'), "1+1F"), - (StringTag('1+1d'), "1+1d"), - (StringTag('1+1f'), "1+1f"), - (StringTag('1+D'), "1+D"), - (StringTag('1+F'), "1+F"), - (StringTag('1+d'), "1+d"), - (StringTag('1+f'), "1+f"), - (StringTag('1-'), "1-"), - (StringTag('1-.'), "1-."), - (StringTag('1-.1'), "1-.1"), - (StringTag('1-.1D'), "1-.1D"), - (StringTag('1-.1F'), "1-.1F"), - (StringTag('1-.1d'), "1-.1d"), - (StringTag('1-.1f'), "1-.1f"), - (StringTag('1-.D'), "1-.D"), - (StringTag('1-.F'), "1-.F"), - (StringTag('1-.d'), "1-.d"), - (StringTag('1-.f'), "1-.f"), - (StringTag('1-1'), "1-1"), - (StringTag('1-1.'), "1-1."), - (StringTag('1-1.1'), "1-1.1"), - (StringTag('1-1.1D'), "1-1.1D"), - (StringTag('1-1.1F'), "1-1.1F"), - (StringTag('1-1.1d'), "1-1.1d"), - (StringTag('1-1.1f'), "1-1.1f"), - (StringTag('1-1.D'), "1-1.D"), - (StringTag('1-1.F'), "1-1.F"), - (StringTag('1-1.d'), "1-1.d"), - (StringTag('1-1.f'), "1-1.f"), - (StringTag('1-1D'), "1-1D"), - (StringTag('1-1F'), "1-1F"), - (StringTag('1-1d'), "1-1d"), - (StringTag('1-1f'), "1-1f"), - (StringTag('1-D'), "1-D"), - (StringTag('1-F'), "1-F"), - (StringTag('1-d'), "1-d"), - (StringTag('1-f'), "1-f"), + (StringTag("1+"), "1+"), + (StringTag("1+."), "1+."), + (StringTag("1+.1"), "1+.1"), + (StringTag("1+.1D"), "1+.1D"), + (StringTag("1+.1F"), "1+.1F"), + (StringTag("1+.1d"), "1+.1d"), + (StringTag("1+.1f"), "1+.1f"), + (StringTag("1+.D"), "1+.D"), + (StringTag("1+.F"), "1+.F"), + (StringTag("1+.d"), "1+.d"), + (StringTag("1+.f"), "1+.f"), + (StringTag("1+1"), "1+1"), + (StringTag("1+1."), "1+1."), + (StringTag("1+1.1"), "1+1.1"), + (StringTag("1+1.1D"), "1+1.1D"), + (StringTag("1+1.1F"), "1+1.1F"), + (StringTag("1+1.1d"), "1+1.1d"), + (StringTag("1+1.1f"), "1+1.1f"), + (StringTag("1+1.D"), "1+1.D"), + (StringTag("1+1.F"), "1+1.F"), + (StringTag("1+1.d"), "1+1.d"), + (StringTag("1+1.f"), "1+1.f"), + (StringTag("1+1D"), "1+1D"), + (StringTag("1+1F"), "1+1F"), + (StringTag("1+1d"), "1+1d"), + (StringTag("1+1f"), "1+1f"), + (StringTag("1+D"), "1+D"), + (StringTag("1+F"), "1+F"), + (StringTag("1+d"), "1+d"), + (StringTag("1+f"), "1+f"), + (StringTag("1-"), "1-"), + (StringTag("1-."), "1-."), + (StringTag("1-.1"), "1-.1"), + (StringTag("1-.1D"), "1-.1D"), + (StringTag("1-.1F"), "1-.1F"), + (StringTag("1-.1d"), "1-.1d"), + (StringTag("1-.1f"), "1-.1f"), + (StringTag("1-.D"), "1-.D"), + (StringTag("1-.F"), "1-.F"), + (StringTag("1-.d"), "1-.d"), + (StringTag("1-.f"), "1-.f"), + (StringTag("1-1"), "1-1"), + (StringTag("1-1."), "1-1."), + (StringTag("1-1.1"), "1-1.1"), + (StringTag("1-1.1D"), "1-1.1D"), + (StringTag("1-1.1F"), "1-1.1F"), + (StringTag("1-1.1d"), "1-1.1d"), + (StringTag("1-1.1f"), "1-1.1f"), + (StringTag("1-1.D"), "1-1.D"), + (StringTag("1-1.F"), "1-1.F"), + (StringTag("1-1.d"), "1-1.d"), + (StringTag("1-1.f"), "1-1.f"), + (StringTag("1-1D"), "1-1D"), + (StringTag("1-1F"), "1-1F"), + (StringTag("1-1d"), "1-1d"), + (StringTag("1-1f"), "1-1f"), + (StringTag("1-D"), "1-D"), + (StringTag("1-F"), "1-F"), + (StringTag("1-d"), "1-d"), + (StringTag("1-f"), "1-f"), (DoubleTag(1.000000), "1."), - (StringTag('1.+'), "1.+"), - (StringTag('1.+.'), "1.+."), - (StringTag('1.+.1'), "1.+.1"), - (StringTag('1.+.1D'), "1.+.1D"), - (StringTag('1.+.1F'), "1.+.1F"), - (StringTag('1.+.1d'), "1.+.1d"), - (StringTag('1.+.1f'), "1.+.1f"), - (StringTag('1.+.D'), "1.+.D"), - (StringTag('1.+.F'), "1.+.F"), - (StringTag('1.+.d'), "1.+.d"), - (StringTag('1.+.f'), "1.+.f"), - (StringTag('1.+1'), "1.+1"), - (StringTag('1.+1.'), "1.+1."), - (StringTag('1.+1.1'), "1.+1.1"), - (StringTag('1.+1.1D'), "1.+1.1D"), - (StringTag('1.+1.1F'), "1.+1.1F"), - (StringTag('1.+1.1d'), "1.+1.1d"), - (StringTag('1.+1.1f'), "1.+1.1f"), - (StringTag('1.+1.D'), "1.+1.D"), - (StringTag('1.+1.F'), "1.+1.F"), - (StringTag('1.+1.d'), "1.+1.d"), - (StringTag('1.+1.f'), "1.+1.f"), - (StringTag('1.+1D'), "1.+1D"), - (StringTag('1.+1F'), "1.+1F"), - (StringTag('1.+1d'), "1.+1d"), - (StringTag('1.+1f'), "1.+1f"), - (StringTag('1.+D'), "1.+D"), - (StringTag('1.+F'), "1.+F"), - (StringTag('1.+d'), "1.+d"), - (StringTag('1.+f'), "1.+f"), - (StringTag('1.-'), "1.-"), - (StringTag('1.-.'), "1.-."), - (StringTag('1.-.1'), "1.-.1"), - (StringTag('1.-.1D'), "1.-.1D"), - (StringTag('1.-.1F'), "1.-.1F"), - (StringTag('1.-.1d'), "1.-.1d"), - (StringTag('1.-.1f'), "1.-.1f"), - (StringTag('1.-.D'), "1.-.D"), - (StringTag('1.-.F'), "1.-.F"), - (StringTag('1.-.d'), "1.-.d"), - (StringTag('1.-.f'), "1.-.f"), - (StringTag('1.-1'), "1.-1"), - (StringTag('1.-1.'), "1.-1."), - (StringTag('1.-1.1'), "1.-1.1"), - (StringTag('1.-1.1D'), "1.-1.1D"), - (StringTag('1.-1.1F'), "1.-1.1F"), - (StringTag('1.-1.1d'), "1.-1.1d"), - (StringTag('1.-1.1f'), "1.-1.1f"), - (StringTag('1.-1.D'), "1.-1.D"), - (StringTag('1.-1.F'), "1.-1.F"), - (StringTag('1.-1.d'), "1.-1.d"), - (StringTag('1.-1.f'), "1.-1.f"), - (StringTag('1.-1D'), "1.-1D"), - (StringTag('1.-1F'), "1.-1F"), - (StringTag('1.-1d'), "1.-1d"), - (StringTag('1.-1f'), "1.-1f"), - (StringTag('1.-D'), "1.-D"), - (StringTag('1.-F'), "1.-F"), - (StringTag('1.-d'), "1.-d"), - (StringTag('1.-f'), "1.-f"), - (StringTag('1..'), "1.."), - (StringTag('1..1'), "1..1"), - (StringTag('1..1D'), "1..1D"), - (StringTag('1..1F'), "1..1F"), - (StringTag('1..1d'), "1..1d"), - (StringTag('1..1f'), "1..1f"), - (StringTag('1..D'), "1..D"), - (StringTag('1..F'), "1..F"), - (StringTag('1..d'), "1..d"), - (StringTag('1..f'), "1..f"), + (StringTag("1.+"), "1.+"), + (StringTag("1.+."), "1.+."), + (StringTag("1.+.1"), "1.+.1"), + (StringTag("1.+.1D"), "1.+.1D"), + (StringTag("1.+.1F"), "1.+.1F"), + (StringTag("1.+.1d"), "1.+.1d"), + (StringTag("1.+.1f"), "1.+.1f"), + (StringTag("1.+.D"), "1.+.D"), + (StringTag("1.+.F"), "1.+.F"), + (StringTag("1.+.d"), "1.+.d"), + (StringTag("1.+.f"), "1.+.f"), + (StringTag("1.+1"), "1.+1"), + (StringTag("1.+1."), "1.+1."), + (StringTag("1.+1.1"), "1.+1.1"), + (StringTag("1.+1.1D"), "1.+1.1D"), + (StringTag("1.+1.1F"), "1.+1.1F"), + (StringTag("1.+1.1d"), "1.+1.1d"), + (StringTag("1.+1.1f"), "1.+1.1f"), + (StringTag("1.+1.D"), "1.+1.D"), + (StringTag("1.+1.F"), "1.+1.F"), + (StringTag("1.+1.d"), "1.+1.d"), + (StringTag("1.+1.f"), "1.+1.f"), + (StringTag("1.+1D"), "1.+1D"), + (StringTag("1.+1F"), "1.+1F"), + (StringTag("1.+1d"), "1.+1d"), + (StringTag("1.+1f"), "1.+1f"), + (StringTag("1.+D"), "1.+D"), + (StringTag("1.+F"), "1.+F"), + (StringTag("1.+d"), "1.+d"), + (StringTag("1.+f"), "1.+f"), + (StringTag("1.-"), "1.-"), + (StringTag("1.-."), "1.-."), + (StringTag("1.-.1"), "1.-.1"), + (StringTag("1.-.1D"), "1.-.1D"), + (StringTag("1.-.1F"), "1.-.1F"), + (StringTag("1.-.1d"), "1.-.1d"), + (StringTag("1.-.1f"), "1.-.1f"), + (StringTag("1.-.D"), "1.-.D"), + (StringTag("1.-.F"), "1.-.F"), + (StringTag("1.-.d"), "1.-.d"), + (StringTag("1.-.f"), "1.-.f"), + (StringTag("1.-1"), "1.-1"), + (StringTag("1.-1."), "1.-1."), + (StringTag("1.-1.1"), "1.-1.1"), + (StringTag("1.-1.1D"), "1.-1.1D"), + (StringTag("1.-1.1F"), "1.-1.1F"), + (StringTag("1.-1.1d"), "1.-1.1d"), + (StringTag("1.-1.1f"), "1.-1.1f"), + (StringTag("1.-1.D"), "1.-1.D"), + (StringTag("1.-1.F"), "1.-1.F"), + (StringTag("1.-1.d"), "1.-1.d"), + (StringTag("1.-1.f"), "1.-1.f"), + (StringTag("1.-1D"), "1.-1D"), + (StringTag("1.-1F"), "1.-1F"), + (StringTag("1.-1d"), "1.-1d"), + (StringTag("1.-1f"), "1.-1f"), + (StringTag("1.-D"), "1.-D"), + (StringTag("1.-F"), "1.-F"), + (StringTag("1.-d"), "1.-d"), + (StringTag("1.-f"), "1.-f"), + (StringTag("1.."), "1.."), + (StringTag("1..1"), "1..1"), + (StringTag("1..1D"), "1..1D"), + (StringTag("1..1F"), "1..1F"), + (StringTag("1..1d"), "1..1d"), + (StringTag("1..1f"), "1..1f"), + (StringTag("1..D"), "1..D"), + (StringTag("1..F"), "1..F"), + (StringTag("1..d"), "1..d"), + (StringTag("1..f"), "1..f"), (DoubleTag(1.100000), "1.1"), - (StringTag('1.1+'), "1.1+"), - (StringTag('1.1+.'), "1.1+."), - (StringTag('1.1+.1'), "1.1+.1"), - (StringTag('1.1+.1D'), "1.1+.1D"), - (StringTag('1.1+.1F'), "1.1+.1F"), - (StringTag('1.1+.1d'), "1.1+.1d"), - (StringTag('1.1+.1f'), "1.1+.1f"), - (StringTag('1.1+.D'), "1.1+.D"), - (StringTag('1.1+.F'), "1.1+.F"), - (StringTag('1.1+.d'), "1.1+.d"), - (StringTag('1.1+.f'), "1.1+.f"), - (StringTag('1.1+1'), "1.1+1"), - (StringTag('1.1+1.'), "1.1+1."), - (StringTag('1.1+1.1'), "1.1+1.1"), - (StringTag('1.1+1.1D'), "1.1+1.1D"), - (StringTag('1.1+1.1F'), "1.1+1.1F"), - (StringTag('1.1+1.1d'), "1.1+1.1d"), - (StringTag('1.1+1.1f'), "1.1+1.1f"), - (StringTag('1.1+1.D'), "1.1+1.D"), - (StringTag('1.1+1.F'), "1.1+1.F"), - (StringTag('1.1+1.d'), "1.1+1.d"), - (StringTag('1.1+1.f'), "1.1+1.f"), - (StringTag('1.1+1D'), "1.1+1D"), - (StringTag('1.1+1F'), "1.1+1F"), - (StringTag('1.1+1d'), "1.1+1d"), - (StringTag('1.1+1f'), "1.1+1f"), - (StringTag('1.1+D'), "1.1+D"), - (StringTag('1.1+F'), "1.1+F"), - (StringTag('1.1+d'), "1.1+d"), - (StringTag('1.1+f'), "1.1+f"), - (StringTag('1.1-'), "1.1-"), - (StringTag('1.1-.'), "1.1-."), - (StringTag('1.1-.1'), "1.1-.1"), - (StringTag('1.1-.1D'), "1.1-.1D"), - (StringTag('1.1-.1F'), "1.1-.1F"), - (StringTag('1.1-.1d'), "1.1-.1d"), - (StringTag('1.1-.1f'), "1.1-.1f"), - (StringTag('1.1-.D'), "1.1-.D"), - (StringTag('1.1-.F'), "1.1-.F"), - (StringTag('1.1-.d'), "1.1-.d"), - (StringTag('1.1-.f'), "1.1-.f"), - (StringTag('1.1-1'), "1.1-1"), - (StringTag('1.1-1.'), "1.1-1."), - (StringTag('1.1-1.1'), "1.1-1.1"), - (StringTag('1.1-1.1D'), "1.1-1.1D"), - (StringTag('1.1-1.1F'), "1.1-1.1F"), - (StringTag('1.1-1.1d'), "1.1-1.1d"), - (StringTag('1.1-1.1f'), "1.1-1.1f"), - (StringTag('1.1-1.D'), "1.1-1.D"), - (StringTag('1.1-1.F'), "1.1-1.F"), - (StringTag('1.1-1.d'), "1.1-1.d"), - (StringTag('1.1-1.f'), "1.1-1.f"), - (StringTag('1.1-1D'), "1.1-1D"), - (StringTag('1.1-1F'), "1.1-1F"), - (StringTag('1.1-1d'), "1.1-1d"), - (StringTag('1.1-1f'), "1.1-1f"), - (StringTag('1.1-D'), "1.1-D"), - (StringTag('1.1-F'), "1.1-F"), - (StringTag('1.1-d'), "1.1-d"), - (StringTag('1.1-f'), "1.1-f"), - (StringTag('1.1.'), "1.1."), - (StringTag('1.1.1'), "1.1.1"), - (StringTag('1.1.1D'), "1.1.1D"), - (StringTag('1.1.1F'), "1.1.1F"), - (StringTag('1.1.1d'), "1.1.1d"), - (StringTag('1.1.1f'), "1.1.1f"), - (StringTag('1.1.D'), "1.1.D"), - (StringTag('1.1.F'), "1.1.F"), - (StringTag('1.1.d'), "1.1.d"), - (StringTag('1.1.f'), "1.1.f"), + (StringTag("1.1+"), "1.1+"), + (StringTag("1.1+."), "1.1+."), + (StringTag("1.1+.1"), "1.1+.1"), + (StringTag("1.1+.1D"), "1.1+.1D"), + (StringTag("1.1+.1F"), "1.1+.1F"), + (StringTag("1.1+.1d"), "1.1+.1d"), + (StringTag("1.1+.1f"), "1.1+.1f"), + (StringTag("1.1+.D"), "1.1+.D"), + (StringTag("1.1+.F"), "1.1+.F"), + (StringTag("1.1+.d"), "1.1+.d"), + (StringTag("1.1+.f"), "1.1+.f"), + (StringTag("1.1+1"), "1.1+1"), + (StringTag("1.1+1."), "1.1+1."), + (StringTag("1.1+1.1"), "1.1+1.1"), + (StringTag("1.1+1.1D"), "1.1+1.1D"), + (StringTag("1.1+1.1F"), "1.1+1.1F"), + (StringTag("1.1+1.1d"), "1.1+1.1d"), + (StringTag("1.1+1.1f"), "1.1+1.1f"), + (StringTag("1.1+1.D"), "1.1+1.D"), + (StringTag("1.1+1.F"), "1.1+1.F"), + (StringTag("1.1+1.d"), "1.1+1.d"), + (StringTag("1.1+1.f"), "1.1+1.f"), + (StringTag("1.1+1D"), "1.1+1D"), + (StringTag("1.1+1F"), "1.1+1F"), + (StringTag("1.1+1d"), "1.1+1d"), + (StringTag("1.1+1f"), "1.1+1f"), + (StringTag("1.1+D"), "1.1+D"), + (StringTag("1.1+F"), "1.1+F"), + (StringTag("1.1+d"), "1.1+d"), + (StringTag("1.1+f"), "1.1+f"), + (StringTag("1.1-"), "1.1-"), + (StringTag("1.1-."), "1.1-."), + (StringTag("1.1-.1"), "1.1-.1"), + (StringTag("1.1-.1D"), "1.1-.1D"), + (StringTag("1.1-.1F"), "1.1-.1F"), + (StringTag("1.1-.1d"), "1.1-.1d"), + (StringTag("1.1-.1f"), "1.1-.1f"), + (StringTag("1.1-.D"), "1.1-.D"), + (StringTag("1.1-.F"), "1.1-.F"), + (StringTag("1.1-.d"), "1.1-.d"), + (StringTag("1.1-.f"), "1.1-.f"), + (StringTag("1.1-1"), "1.1-1"), + (StringTag("1.1-1."), "1.1-1."), + (StringTag("1.1-1.1"), "1.1-1.1"), + (StringTag("1.1-1.1D"), "1.1-1.1D"), + (StringTag("1.1-1.1F"), "1.1-1.1F"), + (StringTag("1.1-1.1d"), "1.1-1.1d"), + (StringTag("1.1-1.1f"), "1.1-1.1f"), + (StringTag("1.1-1.D"), "1.1-1.D"), + (StringTag("1.1-1.F"), "1.1-1.F"), + (StringTag("1.1-1.d"), "1.1-1.d"), + (StringTag("1.1-1.f"), "1.1-1.f"), + (StringTag("1.1-1D"), "1.1-1D"), + (StringTag("1.1-1F"), "1.1-1F"), + (StringTag("1.1-1d"), "1.1-1d"), + (StringTag("1.1-1f"), "1.1-1f"), + (StringTag("1.1-D"), "1.1-D"), + (StringTag("1.1-F"), "1.1-F"), + (StringTag("1.1-d"), "1.1-d"), + (StringTag("1.1-f"), "1.1-f"), + (StringTag("1.1."), "1.1."), + (StringTag("1.1.1"), "1.1.1"), + (StringTag("1.1.1D"), "1.1.1D"), + (StringTag("1.1.1F"), "1.1.1F"), + (StringTag("1.1.1d"), "1.1.1d"), + (StringTag("1.1.1f"), "1.1.1f"), + (StringTag("1.1.D"), "1.1.D"), + (StringTag("1.1.F"), "1.1.F"), + (StringTag("1.1.d"), "1.1.d"), + (StringTag("1.1.f"), "1.1.f"), (DoubleTag(1.110000), "1.11"), - (StringTag('1.11.'), "1.11."), - (StringTag('1.11.1'), "1.11.1"), - (StringTag('1.11.1D'), "1.11.1D"), - (StringTag('1.11.1F'), "1.11.1F"), - (StringTag('1.11.1d'), "1.11.1d"), - (StringTag('1.11.1f'), "1.11.1f"), - (StringTag('1.11.D'), "1.11.D"), - (StringTag('1.11.F'), "1.11.F"), - (StringTag('1.11.d'), "1.11.d"), - (StringTag('1.11.f'), "1.11.f"), + (StringTag("1.11."), "1.11."), + (StringTag("1.11.1"), "1.11.1"), + (StringTag("1.11.1D"), "1.11.1D"), + (StringTag("1.11.1F"), "1.11.1F"), + (StringTag("1.11.1d"), "1.11.1d"), + (StringTag("1.11.1f"), "1.11.1f"), + (StringTag("1.11.D"), "1.11.D"), + (StringTag("1.11.F"), "1.11.F"), + (StringTag("1.11.d"), "1.11.d"), + (StringTag("1.11.f"), "1.11.f"), (DoubleTag(1.110000), "1.11D"), (FloatTag(1.110000), "1.11F"), (DoubleTag(1.110000), "1.11d"), (FloatTag(1.110000), "1.11f"), (DoubleTag(1.100000), "1.1D"), - (StringTag('1.1E'), "1.1E"), - (StringTag('1.1E+'), "1.1E+"), - (StringTag('1.1E+.'), "1.1E+."), - (StringTag('1.1E+.1'), "1.1E+.1"), - (StringTag('1.1E+.1D'), "1.1E+.1D"), - (StringTag('1.1E+.1F'), "1.1E+.1F"), - (StringTag('1.1E+.1d'), "1.1E+.1d"), - (StringTag('1.1E+.1f'), "1.1E+.1f"), - (StringTag('1.1E+.D'), "1.1E+.D"), - (StringTag('1.1E+.F'), "1.1E+.F"), - (StringTag('1.1E+.d'), "1.1E+.d"), - (StringTag('1.1E+.f'), "1.1E+.f"), + (StringTag("1.1E"), "1.1E"), + (StringTag("1.1E+"), "1.1E+"), + (StringTag("1.1E+."), "1.1E+."), + (StringTag("1.1E+.1"), "1.1E+.1"), + (StringTag("1.1E+.1D"), "1.1E+.1D"), + (StringTag("1.1E+.1F"), "1.1E+.1F"), + (StringTag("1.1E+.1d"), "1.1E+.1d"), + (StringTag("1.1E+.1f"), "1.1E+.1f"), + (StringTag("1.1E+.D"), "1.1E+.D"), + (StringTag("1.1E+.F"), "1.1E+.F"), + (StringTag("1.1E+.d"), "1.1E+.d"), + (StringTag("1.1E+.f"), "1.1E+.f"), (DoubleTag(11.000000), "1.1E+1"), - (StringTag('1.1E+1.'), "1.1E+1."), - (StringTag('1.1E+1.1'), "1.1E+1.1"), - (StringTag('1.1E+1.1D'), "1.1E+1.1D"), - (StringTag('1.1E+1.1F'), "1.1E+1.1F"), - (StringTag('1.1E+1.1d'), "1.1E+1.1d"), - (StringTag('1.1E+1.1f'), "1.1E+1.1f"), - (StringTag('1.1E+1.D'), "1.1E+1.D"), - (StringTag('1.1E+1.F'), "1.1E+1.F"), - (StringTag('1.1E+1.d'), "1.1E+1.d"), - (StringTag('1.1E+1.f'), "1.1E+1.f"), + (StringTag("1.1E+1."), "1.1E+1."), + (StringTag("1.1E+1.1"), "1.1E+1.1"), + (StringTag("1.1E+1.1D"), "1.1E+1.1D"), + (StringTag("1.1E+1.1F"), "1.1E+1.1F"), + (StringTag("1.1E+1.1d"), "1.1E+1.1d"), + (StringTag("1.1E+1.1f"), "1.1E+1.1f"), + (StringTag("1.1E+1.D"), "1.1E+1.D"), + (StringTag("1.1E+1.F"), "1.1E+1.F"), + (StringTag("1.1E+1.d"), "1.1E+1.d"), + (StringTag("1.1E+1.f"), "1.1E+1.f"), (DoubleTag(11.000000), "1.1E+1D"), (FloatTag(11.000000), "1.1E+1F"), (DoubleTag(11.000000), "1.1E+1d"), (FloatTag(11.000000), "1.1E+1f"), - (StringTag('1.1E+D'), "1.1E+D"), - (StringTag('1.1E+F'), "1.1E+F"), - (StringTag('1.1E+d'), "1.1E+d"), - (StringTag('1.1E+f'), "1.1E+f"), - (StringTag('1.1E-'), "1.1E-"), - (StringTag('1.1E-.'), "1.1E-."), - (StringTag('1.1E-.1'), "1.1E-.1"), - (StringTag('1.1E-.1D'), "1.1E-.1D"), - (StringTag('1.1E-.1F'), "1.1E-.1F"), - (StringTag('1.1E-.1d'), "1.1E-.1d"), - (StringTag('1.1E-.1f'), "1.1E-.1f"), - (StringTag('1.1E-.D'), "1.1E-.D"), - (StringTag('1.1E-.F'), "1.1E-.F"), - (StringTag('1.1E-.d'), "1.1E-.d"), - (StringTag('1.1E-.f'), "1.1E-.f"), + (StringTag("1.1E+D"), "1.1E+D"), + (StringTag("1.1E+F"), "1.1E+F"), + (StringTag("1.1E+d"), "1.1E+d"), + (StringTag("1.1E+f"), "1.1E+f"), + (StringTag("1.1E-"), "1.1E-"), + (StringTag("1.1E-."), "1.1E-."), + (StringTag("1.1E-.1"), "1.1E-.1"), + (StringTag("1.1E-.1D"), "1.1E-.1D"), + (StringTag("1.1E-.1F"), "1.1E-.1F"), + (StringTag("1.1E-.1d"), "1.1E-.1d"), + (StringTag("1.1E-.1f"), "1.1E-.1f"), + (StringTag("1.1E-.D"), "1.1E-.D"), + (StringTag("1.1E-.F"), "1.1E-.F"), + (StringTag("1.1E-.d"), "1.1E-.d"), + (StringTag("1.1E-.f"), "1.1E-.f"), (DoubleTag(0.110000), "1.1E-1"), - (StringTag('1.1E-1.'), "1.1E-1."), - (StringTag('1.1E-1.1'), "1.1E-1.1"), - (StringTag('1.1E-1.1D'), "1.1E-1.1D"), - (StringTag('1.1E-1.1F'), "1.1E-1.1F"), - (StringTag('1.1E-1.1d'), "1.1E-1.1d"), - (StringTag('1.1E-1.1f'), "1.1E-1.1f"), - (StringTag('1.1E-1.D'), "1.1E-1.D"), - (StringTag('1.1E-1.F'), "1.1E-1.F"), - (StringTag('1.1E-1.d'), "1.1E-1.d"), - (StringTag('1.1E-1.f'), "1.1E-1.f"), + (StringTag("1.1E-1."), "1.1E-1."), + (StringTag("1.1E-1.1"), "1.1E-1.1"), + (StringTag("1.1E-1.1D"), "1.1E-1.1D"), + (StringTag("1.1E-1.1F"), "1.1E-1.1F"), + (StringTag("1.1E-1.1d"), "1.1E-1.1d"), + (StringTag("1.1E-1.1f"), "1.1E-1.1f"), + (StringTag("1.1E-1.D"), "1.1E-1.D"), + (StringTag("1.1E-1.F"), "1.1E-1.F"), + (StringTag("1.1E-1.d"), "1.1E-1.d"), + (StringTag("1.1E-1.f"), "1.1E-1.f"), (DoubleTag(0.110000), "1.1E-1D"), (FloatTag(0.110000), "1.1E-1F"), (DoubleTag(0.110000), "1.1E-1d"), (FloatTag(0.110000), "1.1E-1f"), - (StringTag('1.1E-D'), "1.1E-D"), - (StringTag('1.1E-F'), "1.1E-F"), - (StringTag('1.1E-d'), "1.1E-d"), - (StringTag('1.1E-f'), "1.1E-f"), - (StringTag('1.1E.'), "1.1E."), - (StringTag('1.1E.1'), "1.1E.1"), - (StringTag('1.1E.1D'), "1.1E.1D"), - (StringTag('1.1E.1F'), "1.1E.1F"), - (StringTag('1.1E.1d'), "1.1E.1d"), - (StringTag('1.1E.1f'), "1.1E.1f"), - (StringTag('1.1E.D'), "1.1E.D"), - (StringTag('1.1E.F'), "1.1E.F"), - (StringTag('1.1E.d'), "1.1E.d"), - (StringTag('1.1E.f'), "1.1E.f"), + (StringTag("1.1E-D"), "1.1E-D"), + (StringTag("1.1E-F"), "1.1E-F"), + (StringTag("1.1E-d"), "1.1E-d"), + (StringTag("1.1E-f"), "1.1E-f"), + (StringTag("1.1E."), "1.1E."), + (StringTag("1.1E.1"), "1.1E.1"), + (StringTag("1.1E.1D"), "1.1E.1D"), + (StringTag("1.1E.1F"), "1.1E.1F"), + (StringTag("1.1E.1d"), "1.1E.1d"), + (StringTag("1.1E.1f"), "1.1E.1f"), + (StringTag("1.1E.D"), "1.1E.D"), + (StringTag("1.1E.F"), "1.1E.F"), + (StringTag("1.1E.d"), "1.1E.d"), + (StringTag("1.1E.f"), "1.1E.f"), (DoubleTag(11.000000), "1.1E1"), - (StringTag('1.1E1.'), "1.1E1."), - (StringTag('1.1E1.1'), "1.1E1.1"), - (StringTag('1.1E1.1D'), "1.1E1.1D"), - (StringTag('1.1E1.1F'), "1.1E1.1F"), - (StringTag('1.1E1.1d'), "1.1E1.1d"), - (StringTag('1.1E1.1f'), "1.1E1.1f"), - (StringTag('1.1E1.D'), "1.1E1.D"), - (StringTag('1.1E1.F'), "1.1E1.F"), - (StringTag('1.1E1.d'), "1.1E1.d"), - (StringTag('1.1E1.f'), "1.1E1.f"), + (StringTag("1.1E1."), "1.1E1."), + (StringTag("1.1E1.1"), "1.1E1.1"), + (StringTag("1.1E1.1D"), "1.1E1.1D"), + (StringTag("1.1E1.1F"), "1.1E1.1F"), + (StringTag("1.1E1.1d"), "1.1E1.1d"), + (StringTag("1.1E1.1f"), "1.1E1.1f"), + (StringTag("1.1E1.D"), "1.1E1.D"), + (StringTag("1.1E1.F"), "1.1E1.F"), + (StringTag("1.1E1.d"), "1.1E1.d"), + (StringTag("1.1E1.f"), "1.1E1.f"), (DoubleTag(11.000000), "1.1E1D"), (FloatTag(11.000000), "1.1E1F"), (DoubleTag(11.000000), "1.1E1d"), (FloatTag(11.000000), "1.1E1f"), - (StringTag('1.1ED'), "1.1ED"), - (StringTag('1.1EF'), "1.1EF"), - (StringTag('1.1Ed'), "1.1Ed"), - (StringTag('1.1Ef'), "1.1Ef"), + (StringTag("1.1ED"), "1.1ED"), + (StringTag("1.1EF"), "1.1EF"), + (StringTag("1.1Ed"), "1.1Ed"), + (StringTag("1.1Ef"), "1.1Ef"), (FloatTag(1.100000), "1.1F"), (DoubleTag(1.100000), "1.1d"), - (StringTag('1.1e'), "1.1e"), - (StringTag('1.1e+'), "1.1e+"), - (StringTag('1.1e+.'), "1.1e+."), - (StringTag('1.1e+.1'), "1.1e+.1"), - (StringTag('1.1e+.1D'), "1.1e+.1D"), - (StringTag('1.1e+.1F'), "1.1e+.1F"), - (StringTag('1.1e+.1d'), "1.1e+.1d"), - (StringTag('1.1e+.1f'), "1.1e+.1f"), - (StringTag('1.1e+.D'), "1.1e+.D"), - (StringTag('1.1e+.F'), "1.1e+.F"), - (StringTag('1.1e+.d'), "1.1e+.d"), - (StringTag('1.1e+.f'), "1.1e+.f"), + (StringTag("1.1e"), "1.1e"), + (StringTag("1.1e+"), "1.1e+"), + (StringTag("1.1e+."), "1.1e+."), + (StringTag("1.1e+.1"), "1.1e+.1"), + (StringTag("1.1e+.1D"), "1.1e+.1D"), + (StringTag("1.1e+.1F"), "1.1e+.1F"), + (StringTag("1.1e+.1d"), "1.1e+.1d"), + (StringTag("1.1e+.1f"), "1.1e+.1f"), + (StringTag("1.1e+.D"), "1.1e+.D"), + (StringTag("1.1e+.F"), "1.1e+.F"), + (StringTag("1.1e+.d"), "1.1e+.d"), + (StringTag("1.1e+.f"), "1.1e+.f"), (DoubleTag(11.000000), "1.1e+1"), - (StringTag('1.1e+1.'), "1.1e+1."), - (StringTag('1.1e+1.1'), "1.1e+1.1"), - (StringTag('1.1e+1.1D'), "1.1e+1.1D"), - (StringTag('1.1e+1.1F'), "1.1e+1.1F"), - (StringTag('1.1e+1.1d'), "1.1e+1.1d"), - (StringTag('1.1e+1.1f'), "1.1e+1.1f"), - (StringTag('1.1e+1.D'), "1.1e+1.D"), - (StringTag('1.1e+1.F'), "1.1e+1.F"), - (StringTag('1.1e+1.d'), "1.1e+1.d"), - (StringTag('1.1e+1.f'), "1.1e+1.f"), + (StringTag("1.1e+1."), "1.1e+1."), + (StringTag("1.1e+1.1"), "1.1e+1.1"), + (StringTag("1.1e+1.1D"), "1.1e+1.1D"), + (StringTag("1.1e+1.1F"), "1.1e+1.1F"), + (StringTag("1.1e+1.1d"), "1.1e+1.1d"), + (StringTag("1.1e+1.1f"), "1.1e+1.1f"), + (StringTag("1.1e+1.D"), "1.1e+1.D"), + (StringTag("1.1e+1.F"), "1.1e+1.F"), + (StringTag("1.1e+1.d"), "1.1e+1.d"), + (StringTag("1.1e+1.f"), "1.1e+1.f"), (DoubleTag(11.000000), "1.1e+1D"), (FloatTag(11.000000), "1.1e+1F"), (DoubleTag(11.000000), "1.1e+1d"), (FloatTag(11.000000), "1.1e+1f"), - (StringTag('1.1e+D'), "1.1e+D"), - (StringTag('1.1e+F'), "1.1e+F"), - (StringTag('1.1e+d'), "1.1e+d"), - (StringTag('1.1e+f'), "1.1e+f"), - (StringTag('1.1e-'), "1.1e-"), - (StringTag('1.1e-.'), "1.1e-."), - (StringTag('1.1e-.1'), "1.1e-.1"), - (StringTag('1.1e-.1D'), "1.1e-.1D"), - (StringTag('1.1e-.1F'), "1.1e-.1F"), - (StringTag('1.1e-.1d'), "1.1e-.1d"), - (StringTag('1.1e-.1f'), "1.1e-.1f"), - (StringTag('1.1e-.D'), "1.1e-.D"), - (StringTag('1.1e-.F'), "1.1e-.F"), - (StringTag('1.1e-.d'), "1.1e-.d"), - (StringTag('1.1e-.f'), "1.1e-.f"), + (StringTag("1.1e+D"), "1.1e+D"), + (StringTag("1.1e+F"), "1.1e+F"), + (StringTag("1.1e+d"), "1.1e+d"), + (StringTag("1.1e+f"), "1.1e+f"), + (StringTag("1.1e-"), "1.1e-"), + (StringTag("1.1e-."), "1.1e-."), + (StringTag("1.1e-.1"), "1.1e-.1"), + (StringTag("1.1e-.1D"), "1.1e-.1D"), + (StringTag("1.1e-.1F"), "1.1e-.1F"), + (StringTag("1.1e-.1d"), "1.1e-.1d"), + (StringTag("1.1e-.1f"), "1.1e-.1f"), + (StringTag("1.1e-.D"), "1.1e-.D"), + (StringTag("1.1e-.F"), "1.1e-.F"), + (StringTag("1.1e-.d"), "1.1e-.d"), + (StringTag("1.1e-.f"), "1.1e-.f"), (DoubleTag(0.110000), "1.1e-1"), - (StringTag('1.1e-1.'), "1.1e-1."), - (StringTag('1.1e-1.1'), "1.1e-1.1"), - (StringTag('1.1e-1.1D'), "1.1e-1.1D"), - (StringTag('1.1e-1.1F'), "1.1e-1.1F"), - (StringTag('1.1e-1.1d'), "1.1e-1.1d"), - (StringTag('1.1e-1.1f'), "1.1e-1.1f"), - (StringTag('1.1e-1.D'), "1.1e-1.D"), - (StringTag('1.1e-1.F'), "1.1e-1.F"), - (StringTag('1.1e-1.d'), "1.1e-1.d"), - (StringTag('1.1e-1.f'), "1.1e-1.f"), + (StringTag("1.1e-1."), "1.1e-1."), + (StringTag("1.1e-1.1"), "1.1e-1.1"), + (StringTag("1.1e-1.1D"), "1.1e-1.1D"), + (StringTag("1.1e-1.1F"), "1.1e-1.1F"), + (StringTag("1.1e-1.1d"), "1.1e-1.1d"), + (StringTag("1.1e-1.1f"), "1.1e-1.1f"), + (StringTag("1.1e-1.D"), "1.1e-1.D"), + (StringTag("1.1e-1.F"), "1.1e-1.F"), + (StringTag("1.1e-1.d"), "1.1e-1.d"), + (StringTag("1.1e-1.f"), "1.1e-1.f"), (DoubleTag(0.110000), "1.1e-1D"), (FloatTag(0.110000), "1.1e-1F"), (DoubleTag(0.110000), "1.1e-1d"), (FloatTag(0.110000), "1.1e-1f"), - (StringTag('1.1e-D'), "1.1e-D"), - (StringTag('1.1e-F'), "1.1e-F"), - (StringTag('1.1e-d'), "1.1e-d"), - (StringTag('1.1e-f'), "1.1e-f"), - (StringTag('1.1e.'), "1.1e."), - (StringTag('1.1e.1'), "1.1e.1"), - (StringTag('1.1e.1D'), "1.1e.1D"), - (StringTag('1.1e.1F'), "1.1e.1F"), - (StringTag('1.1e.1d'), "1.1e.1d"), - (StringTag('1.1e.1f'), "1.1e.1f"), - (StringTag('1.1e.D'), "1.1e.D"), - (StringTag('1.1e.F'), "1.1e.F"), - (StringTag('1.1e.d'), "1.1e.d"), - (StringTag('1.1e.f'), "1.1e.f"), + (StringTag("1.1e-D"), "1.1e-D"), + (StringTag("1.1e-F"), "1.1e-F"), + (StringTag("1.1e-d"), "1.1e-d"), + (StringTag("1.1e-f"), "1.1e-f"), + (StringTag("1.1e."), "1.1e."), + (StringTag("1.1e.1"), "1.1e.1"), + (StringTag("1.1e.1D"), "1.1e.1D"), + (StringTag("1.1e.1F"), "1.1e.1F"), + (StringTag("1.1e.1d"), "1.1e.1d"), + (StringTag("1.1e.1f"), "1.1e.1f"), + (StringTag("1.1e.D"), "1.1e.D"), + (StringTag("1.1e.F"), "1.1e.F"), + (StringTag("1.1e.d"), "1.1e.d"), + (StringTag("1.1e.f"), "1.1e.f"), (DoubleTag(11.000000), "1.1e1"), - (StringTag('1.1e1.'), "1.1e1."), - (StringTag('1.1e1.1'), "1.1e1.1"), - (StringTag('1.1e1.1D'), "1.1e1.1D"), - (StringTag('1.1e1.1F'), "1.1e1.1F"), - (StringTag('1.1e1.1d'), "1.1e1.1d"), - (StringTag('1.1e1.1f'), "1.1e1.1f"), - (StringTag('1.1e1.D'), "1.1e1.D"), - (StringTag('1.1e1.F'), "1.1e1.F"), - (StringTag('1.1e1.d'), "1.1e1.d"), - (StringTag('1.1e1.f'), "1.1e1.f"), + (StringTag("1.1e1."), "1.1e1."), + (StringTag("1.1e1.1"), "1.1e1.1"), + (StringTag("1.1e1.1D"), "1.1e1.1D"), + (StringTag("1.1e1.1F"), "1.1e1.1F"), + (StringTag("1.1e1.1d"), "1.1e1.1d"), + (StringTag("1.1e1.1f"), "1.1e1.1f"), + (StringTag("1.1e1.D"), "1.1e1.D"), + (StringTag("1.1e1.F"), "1.1e1.F"), + (StringTag("1.1e1.d"), "1.1e1.d"), + (StringTag("1.1e1.f"), "1.1e1.f"), (DoubleTag(11.000000), "1.1e1D"), (FloatTag(11.000000), "1.1e1F"), (DoubleTag(11.000000), "1.1e1d"), (FloatTag(11.000000), "1.1e1f"), - (StringTag('1.1eD'), "1.1eD"), - (StringTag('1.1eF'), "1.1eF"), - (StringTag('1.1ed'), "1.1ed"), - (StringTag('1.1ef'), "1.1ef"), + (StringTag("1.1eD"), "1.1eD"), + (StringTag("1.1eF"), "1.1eF"), + (StringTag("1.1ed"), "1.1ed"), + (StringTag("1.1ef"), "1.1ef"), (FloatTag(1.100000), "1.1f"), (DoubleTag(1.000000), "1.D"), - (StringTag('1.E'), "1.E"), - (StringTag('1.E+'), "1.E+"), - (StringTag('1.E+.'), "1.E+."), - (StringTag('1.E+.1'), "1.E+.1"), - (StringTag('1.E+.1D'), "1.E+.1D"), - (StringTag('1.E+.1F'), "1.E+.1F"), - (StringTag('1.E+.1d'), "1.E+.1d"), - (StringTag('1.E+.1f'), "1.E+.1f"), - (StringTag('1.E+.D'), "1.E+.D"), - (StringTag('1.E+.F'), "1.E+.F"), - (StringTag('1.E+.d'), "1.E+.d"), - (StringTag('1.E+.f'), "1.E+.f"), + (StringTag("1.E"), "1.E"), + (StringTag("1.E+"), "1.E+"), + (StringTag("1.E+."), "1.E+."), + (StringTag("1.E+.1"), "1.E+.1"), + (StringTag("1.E+.1D"), "1.E+.1D"), + (StringTag("1.E+.1F"), "1.E+.1F"), + (StringTag("1.E+.1d"), "1.E+.1d"), + (StringTag("1.E+.1f"), "1.E+.1f"), + (StringTag("1.E+.D"), "1.E+.D"), + (StringTag("1.E+.F"), "1.E+.F"), + (StringTag("1.E+.d"), "1.E+.d"), + (StringTag("1.E+.f"), "1.E+.f"), (DoubleTag(10.000000), "1.E+1"), - (StringTag('1.E+1.'), "1.E+1."), - (StringTag('1.E+1.1'), "1.E+1.1"), - (StringTag('1.E+1.1D'), "1.E+1.1D"), - (StringTag('1.E+1.1F'), "1.E+1.1F"), - (StringTag('1.E+1.1d'), "1.E+1.1d"), - (StringTag('1.E+1.1f'), "1.E+1.1f"), - (StringTag('1.E+1.D'), "1.E+1.D"), - (StringTag('1.E+1.F'), "1.E+1.F"), - (StringTag('1.E+1.d'), "1.E+1.d"), - (StringTag('1.E+1.f'), "1.E+1.f"), + (StringTag("1.E+1."), "1.E+1."), + (StringTag("1.E+1.1"), "1.E+1.1"), + (StringTag("1.E+1.1D"), "1.E+1.1D"), + (StringTag("1.E+1.1F"), "1.E+1.1F"), + (StringTag("1.E+1.1d"), "1.E+1.1d"), + (StringTag("1.E+1.1f"), "1.E+1.1f"), + (StringTag("1.E+1.D"), "1.E+1.D"), + (StringTag("1.E+1.F"), "1.E+1.F"), + (StringTag("1.E+1.d"), "1.E+1.d"), + (StringTag("1.E+1.f"), "1.E+1.f"), (DoubleTag(10.000000), "1.E+1D"), (FloatTag(10.000000), "1.E+1F"), (DoubleTag(10.000000), "1.E+1d"), (FloatTag(10.000000), "1.E+1f"), - (StringTag('1.E+D'), "1.E+D"), - (StringTag('1.E+F'), "1.E+F"), - (StringTag('1.E+d'), "1.E+d"), - (StringTag('1.E+f'), "1.E+f"), - (StringTag('1.E-'), "1.E-"), - (StringTag('1.E-.'), "1.E-."), - (StringTag('1.E-.1'), "1.E-.1"), - (StringTag('1.E-.1D'), "1.E-.1D"), - (StringTag('1.E-.1F'), "1.E-.1F"), - (StringTag('1.E-.1d'), "1.E-.1d"), - (StringTag('1.E-.1f'), "1.E-.1f"), - (StringTag('1.E-.D'), "1.E-.D"), - (StringTag('1.E-.F'), "1.E-.F"), - (StringTag('1.E-.d'), "1.E-.d"), - (StringTag('1.E-.f'), "1.E-.f"), + (StringTag("1.E+D"), "1.E+D"), + (StringTag("1.E+F"), "1.E+F"), + (StringTag("1.E+d"), "1.E+d"), + (StringTag("1.E+f"), "1.E+f"), + (StringTag("1.E-"), "1.E-"), + (StringTag("1.E-."), "1.E-."), + (StringTag("1.E-.1"), "1.E-.1"), + (StringTag("1.E-.1D"), "1.E-.1D"), + (StringTag("1.E-.1F"), "1.E-.1F"), + (StringTag("1.E-.1d"), "1.E-.1d"), + (StringTag("1.E-.1f"), "1.E-.1f"), + (StringTag("1.E-.D"), "1.E-.D"), + (StringTag("1.E-.F"), "1.E-.F"), + (StringTag("1.E-.d"), "1.E-.d"), + (StringTag("1.E-.f"), "1.E-.f"), (DoubleTag(0.100000), "1.E-1"), - (StringTag('1.E-1.'), "1.E-1."), - (StringTag('1.E-1.1'), "1.E-1.1"), - (StringTag('1.E-1.1D'), "1.E-1.1D"), - (StringTag('1.E-1.1F'), "1.E-1.1F"), - (StringTag('1.E-1.1d'), "1.E-1.1d"), - (StringTag('1.E-1.1f'), "1.E-1.1f"), - (StringTag('1.E-1.D'), "1.E-1.D"), - (StringTag('1.E-1.F'), "1.E-1.F"), - (StringTag('1.E-1.d'), "1.E-1.d"), - (StringTag('1.E-1.f'), "1.E-1.f"), + (StringTag("1.E-1."), "1.E-1."), + (StringTag("1.E-1.1"), "1.E-1.1"), + (StringTag("1.E-1.1D"), "1.E-1.1D"), + (StringTag("1.E-1.1F"), "1.E-1.1F"), + (StringTag("1.E-1.1d"), "1.E-1.1d"), + (StringTag("1.E-1.1f"), "1.E-1.1f"), + (StringTag("1.E-1.D"), "1.E-1.D"), + (StringTag("1.E-1.F"), "1.E-1.F"), + (StringTag("1.E-1.d"), "1.E-1.d"), + (StringTag("1.E-1.f"), "1.E-1.f"), (DoubleTag(0.100000), "1.E-1D"), (FloatTag(0.100000), "1.E-1F"), (DoubleTag(0.100000), "1.E-1d"), (FloatTag(0.100000), "1.E-1f"), - (StringTag('1.E-D'), "1.E-D"), - (StringTag('1.E-F'), "1.E-F"), - (StringTag('1.E-d'), "1.E-d"), - (StringTag('1.E-f'), "1.E-f"), - (StringTag('1.E.'), "1.E."), - (StringTag('1.E.1'), "1.E.1"), - (StringTag('1.E.1D'), "1.E.1D"), - (StringTag('1.E.1F'), "1.E.1F"), - (StringTag('1.E.1d'), "1.E.1d"), - (StringTag('1.E.1f'), "1.E.1f"), - (StringTag('1.E.D'), "1.E.D"), - (StringTag('1.E.F'), "1.E.F"), - (StringTag('1.E.d'), "1.E.d"), - (StringTag('1.E.f'), "1.E.f"), + (StringTag("1.E-D"), "1.E-D"), + (StringTag("1.E-F"), "1.E-F"), + (StringTag("1.E-d"), "1.E-d"), + (StringTag("1.E-f"), "1.E-f"), + (StringTag("1.E."), "1.E."), + (StringTag("1.E.1"), "1.E.1"), + (StringTag("1.E.1D"), "1.E.1D"), + (StringTag("1.E.1F"), "1.E.1F"), + (StringTag("1.E.1d"), "1.E.1d"), + (StringTag("1.E.1f"), "1.E.1f"), + (StringTag("1.E.D"), "1.E.D"), + (StringTag("1.E.F"), "1.E.F"), + (StringTag("1.E.d"), "1.E.d"), + (StringTag("1.E.f"), "1.E.f"), (DoubleTag(10.000000), "1.E1"), - (StringTag('1.E1.'), "1.E1."), - (StringTag('1.E1.1'), "1.E1.1"), - (StringTag('1.E1.1D'), "1.E1.1D"), - (StringTag('1.E1.1F'), "1.E1.1F"), - (StringTag('1.E1.1d'), "1.E1.1d"), - (StringTag('1.E1.1f'), "1.E1.1f"), - (StringTag('1.E1.D'), "1.E1.D"), - (StringTag('1.E1.F'), "1.E1.F"), - (StringTag('1.E1.d'), "1.E1.d"), - (StringTag('1.E1.f'), "1.E1.f"), + (StringTag("1.E1."), "1.E1."), + (StringTag("1.E1.1"), "1.E1.1"), + (StringTag("1.E1.1D"), "1.E1.1D"), + (StringTag("1.E1.1F"), "1.E1.1F"), + (StringTag("1.E1.1d"), "1.E1.1d"), + (StringTag("1.E1.1f"), "1.E1.1f"), + (StringTag("1.E1.D"), "1.E1.D"), + (StringTag("1.E1.F"), "1.E1.F"), + (StringTag("1.E1.d"), "1.E1.d"), + (StringTag("1.E1.f"), "1.E1.f"), (DoubleTag(10.000000), "1.E1D"), (FloatTag(10.000000), "1.E1F"), (DoubleTag(10.000000), "1.E1d"), (FloatTag(10.000000), "1.E1f"), - (StringTag('1.ED'), "1.ED"), - (StringTag('1.EF'), "1.EF"), - (StringTag('1.Ed'), "1.Ed"), - (StringTag('1.Ef'), "1.Ef"), + (StringTag("1.ED"), "1.ED"), + (StringTag("1.EF"), "1.EF"), + (StringTag("1.Ed"), "1.Ed"), + (StringTag("1.Ef"), "1.Ef"), (FloatTag(1.000000), "1.F"), (DoubleTag(1.000000), "1.d"), - (StringTag('1.e'), "1.e"), - (StringTag('1.e+'), "1.e+"), - (StringTag('1.e+.'), "1.e+."), - (StringTag('1.e+.1'), "1.e+.1"), - (StringTag('1.e+.1D'), "1.e+.1D"), - (StringTag('1.e+.1F'), "1.e+.1F"), - (StringTag('1.e+.1d'), "1.e+.1d"), - (StringTag('1.e+.1f'), "1.e+.1f"), - (StringTag('1.e+.D'), "1.e+.D"), - (StringTag('1.e+.F'), "1.e+.F"), - (StringTag('1.e+.d'), "1.e+.d"), - (StringTag('1.e+.f'), "1.e+.f"), + (StringTag("1.e"), "1.e"), + (StringTag("1.e+"), "1.e+"), + (StringTag("1.e+."), "1.e+."), + (StringTag("1.e+.1"), "1.e+.1"), + (StringTag("1.e+.1D"), "1.e+.1D"), + (StringTag("1.e+.1F"), "1.e+.1F"), + (StringTag("1.e+.1d"), "1.e+.1d"), + (StringTag("1.e+.1f"), "1.e+.1f"), + (StringTag("1.e+.D"), "1.e+.D"), + (StringTag("1.e+.F"), "1.e+.F"), + (StringTag("1.e+.d"), "1.e+.d"), + (StringTag("1.e+.f"), "1.e+.f"), (DoubleTag(10.000000), "1.e+1"), - (StringTag('1.e+1.'), "1.e+1."), - (StringTag('1.e+1.1'), "1.e+1.1"), - (StringTag('1.e+1.1D'), "1.e+1.1D"), - (StringTag('1.e+1.1F'), "1.e+1.1F"), - (StringTag('1.e+1.1d'), "1.e+1.1d"), - (StringTag('1.e+1.1f'), "1.e+1.1f"), - (StringTag('1.e+1.D'), "1.e+1.D"), - (StringTag('1.e+1.F'), "1.e+1.F"), - (StringTag('1.e+1.d'), "1.e+1.d"), - (StringTag('1.e+1.f'), "1.e+1.f"), + (StringTag("1.e+1."), "1.e+1."), + (StringTag("1.e+1.1"), "1.e+1.1"), + (StringTag("1.e+1.1D"), "1.e+1.1D"), + (StringTag("1.e+1.1F"), "1.e+1.1F"), + (StringTag("1.e+1.1d"), "1.e+1.1d"), + (StringTag("1.e+1.1f"), "1.e+1.1f"), + (StringTag("1.e+1.D"), "1.e+1.D"), + (StringTag("1.e+1.F"), "1.e+1.F"), + (StringTag("1.e+1.d"), "1.e+1.d"), + (StringTag("1.e+1.f"), "1.e+1.f"), (DoubleTag(10.000000), "1.e+1D"), (FloatTag(10.000000), "1.e+1F"), (DoubleTag(10.000000), "1.e+1d"), (FloatTag(10.000000), "1.e+1f"), - (StringTag('1.e+D'), "1.e+D"), - (StringTag('1.e+F'), "1.e+F"), - (StringTag('1.e+d'), "1.e+d"), - (StringTag('1.e+f'), "1.e+f"), - (StringTag('1.e-'), "1.e-"), - (StringTag('1.e-.'), "1.e-."), - (StringTag('1.e-.1'), "1.e-.1"), - (StringTag('1.e-.1D'), "1.e-.1D"), - (StringTag('1.e-.1F'), "1.e-.1F"), - (StringTag('1.e-.1d'), "1.e-.1d"), - (StringTag('1.e-.1f'), "1.e-.1f"), - (StringTag('1.e-.D'), "1.e-.D"), - (StringTag('1.e-.F'), "1.e-.F"), - (StringTag('1.e-.d'), "1.e-.d"), - (StringTag('1.e-.f'), "1.e-.f"), + (StringTag("1.e+D"), "1.e+D"), + (StringTag("1.e+F"), "1.e+F"), + (StringTag("1.e+d"), "1.e+d"), + (StringTag("1.e+f"), "1.e+f"), + (StringTag("1.e-"), "1.e-"), + (StringTag("1.e-."), "1.e-."), + (StringTag("1.e-.1"), "1.e-.1"), + (StringTag("1.e-.1D"), "1.e-.1D"), + (StringTag("1.e-.1F"), "1.e-.1F"), + (StringTag("1.e-.1d"), "1.e-.1d"), + (StringTag("1.e-.1f"), "1.e-.1f"), + (StringTag("1.e-.D"), "1.e-.D"), + (StringTag("1.e-.F"), "1.e-.F"), + (StringTag("1.e-.d"), "1.e-.d"), + (StringTag("1.e-.f"), "1.e-.f"), (DoubleTag(0.100000), "1.e-1"), - (StringTag('1.e-1.'), "1.e-1."), - (StringTag('1.e-1.1'), "1.e-1.1"), - (StringTag('1.e-1.1D'), "1.e-1.1D"), - (StringTag('1.e-1.1F'), "1.e-1.1F"), - (StringTag('1.e-1.1d'), "1.e-1.1d"), - (StringTag('1.e-1.1f'), "1.e-1.1f"), - (StringTag('1.e-1.D'), "1.e-1.D"), - (StringTag('1.e-1.F'), "1.e-1.F"), - (StringTag('1.e-1.d'), "1.e-1.d"), - (StringTag('1.e-1.f'), "1.e-1.f"), + (StringTag("1.e-1."), "1.e-1."), + (StringTag("1.e-1.1"), "1.e-1.1"), + (StringTag("1.e-1.1D"), "1.e-1.1D"), + (StringTag("1.e-1.1F"), "1.e-1.1F"), + (StringTag("1.e-1.1d"), "1.e-1.1d"), + (StringTag("1.e-1.1f"), "1.e-1.1f"), + (StringTag("1.e-1.D"), "1.e-1.D"), + (StringTag("1.e-1.F"), "1.e-1.F"), + (StringTag("1.e-1.d"), "1.e-1.d"), + (StringTag("1.e-1.f"), "1.e-1.f"), (DoubleTag(0.100000), "1.e-1D"), (FloatTag(0.100000), "1.e-1F"), (DoubleTag(0.100000), "1.e-1d"), (FloatTag(0.100000), "1.e-1f"), - (StringTag('1.e-D'), "1.e-D"), - (StringTag('1.e-F'), "1.e-F"), - (StringTag('1.e-d'), "1.e-d"), - (StringTag('1.e-f'), "1.e-f"), - (StringTag('1.e.'), "1.e."), - (StringTag('1.e.1'), "1.e.1"), - (StringTag('1.e.1D'), "1.e.1D"), - (StringTag('1.e.1F'), "1.e.1F"), - (StringTag('1.e.1d'), "1.e.1d"), - (StringTag('1.e.1f'), "1.e.1f"), - (StringTag('1.e.D'), "1.e.D"), - (StringTag('1.e.F'), "1.e.F"), - (StringTag('1.e.d'), "1.e.d"), - (StringTag('1.e.f'), "1.e.f"), + (StringTag("1.e-D"), "1.e-D"), + (StringTag("1.e-F"), "1.e-F"), + (StringTag("1.e-d"), "1.e-d"), + (StringTag("1.e-f"), "1.e-f"), + (StringTag("1.e."), "1.e."), + (StringTag("1.e.1"), "1.e.1"), + (StringTag("1.e.1D"), "1.e.1D"), + (StringTag("1.e.1F"), "1.e.1F"), + (StringTag("1.e.1d"), "1.e.1d"), + (StringTag("1.e.1f"), "1.e.1f"), + (StringTag("1.e.D"), "1.e.D"), + (StringTag("1.e.F"), "1.e.F"), + (StringTag("1.e.d"), "1.e.d"), + (StringTag("1.e.f"), "1.e.f"), (DoubleTag(10.000000), "1.e1"), - (StringTag('1.e1.'), "1.e1."), - (StringTag('1.e1.1'), "1.e1.1"), - (StringTag('1.e1.1D'), "1.e1.1D"), - (StringTag('1.e1.1F'), "1.e1.1F"), - (StringTag('1.e1.1d'), "1.e1.1d"), - (StringTag('1.e1.1f'), "1.e1.1f"), - (StringTag('1.e1.D'), "1.e1.D"), - (StringTag('1.e1.F'), "1.e1.F"), - (StringTag('1.e1.d'), "1.e1.d"), - (StringTag('1.e1.f'), "1.e1.f"), + (StringTag("1.e1."), "1.e1."), + (StringTag("1.e1.1"), "1.e1.1"), + (StringTag("1.e1.1D"), "1.e1.1D"), + (StringTag("1.e1.1F"), "1.e1.1F"), + (StringTag("1.e1.1d"), "1.e1.1d"), + (StringTag("1.e1.1f"), "1.e1.1f"), + (StringTag("1.e1.D"), "1.e1.D"), + (StringTag("1.e1.F"), "1.e1.F"), + (StringTag("1.e1.d"), "1.e1.d"), + (StringTag("1.e1.f"), "1.e1.f"), (DoubleTag(10.000000), "1.e1D"), (FloatTag(10.000000), "1.e1F"), (DoubleTag(10.000000), "1.e1d"), (FloatTag(10.000000), "1.e1f"), - (StringTag('1.eD'), "1.eD"), - (StringTag('1.eF'), "1.eF"), - (StringTag('1.ed'), "1.ed"), - (StringTag('1.ef'), "1.ef"), + (StringTag("1.eD"), "1.eD"), + (StringTag("1.eF"), "1.eF"), + (StringTag("1.ed"), "1.ed"), + (StringTag("1.ef"), "1.ef"), (FloatTag(1.000000), "1.f"), (IntTag(11), "11"), (DoubleTag(11.000000), "11."), @@ -4883,373 +4882,373 @@ def test_from_snbt(self) -> None: (DoubleTag(11.000000), "11d"), (FloatTag(11.000000), "11f"), (DoubleTag(1.000000), "1D"), - (StringTag('1E'), "1E"), - (StringTag('1E+'), "1E+"), - (StringTag('1E+.'), "1E+."), - (StringTag('1E+.1'), "1E+.1"), - (StringTag('1E+.1D'), "1E+.1D"), - (StringTag('1E+.1F'), "1E+.1F"), - (StringTag('1E+.1d'), "1E+.1d"), - (StringTag('1E+.1f'), "1E+.1f"), - (StringTag('1E+.D'), "1E+.D"), - (StringTag('1E+.F'), "1E+.F"), - (StringTag('1E+.d'), "1E+.d"), - (StringTag('1E+.f'), "1E+.f"), - (StringTag('1E+1'), "1E+1"), - (StringTag('1E+1.'), "1E+1."), - (StringTag('1E+1.1'), "1E+1.1"), - (StringTag('1E+1.1D'), "1E+1.1D"), - (StringTag('1E+1.1F'), "1E+1.1F"), - (StringTag('1E+1.1d'), "1E+1.1d"), - (StringTag('1E+1.1f'), "1E+1.1f"), - (StringTag('1E+1.D'), "1E+1.D"), - (StringTag('1E+1.F'), "1E+1.F"), - (StringTag('1E+1.d'), "1E+1.d"), - (StringTag('1E+1.f'), "1E+1.f"), + (StringTag("1E"), "1E"), + (StringTag("1E+"), "1E+"), + (StringTag("1E+."), "1E+."), + (StringTag("1E+.1"), "1E+.1"), + (StringTag("1E+.1D"), "1E+.1D"), + (StringTag("1E+.1F"), "1E+.1F"), + (StringTag("1E+.1d"), "1E+.1d"), + (StringTag("1E+.1f"), "1E+.1f"), + (StringTag("1E+.D"), "1E+.D"), + (StringTag("1E+.F"), "1E+.F"), + (StringTag("1E+.d"), "1E+.d"), + (StringTag("1E+.f"), "1E+.f"), + (StringTag("1E+1"), "1E+1"), + (StringTag("1E+1."), "1E+1."), + (StringTag("1E+1.1"), "1E+1.1"), + (StringTag("1E+1.1D"), "1E+1.1D"), + (StringTag("1E+1.1F"), "1E+1.1F"), + (StringTag("1E+1.1d"), "1E+1.1d"), + (StringTag("1E+1.1f"), "1E+1.1f"), + (StringTag("1E+1.D"), "1E+1.D"), + (StringTag("1E+1.F"), "1E+1.F"), + (StringTag("1E+1.d"), "1E+1.d"), + (StringTag("1E+1.f"), "1E+1.f"), (DoubleTag(10.000000), "1E+1D"), (FloatTag(10.000000), "1E+1F"), (DoubleTag(10.000000), "1E+1d"), (FloatTag(10.000000), "1E+1f"), - (StringTag('1E+D'), "1E+D"), - (StringTag('1E+F'), "1E+F"), - (StringTag('1E+d'), "1E+d"), - (StringTag('1E+f'), "1E+f"), - (StringTag('1E-'), "1E-"), - (StringTag('1E-.'), "1E-."), - (StringTag('1E-.1'), "1E-.1"), - (StringTag('1E-.1D'), "1E-.1D"), - (StringTag('1E-.1F'), "1E-.1F"), - (StringTag('1E-.1d'), "1E-.1d"), - (StringTag('1E-.1f'), "1E-.1f"), - (StringTag('1E-.D'), "1E-.D"), - (StringTag('1E-.F'), "1E-.F"), - (StringTag('1E-.d'), "1E-.d"), - (StringTag('1E-.f'), "1E-.f"), - (StringTag('1E-1'), "1E-1"), - (StringTag('1E-1.'), "1E-1."), - (StringTag('1E-1.1'), "1E-1.1"), - (StringTag('1E-1.1D'), "1E-1.1D"), - (StringTag('1E-1.1F'), "1E-1.1F"), - (StringTag('1E-1.1d'), "1E-1.1d"), - (StringTag('1E-1.1f'), "1E-1.1f"), - (StringTag('1E-1.D'), "1E-1.D"), - (StringTag('1E-1.F'), "1E-1.F"), - (StringTag('1E-1.d'), "1E-1.d"), - (StringTag('1E-1.f'), "1E-1.f"), + (StringTag("1E+D"), "1E+D"), + (StringTag("1E+F"), "1E+F"), + (StringTag("1E+d"), "1E+d"), + (StringTag("1E+f"), "1E+f"), + (StringTag("1E-"), "1E-"), + (StringTag("1E-."), "1E-."), + (StringTag("1E-.1"), "1E-.1"), + (StringTag("1E-.1D"), "1E-.1D"), + (StringTag("1E-.1F"), "1E-.1F"), + (StringTag("1E-.1d"), "1E-.1d"), + (StringTag("1E-.1f"), "1E-.1f"), + (StringTag("1E-.D"), "1E-.D"), + (StringTag("1E-.F"), "1E-.F"), + (StringTag("1E-.d"), "1E-.d"), + (StringTag("1E-.f"), "1E-.f"), + (StringTag("1E-1"), "1E-1"), + (StringTag("1E-1."), "1E-1."), + (StringTag("1E-1.1"), "1E-1.1"), + (StringTag("1E-1.1D"), "1E-1.1D"), + (StringTag("1E-1.1F"), "1E-1.1F"), + (StringTag("1E-1.1d"), "1E-1.1d"), + (StringTag("1E-1.1f"), "1E-1.1f"), + (StringTag("1E-1.D"), "1E-1.D"), + (StringTag("1E-1.F"), "1E-1.F"), + (StringTag("1E-1.d"), "1E-1.d"), + (StringTag("1E-1.f"), "1E-1.f"), (DoubleTag(0.100000), "1E-1D"), (FloatTag(0.100000), "1E-1F"), (DoubleTag(0.100000), "1E-1d"), (FloatTag(0.100000), "1E-1f"), - (StringTag('1E-D'), "1E-D"), - (StringTag('1E-F'), "1E-F"), - (StringTag('1E-d'), "1E-d"), - (StringTag('1E-f'), "1E-f"), - (StringTag('1E.'), "1E."), - (StringTag('1E.1'), "1E.1"), - (StringTag('1E.1D'), "1E.1D"), - (StringTag('1E.1F'), "1E.1F"), - (StringTag('1E.1d'), "1E.1d"), - (StringTag('1E.1f'), "1E.1f"), - (StringTag('1E.D'), "1E.D"), - (StringTag('1E.F'), "1E.F"), - (StringTag('1E.d'), "1E.d"), - (StringTag('1E.f'), "1E.f"), - (StringTag('1E1'), "1E1"), - (StringTag('1E1.'), "1E1."), - (StringTag('1E1.1'), "1E1.1"), - (StringTag('1E1.1D'), "1E1.1D"), - (StringTag('1E1.1F'), "1E1.1F"), - (StringTag('1E1.1d'), "1E1.1d"), - (StringTag('1E1.1f'), "1E1.1f"), - (StringTag('1E1.D'), "1E1.D"), - (StringTag('1E1.F'), "1E1.F"), - (StringTag('1E1.d'), "1E1.d"), - (StringTag('1E1.f'), "1E1.f"), + (StringTag("1E-D"), "1E-D"), + (StringTag("1E-F"), "1E-F"), + (StringTag("1E-d"), "1E-d"), + (StringTag("1E-f"), "1E-f"), + (StringTag("1E."), "1E."), + (StringTag("1E.1"), "1E.1"), + (StringTag("1E.1D"), "1E.1D"), + (StringTag("1E.1F"), "1E.1F"), + (StringTag("1E.1d"), "1E.1d"), + (StringTag("1E.1f"), "1E.1f"), + (StringTag("1E.D"), "1E.D"), + (StringTag("1E.F"), "1E.F"), + (StringTag("1E.d"), "1E.d"), + (StringTag("1E.f"), "1E.f"), + (StringTag("1E1"), "1E1"), + (StringTag("1E1."), "1E1."), + (StringTag("1E1.1"), "1E1.1"), + (StringTag("1E1.1D"), "1E1.1D"), + (StringTag("1E1.1F"), "1E1.1F"), + (StringTag("1E1.1d"), "1E1.1d"), + (StringTag("1E1.1f"), "1E1.1f"), + (StringTag("1E1.D"), "1E1.D"), + (StringTag("1E1.F"), "1E1.F"), + (StringTag("1E1.d"), "1E1.d"), + (StringTag("1E1.f"), "1E1.f"), (DoubleTag(10.000000), "1E1D"), (FloatTag(10.000000), "1E1F"), (DoubleTag(10.000000), "1E1d"), (FloatTag(10.000000), "1E1f"), - (StringTag('1ED'), "1ED"), - (StringTag('1EF'), "1EF"), - (StringTag('1Ed'), "1Ed"), - (StringTag('1Ef'), "1Ef"), + (StringTag("1ED"), "1ED"), + (StringTag("1EF"), "1EF"), + (StringTag("1Ed"), "1Ed"), + (StringTag("1Ef"), "1Ef"), (FloatTag(1.000000), "1F"), (DoubleTag(1.000000), "1d"), - (StringTag('1e'), "1e"), - (StringTag('1e+'), "1e+"), - (StringTag('1e+.'), "1e+."), - (StringTag('1e+.1'), "1e+.1"), - (StringTag('1e+.1D'), "1e+.1D"), - (StringTag('1e+.1F'), "1e+.1F"), - (StringTag('1e+.1d'), "1e+.1d"), - (StringTag('1e+.1f'), "1e+.1f"), - (StringTag('1e+.D'), "1e+.D"), - (StringTag('1e+.F'), "1e+.F"), - (StringTag('1e+.d'), "1e+.d"), - (StringTag('1e+.f'), "1e+.f"), - (StringTag('1e+1'), "1e+1"), - (StringTag('1e+1.'), "1e+1."), - (StringTag('1e+1.1'), "1e+1.1"), - (StringTag('1e+1.1D'), "1e+1.1D"), - (StringTag('1e+1.1F'), "1e+1.1F"), - (StringTag('1e+1.1d'), "1e+1.1d"), - (StringTag('1e+1.1f'), "1e+1.1f"), - (StringTag('1e+1.D'), "1e+1.D"), - (StringTag('1e+1.F'), "1e+1.F"), - (StringTag('1e+1.d'), "1e+1.d"), - (StringTag('1e+1.f'), "1e+1.f"), + (StringTag("1e"), "1e"), + (StringTag("1e+"), "1e+"), + (StringTag("1e+."), "1e+."), + (StringTag("1e+.1"), "1e+.1"), + (StringTag("1e+.1D"), "1e+.1D"), + (StringTag("1e+.1F"), "1e+.1F"), + (StringTag("1e+.1d"), "1e+.1d"), + (StringTag("1e+.1f"), "1e+.1f"), + (StringTag("1e+.D"), "1e+.D"), + (StringTag("1e+.F"), "1e+.F"), + (StringTag("1e+.d"), "1e+.d"), + (StringTag("1e+.f"), "1e+.f"), + (StringTag("1e+1"), "1e+1"), + (StringTag("1e+1."), "1e+1."), + (StringTag("1e+1.1"), "1e+1.1"), + (StringTag("1e+1.1D"), "1e+1.1D"), + (StringTag("1e+1.1F"), "1e+1.1F"), + (StringTag("1e+1.1d"), "1e+1.1d"), + (StringTag("1e+1.1f"), "1e+1.1f"), + (StringTag("1e+1.D"), "1e+1.D"), + (StringTag("1e+1.F"), "1e+1.F"), + (StringTag("1e+1.d"), "1e+1.d"), + (StringTag("1e+1.f"), "1e+1.f"), (DoubleTag(10.000000), "1e+1D"), (FloatTag(10.000000), "1e+1F"), (DoubleTag(10.000000), "1e+1d"), (FloatTag(10.000000), "1e+1f"), - (StringTag('1e+D'), "1e+D"), - (StringTag('1e+F'), "1e+F"), - (StringTag('1e+d'), "1e+d"), - (StringTag('1e+f'), "1e+f"), - (StringTag('1e-'), "1e-"), - (StringTag('1e-.'), "1e-."), - (StringTag('1e-.1'), "1e-.1"), - (StringTag('1e-.1D'), "1e-.1D"), - (StringTag('1e-.1F'), "1e-.1F"), - (StringTag('1e-.1d'), "1e-.1d"), - (StringTag('1e-.1f'), "1e-.1f"), - (StringTag('1e-.D'), "1e-.D"), - (StringTag('1e-.F'), "1e-.F"), - (StringTag('1e-.d'), "1e-.d"), - (StringTag('1e-.f'), "1e-.f"), - (StringTag('1e-1'), "1e-1"), - (StringTag('1e-1.'), "1e-1."), - (StringTag('1e-1.1'), "1e-1.1"), - (StringTag('1e-1.1D'), "1e-1.1D"), - (StringTag('1e-1.1F'), "1e-1.1F"), - (StringTag('1e-1.1d'), "1e-1.1d"), - (StringTag('1e-1.1f'), "1e-1.1f"), - (StringTag('1e-1.D'), "1e-1.D"), - (StringTag('1e-1.F'), "1e-1.F"), - (StringTag('1e-1.d'), "1e-1.d"), - (StringTag('1e-1.f'), "1e-1.f"), + (StringTag("1e+D"), "1e+D"), + (StringTag("1e+F"), "1e+F"), + (StringTag("1e+d"), "1e+d"), + (StringTag("1e+f"), "1e+f"), + (StringTag("1e-"), "1e-"), + (StringTag("1e-."), "1e-."), + (StringTag("1e-.1"), "1e-.1"), + (StringTag("1e-.1D"), "1e-.1D"), + (StringTag("1e-.1F"), "1e-.1F"), + (StringTag("1e-.1d"), "1e-.1d"), + (StringTag("1e-.1f"), "1e-.1f"), + (StringTag("1e-.D"), "1e-.D"), + (StringTag("1e-.F"), "1e-.F"), + (StringTag("1e-.d"), "1e-.d"), + (StringTag("1e-.f"), "1e-.f"), + (StringTag("1e-1"), "1e-1"), + (StringTag("1e-1."), "1e-1."), + (StringTag("1e-1.1"), "1e-1.1"), + (StringTag("1e-1.1D"), "1e-1.1D"), + (StringTag("1e-1.1F"), "1e-1.1F"), + (StringTag("1e-1.1d"), "1e-1.1d"), + (StringTag("1e-1.1f"), "1e-1.1f"), + (StringTag("1e-1.D"), "1e-1.D"), + (StringTag("1e-1.F"), "1e-1.F"), + (StringTag("1e-1.d"), "1e-1.d"), + (StringTag("1e-1.f"), "1e-1.f"), (DoubleTag(0.100000), "1e-1D"), (FloatTag(0.100000), "1e-1F"), (DoubleTag(0.100000), "1e-1d"), (FloatTag(0.100000), "1e-1f"), - (StringTag('1e-D'), "1e-D"), - (StringTag('1e-F'), "1e-F"), - (StringTag('1e-d'), "1e-d"), - (StringTag('1e-f'), "1e-f"), - (StringTag('1e.'), "1e."), - (StringTag('1e.1'), "1e.1"), - (StringTag('1e.1D'), "1e.1D"), - (StringTag('1e.1F'), "1e.1F"), - (StringTag('1e.1d'), "1e.1d"), - (StringTag('1e.1f'), "1e.1f"), - (StringTag('1e.D'), "1e.D"), - (StringTag('1e.F'), "1e.F"), - (StringTag('1e.d'), "1e.d"), - (StringTag('1e.f'), "1e.f"), - (StringTag('1e1'), "1e1"), - (StringTag('1e1.'), "1e1."), - (StringTag('1e1.1'), "1e1.1"), - (StringTag('1e1.1D'), "1e1.1D"), - (StringTag('1e1.1F'), "1e1.1F"), - (StringTag('1e1.1d'), "1e1.1d"), - (StringTag('1e1.1f'), "1e1.1f"), - (StringTag('1e1.D'), "1e1.D"), - (StringTag('1e1.F'), "1e1.F"), - (StringTag('1e1.d'), "1e1.d"), - (StringTag('1e1.f'), "1e1.f"), + (StringTag("1e-D"), "1e-D"), + (StringTag("1e-F"), "1e-F"), + (StringTag("1e-d"), "1e-d"), + (StringTag("1e-f"), "1e-f"), + (StringTag("1e."), "1e."), + (StringTag("1e.1"), "1e.1"), + (StringTag("1e.1D"), "1e.1D"), + (StringTag("1e.1F"), "1e.1F"), + (StringTag("1e.1d"), "1e.1d"), + (StringTag("1e.1f"), "1e.1f"), + (StringTag("1e.D"), "1e.D"), + (StringTag("1e.F"), "1e.F"), + (StringTag("1e.d"), "1e.d"), + (StringTag("1e.f"), "1e.f"), + (StringTag("1e1"), "1e1"), + (StringTag("1e1."), "1e1."), + (StringTag("1e1.1"), "1e1.1"), + (StringTag("1e1.1D"), "1e1.1D"), + (StringTag("1e1.1F"), "1e1.1F"), + (StringTag("1e1.1d"), "1e1.1d"), + (StringTag("1e1.1f"), "1e1.1f"), + (StringTag("1e1.D"), "1e1.D"), + (StringTag("1e1.F"), "1e1.F"), + (StringTag("1e1.d"), "1e1.d"), + (StringTag("1e1.f"), "1e1.f"), (DoubleTag(10.000000), "1e1D"), (FloatTag(10.000000), "1e1F"), (DoubleTag(10.000000), "1e1d"), (FloatTag(10.000000), "1e1f"), - (StringTag('1eD'), "1eD"), - (StringTag('1eF'), "1eF"), - (StringTag('1ed'), "1ed"), - (StringTag('1ef'), "1ef"), + (StringTag("1eD"), "1eD"), + (StringTag("1eF"), "1eF"), + (StringTag("1ed"), "1ed"), + (StringTag("1ef"), "1ef"), (FloatTag(1.000000), "1f"), - (StringTag('D'), "D"), - (StringTag('E'), "E"), - (StringTag('E+'), "E+"), - (StringTag('E+.'), "E+."), - (StringTag('E+.1'), "E+.1"), - (StringTag('E+.1D'), "E+.1D"), - (StringTag('E+.1F'), "E+.1F"), - (StringTag('E+.1d'), "E+.1d"), - (StringTag('E+.1f'), "E+.1f"), - (StringTag('E+.D'), "E+.D"), - (StringTag('E+.F'), "E+.F"), - (StringTag('E+.d'), "E+.d"), - (StringTag('E+.f'), "E+.f"), - (StringTag('E+1'), "E+1"), - (StringTag('E+1.'), "E+1."), - (StringTag('E+1.1'), "E+1.1"), - (StringTag('E+1.1D'), "E+1.1D"), - (StringTag('E+1.1F'), "E+1.1F"), - (StringTag('E+1.1d'), "E+1.1d"), - (StringTag('E+1.1f'), "E+1.1f"), - (StringTag('E+1.D'), "E+1.D"), - (StringTag('E+1.F'), "E+1.F"), - (StringTag('E+1.d'), "E+1.d"), - (StringTag('E+1.f'), "E+1.f"), - (StringTag('E+1D'), "E+1D"), - (StringTag('E+1F'), "E+1F"), - (StringTag('E+1d'), "E+1d"), - (StringTag('E+1f'), "E+1f"), - (StringTag('E+D'), "E+D"), - (StringTag('E+F'), "E+F"), - (StringTag('E+d'), "E+d"), - (StringTag('E+f'), "E+f"), - (StringTag('E-'), "E-"), - (StringTag('E-.'), "E-."), - (StringTag('E-.1'), "E-.1"), - (StringTag('E-.1D'), "E-.1D"), - (StringTag('E-.1F'), "E-.1F"), - (StringTag('E-.1d'), "E-.1d"), - (StringTag('E-.1f'), "E-.1f"), - (StringTag('E-.D'), "E-.D"), - (StringTag('E-.F'), "E-.F"), - (StringTag('E-.d'), "E-.d"), - (StringTag('E-.f'), "E-.f"), - (StringTag('E-1'), "E-1"), - (StringTag('E-1.'), "E-1."), - (StringTag('E-1.1'), "E-1.1"), - (StringTag('E-1.1D'), "E-1.1D"), - (StringTag('E-1.1F'), "E-1.1F"), - (StringTag('E-1.1d'), "E-1.1d"), - (StringTag('E-1.1f'), "E-1.1f"), - (StringTag('E-1.D'), "E-1.D"), - (StringTag('E-1.F'), "E-1.F"), - (StringTag('E-1.d'), "E-1.d"), - (StringTag('E-1.f'), "E-1.f"), - (StringTag('E-1D'), "E-1D"), - (StringTag('E-1F'), "E-1F"), - (StringTag('E-1d'), "E-1d"), - (StringTag('E-1f'), "E-1f"), - (StringTag('E-D'), "E-D"), - (StringTag('E-F'), "E-F"), - (StringTag('E-d'), "E-d"), - (StringTag('E-f'), "E-f"), - (StringTag('E.'), "E."), - (StringTag('E.1'), "E.1"), - (StringTag('E.1D'), "E.1D"), - (StringTag('E.1F'), "E.1F"), - (StringTag('E.1d'), "E.1d"), - (StringTag('E.1f'), "E.1f"), - (StringTag('E.D'), "E.D"), - (StringTag('E.F'), "E.F"), - (StringTag('E.d'), "E.d"), - (StringTag('E.f'), "E.f"), - (StringTag('E1'), "E1"), - (StringTag('E1.'), "E1."), - (StringTag('E1.1'), "E1.1"), - (StringTag('E1.1D'), "E1.1D"), - (StringTag('E1.1F'), "E1.1F"), - (StringTag('E1.1d'), "E1.1d"), - (StringTag('E1.1f'), "E1.1f"), - (StringTag('E1.D'), "E1.D"), - (StringTag('E1.F'), "E1.F"), - (StringTag('E1.d'), "E1.d"), - (StringTag('E1.f'), "E1.f"), - (StringTag('E1D'), "E1D"), - (StringTag('E1F'), "E1F"), - (StringTag('E1d'), "E1d"), - (StringTag('E1f'), "E1f"), - (StringTag('ED'), "ED"), - (StringTag('EF'), "EF"), - (StringTag('Ed'), "Ed"), - (StringTag('Ef'), "Ef"), - (StringTag('F'), "F"), - (StringTag('d'), "d"), - (StringTag('e'), "e"), - (StringTag('e+'), "e+"), - (StringTag('e+.'), "e+."), - (StringTag('e+.1'), "e+.1"), - (StringTag('e+.1D'), "e+.1D"), - (StringTag('e+.1F'), "e+.1F"), - (StringTag('e+.1d'), "e+.1d"), - (StringTag('e+.1f'), "e+.1f"), - (StringTag('e+.D'), "e+.D"), - (StringTag('e+.F'), "e+.F"), - (StringTag('e+.d'), "e+.d"), - (StringTag('e+.f'), "e+.f"), - (StringTag('e+1'), "e+1"), - (StringTag('e+1.'), "e+1."), - (StringTag('e+1.1'), "e+1.1"), - (StringTag('e+1.1D'), "e+1.1D"), - (StringTag('e+1.1F'), "e+1.1F"), - (StringTag('e+1.1d'), "e+1.1d"), - (StringTag('e+1.1f'), "e+1.1f"), - (StringTag('e+1.D'), "e+1.D"), - (StringTag('e+1.F'), "e+1.F"), - (StringTag('e+1.d'), "e+1.d"), - (StringTag('e+1.f'), "e+1.f"), - (StringTag('e+1D'), "e+1D"), - (StringTag('e+1F'), "e+1F"), - (StringTag('e+1d'), "e+1d"), - (StringTag('e+1f'), "e+1f"), - (StringTag('e+D'), "e+D"), - (StringTag('e+F'), "e+F"), - (StringTag('e+d'), "e+d"), - (StringTag('e+f'), "e+f"), - (StringTag('e-'), "e-"), - (StringTag('e-.'), "e-."), - (StringTag('e-.1'), "e-.1"), - (StringTag('e-.1D'), "e-.1D"), - (StringTag('e-.1F'), "e-.1F"), - (StringTag('e-.1d'), "e-.1d"), - (StringTag('e-.1f'), "e-.1f"), - (StringTag('e-.D'), "e-.D"), - (StringTag('e-.F'), "e-.F"), - (StringTag('e-.d'), "e-.d"), - (StringTag('e-.f'), "e-.f"), - (StringTag('e-1'), "e-1"), - (StringTag('e-1.'), "e-1."), - (StringTag('e-1.1'), "e-1.1"), - (StringTag('e-1.1D'), "e-1.1D"), - (StringTag('e-1.1F'), "e-1.1F"), - (StringTag('e-1.1d'), "e-1.1d"), - (StringTag('e-1.1f'), "e-1.1f"), - (StringTag('e-1.D'), "e-1.D"), - (StringTag('e-1.F'), "e-1.F"), - (StringTag('e-1.d'), "e-1.d"), - (StringTag('e-1.f'), "e-1.f"), - (StringTag('e-1D'), "e-1D"), - (StringTag('e-1F'), "e-1F"), - (StringTag('e-1d'), "e-1d"), - (StringTag('e-1f'), "e-1f"), - (StringTag('e-D'), "e-D"), - (StringTag('e-F'), "e-F"), - (StringTag('e-d'), "e-d"), - (StringTag('e-f'), "e-f"), - (StringTag('e.'), "e."), - (StringTag('e.1'), "e.1"), - (StringTag('e.1D'), "e.1D"), - (StringTag('e.1F'), "e.1F"), - (StringTag('e.1d'), "e.1d"), - (StringTag('e.1f'), "e.1f"), - (StringTag('e.D'), "e.D"), - (StringTag('e.F'), "e.F"), - (StringTag('e.d'), "e.d"), - (StringTag('e.f'), "e.f"), - (StringTag('e1'), "e1"), - (StringTag('e1.'), "e1."), - (StringTag('e1.1'), "e1.1"), - (StringTag('e1.1D'), "e1.1D"), - (StringTag('e1.1F'), "e1.1F"), - (StringTag('e1.1d'), "e1.1d"), - (StringTag('e1.1f'), "e1.1f"), - (StringTag('e1.D'), "e1.D"), - (StringTag('e1.F'), "e1.F"), - (StringTag('e1.d'), "e1.d"), - (StringTag('e1.f'), "e1.f"), - (StringTag('e1D'), "e1D"), - (StringTag('e1F'), "e1F"), - (StringTag('e1d'), "e1d"), - (StringTag('e1f'), "e1f"), - (StringTag('eD'), "eD"), - (StringTag('eF'), "eF"), - (StringTag('ed'), "ed"), - (StringTag('ef'), "ef"), - (StringTag('f'), "f"), + (StringTag("D"), "D"), + (StringTag("E"), "E"), + (StringTag("E+"), "E+"), + (StringTag("E+."), "E+."), + (StringTag("E+.1"), "E+.1"), + (StringTag("E+.1D"), "E+.1D"), + (StringTag("E+.1F"), "E+.1F"), + (StringTag("E+.1d"), "E+.1d"), + (StringTag("E+.1f"), "E+.1f"), + (StringTag("E+.D"), "E+.D"), + (StringTag("E+.F"), "E+.F"), + (StringTag("E+.d"), "E+.d"), + (StringTag("E+.f"), "E+.f"), + (StringTag("E+1"), "E+1"), + (StringTag("E+1."), "E+1."), + (StringTag("E+1.1"), "E+1.1"), + (StringTag("E+1.1D"), "E+1.1D"), + (StringTag("E+1.1F"), "E+1.1F"), + (StringTag("E+1.1d"), "E+1.1d"), + (StringTag("E+1.1f"), "E+1.1f"), + (StringTag("E+1.D"), "E+1.D"), + (StringTag("E+1.F"), "E+1.F"), + (StringTag("E+1.d"), "E+1.d"), + (StringTag("E+1.f"), "E+1.f"), + (StringTag("E+1D"), "E+1D"), + (StringTag("E+1F"), "E+1F"), + (StringTag("E+1d"), "E+1d"), + (StringTag("E+1f"), "E+1f"), + (StringTag("E+D"), "E+D"), + (StringTag("E+F"), "E+F"), + (StringTag("E+d"), "E+d"), + (StringTag("E+f"), "E+f"), + (StringTag("E-"), "E-"), + (StringTag("E-."), "E-."), + (StringTag("E-.1"), "E-.1"), + (StringTag("E-.1D"), "E-.1D"), + (StringTag("E-.1F"), "E-.1F"), + (StringTag("E-.1d"), "E-.1d"), + (StringTag("E-.1f"), "E-.1f"), + (StringTag("E-.D"), "E-.D"), + (StringTag("E-.F"), "E-.F"), + (StringTag("E-.d"), "E-.d"), + (StringTag("E-.f"), "E-.f"), + (StringTag("E-1"), "E-1"), + (StringTag("E-1."), "E-1."), + (StringTag("E-1.1"), "E-1.1"), + (StringTag("E-1.1D"), "E-1.1D"), + (StringTag("E-1.1F"), "E-1.1F"), + (StringTag("E-1.1d"), "E-1.1d"), + (StringTag("E-1.1f"), "E-1.1f"), + (StringTag("E-1.D"), "E-1.D"), + (StringTag("E-1.F"), "E-1.F"), + (StringTag("E-1.d"), "E-1.d"), + (StringTag("E-1.f"), "E-1.f"), + (StringTag("E-1D"), "E-1D"), + (StringTag("E-1F"), "E-1F"), + (StringTag("E-1d"), "E-1d"), + (StringTag("E-1f"), "E-1f"), + (StringTag("E-D"), "E-D"), + (StringTag("E-F"), "E-F"), + (StringTag("E-d"), "E-d"), + (StringTag("E-f"), "E-f"), + (StringTag("E."), "E."), + (StringTag("E.1"), "E.1"), + (StringTag("E.1D"), "E.1D"), + (StringTag("E.1F"), "E.1F"), + (StringTag("E.1d"), "E.1d"), + (StringTag("E.1f"), "E.1f"), + (StringTag("E.D"), "E.D"), + (StringTag("E.F"), "E.F"), + (StringTag("E.d"), "E.d"), + (StringTag("E.f"), "E.f"), + (StringTag("E1"), "E1"), + (StringTag("E1."), "E1."), + (StringTag("E1.1"), "E1.1"), + (StringTag("E1.1D"), "E1.1D"), + (StringTag("E1.1F"), "E1.1F"), + (StringTag("E1.1d"), "E1.1d"), + (StringTag("E1.1f"), "E1.1f"), + (StringTag("E1.D"), "E1.D"), + (StringTag("E1.F"), "E1.F"), + (StringTag("E1.d"), "E1.d"), + (StringTag("E1.f"), "E1.f"), + (StringTag("E1D"), "E1D"), + (StringTag("E1F"), "E1F"), + (StringTag("E1d"), "E1d"), + (StringTag("E1f"), "E1f"), + (StringTag("ED"), "ED"), + (StringTag("EF"), "EF"), + (StringTag("Ed"), "Ed"), + (StringTag("Ef"), "Ef"), + (StringTag("F"), "F"), + (StringTag("d"), "d"), + (StringTag("e"), "e"), + (StringTag("e+"), "e+"), + (StringTag("e+."), "e+."), + (StringTag("e+.1"), "e+.1"), + (StringTag("e+.1D"), "e+.1D"), + (StringTag("e+.1F"), "e+.1F"), + (StringTag("e+.1d"), "e+.1d"), + (StringTag("e+.1f"), "e+.1f"), + (StringTag("e+.D"), "e+.D"), + (StringTag("e+.F"), "e+.F"), + (StringTag("e+.d"), "e+.d"), + (StringTag("e+.f"), "e+.f"), + (StringTag("e+1"), "e+1"), + (StringTag("e+1."), "e+1."), + (StringTag("e+1.1"), "e+1.1"), + (StringTag("e+1.1D"), "e+1.1D"), + (StringTag("e+1.1F"), "e+1.1F"), + (StringTag("e+1.1d"), "e+1.1d"), + (StringTag("e+1.1f"), "e+1.1f"), + (StringTag("e+1.D"), "e+1.D"), + (StringTag("e+1.F"), "e+1.F"), + (StringTag("e+1.d"), "e+1.d"), + (StringTag("e+1.f"), "e+1.f"), + (StringTag("e+1D"), "e+1D"), + (StringTag("e+1F"), "e+1F"), + (StringTag("e+1d"), "e+1d"), + (StringTag("e+1f"), "e+1f"), + (StringTag("e+D"), "e+D"), + (StringTag("e+F"), "e+F"), + (StringTag("e+d"), "e+d"), + (StringTag("e+f"), "e+f"), + (StringTag("e-"), "e-"), + (StringTag("e-."), "e-."), + (StringTag("e-.1"), "e-.1"), + (StringTag("e-.1D"), "e-.1D"), + (StringTag("e-.1F"), "e-.1F"), + (StringTag("e-.1d"), "e-.1d"), + (StringTag("e-.1f"), "e-.1f"), + (StringTag("e-.D"), "e-.D"), + (StringTag("e-.F"), "e-.F"), + (StringTag("e-.d"), "e-.d"), + (StringTag("e-.f"), "e-.f"), + (StringTag("e-1"), "e-1"), + (StringTag("e-1."), "e-1."), + (StringTag("e-1.1"), "e-1.1"), + (StringTag("e-1.1D"), "e-1.1D"), + (StringTag("e-1.1F"), "e-1.1F"), + (StringTag("e-1.1d"), "e-1.1d"), + (StringTag("e-1.1f"), "e-1.1f"), + (StringTag("e-1.D"), "e-1.D"), + (StringTag("e-1.F"), "e-1.F"), + (StringTag("e-1.d"), "e-1.d"), + (StringTag("e-1.f"), "e-1.f"), + (StringTag("e-1D"), "e-1D"), + (StringTag("e-1F"), "e-1F"), + (StringTag("e-1d"), "e-1d"), + (StringTag("e-1f"), "e-1f"), + (StringTag("e-D"), "e-D"), + (StringTag("e-F"), "e-F"), + (StringTag("e-d"), "e-d"), + (StringTag("e-f"), "e-f"), + (StringTag("e."), "e."), + (StringTag("e.1"), "e.1"), + (StringTag("e.1D"), "e.1D"), + (StringTag("e.1F"), "e.1F"), + (StringTag("e.1d"), "e.1d"), + (StringTag("e.1f"), "e.1f"), + (StringTag("e.D"), "e.D"), + (StringTag("e.F"), "e.F"), + (StringTag("e.d"), "e.d"), + (StringTag("e.f"), "e.f"), + (StringTag("e1"), "e1"), + (StringTag("e1."), "e1."), + (StringTag("e1.1"), "e1.1"), + (StringTag("e1.1D"), "e1.1D"), + (StringTag("e1.1F"), "e1.1F"), + (StringTag("e1.1d"), "e1.1d"), + (StringTag("e1.1f"), "e1.1f"), + (StringTag("e1.D"), "e1.D"), + (StringTag("e1.F"), "e1.F"), + (StringTag("e1.d"), "e1.d"), + (StringTag("e1.f"), "e1.f"), + (StringTag("e1D"), "e1D"), + (StringTag("e1F"), "e1F"), + (StringTag("e1d"), "e1d"), + (StringTag("e1f"), "e1f"), + (StringTag("eD"), "eD"), + (StringTag("eF"), "eF"), + (StringTag("ed"), "ed"), + (StringTag("ef"), "ef"), + (StringTag("f"), "f"), ] for tag, snbt in float_data: diff --git a/tests/test_amulet_nbt/test_tag/test_int.py b/tests/test_amulet_nbt/test_tag/test_int.py index 75fadd5f..c9a0f899 100644 --- a/tests/test_amulet_nbt/test_tag/test_int.py +++ b/tests/test_amulet_nbt/test_tag/test_int.py @@ -35,25 +35,25 @@ def test_constructor(self) -> None: with self.assertRaises(TypeError): int_cls(None) # type: ignore - RangeByte = 2 ** 8 - RangeShort = 2 ** 16 - RangeInt = 2 ** 32 - RangeLong = 2 ** 64 + RangeByte = 2**8 + RangeShort = 2**16 + RangeInt = 2**32 + RangeLong = 2**64 - MinByte = -(2 ** 7) - MinShort = -(2 ** 15) - MinInt = -(2 ** 31) - MinLong = -(2 ** 63) + MinByte = -(2**7) + MinShort = -(2**15) + MinInt = -(2**31) + MinLong = -(2**63) UnderflowByte = MinByte - 1 UnderflowShort = MinShort - 1 UnderflowInt = MinInt - 1 UnderflowLong = MinLong - 1 - MaxByte = 2 ** 7 - 1 - MaxShort = 2 ** 15 - 1 - MaxInt = 2 ** 31 - 1 - MaxLong = 2 ** 63 - 1 + MaxByte = 2**7 - 1 + MaxShort = 2**15 - 1 + MaxInt = 2**31 - 1 + MaxLong = 2**63 - 1 OverflowByte = MaxByte + 1 OverflowShort = MaxShort + 1 @@ -83,10 +83,18 @@ def test_constructor(self) -> None: self.assertEqual(MinByte, int(ByteTag(OverflowByte + 2 * RangeByte))) self.assertEqual(MinByte, int(ByteTag(OverflowByte + 3 * RangeByte))) self.assertEqual(MinByte, int(ByteTag(OverflowByte + 4 * RangeByte))) - self.assertEqual(MinShort, int(ShortTag(OverflowShort + 1 * RangeShort))) - self.assertEqual(MinShort, int(ShortTag(OverflowShort + 2 * RangeShort))) - self.assertEqual(MinShort, int(ShortTag(OverflowShort + 3 * RangeShort))) - self.assertEqual(MinShort, int(ShortTag(OverflowShort + 4 * RangeShort))) + self.assertEqual( + MinShort, int(ShortTag(OverflowShort + 1 * RangeShort)) + ) + self.assertEqual( + MinShort, int(ShortTag(OverflowShort + 2 * RangeShort)) + ) + self.assertEqual( + MinShort, int(ShortTag(OverflowShort + 3 * RangeShort)) + ) + self.assertEqual( + MinShort, int(ShortTag(OverflowShort + 4 * RangeShort)) + ) self.assertEqual(MinInt, int(IntTag(OverflowInt + 1 * RangeInt))) self.assertEqual(MinInt, int(IntTag(OverflowInt + 2 * RangeInt))) self.assertEqual(MinInt, int(IntTag(OverflowInt + 3 * RangeInt))) @@ -119,10 +127,18 @@ def test_constructor(self) -> None: self.assertEqual(MaxByte, int(ByteTag(UnderflowByte - 2 * RangeByte))) self.assertEqual(MaxByte, int(ByteTag(UnderflowByte - 3 * RangeByte))) self.assertEqual(MaxByte, int(ByteTag(UnderflowByte - 4 * RangeByte))) - self.assertEqual(MaxShort, int(ShortTag(UnderflowShort - 1 * RangeShort))) - self.assertEqual(MaxShort, int(ShortTag(UnderflowShort - 2 * RangeShort))) - self.assertEqual(MaxShort, int(ShortTag(UnderflowShort - 3 * RangeShort))) - self.assertEqual(MaxShort, int(ShortTag(UnderflowShort - 4 * RangeShort))) + self.assertEqual( + MaxShort, int(ShortTag(UnderflowShort - 1 * RangeShort)) + ) + self.assertEqual( + MaxShort, int(ShortTag(UnderflowShort - 2 * RangeShort)) + ) + self.assertEqual( + MaxShort, int(ShortTag(UnderflowShort - 3 * RangeShort)) + ) + self.assertEqual( + MaxShort, int(ShortTag(UnderflowShort - 4 * RangeShort)) + ) self.assertEqual(MaxInt, int(IntTag(UnderflowInt - 1 * RangeInt))) self.assertEqual(MaxInt, int(IntTag(UnderflowInt - 2 * RangeInt))) self.assertEqual(MaxInt, int(IntTag(UnderflowInt - 3 * RangeInt))) diff --git a/tests/test_amulet_nbt/test_tag/test_list.py b/tests/test_amulet_nbt/test_tag/test_list.py index 97eb3a90..93ee9358 100644 --- a/tests/test_amulet_nbt/test_tag/test_list.py +++ b/tests/test_amulet_nbt/test_tag/test_list.py @@ -574,7 +574,9 @@ def test_insert(self) -> None: tag.insert(1, obj) def test_contains(self) -> None: - tag: ListTag = ListTag([StringTag("val1"), StringTag("val2"), StringTag("val3")]) + tag: ListTag = ListTag( + [StringTag("val1"), StringTag("val2"), StringTag("val3")] + ) self.assertIn(StringTag("val1"), tag) self.assertNotIn(StringTag("val4"), tag) for not_nbt in self.not_nbt: diff --git a/tests/test_amulet_nbt/test_tag/test_string.py b/tests/test_amulet_nbt/test_tag/test_string.py index 73cedbc1..33e28b6a 100644 --- a/tests/test_amulet_nbt/test_tag/test_string.py +++ b/tests/test_amulet_nbt/test_tag/test_string.py @@ -45,7 +45,7 @@ def test_repr(self) -> None: self.assertEqual("StringTag('')", repr(StringTag())) self.assertEqual("StringTag('value')", repr(StringTag("value"))) self.assertEqual("StringTag('quote\"value')", repr(StringTag('quote"value'))) - self.assertEqual("StringTag(\"quote'value\")", repr(StringTag("quote'value"))) + self.assertEqual('StringTag("quote\'value")', repr(StringTag("quote'value"))) def test_str(self) -> None: self.assertEqual("hello world", str(StringTag("hello world"))) From ffb125530f0aee71c9dd9d6db09a960b5489f29d Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Mon, 15 Jul 2024 10:08:14 +0100 Subject: [PATCH 106/121] Remove pragma once from source file --- src/amulet_nbt/cpp/nbt_encoding/binary/write_binary.cpp | 2 -- src/amulet_nbt/cpp/nbt_encoding/string/write_string.cpp | 2 -- 2 files changed, 4 deletions(-) diff --git a/src/amulet_nbt/cpp/nbt_encoding/binary/write_binary.cpp b/src/amulet_nbt/cpp/nbt_encoding/binary/write_binary.cpp index 0e728731..1d3dd90d 100644 --- a/src/amulet_nbt/cpp/nbt_encoding/binary/write_binary.cpp +++ b/src/amulet_nbt/cpp/nbt_encoding/binary/write_binary.cpp @@ -1,5 +1,3 @@ -#pragma once - #include #include #include diff --git a/src/amulet_nbt/cpp/nbt_encoding/string/write_string.cpp b/src/amulet_nbt/cpp/nbt_encoding/string/write_string.cpp index 3b0afea8..d4d88e91 100644 --- a/src/amulet_nbt/cpp/nbt_encoding/string/write_string.cpp +++ b/src/amulet_nbt/cpp/nbt_encoding/string/write_string.cpp @@ -1,5 +1,3 @@ -#pragma once - #include #include #include From 4fb276ddccc94a540641f4972e093e5afd982a14 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Mon, 15 Jul 2024 10:20:08 +0100 Subject: [PATCH 107/121] Added brackets to binary operators --- src/amulet_nbt/cpp/string_encoding/mutf8.cpp | 18 +++++++++--------- src/amulet_nbt/cpp/string_encoding/utf8.cpp | 18 +++++++++--------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/amulet_nbt/cpp/string_encoding/mutf8.cpp b/src/amulet_nbt/cpp/string_encoding/mutf8.cpp index 598814ad..6eecb5ba 100644 --- a/src/amulet_nbt/cpp/string_encoding/mutf8.cpp +++ b/src/amulet_nbt/cpp/string_encoding/mutf8.cpp @@ -110,24 +110,24 @@ namespace Amulet { dst.push_back(c & 0b01111111); } else if (c <= 2047) { - dst.push_back(0b11000000 | 0b00011111 & (c >> 6)); - dst.push_back(0b10000000 | 0b00111111 & c); + dst.push_back(0b11000000 | (0b00011111 & (c >> 6))); + dst.push_back(0b10000000 | (0b00111111 & c)); } else if (c <= 65535) { if ((c >= 0xD800) && (c <= 0xDFFF)) { throw std::invalid_argument("code point at index " + std::to_string(index) + " cannot be encoded."); } - dst.push_back(0b11100000 | 0b00001111 & (c >> 12)); - dst.push_back(0b10000000 | 0b00111111 & (c >> 6)); - dst.push_back(0b10000000 | 0b00111111 & c); + dst.push_back(0b11100000 | (0b00001111 & (c >> 12))); + dst.push_back(0b10000000 | (0b00111111 & (c >> 6))); + dst.push_back(0b10000000 | (0b00111111 & c)); } else if (c <= 1114111) { dst.push_back(0b11101101); - dst.push_back(0b10100000 | 0b00001111 & ((c >> 16) - 1)); - dst.push_back(0b10000000 | 0b00111111 & (c >> 10)); + dst.push_back(0b10100000 | (0b00001111 & ((c >> 16) - 1))); + dst.push_back(0b10000000 | (0b00111111 & (c >> 10))); dst.push_back(0b11101101); - dst.push_back(0b10110000 | 0b00001111 & (c >> 6)); - dst.push_back(0b10000000 | 0b00111111 & c); + dst.push_back(0b10110000 | (0b00001111 & (c >> 6))); + dst.push_back(0b10000000 | (0b00111111 & c)); } else { throw std::invalid_argument("Invalid code point at index " + std::to_string(index)); diff --git a/src/amulet_nbt/cpp/string_encoding/utf8.cpp b/src/amulet_nbt/cpp/string_encoding/utf8.cpp index 71337578..a0b7b260 100644 --- a/src/amulet_nbt/cpp/string_encoding/utf8.cpp +++ b/src/amulet_nbt/cpp/string_encoding/utf8.cpp @@ -181,8 +181,8 @@ constexpr void _write_utf8(std::string &dst, const Amulet::CodePointVector& src) dst.push_back(c & 0b01111111); } else if (c <= 2047) { - dst.push_back(0b11000000 | 0b00011111 & (c >> 6)); - dst.push_back(0b10000000 | 0b00111111 & c); + dst.push_back(0b11000000 | (0b00011111 & (c >> 6))); + dst.push_back(0b10000000 | (0b00111111 & c)); } else if (c <= 65535) { if constexpr (escapeErrors){ @@ -203,15 +203,15 @@ constexpr void _write_utf8(std::string &dst, const Amulet::CodePointVector& src) if ((c >= 0xD800) && (c <= 0xDFFF)){ throw std::invalid_argument("code point at index " + std::to_string(index) + " cannot be encoded."); } - dst.push_back(0b11100000 | 0b00001111 & (c >> 12)); - dst.push_back(0b10000000 | 0b00111111 & (c >> 6)); - dst.push_back(0b10000000 | 0b00111111 & c); + dst.push_back(0b11100000 | (0b00001111 & (c >> 12))); + dst.push_back(0b10000000 | (0b00111111 & (c >> 6))); + dst.push_back(0b10000000 | (0b00111111 & c)); } else if (c <= 1114111) { - dst.push_back(0b11110000 | 0b00000111 & (c >> 18)); - dst.push_back(0b10000000 | 0b00111111 & (c >> 12)); - dst.push_back(0b10000000 | 0b00111111 & (c >> 6)); - dst.push_back(0b10000000 | 0b00111111 & c); + dst.push_back(0b11110000 | (0b00000111 & (c >> 18))); + dst.push_back(0b10000000 | (0b00111111 & (c >> 12))); + dst.push_back(0b10000000 | (0b00111111 & (c >> 6))); + dst.push_back(0b10000000 | (0b00111111 & c)); } else { throw std::invalid_argument("Invalid code point at index " + std::to_string(index)); From 314e23d30a890119323c09e73151c60ecddab861 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Mon, 15 Jul 2024 10:23:04 +0100 Subject: [PATCH 108/121] Added limits import --- src/amulet_nbt/cpp/nbt_encoding/binary/write_binary.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/amulet_nbt/cpp/nbt_encoding/binary/write_binary.cpp b/src/amulet_nbt/cpp/nbt_encoding/binary/write_binary.cpp index 1d3dd90d..e81555ed 100644 --- a/src/amulet_nbt/cpp/nbt_encoding/binary/write_binary.cpp +++ b/src/amulet_nbt/cpp/nbt_encoding/binary/write_binary.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include #include From 87d9bd4249e5528dd6dcc08197fb47198a4bc183 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Mon, 15 Jul 2024 10:30:34 +0100 Subject: [PATCH 109/121] Added and moved pragma once --- src/amulet_nbt/include/amulet_nbt/nbt_encoding/string.hpp | 2 ++ src/amulet_nbt/include/amulet_nbt/tag/compound.hpp | 4 ++-- src/amulet_nbt/include/amulet_nbt/tag/eq.hpp | 4 ++-- src/amulet_nbt/include/amulet_nbt/tag/list.hpp | 4 ++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/amulet_nbt/include/amulet_nbt/nbt_encoding/string.hpp b/src/amulet_nbt/include/amulet_nbt/nbt_encoding/string.hpp index 5a1cfe6f..bcaefff6 100644 --- a/src/amulet_nbt/include/amulet_nbt/nbt_encoding/string.hpp +++ b/src/amulet_nbt/include/amulet_nbt/nbt_encoding/string.hpp @@ -1,3 +1,5 @@ +#pragma once + #include #include diff --git a/src/amulet_nbt/include/amulet_nbt/tag/compound.hpp b/src/amulet_nbt/include/amulet_nbt/tag/compound.hpp index c6b18372..96258892 100644 --- a/src/amulet_nbt/include/amulet_nbt/tag/compound.hpp +++ b/src/amulet_nbt/include/amulet_nbt/tag/compound.hpp @@ -1,7 +1,7 @@ -// Utility functions for the CompoundTag - #pragma once +// Utility functions for the CompoundTag + #include namespace Amulet { diff --git a/src/amulet_nbt/include/amulet_nbt/tag/eq.hpp b/src/amulet_nbt/include/amulet_nbt/tag/eq.hpp index c3a1b091..75eed734 100644 --- a/src/amulet_nbt/include/amulet_nbt/tag/eq.hpp +++ b/src/amulet_nbt/include/amulet_nbt/tag/eq.hpp @@ -1,7 +1,7 @@ -// All of the NBT equal functions - #pragma once +// All of the NBT equal functions + #include namespace Amulet { diff --git a/src/amulet_nbt/include/amulet_nbt/tag/list.hpp b/src/amulet_nbt/include/amulet_nbt/tag/list.hpp index f89e9ec8..1fca78c6 100644 --- a/src/amulet_nbt/include/amulet_nbt/tag/list.hpp +++ b/src/amulet_nbt/include/amulet_nbt/tag/list.hpp @@ -1,7 +1,7 @@ -// Utility functions for the ListTag - #pragma once +// Utility functions for the ListTag + #include #include #include From 87d8ba760ec693663c2748bc83ca5407ecc9d0af Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Mon, 15 Jul 2024 10:36:36 +0100 Subject: [PATCH 110/121] Change header --- src/amulet_nbt/cpp/string_encoding/mutf8.cpp | 2 +- src/amulet_nbt/cpp/string_encoding/utf8.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/amulet_nbt/cpp/string_encoding/mutf8.cpp b/src/amulet_nbt/cpp/string_encoding/mutf8.cpp index 6eecb5ba..0fd08252 100644 --- a/src/amulet_nbt/cpp/string_encoding/mutf8.cpp +++ b/src/amulet_nbt/cpp/string_encoding/mutf8.cpp @@ -1,7 +1,7 @@ // Partially based on the mutf8 python library by Tyler Kennedy MIT // Rewritten to stay within C++ -#include +#include #include #include #include diff --git a/src/amulet_nbt/cpp/string_encoding/utf8.cpp b/src/amulet_nbt/cpp/string_encoding/utf8.cpp index a0b7b260..7b23dcb4 100644 --- a/src/amulet_nbt/cpp/string_encoding/utf8.cpp +++ b/src/amulet_nbt/cpp/string_encoding/utf8.cpp @@ -1,7 +1,7 @@ // Partially based on the mutf8 python library by Tyler Kennedy MIT // Rewritten to stay within C++ -#include +#include #include #include #include From 495ae040d715dd98e387711c563180a5df2d89a6 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Mon, 15 Jul 2024 10:36:57 +0100 Subject: [PATCH 111/121] Add std prefix --- src/amulet_nbt/cpp/tag/eq.cpp | 6 ++-- src/amulet_nbt/cpp/tag/list.cpp | 4 +-- src/amulet_nbt/cpp/tag/wrapper.cpp | 4 +-- .../include/amulet_nbt/tag/list.hpp | 18 ++++++------ src/amulet_nbt/pybind/tag/py_list_tag.cpp | 28 +++++++++---------- 5 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/amulet_nbt/cpp/tag/eq.cpp b/src/amulet_nbt/cpp/tag/eq.cpp index 55685399..b312d95a 100644 --- a/src/amulet_nbt/cpp/tag/eq.cpp +++ b/src/amulet_nbt/cpp/tag/eq.cpp @@ -20,11 +20,11 @@ namespace Amulet{ template inline bool ListTag_eq(const Amulet::ListTagPtr a, const Amulet::ListTagPtr b){ - const std::vector& a_vec = get>(*a); + const std::vector& a_vec = std::get>(*a); if (b->index() != variant_index>()){ return a_vec.size() == 0 && ListTag_size(*b) == 0; } - const std::vector& b_vec = get>(*b); + const std::vector& b_vec = std::get>(*b); if constexpr (is_shared_ptr::value){ // Values are shared pointers @@ -72,7 +72,7 @@ namespace Amulet{ }; bool NBTTag_eq(const Amulet::TagNode a, const Amulet::TagNode b){ switch(a.index()){ - #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG) case ID: return b.index() == ID && NBTTag_eq(get(a), get(b)); + #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG) case ID: return b.index() == ID && NBTTag_eq(std::get(a), std::get(b)); case 0: return b.index() == 0; FOR_EACH_LIST_TAG(CASE) diff --git a/src/amulet_nbt/cpp/tag/list.cpp b/src/amulet_nbt/cpp/tag/list.cpp index 7606f4d9..49324773 100644 --- a/src/amulet_nbt/cpp/tag/list.cpp +++ b/src/amulet_nbt/cpp/tag/list.cpp @@ -7,7 +7,7 @@ namespace Amulet { size_t ListTag_size(const Amulet::ListTag& self){ switch(self.index()){ - #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG) case ID: return get(self).size(); + #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG) case ID: return std::get(self).size(); FOR_EACH_LIST_TAG(CASE) #undef CASE } @@ -18,7 +18,7 @@ namespace Amulet { switch(tag.index()){ #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG)\ case ID:\ - ListTag_append(self, get(tag));\ + ListTag_append(self, std::get(tag));\ break; case 0: throw AmuletNBT::type_error("Cannot append null TagNode"); diff --git a/src/amulet_nbt/cpp/tag/wrapper.cpp b/src/amulet_nbt/cpp/tag/wrapper.cpp index 26347276..91a78c94 100644 --- a/src/amulet_nbt/cpp/tag/wrapper.cpp +++ b/src/amulet_nbt/cpp/tag/wrapper.cpp @@ -3,7 +3,7 @@ namespace Amulet { Amulet::WrapperNode wrap_node(Amulet::TagNode node){ switch(node.index()){ - #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG) case ID: return Amulet::WrapperNode(TagWrapper(get(node))); + #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG) case ID: return Amulet::WrapperNode(TagWrapper(std::get(node))); FOR_EACH_LIST_TAG(CASE) default: return Amulet::WrapperNode(); @@ -12,7 +12,7 @@ namespace Amulet { } Amulet::TagNode unwrap_node(Amulet::WrapperNode node){ switch(node.index()){ - #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG) case ID: return Amulet::TagNode(get>(node).tag); + #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG) case ID: return Amulet::TagNode(std::get>(node).tag); FOR_EACH_LIST_TAG(CASE) default: return Amulet::TagNode(); diff --git a/src/amulet_nbt/include/amulet_nbt/tag/list.hpp b/src/amulet_nbt/include/amulet_nbt/tag/list.hpp index 1fca78c6..f68b240b 100644 --- a/src/amulet_nbt/include/amulet_nbt/tag/list.hpp +++ b/src/amulet_nbt/include/amulet_nbt/tag/list.hpp @@ -16,7 +16,7 @@ namespace Amulet { template void ListTag_append(Amulet::ListTag& self, tagT tag){ if (self.index() == variant_index>()){ - get>(self).push_back(tag); + std::get>(self).push_back(tag); } else if (ListTag_size(self) == 0){ self.emplace>().push_back(tag); } else { @@ -62,7 +62,7 @@ namespace Amulet { template tagT ListTag_get(const Amulet::ListTag& self, indexT index){ - auto& list_tag = get>(self); + auto& list_tag = std::get>(self); return list_tag[Amulet::ListTag_bounds_check(list_tag.size(), index)]; } @@ -85,7 +85,7 @@ namespace Amulet { size_t abs_index = ListTag_bounds_check(ListTag_size(self), index); if (self.index() == variant_index>()){ // If the list type is the same as the tag - auto& list_tag = get>(self); + auto& list_tag = std::get>(self); list_tag[abs_index] = tag; } else if (ListTag_size(self) == 1 && abs_index == 0){ // Overwriting the only value @@ -101,7 +101,7 @@ namespace Amulet { #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG)\ case ID:\ {\ - LIST_TAG& list_tag = get(self);\ + LIST_TAG& list_tag = std::get(self);\ size_t abs_index = Amulet::ListTag_bounds_check(list_tag.size(), index);\ list_tag.erase(list_tag.begin() + abs_index);\ break;\ @@ -117,7 +117,7 @@ namespace Amulet { #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG)\ case ID:\ {\ - LIST_TAG& list_tag = get(self);\ + LIST_TAG& list_tag = std::get(self);\ size_t abs_index = Amulet::ListTag_bounds_check(list_tag.size(), index);\ TAG_STORAGE tag = list_tag[abs_index];\ list_tag.erase(list_tag.begin() + abs_index);\ @@ -143,7 +143,7 @@ namespace Amulet { ); } } - auto& list_tag = get>(self); + auto& list_tag = std::get>(self); size_t abs_index = ListTag_bounds_check(list_tag.size(), index); list_tag.insert(list_tag.begin() + abs_index, tag); } @@ -153,7 +153,7 @@ namespace Amulet { switch(self.index()){ #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG)\ case ID:\ - ListTag_insert(self, index, get(node));\ + ListTag_insert(self, index, std::get(node));\ break; FOR_EACH_LIST_TAG(CASE) #undef CASE @@ -165,7 +165,7 @@ namespace Amulet { if (self.index() != variant_index>()){ throw std::invalid_argument("item is not in the ListTag"); } - auto& list_tag = get>(self); + auto& list_tag = std::get>(self); size_t abs_start = ListTag_bounds_check(list_tag.size(), start); size_t abs_stop = ListTag_bounds_check(list_tag.size(), stop); for (size_t i = abs_start; i < abs_stop; i++){ @@ -182,7 +182,7 @@ namespace Amulet { if (self.index() != variant_index>()){ return 0; } - auto& list_tag = get>(self); + auto& list_tag = std::get>(self); size_t count = 0; for (tagT tag_i: list_tag){ if (NBTTag_eq(tag, tag_i)){ diff --git a/src/amulet_nbt/pybind/tag/py_list_tag.cpp b/src/amulet_nbt/pybind/tag/py_list_tag.cpp index 128d05ec..dcec9014 100644 --- a/src/amulet_nbt/pybind/tag/py_list_tag.cpp +++ b/src/amulet_nbt/pybind/tag/py_list_tag.cpp @@ -23,7 +23,7 @@ void ListTag_extend(Amulet::ListTagPtr tag, py::object value){ switch(node.index()){ #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG)\ case ID:\ - Amulet::ListTag_append(*tag, get>(node).tag);\ + Amulet::ListTag_append(*tag, std::get>(node).tag);\ break; case 0: throw py::type_error("Cannot append null TagNode"); @@ -38,7 +38,7 @@ template void ListTag_set_slice(Amulet::ListTagPtr self, const py::slice &slice, std::vector& vec){ if (self->index() == variant_index>()){ // Tag type matches - std::vector& list_tag = get>(*self); + std::vector& list_tag = std::get>(*self); Py_ssize_t start = 0, stop = 0, step = 0, slice_length = 0; if (!slice.compute(list_tag.size(), &start, &stop, &step, &slice_length)) { throw py::error_already_set(); @@ -167,7 +167,7 @@ void init_list(py::module& m) { #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG)\ case ID:\ {\ - LIST_TAG& tag = get(*self.tag);\ + LIST_TAG& tag = std::get(*self.tag);\ for (size_t i = 0; i < tag.size(); i++){\ list.append(\ Amulet::TagWrapper(tag[i])\ @@ -212,7 +212,7 @@ void init_list(py::module& m) { #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG)\ case ID:\ {\ - LIST_TAG& list_tag = get(*self.tag);\ + LIST_TAG& list_tag = std::get(*self.tag);\ for (size_t i = 0; i < list_tag.size(); i++){\ if (i != 0){out += ", ";}\ out += py::repr(py::cast(Amulet::TagWrapper(list_tag[i])));\ @@ -355,8 +355,8 @@ void init_list(py::module& m) { #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG)\ case ID:\ {\ - TAG_STORAGE item_tag = get>(item).tag;\ - LIST_TAG& list_tag = get(*self.tag);\ + TAG_STORAGE item_tag = std::get>(item).tag;\ + LIST_TAG& list_tag = std::get(*self.tag);\ for (TAG_STORAGE tag: list_tag){\ if (Amulet::NBTTag_eq(tag, item_tag)){\ return true;\ @@ -378,7 +378,7 @@ void init_list(py::module& m) { switch(tag.index()){ #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG)\ case ID:\ - return Amulet::ListTag_index(*self.tag, get>(tag).tag, start, stop); + return Amulet::ListTag_index(*self.tag, std::get>(tag).tag, start, stop); FOR_EACH_LIST_TAG(CASE) #undef CASE default: @@ -393,7 +393,7 @@ void init_list(py::module& m) { switch(tag.index()){ #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG)\ case ID:\ - return Amulet::ListTag_count(*self.tag, get>(tag).tag); + return Amulet::ListTag_count(*self.tag, std::get>(tag).tag); FOR_EACH_LIST_TAG(CASE) #undef CASE default: @@ -407,7 +407,7 @@ void init_list(py::module& m) { switch(tag.index()){ #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG)\ case ID:\ - Amulet::ListTag_set(*self.tag, index, get>(tag).tag);\ + Amulet::ListTag_set(*self.tag, index, std::get>(tag).tag);\ break; FOR_EACH_LIST_TAG(CASE) #undef CASE @@ -471,7 +471,7 @@ void init_list(py::module& m) { switch(self.tag->index()){ #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG)\ case ID:{\ - ListTag_del_slice(get>(*self.tag), slice);\ + ListTag_del_slice(std::get>(*self.tag), slice);\ break;\ } FOR_EACH_LIST_TAG(CASE) @@ -485,7 +485,7 @@ void init_list(py::module& m) { switch(tag.index()){ #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG)\ case ID:\ - Amulet::ListTag_insert(*self.tag, index, get>(tag).tag);\ + Amulet::ListTag_insert(*self.tag, index, std::get>(tag).tag);\ break; case 0: throw py::type_error("Cannot insert null TagNode"); @@ -498,7 +498,7 @@ void init_list(py::module& m) { "append", [](const Amulet::ListTagWrapper& self, Amulet::WrapperNode tag){ switch(tag.index()){ - #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG) case ID: Amulet::ListTag_append(*self.tag, get>(tag).tag); break; + #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG) case ID: Amulet::ListTag_append(*self.tag, std::get>(tag).tag); break; case 0: throw py::type_error("Cannot append null TagNode"); FOR_EACH_LIST_TAG(CASE) @@ -510,7 +510,7 @@ void init_list(py::module& m) { "clear", [](const Amulet::ListTagWrapper& self){ switch(self.tag->index()){ - #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG) case ID: get(*self.tag).clear(); break; + #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG) case ID: std::get(*self.tag).clear(); break; FOR_EACH_LIST_TAG(CASE) #undef CASE } @@ -520,7 +520,7 @@ void init_list(py::module& m) { "reverse", [](const Amulet::ListTagWrapper& self){ switch(self.tag->index()){ - #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG) case ID: {LIST_TAG& tag = get(*self.tag); std::reverse(tag.begin(), tag.end());}; break; + #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG) case ID: {LIST_TAG& tag = std::get(*self.tag); std::reverse(tag.begin(), tag.end());}; break; FOR_EACH_LIST_TAG(CASE) #undef CASE } From ead15c4da5891cd13228daa48aadded49dda9006 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Mon, 15 Jul 2024 11:26:18 +0100 Subject: [PATCH 112/121] Added missing imports --- src/amulet_nbt/cpp/nbt_encoding/binary/read_binary.cpp | 8 ++++++++ src/amulet_nbt/cpp/nbt_encoding/binary/write_binary.cpp | 3 +++ src/amulet_nbt/cpp/nbt_encoding/string/read_string.cpp | 4 ++++ src/amulet_nbt/cpp/nbt_encoding/string/write_string.cpp | 5 +++++ src/amulet_nbt/cpp/tag/compound.cpp | 4 ++++ src/amulet_nbt/cpp/tag/copy.cpp | 7 +++++++ src/amulet_nbt/cpp/tag/eq.cpp | 2 ++ src/amulet_nbt/cpp/tag/list.cpp | 3 +++ src/amulet_nbt/cpp/tag/wrapper.cpp | 2 ++ src/amulet_nbt/include/amulet_nbt/io/binary_reader.hpp | 1 + src/amulet_nbt/include/amulet_nbt/tag/compound.hpp | 1 + src/amulet_nbt/include/amulet_nbt/tag/list.hpp | 6 ++++++ src/amulet_nbt/include/amulet_nbt/tag/nbt.hpp | 1 + src/amulet_nbt/include/amulet_nbt/tag/wrapper.hpp | 2 ++ src/amulet_nbt/pybind/amulet_nbt.cpp | 2 ++ src/amulet_nbt/pybind/bnbt.cpp | 4 ++++ src/amulet_nbt/pybind/encoding.cpp | 1 + src/amulet_nbt/pybind/snbt.cpp | 2 ++ src/amulet_nbt/pybind/tag/py_abc_tag.cpp | 3 +++ src/amulet_nbt/pybind/tag/py_array_tag.cpp | 5 +++++ src/amulet_nbt/pybind/tag/py_compound_tag.cpp | 6 ++++++ src/amulet_nbt/pybind/tag/py_float_tag.cpp | 2 ++ src/amulet_nbt/pybind/tag/py_int_tag.cpp | 2 ++ src/amulet_nbt/pybind/tag/py_list_tag.cpp | 7 +++++++ src/amulet_nbt/pybind/tag/py_named_tag.cpp | 5 +++++ src/amulet_nbt/pybind/tag/py_string_tag.cpp | 4 +++- 26 files changed, 91 insertions(+), 1 deletion(-) diff --git a/src/amulet_nbt/cpp/nbt_encoding/binary/read_binary.cpp b/src/amulet_nbt/cpp/nbt_encoding/binary/read_binary.cpp index b32e5849..9e12627c 100644 --- a/src/amulet_nbt/cpp/nbt_encoding/binary/read_binary.cpp +++ b/src/amulet_nbt/cpp/nbt_encoding/binary/read_binary.cpp @@ -1,3 +1,11 @@ +#include +#include +#include +#include +#include +#include +#include + #include Amulet::StringTag read_string_tag(Amulet::BinaryReader& reader){ diff --git a/src/amulet_nbt/cpp/nbt_encoding/binary/write_binary.cpp b/src/amulet_nbt/cpp/nbt_encoding/binary/write_binary.cpp index e81555ed..a5d471ee 100644 --- a/src/amulet_nbt/cpp/nbt_encoding/binary/write_binary.cpp +++ b/src/amulet_nbt/cpp/nbt_encoding/binary/write_binary.cpp @@ -4,6 +4,9 @@ #include #include #include +#include +#include +#include #include #include diff --git a/src/amulet_nbt/cpp/nbt_encoding/string/read_string.cpp b/src/amulet_nbt/cpp/nbt_encoding/string/read_string.cpp index 89e7607a..aad1f6c4 100644 --- a/src/amulet_nbt/cpp/nbt_encoding/string/read_string.cpp +++ b/src/amulet_nbt/cpp/nbt_encoding/string/read_string.cpp @@ -3,6 +3,10 @@ #include #include #include +#include +#include +#include +#include #include #include diff --git a/src/amulet_nbt/cpp/nbt_encoding/string/write_string.cpp b/src/amulet_nbt/cpp/nbt_encoding/string/write_string.cpp index d4d88e91..8ffcd131 100644 --- a/src/amulet_nbt/cpp/nbt_encoding/string/write_string.cpp +++ b/src/amulet_nbt/cpp/nbt_encoding/string/write_string.cpp @@ -8,6 +8,11 @@ #include #include #include +#include +#include +#include +#include +#include #include #include diff --git a/src/amulet_nbt/cpp/tag/compound.cpp b/src/amulet_nbt/cpp/tag/compound.cpp index c3b67fa9..2eb0ca86 100644 --- a/src/amulet_nbt/cpp/tag/compound.cpp +++ b/src/amulet_nbt/cpp/tag/compound.cpp @@ -1,3 +1,7 @@ +#include +#include +#include + #include namespace Amulet { diff --git a/src/amulet_nbt/cpp/tag/copy.cpp b/src/amulet_nbt/cpp/tag/copy.cpp index 4501d0ad..ae768fb3 100644 --- a/src/amulet_nbt/cpp/tag/copy.cpp +++ b/src/amulet_nbt/cpp/tag/copy.cpp @@ -1,3 +1,10 @@ +#include +#include +#include +#include +#include +#include + #include namespace Amulet { diff --git a/src/amulet_nbt/cpp/tag/eq.cpp b/src/amulet_nbt/cpp/tag/eq.cpp index b312d95a..b377df7a 100644 --- a/src/amulet_nbt/cpp/tag/eq.cpp +++ b/src/amulet_nbt/cpp/tag/eq.cpp @@ -1,5 +1,7 @@ #include #include +#include +#include #include #include diff --git a/src/amulet_nbt/cpp/tag/list.cpp b/src/amulet_nbt/cpp/tag/list.cpp index 49324773..ff865dee 100644 --- a/src/amulet_nbt/cpp/tag/list.cpp +++ b/src/amulet_nbt/cpp/tag/list.cpp @@ -1,4 +1,7 @@ #include +#include +#include + #include #include #include diff --git a/src/amulet_nbt/cpp/tag/wrapper.cpp b/src/amulet_nbt/cpp/tag/wrapper.cpp index 91a78c94..bca61f1f 100644 --- a/src/amulet_nbt/cpp/tag/wrapper.cpp +++ b/src/amulet_nbt/cpp/tag/wrapper.cpp @@ -1,3 +1,5 @@ +#include + #include namespace Amulet { diff --git a/src/amulet_nbt/include/amulet_nbt/io/binary_reader.hpp b/src/amulet_nbt/include/amulet_nbt/io/binary_reader.hpp index af95b8a1..6c389b4d 100644 --- a/src/amulet_nbt/include/amulet_nbt/io/binary_reader.hpp +++ b/src/amulet_nbt/include/amulet_nbt/io/binary_reader.hpp @@ -7,6 +7,7 @@ #include #include #include +#include namespace Amulet { diff --git a/src/amulet_nbt/include/amulet_nbt/tag/compound.hpp b/src/amulet_nbt/include/amulet_nbt/tag/compound.hpp index 96258892..9f7b0e1d 100644 --- a/src/amulet_nbt/include/amulet_nbt/tag/compound.hpp +++ b/src/amulet_nbt/include/amulet_nbt/tag/compound.hpp @@ -1,6 +1,7 @@ #pragma once // Utility functions for the CompoundTag +#include #include diff --git a/src/amulet_nbt/include/amulet_nbt/tag/list.hpp b/src/amulet_nbt/include/amulet_nbt/tag/list.hpp index f68b240b..9f26e548 100644 --- a/src/amulet_nbt/include/amulet_nbt/tag/list.hpp +++ b/src/amulet_nbt/include/amulet_nbt/tag/list.hpp @@ -6,6 +6,12 @@ #include #include #include +#include +#include +#include +#include +#include + #include #include #include diff --git a/src/amulet_nbt/include/amulet_nbt/tag/nbt.hpp b/src/amulet_nbt/include/amulet_nbt/tag/nbt.hpp index 0ce42ac6..1af730fc 100644 --- a/src/amulet_nbt/include/amulet_nbt/tag/nbt.hpp +++ b/src/amulet_nbt/include/amulet_nbt/tag/nbt.hpp @@ -1,5 +1,6 @@ #pragma once +#include #include #include #include diff --git a/src/amulet_nbt/include/amulet_nbt/tag/wrapper.hpp b/src/amulet_nbt/include/amulet_nbt/tag/wrapper.hpp index 14c01919..75a0ec05 100644 --- a/src/amulet_nbt/include/amulet_nbt/tag/wrapper.hpp +++ b/src/amulet_nbt/include/amulet_nbt/tag/wrapper.hpp @@ -2,6 +2,8 @@ #include #include +#include +#include #include #include diff --git a/src/amulet_nbt/pybind/amulet_nbt.cpp b/src/amulet_nbt/pybind/amulet_nbt.cpp index 90a23868..bae46fc3 100644 --- a/src/amulet_nbt/pybind/amulet_nbt.cpp +++ b/src/amulet_nbt/pybind/amulet_nbt.cpp @@ -1,3 +1,5 @@ +#include + #include #include diff --git a/src/amulet_nbt/pybind/bnbt.cpp b/src/amulet_nbt/pybind/bnbt.cpp index 9426fb51..2fd02e11 100644 --- a/src/amulet_nbt/pybind/bnbt.cpp +++ b/src/amulet_nbt/pybind/bnbt.cpp @@ -1,4 +1,8 @@ #include +#include +#include +#include +#include #include #include diff --git a/src/amulet_nbt/pybind/encoding.cpp b/src/amulet_nbt/pybind/encoding.cpp index 5074ada0..3e6a0238 100644 --- a/src/amulet_nbt/pybind/encoding.cpp +++ b/src/amulet_nbt/pybind/encoding.cpp @@ -1,4 +1,5 @@ #include +#include #include #include diff --git a/src/amulet_nbt/pybind/snbt.cpp b/src/amulet_nbt/pybind/snbt.cpp index 06d3340c..1edc68df 100644 --- a/src/amulet_nbt/pybind/snbt.cpp +++ b/src/amulet_nbt/pybind/snbt.cpp @@ -1,3 +1,5 @@ +#include + #include #include #include diff --git a/src/amulet_nbt/pybind/tag/py_abc_tag.cpp b/src/amulet_nbt/pybind/tag/py_abc_tag.cpp index c7714c35..604c3760 100644 --- a/src/amulet_nbt/pybind/tag/py_abc_tag.cpp +++ b/src/amulet_nbt/pybind/tag/py_abc_tag.cpp @@ -1,5 +1,8 @@ #include #include +#include +#include +#include #include #include diff --git a/src/amulet_nbt/pybind/tag/py_array_tag.cpp b/src/amulet_nbt/pybind/tag/py_array_tag.cpp index 18db1266..39a3097e 100644 --- a/src/amulet_nbt/pybind/tag/py_array_tag.cpp +++ b/src/amulet_nbt/pybind/tag/py_array_tag.cpp @@ -1,4 +1,9 @@ #include +#include +#include +#include +#include +#include #include #include diff --git a/src/amulet_nbt/pybind/tag/py_compound_tag.cpp b/src/amulet_nbt/pybind/tag/py_compound_tag.cpp index 18e57faf..22bb547a 100644 --- a/src/amulet_nbt/pybind/tag/py_compound_tag.cpp +++ b/src/amulet_nbt/pybind/tag/py_compound_tag.cpp @@ -1,4 +1,10 @@ #include +#include +#include +#include +#include +#include +#include #include #include diff --git a/src/amulet_nbt/pybind/tag/py_float_tag.cpp b/src/amulet_nbt/pybind/tag/py_float_tag.cpp index bdede36d..48190dd3 100644 --- a/src/amulet_nbt/pybind/tag/py_float_tag.cpp +++ b/src/amulet_nbt/pybind/tag/py_float_tag.cpp @@ -1,3 +1,5 @@ +#include + #include #include #include diff --git a/src/amulet_nbt/pybind/tag/py_int_tag.cpp b/src/amulet_nbt/pybind/tag/py_int_tag.cpp index ea5741b2..ed932acd 100644 --- a/src/amulet_nbt/pybind/tag/py_int_tag.cpp +++ b/src/amulet_nbt/pybind/tag/py_int_tag.cpp @@ -1,3 +1,5 @@ +#include + #include #include #include diff --git a/src/amulet_nbt/pybind/tag/py_list_tag.cpp b/src/amulet_nbt/pybind/tag/py_list_tag.cpp index dcec9014..2e6cafff 100644 --- a/src/amulet_nbt/pybind/tag/py_list_tag.cpp +++ b/src/amulet_nbt/pybind/tag/py_list_tag.cpp @@ -1,6 +1,13 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include #include #include diff --git a/src/amulet_nbt/pybind/tag/py_named_tag.cpp b/src/amulet_nbt/pybind/tag/py_named_tag.cpp index a2fcae16..264a6f00 100644 --- a/src/amulet_nbt/pybind/tag/py_named_tag.cpp +++ b/src/amulet_nbt/pybind/tag/py_named_tag.cpp @@ -1,5 +1,10 @@ #include #include +#include +#include +#include +#include +#include #include #include diff --git a/src/amulet_nbt/pybind/tag/py_string_tag.cpp b/src/amulet_nbt/pybind/tag/py_string_tag.cpp index a0ce3544..a238139d 100644 --- a/src/amulet_nbt/pybind/tag/py_string_tag.cpp +++ b/src/amulet_nbt/pybind/tag/py_string_tag.cpp @@ -1,9 +1,11 @@ -#include +#include #include #include #include +#include + namespace py = pybind11; void init_string(py::module& m) { From a234d4ae101c90f99a7f84990e3d820a82477872 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Mon, 15 Jul 2024 11:26:42 +0100 Subject: [PATCH 113/121] Changed set to unordered_set --- src/amulet_nbt/cpp/nbt_encoding/string/read_string.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/amulet_nbt/cpp/nbt_encoding/string/read_string.cpp b/src/amulet_nbt/cpp/nbt_encoding/string/read_string.cpp index aad1f6c4..b3bd65a1 100644 --- a/src/amulet_nbt/cpp/nbt_encoding/string/read_string.cpp +++ b/src/amulet_nbt/cpp/nbt_encoding/string/read_string.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include #include @@ -12,8 +12,8 @@ #include -const std::set Whitespace{' ', '\t', '\r', '\n'}; -const std::set AlphaNumPlus{'+', '-', '.', '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'}; +const std::unordered_set Whitespace{' ', '\t', '\r', '\n'}; +const std::unordered_set AlphaNumPlus{'+', '-', '.', '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'}; const Amulet::ByteTag byte_false = 0; const Amulet::ByteTag byte_true = 1; From 1343cd9a2821b149c452b4da41cc4478b54d81c9 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Mon, 15 Jul 2024 11:32:07 +0100 Subject: [PATCH 114/121] Change exception to runtime_error --- src/amulet_nbt/cpp/tag/compound.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/amulet_nbt/cpp/tag/compound.cpp b/src/amulet_nbt/cpp/tag/compound.cpp index 2eb0ca86..e29670d5 100644 --- a/src/amulet_nbt/cpp/tag/compound.cpp +++ b/src/amulet_nbt/cpp/tag/compound.cpp @@ -11,7 +11,7 @@ namespace Amulet { std::string CompoundTagIterator::next(){ if (!is_valid()){ - throw std::exception("CompoundTag changed size during iteration."); + throw std::runtime_error("CompoundTag changed size during iteration."); } return (pos++)->first; }; From 525976d28891234ad8d0c6eafd6959a283f9e0a9 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Mon, 15 Jul 2024 11:48:11 +0100 Subject: [PATCH 115/121] Added virtual destructors to ABCs --- .../include/amulet_nbt/tag/wrapper.hpp | 31 +++++++++++++++---- 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/src/amulet_nbt/include/amulet_nbt/tag/wrapper.hpp b/src/amulet_nbt/include/amulet_nbt/tag/wrapper.hpp index 75a0ec05..148f18e5 100644 --- a/src/amulet_nbt/include/amulet_nbt/tag/wrapper.hpp +++ b/src/amulet_nbt/include/amulet_nbt/tag/wrapper.hpp @@ -15,17 +15,36 @@ namespace Amulet { class AbstractBaseTag { public: + virtual ~AbstractBaseTag(){}; virtual std::string to_nbt(std::string, std::endian, Amulet::StringEncode) const = 0; virtual std::string to_snbt() const = 0; virtual std::string to_snbt(const std::string& indent) const = 0; }; - class AbstractBaseImmutableTag: public AbstractBaseTag {}; - class AbstractBaseMutableTag: public AbstractBaseTag {}; - class AbstractBaseNumericTag: public AbstractBaseImmutableTag {}; - class AbstractBaseIntTag: public AbstractBaseNumericTag {}; - class AbstractBaseFloatTag: public AbstractBaseNumericTag {}; - class AbstractBaseArrayTag: public AbstractBaseMutableTag {}; + class AbstractBaseImmutableTag: public AbstractBaseTag { + public: + virtual ~AbstractBaseImmutableTag(){}; + }; + class AbstractBaseMutableTag: public AbstractBaseTag { + public: + virtual ~AbstractBaseMutableTag(){}; + }; + class AbstractBaseNumericTag: public AbstractBaseImmutableTag { + public: + virtual ~AbstractBaseNumericTag(){}; + }; + class AbstractBaseIntTag: public AbstractBaseNumericTag { + public: + virtual ~AbstractBaseIntTag(){}; + }; + class AbstractBaseFloatTag: public AbstractBaseNumericTag { + public: + virtual ~AbstractBaseFloatTag(){}; + }; + class AbstractBaseArrayTag: public AbstractBaseMutableTag { + public: + virtual ~AbstractBaseArrayTag(){}; + }; // pybind cannot directly store fundamental types // This wrapper exists to allow pybind to store fundamental types From 0705a06096522d780b3e23ba8bd5686631d33c63 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Mon, 15 Jul 2024 12:02:25 +0100 Subject: [PATCH 116/121] Added space This is needed for GCC but MSVC doesn't seem to care --- src/amulet_nbt/pybind/tag/py_compound_tag.cpp | 6 +++--- src/amulet_nbt/pybind/tag/py_list_tag.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/amulet_nbt/pybind/tag/py_compound_tag.cpp b/src/amulet_nbt/pybind/tag/py_compound_tag.cpp index 22bb547a..6bbfc947 100644 --- a/src/amulet_nbt/pybind/tag/py_compound_tag.cpp +++ b/src/amulet_nbt/pybind/tag/py_compound_tag.cpp @@ -351,7 +351,7 @@ void init_compound(py::module& m) { #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG)\ CompoundTag.def(\ - "get_"TAG_NAME,\ + "get_" TAG_NAME,\ [](\ const Amulet::CompoundTagWrapper& self,\ std::string key,\ @@ -388,7 +388,7 @@ void init_compound(py::module& m) { )\ );\ CompoundTag.def(\ - "setdefault_"TAG_NAME,\ + "setdefault_" TAG_NAME,\ [isinstance](\ const Amulet::CompoundTagWrapper& self,\ std::string key,\ @@ -434,7 +434,7 @@ void init_compound(py::module& m) { )\ );\ CompoundTag.def(\ - "pop_"TAG_NAME,\ + "pop_" TAG_NAME,\ [marker](\ const Amulet::CompoundTagWrapper& self,\ std::string key,\ diff --git a/src/amulet_nbt/pybind/tag/py_list_tag.cpp b/src/amulet_nbt/pybind/tag/py_list_tag.cpp index 2e6cafff..c3802a39 100644 --- a/src/amulet_nbt/pybind/tag/py_list_tag.cpp +++ b/src/amulet_nbt/pybind/tag/py_list_tag.cpp @@ -582,7 +582,7 @@ void init_list(py::module& m) { ); #define CASE(ID, TAG_NAME, TAG, TAG_STORAGE, LIST_TAG)\ ListTag.def(\ - "get_"TAG_NAME,\ + "get_" TAG_NAME,\ [](const Amulet::ListTagWrapper& self, Py_ssize_t index){\ if (self.tag->index() != variant_index>()){\ throw pybind11::type_error("ListTag elements are not "#TAG);\ From 02ac0a75070217ba86ade8fd39212a6a2a59a157 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Mon, 15 Jul 2024 13:27:56 +0100 Subject: [PATCH 117/121] Moved tag creation into template function --- src/amulet_nbt/pybind/tag/py_compound_tag.cpp | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/amulet_nbt/pybind/tag/py_compound_tag.cpp b/src/amulet_nbt/pybind/tag/py_compound_tag.cpp index 6bbfc947..c1dc2d1a 100644 --- a/src/amulet_nbt/pybind/tag/py_compound_tag.cpp +++ b/src/amulet_nbt/pybind/tag/py_compound_tag.cpp @@ -29,6 +29,22 @@ void CompoundTag_update(Amulet::CompoundTag& self, py::dict other){ } } +template < + typename T, + std::enable_if_t::value, bool> = true +> +T new_tag(){ + return T(); +} + +template < + typename T, + std::enable_if_t::value, bool> = true +> +T new_tag(){ + return std::make_shared(); +} + void init_compound(py::module& m) { py::class_ CompoundTagIterator(m, "CompoundTagIterator"); @@ -401,11 +417,7 @@ void init_compound(py::module& m) { };\ auto create_set_return = [set_and_return, default_](){\ if (default_.index() == 0){\ - if constexpr (is_shared_ptr::value){\ - return set_and_return(std::make_shared());\ - } else {\ - return set_and_return(TAG_STORAGE());\ - }\ + return set_and_return(new_tag());\ } else {\ return set_and_return(std::get>(default_).tag);\ }\ From f910fecabb0ee6a11acd56cdbdd09a45ee8d7412 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Mon, 15 Jul 2024 13:56:06 +0100 Subject: [PATCH 118/121] Removed cython version --- src_/amulet_nbt/__init__.pyx | 156 -- src_/amulet_nbt/_errors.pyx | 27 - .../_nbt_encoding/_string/read_snbt.pyx | 225 -- src_/amulet_nbt/_tag/__init__.pyx | 0 src_/amulet_nbt/_tag/abc.pxd | 23 - src_/amulet_nbt/_tag/abc.pyx | 202 -- src_/amulet_nbt/_tag/array.pxd | 31 - src_/amulet_nbt/_tag/array.pyx | 684 ----- src_/amulet_nbt/_tag/array.pyx.tp | 192 -- src_/amulet_nbt/_tag/compound.pxd | 22 - src_/amulet_nbt/_tag/compound.pyx | 1842 ------------ src_/amulet_nbt/_tag/compound.pyx.tp | 392 --- src_/amulet_nbt/_tag/deepcopy.pxd | 4 - src_/amulet_nbt/_tag/deepcopy.pyx | 128 - src_/amulet_nbt/_tag/float.pxd | 20 - src_/amulet_nbt/_tag/float.pyx | 209 -- src_/amulet_nbt/_tag/float.pyx.tp | 55 - src_/amulet_nbt/_tag/int.pxd | 34 - src_/amulet_nbt/_tag/int.pyx | 417 --- src_/amulet_nbt/_tag/int.pyx.tp | 91 - src_/amulet_nbt/_tag/list.pxd | 19 - src_/amulet_nbt/_tag/list.pyx | 2469 ----------------- src_/amulet_nbt/_tag/list.pyx.tp | 776 ------ src_/amulet_nbt/_tag/named_tag.pxd | 13 - src_/amulet_nbt/_tag/named_tag.pyx | 323 --- src_/amulet_nbt/_tag/named_tag.pyx.tp | 229 -- src_/amulet_nbt/_tag/numeric.pxd | 5 - src_/amulet_nbt/_tag/numeric.pyx | 16 - src_/amulet_nbt/_tag/string.pxd | 10 - src_/amulet_nbt/_tag/string.pyx | 124 - src_/amulet_nbt/_tag/string.pyx.tp | 119 - src_/amulet_nbt/tpf/ArrayTag.pyx.tpf | 175 -- src_/amulet_nbt/tpf/Comparison.pyx.tpf | 15 - .../tpf/CompoundGetSetdefault.pyx.tpf | 113 - src_/amulet_nbt/tpf/FloatTag.pyx.tpf | 17 - src_/amulet_nbt/tpf/ImmutableTag.pyx.tpf | 5 - src_/amulet_nbt/tpf/IntTag.pyx.tpf | 21 - src_/amulet_nbt/tpf/ListGet.pyx.tpf | 10 - src_/amulet_nbt/tpf/NamedTagGet.pyx.tpf | 9 - src_/amulet_nbt/tpf/NumericTag.pyx.tpf | 36 - src_/amulet_nbt/tpf/to_snbt.pyx.tpf | 4 - src_/amulet_nbt/tpf/to_snbt_multiline.pyx.tpf | 14 - 42 files changed, 9276 deletions(-) delete mode 100644 src_/amulet_nbt/__init__.pyx delete mode 100644 src_/amulet_nbt/_errors.pyx delete mode 100644 src_/amulet_nbt/_nbt_encoding/_string/read_snbt.pyx delete mode 100644 src_/amulet_nbt/_tag/__init__.pyx delete mode 100644 src_/amulet_nbt/_tag/abc.pxd delete mode 100644 src_/amulet_nbt/_tag/abc.pyx delete mode 100644 src_/amulet_nbt/_tag/array.pxd delete mode 100644 src_/amulet_nbt/_tag/array.pyx delete mode 100644 src_/amulet_nbt/_tag/array.pyx.tp delete mode 100644 src_/amulet_nbt/_tag/compound.pxd delete mode 100644 src_/amulet_nbt/_tag/compound.pyx delete mode 100644 src_/amulet_nbt/_tag/compound.pyx.tp delete mode 100644 src_/amulet_nbt/_tag/deepcopy.pxd delete mode 100644 src_/amulet_nbt/_tag/deepcopy.pyx delete mode 100644 src_/amulet_nbt/_tag/float.pxd delete mode 100644 src_/amulet_nbt/_tag/float.pyx delete mode 100644 src_/amulet_nbt/_tag/float.pyx.tp delete mode 100644 src_/amulet_nbt/_tag/int.pxd delete mode 100644 src_/amulet_nbt/_tag/int.pyx delete mode 100644 src_/amulet_nbt/_tag/int.pyx.tp delete mode 100644 src_/amulet_nbt/_tag/list.pxd delete mode 100644 src_/amulet_nbt/_tag/list.pyx delete mode 100644 src_/amulet_nbt/_tag/list.pyx.tp delete mode 100644 src_/amulet_nbt/_tag/named_tag.pxd delete mode 100644 src_/amulet_nbt/_tag/named_tag.pyx delete mode 100644 src_/amulet_nbt/_tag/named_tag.pyx.tp delete mode 100644 src_/amulet_nbt/_tag/numeric.pxd delete mode 100644 src_/amulet_nbt/_tag/numeric.pyx delete mode 100644 src_/amulet_nbt/_tag/string.pxd delete mode 100644 src_/amulet_nbt/_tag/string.pyx delete mode 100644 src_/amulet_nbt/_tag/string.pyx.tp delete mode 100644 src_/amulet_nbt/tpf/ArrayTag.pyx.tpf delete mode 100644 src_/amulet_nbt/tpf/Comparison.pyx.tpf delete mode 100644 src_/amulet_nbt/tpf/CompoundGetSetdefault.pyx.tpf delete mode 100644 src_/amulet_nbt/tpf/FloatTag.pyx.tpf delete mode 100644 src_/amulet_nbt/tpf/ImmutableTag.pyx.tpf delete mode 100644 src_/amulet_nbt/tpf/IntTag.pyx.tpf delete mode 100644 src_/amulet_nbt/tpf/ListGet.pyx.tpf delete mode 100644 src_/amulet_nbt/tpf/NamedTagGet.pyx.tpf delete mode 100644 src_/amulet_nbt/tpf/NumericTag.pyx.tpf delete mode 100644 src_/amulet_nbt/tpf/to_snbt.pyx.tpf delete mode 100644 src_/amulet_nbt/tpf/to_snbt_multiline.pyx.tpf diff --git a/src_/amulet_nbt/__init__.pyx b/src_/amulet_nbt/__init__.pyx deleted file mode 100644 index 9d44e0f5..00000000 --- a/src_/amulet_nbt/__init__.pyx +++ /dev/null @@ -1,156 +0,0 @@ -import re -from typing import Union - -from . import _version - -__version__ = _version.get_versions()["version"] -__major__ = int(re.match(r"\d+", __version__)[0]) -__all__ = [ - "AbstractBaseTag", - "AbstractBaseImmutableTag", - "AbstractBaseMutableTag", - "AbstractBaseNumericTag", - "AbstractBaseIntTag", - "ByteTag", - "TAG_Byte", - "ShortTag", - "TAG_Short", - "IntTag", - "TAG_Int", - "LongTag", - "TAG_Long", - "AbstractBaseFloatTag", - "FloatTag", - "TAG_Float", - "DoubleTag", - "TAG_Double", - "AbstractBaseArrayTag", - "ByteArrayTag", - "TAG_Byte_Array", - "IntArrayTag", - "TAG_Int_Array", - "LongArrayTag", - "TAG_Long_Array", - "StringTag", - "TAG_String", - "ListTag", - "TAG_List", - "CompoundTag", - "TAG_Compound", - "NamedTag", - "load", - "load_array", - "ReadOffset", - "from_snbt", - "NBTError", - "NBTLoadError", - "NBTFormatError", - "SNBTParseError", - "SNBTType", - "IntType", - "FloatType", - "NumberType", - "ArrayType", - "AnyNBT", - "StringEncoding", - "mutf8_encoding", - "utf8_encoding", - "utf8_escape_encoding", - "EncodingPreset", - "java_encoding", - "bedrock_encoding", -] - -from ._tag.abc import ( - AbstractBaseTag, - AbstractBaseImmutableTag, - AbstractBaseMutableTag, -) -from ._tag.numeric import AbstractBaseNumericTag - -# Types -from ._tag.int import ( - AbstractBaseIntTag, - ByteTag, - ShortTag, - IntTag, - LongTag, - ByteTag as TAG_Byte, - ShortTag as TAG_Short, - IntTag as TAG_Int, - LongTag as TAG_Long, -) -from ._tag.float import ( - AbstractBaseFloatTag, - FloatTag, - DoubleTag, - FloatTag as TAG_Float, - DoubleTag as TAG_Double, -) -from ._tag.array import ( - AbstractBaseArrayTag, - ByteArrayTag, - IntArrayTag, - LongArrayTag, - ByteArrayTag as TAG_Byte_Array, - IntArrayTag as TAG_Int_Array, - LongArrayTag as TAG_Long_Array, -) -from ._tag.string import ( - StringTag, - StringTag as TAG_String, -) - -from ._tag.named_tag import NamedTag - -from ._tag.list import ( - ListTag, - ListTag as TAG_List, -) -from ._tag.compound import ( - CompoundTag, - CompoundTag as TAG_Compound, -) - -# Load functions -from amulet_nbt._nbt_encoding._binary import load, load_array, ReadOffset -from amulet_nbt._nbt_encoding._string import from_snbt - -from ._errors import NBTError, NBTLoadError, NBTFormatError, SNBTParseError - -from ._string_encoding.encoding import ( - mutf8_encoding, - utf8_encoding, - utf8_escape_encoding, - StringEncoding, -) -from ._nbt_encoding._binary.encoding_preset import ( - java_encoding, - bedrock_encoding, - EncodingPreset, -) - -SNBTType = str - -IntType = Union[ByteTag, ShortTag, IntTag, LongTag] - -FloatType = Union[FloatTag, DoubleTag] - -NumberType = Union[ByteTag, ShortTag, IntTag, LongTag, FloatTag, DoubleTag] - -ArrayType = Union[ByteArrayTag, IntArrayTag, LongArrayTag] - -AnyNBT = Union[ - ByteTag, - ShortTag, - IntTag, - LongTag, - FloatTag, - DoubleTag, - ByteArrayTag, - StringTag, - ListTag, - CompoundTag, - IntArrayTag, - LongArrayTag, -] diff --git a/src_/amulet_nbt/_errors.pyx b/src_/amulet_nbt/_errors.pyx deleted file mode 100644 index 0ec0e2f4..00000000 --- a/src_/amulet_nbt/_errors.pyx +++ /dev/null @@ -1,27 +0,0 @@ -from typing import Optional - - -class NBTError(Exception): - """Some error in the NBT library.""" - - -class NBTLoadError(NBTError): - """The NBT data failed to load for some reason.""" - - pass - - -class NBTFormatError(NBTLoadError): - """Indicates the NBT format is invalid.""" - - pass - - -class SNBTParseError(NBTError): - """Indicates the SNBT format is invalid.""" - - index: Optional[int] # The index at which the error occurred - - def __init__(self, *args, index=None, **kwargs): - super().__init__(*args, **kwargs) - self.index = index diff --git a/src_/amulet_nbt/_nbt_encoding/_string/read_snbt.pyx b/src_/amulet_nbt/_nbt_encoding/_string/read_snbt.pyx deleted file mode 100644 index 70f5ee78..00000000 --- a/src_/amulet_nbt/_nbt_encoding/_string/read_snbt.pyx +++ /dev/null @@ -1,225 +0,0 @@ -import re - -import amulet_nbt -from amulet_nbt._errors import SNBTParseError -from amulet_nbt._tag.abc cimport AbstractBaseTag -from amulet_nbt._tag.int cimport ByteTag, ShortTag, IntTag, LongTag -from amulet_nbt._tag.float cimport FloatTag, DoubleTag -from amulet_nbt._tag.array cimport ByteArrayTag, IntArrayTag, LongArrayTag -from amulet_nbt._tag.string cimport StringTag -from amulet_nbt._tag.list cimport ListTag -from amulet_nbt._tag.compound cimport CompoundTag - -whitespace = re.compile(r"[ \t\r\n]*") -int_numeric = re.compile(r"[+-]?\d+[bBsSlL]?") -# If the letter code and decimal do not exist it is parsed as a string tag. -float_numeric = re.compile(r"[+-]?((((\d+\.\d*)|(\d*\.\d+))([eE][+-]?\d+)?)|((\d+|(\d+\.\d*)|(\d*\.\d+))([eE][+-]?\d+)?[fFdD]))") -alnumplus = re.compile(r"[A-Za-z0-9._+-]+") -comma = re.compile(r"[ \t\r\n]*,[ \t\r\n]*") -colon = re.compile(r"[ \t\r\n]*:[ \t\r\n]*") -array_lookup = {'B': ByteArrayTag, 'I': IntArrayTag, 'L': LongArrayTag} - -cdef int _strip_whitespace(unicode snbt, int index): - cdef object match - - match = whitespace.match(snbt, index) - if match is None: - return index - else: - return match.end() - -cdef int _strip_comma(unicode snbt, int index, unicode end_chr) except -1: - cdef object match - - match = comma.match(snbt, index) - if match is None: - index = _strip_whitespace(snbt, index) - if snbt[index] != end_chr: - raise SNBTParseError( - f'Expected a comma or {end_chr} at {index} but got ->{snbt[index:index + 10]} instead', - index=index - ) - else: - index = match.end() - return index - -cdef int _strip_colon(unicode snbt, int index) except -1: - cdef object match - - match = colon.match(snbt, index) - if match is None: - raise SNBTParseError( - f'Expected : at {index} but got ->{snbt[index:index + 10]} instead', - index=index - ) - else: - return match.end() - -cdef inline unescape(unicode string): - return string.replace('\\"', '"').replace("\\\\", "\\") - -cdef tuple _capture_string(unicode snbt, int index): - cdef unicode val, quote - cdef bint strict_str - cdef int end_index - cdef object match - - if snbt[index] in ('"', "'"): - quote = snbt[index] - strict_str = True - index += 1 - end_index = index - while not (snbt[end_index] == quote and not (len(snbt[:end_index]) - len(snbt[:end_index].rstrip('\\')))): - end_index += 1 - val = unescape(snbt[index:end_index]) - index = end_index + 1 - else: - strict_str = False - match = alnumplus.match(snbt, index) - if match is None: - raise SNBTParseError( - f'Expected a string at {index} but got ->{snbt[index:index + 10]} instead', - index=index - ) - val = match.group() - index = match.end() - - return val, strict_str, index - -cdef tuple _parse_snbt_recursive(unicode snbt, int index=0): - cdef dict data_ - cdef list array - cdef unicode array_type_chr - cdef object array_type, first_data_type - cdef AbstractBaseTag nested_data, data - cdef unicode val - cdef bint strict_str - - index = _strip_whitespace(snbt, index) - if snbt[index] == '{': - data_ = {} - index += 1 - index = _strip_whitespace(snbt, index) - while snbt[index] != '}': - # read the key - key, _, index = _capture_string(snbt, index) - - # get around the colon - index = _strip_colon(snbt, index) - - # load the data and save it to the dictionary - nested_data, index = _parse_snbt_recursive(snbt, index) - data_[key] = nested_data - - index = _strip_comma(snbt, index, '}') - data = CompoundTag(data_) - # skip the } - index += 1 - - elif snbt[index] == '[': - index += 1 - index = _strip_whitespace(snbt, index) - if snbt[index:index + 2] in {'B;', 'I;', 'L;'}: - # array - array = [] - array_type_chr = snbt[index] - array_type = array_lookup[array_type_chr] - index += 2 - index = _strip_whitespace(snbt, index) - - while snbt[index] != ']': - match = int_numeric.match(snbt, index) - if match is None: - raise SNBTParseError( - f'Expected an integer value or ] at {index} but got ->{snbt[index:index + 10]} instead', - index=index - ) - else: - val = match.group() - if array_type_chr in {"B", "L"}: - if val[-1].upper() == array_type_chr: - val = val[:-1] - else: - raise SNBTParseError( - f'Expected the datatype marker "{array_type_chr}" at {index} but got ->{snbt[index:index + 10]} instead', - index=index - ) - array.append(int(val)) - index = match.end() - - index = _strip_comma(snbt, index, ']') - data = array_type(array) - else: - # list - array = [] - first_data_type = None - while snbt[index] != ']': - nested_data, index_ = _parse_snbt_recursive(snbt, index) - if first_data_type is None: - first_data_type = nested_data.__class__ - if not isinstance(nested_data, first_data_type): - raise SNBTParseError( - f'Expected type {first_data_type.__name__} but got {nested_data.__class__.__name__} at {index}', - index=index - ) - else: - index = index_ - array.append(nested_data) - index = _strip_comma(snbt, index, ']') - - if first_data_type is None: - data = ListTag() - else: - data = ListTag(array, first_data_type().tag_id) - - # skip the ] - index += 1 - - else: - val, strict_str, index = _capture_string(snbt, index) - if strict_str: - data = StringTag(val) - else: - if int_numeric.fullmatch(val) is not None: - # we have an int type - if val[-1] in {'b', 'B'}: - data = ByteTag(int(val[:-1])) - elif val[-1] in {'s', 'S'}: - data = ShortTag(int(val[:-1])) - elif val[-1] in {'l', 'L'}: - data = LongTag(int(val[:-1])) - else: - data = IntTag(int(val)) - elif float_numeric.fullmatch(val) is not None: - # we have a float type - if val[-1] in {'f', 'F'}: - data = FloatTag(val[:-1]) - elif val[-1] in {'d', 'D'}: - data = DoubleTag(val[:-1]) - else: - data = DoubleTag(val) - elif val.lower() == "false": - data = ByteTag(0) - elif val.lower() == "true": - data = ByteTag(1) - else: - # we just have a string type - data = StringTag(val) - - return data, index - -def from_snbt(unicode snbt: str) -> amulet_nbt.AbstractBaseTag: - """Parse Stringified NBT. - - :param snbt: The SNBT string to parse. - :return: The tag - :raises: SNBTParseError if the SNBT format is invalid. - """ - try: - return _parse_snbt_recursive(snbt)[0] - except SNBTParseError as e: - raise e - except IndexError: - raise SNBTParseError('SNBT string is incomplete. Reached the end of the string.') - except Exception as e: - raise SNBTParseError(e) diff --git a/src_/amulet_nbt/_tag/__init__.pyx b/src_/amulet_nbt/_tag/__init__.pyx deleted file mode 100644 index e69de29b..00000000 diff --git a/src_/amulet_nbt/_tag/abc.pxd b/src_/amulet_nbt/_tag/abc.pxd deleted file mode 100644 index 7f29c10d..00000000 --- a/src_/amulet_nbt/_tag/abc.pxd +++ /dev/null @@ -1,23 +0,0 @@ -from libcpp.string cimport string -from libcpp cimport bool -from amulet_nbt._libcpp.endian cimport endian - -from amulet_nbt._tag._cpp cimport TagNode -from amulet_nbt._string_encoding._cpp cimport CStringEncode - - -cdef class AbstractBase: - pass - - -cdef class AbstractBaseTag(AbstractBase): - cdef TagNode to_node(self) - cdef string write_nbt(self, string, endian, CStringEncode) - - -cdef class AbstractBaseImmutableTag(AbstractBaseTag): - pass - - -cdef class AbstractBaseMutableTag(AbstractBaseTag): - pass diff --git a/src_/amulet_nbt/_tag/abc.pyx b/src_/amulet_nbt/_tag/abc.pyx deleted file mode 100644 index 7a42712e..00000000 --- a/src_/amulet_nbt/_tag/abc.pyx +++ /dev/null @@ -1,202 +0,0 @@ -# cython: language_level=3, boundscheck=False, wraparound=False -# distutils: language = c++ -# distutils: extra_compile_args = CPPCARGS -# cython: c_string_type=str, c_string_encoding=utf8 - -from copy import copy -from typing import Any, Self, BinaryIO -import gzip - -from libcpp cimport bool -from libcpp.string cimport string - -from amulet_nbt._libcpp.endian cimport endian - -import amulet_nbt -from amulet_nbt._string_encoding cimport StringEncoding -from amulet_nbt._string_encoding._cpp cimport CStringEncode -from amulet_nbt._string_encoding import mutf8_encoding -from amulet_nbt._nbt_encoding._binary.encoding_preset cimport EncodingPreset - - -cdef class AbstractBase: - """Abstract Base class for all Tags and the NamedTag""" - - -cdef class AbstractBaseTag(AbstractBase): - """Abstract Base Class for all Tag classes""" - tag_id: int = -1 - - cdef TagNode to_node(self): - raise NotImplementedError - - @property - def py_data(self) -> Any: - """A python representation of the class. Note that the return type is undefined and may change in the future. - - You would be better off using the py_{type} or np_array properties if you require a fixed type. - This is here for convenience to get a python representation under the same property name. - """ - raise NotImplementedError - - cdef string write_nbt(self, string name, endian endianness, CStringEncode string_encode): - raise NotImplementedError - - def to_nbt( - self, - *, - EncodingPreset preset: amulet_nbt.EncodingPreset = None, - bool compressed: bool = True, - bool little_endian: bool = False, - StringEncoding string_encoding: amulet_nbt.StringTag = mutf8_encoding, - string name: str | bytes = b"", - ) -> bytes: - """Get the data in binary NBT format. - - :param preset: A class containing endianness and encoding presets. - :param compressed: Should the bytes be compressed with gzip. - :param little_endian: Should the bytes be saved in little endian format. Ignored if preset is defined. - :param string_encoding: The StringEncoding to use. Ignored if preset is defined. - :param name: The root tag name. - :return: The binary NBT representation of the class. - """ - cdef endian endianness - - if preset is not None: - endianness = preset.endianness - compressed = preset.compressed - string_encoding = preset.string_encoding - else: - endianness = endian.little if little_endian else endian.big - - cdef bytes data = self.write_nbt( - name, - endianness, - string_encoding.encode_cpp - ) - - if compressed: - return gzip.compress(data) - return data - - def save_to( - self, - object filepath_or_buffer: bytes | str | BinaryIO | memoryview | None = None, - *, - EncodingPreset preset: amulet_nbt.EncodingPreset = None, - bool compressed: bool = True, - bool little_endian: bool = False, - StringEncoding string_encoding: amulet_nbt.StringEncoding = mutf8_encoding, - string name: str | bytes = b"", - ) -> bytes: - """Convert the data to the binary NBT format. Optionally write to a file. - - If filepath_or_buffer is a valid file path in string form the data will be written to that file. - - If filepath_or_buffer is a file like object the bytes will be written to it using .write method. - - :param filepath_or_buffer: A path or writeable object to write the data to. - :param preset: A class containing endianness and encoding presets. - :param compressed: Should the bytes be compressed with gzip. - :param little_endian: Should the bytes be saved in little endian format. Ignored if preset is defined. - :param string_encoding: The StringEncoding to use. Ignored if preset is defined. - :param name: The root tag name. - :return: The binary NBT representation of the class. - """ - data = self.to_nbt( - preset=preset, - compressed=compressed, - little_endian=little_endian, - string_encoding=string_encoding, - name=name, - ) - - if filepath_or_buffer is not None: - if isinstance(filepath_or_buffer, str): - with open(filepath_or_buffer, 'wb') as fp: - fp.write(data) - else: - filepath_or_buffer.write(data) - return data - - def to_snbt(self, object indent: None | str | int = None) -> str: - """Convert the data to the Stringified NBT format. - - :param indent: - If None (the default) the SNBT will be on one line. - If an int will be multi-line SNBT with this many spaces per indentation. - If a string will be multi-line SNBT with this string as the indentation. - :return: The SNBT string. - """ - raise NotImplementedError - - def __eq__(self, object other: Any) -> bool: - """Check if the instance is equal to another instance. - - This will only return True if the tag type is the same and the data contained is the same. - - >>> from amulet_nbt import ByteTag, ShortTag - >>> tag1 = ByteTag(1) - >>> tag2 = ByteTag(2) - >>> tag3 = ShortTag(1) - >>> tag1 == tag1 # True - >>> tag1 == tag2 # False - >>> tag1 == tag3 # False - """ - raise NotImplementedError - - def __repr__(self) -> str: - """A string representation of the object to show how it can be constructed. - - >>> from amulet_nbt import ByteTag - >>> tag = ByteTag(1) - >>> repr(tag) # "ByteTag(1)" - """ - raise NotImplementedError - - def __str__(self) -> str: - """A string representation of the object.""" - raise NotImplementedError - - def __reduce__(self): - raise NotImplementedError - - def copy(self) -> Self: - """Return a shallow copy of the class""" - return copy(self) - - def __copy__(self): - """A shallow copy of the class - - >>> import copy - >>> from amulet_nbt import ListTag - >>> tag = ListTag() - >>> tag2 = copy.copy(tag) - - :return: A shallow copy of the class - """ - raise NotImplementedError - - def __deepcopy__(self, memo=None): - """A deep copy of the class - - >>> import copy - >>> from amulet_nbt import ListTag - >>> tag = ListTag() - >>> tag2 = copy.deepcopy(tag) - - :return: A deep copy of the class - """ - raise NotImplementedError - - -cdef class AbstractBaseImmutableTag(AbstractBaseTag): - """Abstract Base Class for all immutable Tag classes""" - def __hash__(self) -> int: - """A hash of the data in the class.""" - raise NotImplementedError - - -cdef class AbstractBaseMutableTag(AbstractBaseTag): - """Abstract Base Class for all mutable Tag classes""" - __hash__ = None diff --git a/src_/amulet_nbt/_tag/array.pxd b/src_/amulet_nbt/_tag/array.pxd deleted file mode 100644 index 28f22ae8..00000000 --- a/src_/amulet_nbt/_tag/array.pxd +++ /dev/null @@ -1,31 +0,0 @@ -from amulet_nbt._tag.abc cimport AbstractBaseMutableTag -from amulet_nbt._tag._cpp cimport ( - CByteArrayTagPtr, - CIntArrayTagPtr, - CLongArrayTagPtr -) - - -cdef class AbstractBaseArrayTag(AbstractBaseMutableTag): - pass - - -cdef class ByteArrayTag(AbstractBaseArrayTag): - cdef CByteArrayTagPtr cpp - - @staticmethod - cdef ByteArrayTag wrap(CByteArrayTagPtr) - - -cdef class IntArrayTag(AbstractBaseArrayTag): - cdef CIntArrayTagPtr cpp - - @staticmethod - cdef IntArrayTag wrap(CIntArrayTagPtr) - - -cdef class LongArrayTag(AbstractBaseArrayTag): - cdef CLongArrayTagPtr cpp - - @staticmethod - cdef LongArrayTag wrap(CLongArrayTagPtr) diff --git a/src_/amulet_nbt/_tag/array.pyx b/src_/amulet_nbt/_tag/array.pyx deleted file mode 100644 index 86913bc8..00000000 --- a/src_/amulet_nbt/_tag/array.pyx +++ /dev/null @@ -1,684 +0,0 @@ -## This file is generated from a template. -## Do not modify this file directly or your changes will get overwritten. -## Edit the accompanying .pyx.tp file instead. -# cython: language_level=3, boundscheck=False, wraparound=False -# distutils: language = c++ -# distutils: extra_compile_args = CPPCARGS -# cython: c_string_type=str, c_string_encoding=utf8 - -import numpy -cimport numpy -numpy.import_array() -from numpy.typing import NDArray, ArrayLike -from typing import Any, overload, SupportsInt -from collections.abc import Iterable, Iterator - -from cython.operator cimport dereference -from cpython cimport Py_INCREF -from libcpp.memory cimport make_shared -from libcpp.string cimport string -from amulet_nbt._libcpp.endian cimport endian -from amulet_nbt._string_encoding._cpp cimport CStringEncode -from amulet_nbt._nbt_encoding._binary cimport write_named_tag -from amulet_nbt._nbt_encoding._string cimport write_byte_array_snbt, write_int_array_snbt, write_long_array_snbt -from amulet_nbt._tag._cpp cimport TagNode, CByteArrayTag, CIntArrayTag, CLongArrayTag -from .abc cimport AbstractBaseMutableTag - - -cdef class AbstractBaseArrayTag(AbstractBaseMutableTag): - @property - def np_array(self) -> NDArray[numpy.int8 | numpy.int32 | numpy.int64]: - """A numpy array holding the same internal data. - - Changes to the array will also modify the internal state. - """ - raise NotImplementedError - - @property - def py_data(self) -> Any: - return self.np_array - - # Sized - def __len__(self) -> int: - """The length of the array. - - >>> from amulet_nbt import ByteArrayTag - >>> tag = ByteArrayTag([1, 2, 3]) - >>> len(tag) # 3 - """ - raise NotImplementedError - - # Sequence - @overload - def __getitem__(self, item: int) -> numpy.int8 | numpy.int32 | numpy.int64: - ... - - @overload - def __getitem__(self, item: slice) -> NDArray[numpy.int8 | numpy.int32 | numpy.int64]: - ... - - @overload - def __getitem__(self, item: NDArray[numpy.integer]) -> NDArray[numpy.int8 | numpy.int32 | numpy.int64]: - ... - - def __getitem__(self, item): - """Get item(s) from the array. - - This supports the full numpy protocol. - If a numpy array is returned, the array data is the same as the data contained in this class. - - >>> from amulet_nbt import ByteArrayTag - >>> import numpy - >>> tag = ByteArrayTag([1, 2, 3]) - >>> tag[0] # 1 - >>> tag[:1] # numpy.array([1], dtype=numpy.int8) - >>> tag[numpy.array([1, 2])] # numpy.array([2, 3], dtype=int8) - """ - raise NotImplementedError - - def __iter__(self) -> Iterator[numpy.int8 | numpy.int32 | numpy.int64]: - """Iterate through the items in the array. - - >>> from amulet_nbt import ByteArrayTag - >>> tag = ByteArrayTag([1, 2, 3]) - >>> for num in tag: - >>> pass - >>> iter(tag) - """ - raise NotImplementedError - - def __reversed__(self) -> Iterator[numpy.int8 | numpy.int32 | numpy.int64]: - """Iterate through the items in the array in reverse order. - - >>> from amulet_nbt import ByteArrayTag - >>> tag = ByteArrayTag([1, 2, 3]) - >>> for num in reversed(tag): - >>> pass - - :return: A reversed iterator. - """ - raise NotImplementedError - - def __contains__(self, item: Any) -> bool: - """Check if an item is in the array. - - >>> from amulet_nbt import ByteArrayTag - >>> tag = ByteArrayTag([1, 2, 3]) - >>> 1 in tag # True - """ - raise NotImplementedError - - # MutableSequence - @overload - def __setitem__(self, item: int, value: numpy.integer) -> None: - ... - - @overload - def __setitem__(self, item: slice, value: ArrayLike[numpy.integer]) -> None: - ... - - @overload - def __setitem__(self, item: ArrayLike, value: ArrayLike[numpy.integer]) -> None: - ... - - def __setitem__(self, key, value): - """Set item(s) in the array. - - This supports the full numpy protocol. - - >>> from amulet_nbt import ByteArrayTag - >>> import numpy - >>> tag = ByteArrayTag([1, 2, 3]) - >>> tag[0] = 10 # [10, 2, 3] - >>> tag[:2] = [4, 5] # [4, 5, 3] - >>> tag[numpy.array([1, 2])] = [6, 7] # [4, 6, 7] - """ - raise NotImplementedError - - # Array interface - def __array__(self, dtype: Any = None) -> NDArray[numpy.int8 | numpy.int32 | numpy.int64]: - """Get a numpy array representation of the stored data. - - >>> from amulet_nbt import ByteArrayTag - >>> import numpy - >>> tag = ByteArrayTag([1, 2, 3]) - >>> arr = numpy.asarray(tag) - - :param dtype: This is ignored but is part of the array interace - :return: A numpy array that shares the memory with this instance. - """ - raise NotImplementedError - - -cdef class ByteArrayTag(AbstractBaseArrayTag): - """This class behaves like an 1D Numpy signed integer array with each value stored in a byte.""" - tag_id: int = 7 - - def __init__(self, object value: Iterable[SupportsInt] = ()) -> None: - """Construct a new ByteArrayTag object from an array-like object.""" - cdef numpy.ndarray arr = numpy.asarray(value, numpy.dtype("int8")).ravel() - self.cpp = make_shared[CByteArrayTag](arr.size) - cdef size_t i - for i in range(arr.size): - dereference(self.cpp)[i] = arr[i] - - @staticmethod - cdef ByteArrayTag wrap(CByteArrayTagPtr cpp): - cdef ByteArrayTag tag = ByteArrayTag.__new__(ByteArrayTag) - tag.cpp = cpp - return tag - - cdef TagNode to_node(self): - cdef TagNode node - node.emplace[CByteArrayTagPtr](self.cpp) - return node - - @property - def np_array(self) -> NDArray[numpy.int8]: - return numpy.asarray(self) - - cdef string write_nbt(self, string name, endian endianness, CStringEncode string_encode): - return write_named_tag[CByteArrayTagPtr](name, self.cpp, endianness, string_encode) - - def to_snbt(self, object indent: None | str | int = None) -> str: - cdef string snbt - write_byte_array_snbt(snbt, self.cpp) - return snbt - - def __eq__(self, object other: Any) -> bool: - if not isinstance(other, ByteArrayTag): - return False - cdef ByteArrayTag tag = other - return dereference(self.cpp) == dereference(tag.cpp) - - def __repr__(self) -> str: - return f"ByteArrayTag({list(self)})" - - def __str__(self) -> str: - return str(list(self)) - - def __reduce__(self): - return ByteArrayTag, (list(self),) - - def __copy__(self) -> ByteArrayTag: - return ByteArrayTag.wrap( - make_shared[CByteArrayTag](dereference(self.cpp)) - ) - - def __deepcopy__(self, memo=None) -> ByteArrayTag: - return ByteArrayTag.wrap( - make_shared[CByteArrayTag](dereference(self.cpp)) - ) - - # Sized - def __len__(self) -> int: - """The length of the array. - - >>> from amulet_nbt import ByteArrayTag - >>> tag = ByteArrayTag([1, 2, 3]) - >>> len(tag) # 3 - """ - return dereference(self.cpp).size() - - # Sequence - @overload - def __getitem__(self, item: int) -> numpy.int8: - ... - - @overload - def __getitem__(self, item: slice) -> NDArray[numpy.int8]: - ... - - @overload - def __getitem__(self, item: NDArray[numpy.integer]) -> NDArray[numpy.int8]: - ... - - def __getitem__(self, object item): - """Get item(s) from the array. - - This supports the full numpy protocol. - If a numpy array is returned, the array data is the same as the data contained in this class. - - >>> from amulet_nbt import ByteArrayTag - >>> import numpy - >>> tag = ByteArrayTag([1, 2, 3]) - >>> tag[0] # 1 - >>> tag[:1] # numpy.array([1], dtype=numpy.int8) - >>> tag[numpy.array([1, 2])] # numpy.array([2, 3], dtype=int8) - """ - return numpy.asarray(self)[item] - - def __iter__(self) -> Iterator[numpy.int8]: - """Iterate through the items in the array. - - >>> from amulet_nbt import ByteArrayTag - >>> tag = ByteArrayTag([1, 2, 3]) - >>> for num in tag: - >>> pass - >>> iter(tag) - """ - return iter(numpy.asarray(self)) - - def __reversed__(self) -> Iterator[numpy.int8]: - """Iterate through the items in the array in reverse order. - - >>> from amulet_nbt import ByteArrayTag - >>> tag = ByteArrayTag([1, 2, 3]) - >>> for num in reversed(tag): - >>> pass - - :return: A reversed iterator. - """ - return reversed(numpy.asarray(self)) - - def __contains__(self, value: int) -> bool: - """Check if an item is in the array. - - >>> from amulet_nbt import ByteArrayTag - >>> tag = ByteArrayTag([1, 2, 3]) - >>> 1 in tag # True - """ - return value in numpy.asarray(self) - - # MutableSequence - @overload - def __setitem__(self, item: int, value: numpy.integer) -> None: - ... - - @overload - def __setitem__(self, item: slice, value: NDArray[numpy.integer]) -> None: - ... - - @overload - def __setitem__(self, item: ArrayLike, value: NDArray[numpy.integer]) -> None: - ... - - def __setitem__(self, object item, object value): - """Set item(s) in the array. - - This supports the full numpy protocol. - - >>> from amulet_nbt import ByteArrayTag - >>> import numpy - >>> tag = ByteArrayTag([1, 2, 3]) - >>> tag[0] = 10 # [10, 2, 3] - >>> tag[:2] = [4, 5] # [4, 5, 3] - >>> tag[numpy.array([1, 2])] = [6, 7] # [4, 6, 7] - """ - numpy.asarray(self)[item] = value - - # Array interface - def __array__(self, dtype: Any = None) -> NDArray[numpy.int8]: - """Get a numpy array representation of the stored data. - - >>> from amulet_nbt import ByteArrayTag - >>> import numpy - >>> tag = ByteArrayTag([1, 2, 3]) - >>> arr = numpy.asarray(tag) - - :param dtype: This is ignored but is part of the array interace - :return: A numpy array that shares the memory with this instance. - """ - cdef numpy.npy_intp shape[1] - shape[0] = dereference(self.cpp).size() - cdef numpy.ndarray ndarray = numpy.PyArray_SimpleNewFromData(1, shape, numpy.NPY_INT8, dereference(self.cpp).data()) - Py_INCREF(self) - numpy.PyArray_SetBaseObject(ndarray, self) - return ndarray - - - -cdef class IntArrayTag(AbstractBaseArrayTag): - """This class behaves like an 1D Numpy signed integer array with each value stored in a int.""" - tag_id: int = 11 - - def __init__(self, object value: Iterable[SupportsInt] = ()) -> None: - """Construct a new IntArrayTag object from an array-like object.""" - cdef numpy.ndarray arr = numpy.asarray(value, numpy.int32).ravel() - self.cpp = make_shared[CIntArrayTag](arr.size) - cdef size_t i - for i in range(arr.size): - dereference(self.cpp)[i] = arr[i] - - @staticmethod - cdef IntArrayTag wrap(CIntArrayTagPtr cpp): - cdef IntArrayTag tag = IntArrayTag.__new__(IntArrayTag) - tag.cpp = cpp - return tag - - cdef TagNode to_node(self): - cdef TagNode node - node.emplace[CIntArrayTagPtr](self.cpp) - return node - - @property - def np_array(self) -> NDArray[numpy.int32]: - return numpy.asarray(self) - - cdef string write_nbt(self, string name, endian endianness, CStringEncode string_encode): - return write_named_tag[CIntArrayTagPtr](name, self.cpp, endianness, string_encode) - - def to_snbt(self, object indent: None | str | int = None) -> str: - cdef string snbt - write_int_array_snbt(snbt, self.cpp) - return snbt - - def __eq__(self, object other: Any) -> bool: - if not isinstance(other, IntArrayTag): - return False - cdef IntArrayTag tag = other - return dereference(self.cpp) == dereference(tag.cpp) - - def __repr__(self) -> str: - return f"IntArrayTag({list(self)})" - - def __str__(self) -> str: - return str(list(self)) - - def __reduce__(self): - return IntArrayTag, (list(self),) - - def __copy__(self) -> IntArrayTag: - return IntArrayTag.wrap( - make_shared[CIntArrayTag](dereference(self.cpp)) - ) - - def __deepcopy__(self, memo=None) -> IntArrayTag: - return IntArrayTag.wrap( - make_shared[CIntArrayTag](dereference(self.cpp)) - ) - - # Sized - def __len__(self) -> int: - """The length of the array. - - >>> from amulet_nbt import IntArrayTag - >>> tag = IntArrayTag([1, 2, 3]) - >>> len(tag) # 3 - """ - return dereference(self.cpp).size() - - # Sequence - @overload - def __getitem__(self, item: int) -> numpy.int32: - ... - - @overload - def __getitem__(self, item: slice) -> NDArray[numpy.int32]: - ... - - @overload - def __getitem__(self, item: NDArray[numpy.integer]) -> NDArray[numpy.int32]: - ... - - def __getitem__(self, object item): - """Get item(s) from the array. - - This supports the full numpy protocol. - If a numpy array is returned, the array data is the same as the data contained in this class. - - >>> from amulet_nbt import IntArrayTag - >>> import numpy - >>> tag = IntArrayTag([1, 2, 3]) - >>> tag[0] # 1 - >>> tag[:1] # numpy.array([1], dtype=numpy.int8) - >>> tag[numpy.array([1, 2])] # numpy.array([2, 3], dtype=int8) - """ - return numpy.asarray(self)[item] - - def __iter__(self) -> Iterator[numpy.int32]: - """Iterate through the items in the array. - - >>> from amulet_nbt import IntArrayTag - >>> tag = IntArrayTag([1, 2, 3]) - >>> for num in tag: - >>> pass - >>> iter(tag) - """ - return iter(numpy.asarray(self)) - - def __reversed__(self) -> Iterator[numpy.int32]: - """Iterate through the items in the array in reverse order. - - >>> from amulet_nbt import IntArrayTag - >>> tag = IntArrayTag([1, 2, 3]) - >>> for num in reversed(tag): - >>> pass - - :return: A reversed iterator. - """ - return reversed(numpy.asarray(self)) - - def __contains__(self, value: int) -> bool: - """Check if an item is in the array. - - >>> from amulet_nbt import IntArrayTag - >>> tag = IntArrayTag([1, 2, 3]) - >>> 1 in tag # True - """ - return value in numpy.asarray(self) - - # MutableSequence - @overload - def __setitem__(self, item: int, value: numpy.integer) -> None: - ... - - @overload - def __setitem__(self, item: slice, value: NDArray[numpy.integer]) -> None: - ... - - @overload - def __setitem__(self, item: ArrayLike, value: NDArray[numpy.integer]) -> None: - ... - - def __setitem__(self, object item, object value): - """Set item(s) in the array. - - This supports the full numpy protocol. - - >>> from amulet_nbt import IntArrayTag - >>> import numpy - >>> tag = IntArrayTag([1, 2, 3]) - >>> tag[0] = 10 # [10, 2, 3] - >>> tag[:2] = [4, 5] # [4, 5, 3] - >>> tag[numpy.array([1, 2])] = [6, 7] # [4, 6, 7] - """ - numpy.asarray(self)[item] = value - - # Array interface - def __array__(self, dtype: Any = None) -> NDArray[numpy.int32]: - """Get a numpy array representation of the stored data. - - >>> from amulet_nbt import IntArrayTag - >>> import numpy - >>> tag = IntArrayTag([1, 2, 3]) - >>> arr = numpy.asarray(tag) - - :param dtype: This is ignored but is part of the array interace - :return: A numpy array that shares the memory with this instance. - """ - cdef numpy.npy_intp shape[1] - shape[0] = dereference(self.cpp).size() - cdef numpy.ndarray ndarray = numpy.PyArray_SimpleNewFromData(1, shape, numpy.NPY_INT32, dereference(self.cpp).data()) - Py_INCREF(self) - numpy.PyArray_SetBaseObject(ndarray, self) - return ndarray - - - -cdef class LongArrayTag(AbstractBaseArrayTag): - """This class behaves like an 1D Numpy signed integer array with each value stored in a long.""" - tag_id: int = 12 - - def __init__(self, object value: Iterable[SupportsInt] = ()) -> None: - """Construct a new LongArrayTag object from an array-like object.""" - cdef numpy.ndarray arr = numpy.asarray(value, numpy.int64).ravel() - self.cpp = make_shared[CLongArrayTag](arr.size) - cdef size_t i - for i in range(arr.size): - dereference(self.cpp)[i] = arr[i] - - @staticmethod - cdef LongArrayTag wrap(CLongArrayTagPtr cpp): - cdef LongArrayTag tag = LongArrayTag.__new__(LongArrayTag) - tag.cpp = cpp - return tag - - cdef TagNode to_node(self): - cdef TagNode node - node.emplace[CLongArrayTagPtr](self.cpp) - return node - - @property - def np_array(self) -> NDArray[numpy.int64]: - return numpy.asarray(self) - - cdef string write_nbt(self, string name, endian endianness, CStringEncode string_encode): - return write_named_tag[CLongArrayTagPtr](name, self.cpp, endianness, string_encode) - - def to_snbt(self, object indent: None | str | int = None) -> str: - cdef string snbt - write_long_array_snbt(snbt, self.cpp) - return snbt - - def __eq__(self, object other: Any) -> bool: - if not isinstance(other, LongArrayTag): - return False - cdef LongArrayTag tag = other - return dereference(self.cpp) == dereference(tag.cpp) - - def __repr__(self) -> str: - return f"LongArrayTag({list(self)})" - - def __str__(self) -> str: - return str(list(self)) - - def __reduce__(self): - return LongArrayTag, (list(self),) - - def __copy__(self) -> LongArrayTag: - return LongArrayTag.wrap( - make_shared[CLongArrayTag](dereference(self.cpp)) - ) - - def __deepcopy__(self, memo=None) -> LongArrayTag: - return LongArrayTag.wrap( - make_shared[CLongArrayTag](dereference(self.cpp)) - ) - - # Sized - def __len__(self) -> int: - """The length of the array. - - >>> from amulet_nbt import LongArrayTag - >>> tag = LongArrayTag([1, 2, 3]) - >>> len(tag) # 3 - """ - return dereference(self.cpp).size() - - # Sequence - @overload - def __getitem__(self, item: int) -> numpy.int64: - ... - - @overload - def __getitem__(self, item: slice) -> NDArray[numpy.int64]: - ... - - @overload - def __getitem__(self, item: NDArray[numpy.integer]) -> NDArray[numpy.int64]: - ... - - def __getitem__(self, object item): - """Get item(s) from the array. - - This supports the full numpy protocol. - If a numpy array is returned, the array data is the same as the data contained in this class. - - >>> from amulet_nbt import LongArrayTag - >>> import numpy - >>> tag = LongArrayTag([1, 2, 3]) - >>> tag[0] # 1 - >>> tag[:1] # numpy.array([1], dtype=numpy.int8) - >>> tag[numpy.array([1, 2])] # numpy.array([2, 3], dtype=int8) - """ - return numpy.asarray(self)[item] - - def __iter__(self) -> Iterator[numpy.int64]: - """Iterate through the items in the array. - - >>> from amulet_nbt import LongArrayTag - >>> tag = LongArrayTag([1, 2, 3]) - >>> for num in tag: - >>> pass - >>> iter(tag) - """ - return iter(numpy.asarray(self)) - - def __reversed__(self) -> Iterator[numpy.int64]: - """Iterate through the items in the array in reverse order. - - >>> from amulet_nbt import LongArrayTag - >>> tag = LongArrayTag([1, 2, 3]) - >>> for num in reversed(tag): - >>> pass - - :return: A reversed iterator. - """ - return reversed(numpy.asarray(self)) - - def __contains__(self, value: int) -> bool: - """Check if an item is in the array. - - >>> from amulet_nbt import LongArrayTag - >>> tag = LongArrayTag([1, 2, 3]) - >>> 1 in tag # True - """ - return value in numpy.asarray(self) - - # MutableSequence - @overload - def __setitem__(self, item: int, value: numpy.integer) -> None: - ... - - @overload - def __setitem__(self, item: slice, value: NDArray[numpy.integer]) -> None: - ... - - @overload - def __setitem__(self, item: ArrayLike, value: NDArray[numpy.integer]) -> None: - ... - - def __setitem__(self, object item, object value): - """Set item(s) in the array. - - This supports the full numpy protocol. - - >>> from amulet_nbt import LongArrayTag - >>> import numpy - >>> tag = LongArrayTag([1, 2, 3]) - >>> tag[0] = 10 # [10, 2, 3] - >>> tag[:2] = [4, 5] # [4, 5, 3] - >>> tag[numpy.array([1, 2])] = [6, 7] # [4, 6, 7] - """ - numpy.asarray(self)[item] = value - - # Array interface - def __array__(self, dtype: Any = None) -> NDArray[numpy.int64]: - """Get a numpy array representation of the stored data. - - >>> from amulet_nbt import LongArrayTag - >>> import numpy - >>> tag = LongArrayTag([1, 2, 3]) - >>> arr = numpy.asarray(tag) - - :param dtype: This is ignored but is part of the array interace - :return: A numpy array that shares the memory with this instance. - """ - cdef numpy.npy_intp shape[1] - shape[0] = dereference(self.cpp).size() - cdef numpy.ndarray ndarray = numpy.PyArray_SimpleNewFromData(1, shape, numpy.NPY_INT64, dereference(self.cpp).data()) - Py_INCREF(self) - numpy.PyArray_SetBaseObject(ndarray, self) - return ndarray - diff --git a/src_/amulet_nbt/_tag/array.pyx.tp b/src_/amulet_nbt/_tag/array.pyx.tp deleted file mode 100644 index 7f489bcb..00000000 --- a/src_/amulet_nbt/_tag/array.pyx.tp +++ /dev/null @@ -1,192 +0,0 @@ -{{py: -import base64 -from template import include -import numpy -}} -{{base64.b64decode("IyMgVGhpcyBmaWxlIGlzIGdlbmVyYXRlZCBmcm9tIGEgdGVtcGxhdGUuCiMjIERvIG5vdCBtb2RpZnkgdGhpcyBmaWxlIGRpcmVjdGx5IG9yIHlvdXIgY2hhbmdlcyB3aWxsIGdldCBvdmVyd3JpdHRlbi4KIyMgRWRpdCB0aGUgYWNjb21wYW55aW5nIC5weXgudHAgZmlsZSBpbnN0ZWFkLg==").decode()}} -# cython: language_level=3, boundscheck=False, wraparound=False -# distutils: language = c++ -# distutils: extra_compile_args = CPPCARGS -# cython: c_string_type=str, c_string_encoding=utf8 - -import numpy -cimport numpy -numpy.import_array() -from numpy.typing import NDArray, ArrayLike -from typing import Any, overload, SupportsInt -from collections.abc import Iterable, Iterator - -from cython.operator cimport dereference -from cpython cimport Py_INCREF -from libcpp.memory cimport make_shared -from libcpp.string cimport string -from amulet_nbt._libcpp.endian cimport endian -from amulet_nbt._string_encoding._cpp cimport CStringEncode -from amulet_nbt._nbt_encoding._binary cimport write_named_tag -from amulet_nbt._nbt_encoding._string cimport write_byte_array_snbt, write_int_array_snbt, write_long_array_snbt -from amulet_nbt._tag._cpp cimport TagNode, CByteArrayTag, CIntArrayTag, CLongArrayTag -from .abc cimport AbstractBaseMutableTag - - -cdef class AbstractBaseArrayTag(AbstractBaseMutableTag): - @property - def np_array(self) -> NDArray[numpy.int8 | numpy.int32 | numpy.int64]: - """A numpy array holding the same internal data. - - Changes to the array will also modify the internal state. - """ - raise NotImplementedError - - @property - def py_data(self) -> Any: - return self.np_array - - # Sized - def __len__(self) -> int: - """The length of the array. - - >>> from amulet_nbt import ByteArrayTag - >>> tag = ByteArrayTag([1, 2, 3]) - >>> len(tag) # 3 - """ - raise NotImplementedError - - # Sequence - @overload - def __getitem__(self, item: int) -> numpy.int8 | numpy.int32 | numpy.int64: - ... - - @overload - def __getitem__(self, item: slice) -> NDArray[numpy.int8 | numpy.int32 | numpy.int64]: - ... - - @overload - def __getitem__(self, item: NDArray[numpy.integer]) -> NDArray[numpy.int8 | numpy.int32 | numpy.int64]: - ... - - def __getitem__(self, item): - """Get item(s) from the array. - - This supports the full numpy protocol. - If a numpy array is returned, the array data is the same as the data contained in this class. - - >>> from amulet_nbt import ByteArrayTag - >>> import numpy - >>> tag = ByteArrayTag([1, 2, 3]) - >>> tag[0] # 1 - >>> tag[:1] # numpy.array([1], dtype=numpy.int8) - >>> tag[numpy.array([1, 2])] # numpy.array([2, 3], dtype=int8) - """ - raise NotImplementedError - - def __iter__(self) -> Iterator[numpy.int8 | numpy.int32 | numpy.int64]: - """Iterate through the items in the array. - - >>> from amulet_nbt import ByteArrayTag - >>> tag = ByteArrayTag([1, 2, 3]) - >>> for num in tag: - >>> pass - >>> iter(tag) - """ - raise NotImplementedError - - def __reversed__(self) -> Iterator[numpy.int8 | numpy.int32 | numpy.int64]: - """Iterate through the items in the array in reverse order. - - >>> from amulet_nbt import ByteArrayTag - >>> tag = ByteArrayTag([1, 2, 3]) - >>> for num in reversed(tag): - >>> pass - - :return: A reversed iterator. - """ - raise NotImplementedError - - def __contains__(self, item: Any) -> bool: - """Check if an item is in the array. - - >>> from amulet_nbt import ByteArrayTag - >>> tag = ByteArrayTag([1, 2, 3]) - >>> 1 in tag # True - """ - raise NotImplementedError - - # MutableSequence - @overload - def __setitem__(self, item: int, value: numpy.integer) -> None: - ... - - @overload - def __setitem__(self, item: slice, value: ArrayLike[numpy.integer]) -> None: - ... - - @overload - def __setitem__(self, item: ArrayLike, value: ArrayLike[numpy.integer]) -> None: - ... - - def __setitem__(self, key, value): - """Set item(s) in the array. - - This supports the full numpy protocol. - - >>> from amulet_nbt import ByteArrayTag - >>> import numpy - >>> tag = ByteArrayTag([1, 2, 3]) - >>> tag[0] = 10 # [10, 2, 3] - >>> tag[:2] = [4, 5] # [4, 5, 3] - >>> tag[numpy.array([1, 2])] = [6, 7] # [4, 6, 7] - """ - raise NotImplementedError - - # Array interface - def __array__(self, dtype: Any = None) -> NDArray[numpy.int8 | numpy.int32 | numpy.int64]: - """Get a numpy array representation of the stored data. - - >>> from amulet_nbt import ByteArrayTag - >>> import numpy - >>> tag = ByteArrayTag([1, 2, 3]) - >>> arr = numpy.asarray(tag) - - :param dtype: This is ignored but is part of the array interace - :return: A numpy array that shares the memory with this instance. - """ - raise NotImplementedError - - -{{include( - "amulet_nbt/tpf/ArrayTag.pyx.tpf", - native_data_type='numpy.dtype("int8")', - int_byte_width=1, - dtype="byte", - py_cls="ByteArrayTag", - cpp_cls="CByteArrayTag", - cpp_cls_ptr="CByteArrayTagPtr", - npy_c="NPY_INT8", - tag_id = 7, -)}} - - -{{include( - "amulet_nbt/tpf/ArrayTag.pyx.tpf", - native_data_type='numpy.int32', - int_byte_width=4, - dtype="int", - py_cls="IntArrayTag", - cpp_cls="CIntArrayTag", - cpp_cls_ptr="CIntArrayTagPtr", - npy_c="NPY_INT32", - tag_id = 11, -)}} - - -{{include( - "amulet_nbt/tpf/ArrayTag.pyx.tpf", - native_data_type='numpy.int64', - int_byte_width=8, - dtype="long", - py_cls="LongArrayTag", - cpp_cls="CLongArrayTag", - cpp_cls_ptr="CLongArrayTagPtr", - npy_c="NPY_INT64", - tag_id = 12, -)}} diff --git a/src_/amulet_nbt/_tag/compound.pxd b/src_/amulet_nbt/_tag/compound.pxd deleted file mode 100644 index a88a9cce..00000000 --- a/src_/amulet_nbt/_tag/compound.pxd +++ /dev/null @@ -1,22 +0,0 @@ -from libcpp cimport bool -from libcpp.string cimport string - -from amulet_nbt._tag._cpp cimport CCompoundTagPtr, TagNode - -from .abc cimport AbstractBaseTag, AbstractBaseMutableTag -from .int cimport ByteTag, ShortTag, IntTag, LongTag -from .float cimport FloatTag, DoubleTag -from .string cimport StringTag -from .list cimport ListTag -from .array cimport ByteArrayTag, IntArrayTag, LongArrayTag - - -cdef bool is_compound_eq(CCompoundTagPtr a, CCompoundTagPtr b) noexcept nogil -cdef AbstractBaseTag wrap_node(TagNode* node) - - -cdef class CompoundTag(AbstractBaseMutableTag): - cdef CCompoundTagPtr cpp - - @staticmethod - cdef CompoundTag wrap(CCompoundTagPtr) diff --git a/src_/amulet_nbt/_tag/compound.pyx b/src_/amulet_nbt/_tag/compound.pyx deleted file mode 100644 index fbbfd599..00000000 --- a/src_/amulet_nbt/_tag/compound.pyx +++ /dev/null @@ -1,1842 +0,0 @@ -## This file is generated from a template. -## Do not modify this file directly or your changes will get overwritten. -## Edit the accompanying .pyx.tp file instead. -# cython: language_level=3, boundscheck=False, wraparound=False -# distutils: language = c++ -# distutils: extra_compile_args = CPPCARGS -# cython: c_string_type=str, c_string_encoding=utf8 -# distutils: sources = [src/amulet_nbt/_string_encoding/_cpp/utf8.cpp, src/amulet_nbt/_nbt_encoding/_binary/_cpp/read_nbt.cpp] - -from __future__ import annotations - -from collections.abc import Mapping, Iterator, Iterable, KeysView, ItemsView, ValuesView -from typing import Any, overload, Type, TypeVar, Literal - -from libcpp.string cimport string -from libcpp cimport bool -from libcpp.pair cimport pair -from libcpp.memory cimport make_shared -from cython.operator cimport dereference, postincrement -import amulet_nbt -from amulet_nbt._libcpp.endian cimport endian -from amulet_nbt._string_encoding._cpp cimport CStringEncode -from amulet_nbt._string_encoding._cpp.utf8 cimport utf8_escape_to_utf8, utf8_to_utf8_escape -from amulet_nbt._nbt_encoding._binary._cpp cimport read_named_tag -from amulet_nbt._nbt_encoding._binary cimport write_named_tag -from amulet_nbt._nbt_encoding._string cimport write_compound_snbt - -from amulet_nbt._tag._cpp cimport CCompoundTag, CCompoundTagPtr, CIntTag, TagNode -from amulet_nbt._libcpp.variant cimport get -from .abc cimport AbstractBaseTag, AbstractBaseMutableTag - -from amulet_nbt._tag._cpp cimport ( - CByteTag, - CShortTag, - CIntTag, - CLongTag, - CFloatTag, - CDoubleTag, - CStringTag, - CCompoundTag, - CListTagPtr, - CCompoundTagPtr, - CByteArrayTagPtr, - CIntArrayTagPtr, - CLongArrayTagPtr, - TagNode, -) - -from .int cimport ByteTag, ShortTag, IntTag, LongTag -from .float cimport FloatTag, DoubleTag -from .string cimport StringTag -from .list cimport is_list_eq, ListTag -from .array cimport ByteArrayTag, IntArrayTag, LongArrayTag -from .deepcopy cimport CCompoundTagPtr_deepcopy - -import amulet_nbt - -_T = TypeVar("_T") - -cdef inline bool _is_byte_tag_node_eq(TagNode* a, TagNode* b) noexcept nogil: - if dereference(b).index() == 1: - return get[CByteTag](dereference(a)) == get[CByteTag](dereference(b)) - return False - - -cdef inline bool _is_short_tag_node_eq(TagNode* a, TagNode* b) noexcept nogil: - if dereference(b).index() == 2: - return get[CShortTag](dereference(a)) == get[CShortTag](dereference(b)) - return False - - -cdef inline bool _is_int_tag_node_eq(TagNode* a, TagNode* b) noexcept nogil: - if dereference(b).index() == 3: - return get[CIntTag](dereference(a)) == get[CIntTag](dereference(b)) - return False - - -cdef inline bool _is_long_tag_node_eq(TagNode* a, TagNode* b) noexcept nogil: - if dereference(b).index() == 4: - return get[CLongTag](dereference(a)) == get[CLongTag](dereference(b)) - return False - - -cdef inline bool _is_float_tag_node_eq(TagNode* a, TagNode* b) noexcept nogil: - if dereference(b).index() == 5: - return get[CFloatTag](dereference(a)) == get[CFloatTag](dereference(b)) - return False - - -cdef inline bool _is_double_tag_node_eq(TagNode* a, TagNode* b) noexcept nogil: - if dereference(b).index() == 6: - return get[CDoubleTag](dereference(a)) == get[CDoubleTag](dereference(b)) - return False - - -cdef inline bool _is_byte_array_tag_node_eq(TagNode* a, TagNode* b) noexcept nogil: - if dereference(b).index() == 7: - return dereference(get[CByteArrayTagPtr](dereference(a))) == dereference(get[CByteArrayTagPtr](dereference(b))) - return False - - -cdef inline bool _is_string_tag_node_eq(TagNode* a, TagNode* b) noexcept nogil: - if dereference(b).index() == 8: - return get[CStringTag](dereference(a)) == get[CStringTag](dereference(b)) - return False - - -cdef inline bool _is_list_tag_node_eq(TagNode* a, TagNode* b) noexcept nogil: - if dereference(b).index() == 9: - return is_list_eq(get[CListTagPtr](dereference(a)), get[CListTagPtr](dereference(b))) - return False - - -cdef inline bool _is_compound_tag_node_eq(TagNode* a, TagNode* b) noexcept nogil: - if dereference(b).index() == 10: - return is_compound_eq(get[CCompoundTagPtr](dereference(a)), get[CCompoundTagPtr](dereference(b))) - return False - - -cdef inline bool _is_int_array_tag_node_eq(TagNode* a, TagNode* b) noexcept nogil: - if dereference(b).index() == 11: - return dereference(get[CIntArrayTagPtr](dereference(a))) == dereference(get[CIntArrayTagPtr](dereference(b))) - return False - - -cdef inline bool _is_long_array_tag_node_eq(TagNode* a, TagNode* b) noexcept nogil: - if dereference(b).index() == 12: - return dereference(get[CLongArrayTagPtr](dereference(a))) == dereference(get[CLongArrayTagPtr](dereference(b))) - return False - - -cdef bool is_compound_eq(CCompoundTagPtr a, CCompoundTagPtr b) noexcept nogil: - if dereference(a).size() != dereference(b).size(): - return False - - cdef CCompoundTag.iterator it1 = dereference(a).begin() - cdef CCompoundTag.iterator it2 - cdef string key - cdef TagNode* node - cdef size_t node_index - - while it1 != dereference(a).end(): - key = dereference(it1).first - it2 = dereference(b).find(key) - if it2 == dereference(b).end(): - return False - node = &dereference(it1).second - node_index = dereference(node).index() - if node_index == 1: - if not _is_byte_tag_node_eq(node, &dereference(it2).second): - return False - elif node_index == 2: - if not _is_short_tag_node_eq(node, &dereference(it2).second): - return False - elif node_index == 3: - if not _is_int_tag_node_eq(node, &dereference(it2).second): - return False - elif node_index == 4: - if not _is_long_tag_node_eq(node, &dereference(it2).second): - return False - elif node_index == 5: - if not _is_float_tag_node_eq(node, &dereference(it2).second): - return False - elif node_index == 6: - if not _is_double_tag_node_eq(node, &dereference(it2).second): - return False - elif node_index == 7: - if not _is_byte_array_tag_node_eq(node, &dereference(it2).second): - return False - elif node_index == 8: - if not _is_string_tag_node_eq(node, &dereference(it2).second): - return False - elif node_index == 9: - if not _is_list_tag_node_eq(node, &dereference(it2).second): - return False - elif node_index == 10: - if not _is_compound_tag_node_eq(node, &dereference(it2).second): - return False - elif node_index == 11: - if not _is_int_array_tag_node_eq(node, &dereference(it2).second): - return False - elif node_index == 12: - if not _is_long_array_tag_node_eq(node, &dereference(it2).second): - return False - postincrement(it1) - return True - - -cdef AbstractBaseTag wrap_node(TagNode* node): - cdef size_t index = dereference(node).index() - if index == 1: - return ByteTag.wrap(get[CByteTag](dereference(node))) - elif index == 2: - return ShortTag.wrap(get[CShortTag](dereference(node))) - elif index == 3: - return IntTag.wrap(get[CIntTag](dereference(node))) - elif index == 4: - return LongTag.wrap(get[CLongTag](dereference(node))) - elif index == 5: - return FloatTag.wrap(get[CFloatTag](dereference(node))) - elif index == 6: - return DoubleTag.wrap(get[CDoubleTag](dereference(node))) - elif index == 7: - return ByteArrayTag.wrap(get[CByteArrayTagPtr](dereference(node))) - elif index == 8: - return StringTag.wrap(get[CStringTag](dereference(node))) - elif index == 9: - return ListTag.wrap(get[CListTagPtr](dereference(node))) - elif index == 10: - return CompoundTag.wrap(get[CCompoundTagPtr](dereference(node))) - elif index == 11: - return IntArrayTag.wrap(get[CIntArrayTagPtr](dereference(node))) - elif index == 12: - return LongArrayTag.wrap(get[CLongArrayTagPtr](dereference(node))) - else: - raise RuntimeError - - -_TagT = TypeVar("_TagT", bound=AbstractBaseTag) - - -def _unpickle(string data) -> CompoundTag: - cdef pair[string, TagNode] named_tag = read_named_tag(data, endian.big, utf8_to_utf8_escape) - return CompoundTag.wrap(get[CCompoundTagPtr](named_tag.second)) - - -cdef class CompoundTag(AbstractBaseMutableTag): - """A Python wrapper around a C++ unordered map. - - Note that this class is not thread safe and inherits all the limitations of a C++ unordered_map. - """ - tag_id: int = 10 - - def __init__( - self, - value: ( - Mapping[str | bytes, AbstractBaseTag] - | Iterable[tuple[str | bytes, AbstractBaseTag]] - | Mapping[str, AbstractBaseTag] - | Mapping[bytes, AbstractBaseTag] - ) = (), - **kwargs: AbstractBaseTag, - ) -> None: - self.cpp = make_shared[CCompoundTag]() - self.update(value, **kwargs) - - @staticmethod - cdef CompoundTag wrap(CCompoundTagPtr cpp): - cdef CompoundTag tag = CompoundTag.__new__(CompoundTag) - tag.cpp = cpp - return tag - - cdef TagNode to_node(self): - cdef TagNode node - node.emplace[CCompoundTagPtr](self.cpp) - return node - - @property - def py_dict(self) -> dict[str, amulet_nbt.AnyNBT]: - """A shallow copy of the CompoundTag as a python dictionary.""" - return dict(self) - - @property - def py_data(self) -> Any: - return dict(self) - - cdef string write_nbt(self, string name, endian endianness, CStringEncode string_encode): - return write_named_tag[CCompoundTagPtr](name, self.cpp, endianness, string_encode) - - def to_snbt(self, object indent: None | str | int = None) -> str: - cdef string snbt - cdef string indent_str - if indent is None: - write_compound_snbt(snbt, self.cpp) - else: - if isinstance(indent, int): - indent_str = " " * indent - elif isinstance(indent, str): - indent_str = indent - else: - raise TypeError("indent must be a str, int or None") - write_compound_snbt(snbt, self.cpp, indent_str, 0) - return snbt - - def __eq__(self, object other: Any) -> bool: - if not isinstance(other, CompoundTag): - return False - cdef CompoundTag tag = other - return is_compound_eq(self.cpp, tag.cpp) - - def __repr__(self) -> str: - return f"CompoundTag({dict(self)})" - - def __str__(self) -> str: - return str(dict(self)) - - def __reduce__(self): - cdef bytes nbt = self.write_nbt(b"", endian.big, utf8_escape_to_utf8) - return _unpickle, (nbt,) - - def __copy__(self) -> CompoundTag: - return CompoundTag.wrap( - make_shared[CCompoundTag](dereference(self.cpp)) - ) - - def __deepcopy__(self, memo=None) -> CompoundTag: - return CompoundTag.wrap(CCompoundTagPtr_deepcopy(self.cpp)) - - # Sized - def __len__(self) -> int: - return dereference(self.cpp).size() - - # Iterable - def __iter__(self) -> Iterator[str | bytes]: - cdef CCompoundTag.iterator it = dereference(self.cpp).begin() - cdef string key - while it != dereference(self.cpp).end(): - key = dereference(it).first - try: - yield key - except UnicodeDecodeError as e: - yield key - postincrement(it) - - # Mapping - def __getitem__(self, string key: str | bytes) -> amulet_nbt.AbstractBaseTag: - cdef CCompoundTag.iterator it = dereference(self.cpp).find(key) - - if it == dereference(self.cpp).end(): - raise KeyError(key) - - return wrap_node(&dereference(it).second) - - @overload - def get(self, key: str | bytes) -> AnyNBT | None: ... - @overload - def get(self, key: str | bytes, default: _T) -> AnyNBT | _T: ... - @overload - def get(self, key: str | bytes, *, cls: Type[_TagT]) -> _TagT | None: ... - @overload - def get(self, key: str | bytes, default: _T, cls: Type[_TagT]) -> _TagT | _T: ... - - def get( - self, - string key: str | bytes, - object default: _T = None, - object cls: Type[_TagT] = AbstractBaseTag - ) -> _TagT | _T: - """Get an item from the CompoundTag. - - :param key: The key to get - :param default: The value to return if the key does not exist or the type is wrong. - :param cls: The class that the stored tag must inherit from. If the type is incorrect default is returned. - :return: The tag stored in the CompoundTag if the type is correct else default. - :raises: KeyError if the key does not exist. - :raises: TypeError if the stored type is not a subclass of cls. - """ - cdef CCompoundTag.iterator it = dereference(self.cpp).find(key) - - if it == dereference(self.cpp).end(): - return default - - cdef AbstractBaseTag tag = wrap_node(&dereference(it).second) - if isinstance(tag, cls): - return tag - else: - return default - - def __contains__(self, string key: str | bytes) -> bool: - return dereference(self.cpp).contains(key) - - def keys(self) -> KeysView[str | bytes]: - return KeysView(self) - - def items(self) -> ItemsView[str | bytes, amulet_nbt.AnyNBT]: - return ItemsView(self) - - def values(self) -> ValuesView[amulet_nbt.AnyNBT]: - return ValuesView(self) - - # MutableMapping - def __setitem__(self, string key: str | bytes, AbstractBaseTag tag not None: amulet_nbt.AnyNBT) -> None: - dereference(self.cpp)[ key] = tag.to_node() - - def __delitem__(self, string key: str | bytes) -> None: - dereference(self.cpp).erase(key) - - __marker = object() - - def pop(self, string key, default=__marker) -> amulet_nbt.AnyNBT: - '''D.pop(k[,d]) -> v, remove specified key and return the corresponding value. - If key is not found, d is returned if given, otherwise KeyError is raised. - ''' - cdef CCompoundTag.iterator it = dereference(self.cpp).find(key) - if it == dereference(self.cpp).end(): - if default is self.__marker: - raise KeyError(key) - else: - return default - - cdef AbstractBaseTag tag = wrap_node(&dereference(it).second) - dereference(self.cpp).erase(it) - return tag - - def popitem(self) -> amulet_nbt.AnyNBT: - '''D.popitem() -> (k, v), remove and return some (key, value) pair - as a 2-tuple; but raise KeyError if D is empty. - ''' - cdef CCompoundTag.iterator it = dereference(self.cpp).begin() - if it == dereference(self.cpp).end(): - raise KeyError - - cdef string key = dereference(it).first - cdef AbstractBaseTag tag = wrap_node(&dereference(it).second) - dereference(self.cpp).erase(it) - return key, tag - - def clear(self) -> None: - dereference(self.cpp).clear() - - def update(self, other=(), /, **kwds) -> None: - ''' D.update([E, ]**F) -> None. Update D from mapping/iterable E and F. - If E present and has a .keys() method, does: for k in E: D[k] = E[k] - If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v - In either case, this is followed by: for k, v in F.items(): D[k] = v - ''' - if isinstance(other, Mapping): - for key in other: - self[key] = other[key] - elif hasattr(other, "keys"): - for key in other.keys(): - self[key] = other[key] - else: - for key, value in other: - self[key] = value - for key, value in kwds.items(): - self[key] = value - - def setdefault(self, string key, AbstractBaseTag tag = None, object cls = AbstractBaseTag) -> amulet_nbt.AnyNBT: - cdef CCompoundTag.iterator it = dereference(self.cpp).find(key) - - if it == dereference(self.cpp).end(): - # if the key does not exist then set it - if tag is None: - raise TypeError("Cannot setdefault a value of None.") - self[key] = tag - return tag - - cdef AbstractBaseTag existing_tag = wrap_node(&dereference(it).second) - - if not isinstance(existing_tag, cls): - # if the key exists but has the wrong type then set it - if tag is None: - raise TypeError("Cannot setdefault a value of None.") - self[key] = tag - return tag - - return existing_tag - - @classmethod - def fromkeys(cls, keys: Iterable[str], AbstractBaseTag value) -> CompoundTag: - return cls(dict.fromkeys(keys, value)) - - @overload - def get_byte(self, key: str | bytes) -> amulet_nbt.ByteTag | None: ... - @overload - def get_byte(self, key: str | bytes, default: None) -> amulet_nbt.ByteTag | None: ... - @overload - def get_byte(self, key: str | bytes, default: amulet_nbt.ByteTag) -> amulet_nbt.ByteTag: ... - @overload - def get_byte(self, key: str | bytes, default: None, raise_errors: Literal[False]) -> amulet_nbt.ByteTag | None: ... - @overload - def get_byte(self, key: str | bytes, default: amulet_nbt.ByteTag, raise_errors: Literal[False]) -> amulet_nbt.ByteTag: ... - @overload - def get_byte(self, key: str | bytes, default: amulet_nbt.ByteTag | None, raise_errors: Literal[True]) -> amulet_nbt.ByteTag: ... - @overload - def get_byte(self, key: str | bytes, *, raise_errors: Literal[False]) -> amulet_nbt.ByteTag | None: ... - @overload - def get_byte(self, key: str | bytes, *, raise_errors: Literal[True]) -> amulet_nbt.ByteTag: ... - - def get_byte(self, string key: str | bytes, ByteTag default: _T = None, bool raise_errors: bool = False) -> amulet_nbt.ByteTag | _T: - """Get the tag stored in key if it is a ByteTag. - - :param key: The key to get - :param default: The value to return if the key does not exist or the type is wrong. - :param raise_errors: If True, KeyError and TypeError are raise on error. If False, default is returned on error. - :return: The ByteTag. - :raises: KeyError if the key does not exist and raise_errors is True. - :raises: TypeError if the stored type is not a ByteTag and raise_errors is True. - """ - cdef CCompoundTag.iterator it = dereference(self.cpp).find(key) - - if it == dereference(self.cpp).end(): - if raise_errors: - raise KeyError(key) - else: - return default - - cdef AbstractBaseTag tag = wrap_node(&dereference(it).second) - if isinstance(tag, ByteTag): - return tag - elif raise_errors: - raise TypeError - else: - return default - - def setdefault_byte(self, string key: str | bytes, ByteTag default: amulet_nbt.ByteTag | None = None) -> amulet_nbt.ByteTag: - """Populate key if not defined or value is not ByteTag. Return the value stored. - - If default is a ByteTag then it will be stored under key else a default instance will be created. - - :param key: The key to populate and get - :param default: The default value to use. If None, the default ByteTag is used. - :return: The ByteTag stored in key - """ - cdef AbstractBaseTag tag - try: - tag = self[key] - except KeyError as e: - if default is None: - tag = self[key] = ByteTag() - else: - tag = self[key] = default - else: - if not isinstance(tag, ByteTag): - if default is None: - tag = self[key] = ByteTag() - else: - tag = self[key] = default - return tag - - @overload - def pop_byte(self, key: str | bytes) -> amulet_nbt.ByteTag | None: ... - @overload - def pop_byte(self, key: str | bytes, default: None) -> amulet_nbt.ByteTag | None: ... - @overload - def pop_byte(self, key: str | bytes, default: amulet_nbt.ByteTag) -> amulet_nbt.ByteTag: ... - @overload - def pop_byte(self, key: str | bytes, default: None, raise_errors: Literal[False]) -> amulet_nbt.ByteTag | None: ... - @overload - def pop_byte(self, key: str | bytes, default: amulet_nbt.ByteTag, raise_errors: Literal[False]) -> amulet_nbt.ByteTag: ... - @overload - def pop_byte(self, key: str | bytes, default: amulet_nbt.ByteTag | None, raise_errors: Literal[True]) -> amulet_nbt.ByteTag: ... - @overload - def pop_byte(self, key: str | bytes, *, raise_errors: Literal[False]) -> amulet_nbt.ByteTag | None: ... - @overload - def pop_byte(self, key: str | bytes, *, raise_errors: Literal[True]) -> amulet_nbt.ByteTag: ... - - def pop_byte(self, string key: str | bytes, ByteTag default: _T = None, bool raise_errors: bool = False) -> amulet_nbt.ByteTag | _T: - """Remove the specified key and return the corresponding value if it is a ByteTag. - - If the key exists but the type is incorrect, the value will not be removed. - - :param key: The key to get and remove - :param default: The value to return if the key does not exist or the type is wrong. - :param raise_errors: If True, KeyError and TypeError are raise on error. If False, default is returned on error. - :return: The ByteTag. - :raises: KeyError if the key does not exist and raise_errors is True. - :raises: TypeError if the stored type is not a ByteTag and raise_errors is True. - """ - cdef CCompoundTag.iterator it = dereference(self.cpp).find(key) - - if it == dereference(self.cpp).end(): - if raise_errors: - raise KeyError(key) - else: - return default - - cdef AbstractBaseTag tag = wrap_node(&dereference(it).second) - if isinstance(tag, ByteTag): - dereference(self.cpp).erase(it) - return tag - elif raise_errors: - raise TypeError - else: - return default - - - @overload - def get_short(self, key: str | bytes) -> amulet_nbt.ShortTag | None: ... - @overload - def get_short(self, key: str | bytes, default: None) -> amulet_nbt.ShortTag | None: ... - @overload - def get_short(self, key: str | bytes, default: amulet_nbt.ShortTag) -> amulet_nbt.ShortTag: ... - @overload - def get_short(self, key: str | bytes, default: None, raise_errors: Literal[False]) -> amulet_nbt.ShortTag | None: ... - @overload - def get_short(self, key: str | bytes, default: amulet_nbt.ShortTag, raise_errors: Literal[False]) -> amulet_nbt.ShortTag: ... - @overload - def get_short(self, key: str | bytes, default: amulet_nbt.ShortTag | None, raise_errors: Literal[True]) -> amulet_nbt.ShortTag: ... - @overload - def get_short(self, key: str | bytes, *, raise_errors: Literal[False]) -> amulet_nbt.ShortTag | None: ... - @overload - def get_short(self, key: str | bytes, *, raise_errors: Literal[True]) -> amulet_nbt.ShortTag: ... - - def get_short(self, string key: str | bytes, ShortTag default: _T = None, bool raise_errors: bool = False) -> amulet_nbt.ShortTag | _T: - """Get the tag stored in key if it is a ShortTag. - - :param key: The key to get - :param default: The value to return if the key does not exist or the type is wrong. - :param raise_errors: If True, KeyError and TypeError are raise on error. If False, default is returned on error. - :return: The ShortTag. - :raises: KeyError if the key does not exist and raise_errors is True. - :raises: TypeError if the stored type is not a ShortTag and raise_errors is True. - """ - cdef CCompoundTag.iterator it = dereference(self.cpp).find(key) - - if it == dereference(self.cpp).end(): - if raise_errors: - raise KeyError(key) - else: - return default - - cdef AbstractBaseTag tag = wrap_node(&dereference(it).second) - if isinstance(tag, ShortTag): - return tag - elif raise_errors: - raise TypeError - else: - return default - - def setdefault_short(self, string key: str | bytes, ShortTag default: amulet_nbt.ShortTag | None = None) -> amulet_nbt.ShortTag: - """Populate key if not defined or value is not ShortTag. Return the value stored. - - If default is a ShortTag then it will be stored under key else a default instance will be created. - - :param key: The key to populate and get - :param default: The default value to use. If None, the default ShortTag is used. - :return: The ShortTag stored in key - """ - cdef AbstractBaseTag tag - try: - tag = self[key] - except KeyError as e: - if default is None: - tag = self[key] = ShortTag() - else: - tag = self[key] = default - else: - if not isinstance(tag, ShortTag): - if default is None: - tag = self[key] = ShortTag() - else: - tag = self[key] = default - return tag - - @overload - def pop_short(self, key: str | bytes) -> amulet_nbt.ShortTag | None: ... - @overload - def pop_short(self, key: str | bytes, default: None) -> amulet_nbt.ShortTag | None: ... - @overload - def pop_short(self, key: str | bytes, default: amulet_nbt.ShortTag) -> amulet_nbt.ShortTag: ... - @overload - def pop_short(self, key: str | bytes, default: None, raise_errors: Literal[False]) -> amulet_nbt.ShortTag | None: ... - @overload - def pop_short(self, key: str | bytes, default: amulet_nbt.ShortTag, raise_errors: Literal[False]) -> amulet_nbt.ShortTag: ... - @overload - def pop_short(self, key: str | bytes, default: amulet_nbt.ShortTag | None, raise_errors: Literal[True]) -> amulet_nbt.ShortTag: ... - @overload - def pop_short(self, key: str | bytes, *, raise_errors: Literal[False]) -> amulet_nbt.ShortTag | None: ... - @overload - def pop_short(self, key: str | bytes, *, raise_errors: Literal[True]) -> amulet_nbt.ShortTag: ... - - def pop_short(self, string key: str | bytes, ShortTag default: _T = None, bool raise_errors: bool = False) -> amulet_nbt.ShortTag | _T: - """Remove the specified key and return the corresponding value if it is a ShortTag. - - If the key exists but the type is incorrect, the value will not be removed. - - :param key: The key to get and remove - :param default: The value to return if the key does not exist or the type is wrong. - :param raise_errors: If True, KeyError and TypeError are raise on error. If False, default is returned on error. - :return: The ShortTag. - :raises: KeyError if the key does not exist and raise_errors is True. - :raises: TypeError if the stored type is not a ShortTag and raise_errors is True. - """ - cdef CCompoundTag.iterator it = dereference(self.cpp).find(key) - - if it == dereference(self.cpp).end(): - if raise_errors: - raise KeyError(key) - else: - return default - - cdef AbstractBaseTag tag = wrap_node(&dereference(it).second) - if isinstance(tag, ShortTag): - dereference(self.cpp).erase(it) - return tag - elif raise_errors: - raise TypeError - else: - return default - - - @overload - def get_int(self, key: str | bytes) -> amulet_nbt.IntTag | None: ... - @overload - def get_int(self, key: str | bytes, default: None) -> amulet_nbt.IntTag | None: ... - @overload - def get_int(self, key: str | bytes, default: amulet_nbt.IntTag) -> amulet_nbt.IntTag: ... - @overload - def get_int(self, key: str | bytes, default: None, raise_errors: Literal[False]) -> amulet_nbt.IntTag | None: ... - @overload - def get_int(self, key: str | bytes, default: amulet_nbt.IntTag, raise_errors: Literal[False]) -> amulet_nbt.IntTag: ... - @overload - def get_int(self, key: str | bytes, default: amulet_nbt.IntTag | None, raise_errors: Literal[True]) -> amulet_nbt.IntTag: ... - @overload - def get_int(self, key: str | bytes, *, raise_errors: Literal[False]) -> amulet_nbt.IntTag | None: ... - @overload - def get_int(self, key: str | bytes, *, raise_errors: Literal[True]) -> amulet_nbt.IntTag: ... - - def get_int(self, string key: str | bytes, IntTag default: _T = None, bool raise_errors: bool = False) -> amulet_nbt.IntTag | _T: - """Get the tag stored in key if it is a IntTag. - - :param key: The key to get - :param default: The value to return if the key does not exist or the type is wrong. - :param raise_errors: If True, KeyError and TypeError are raise on error. If False, default is returned on error. - :return: The IntTag. - :raises: KeyError if the key does not exist and raise_errors is True. - :raises: TypeError if the stored type is not a IntTag and raise_errors is True. - """ - cdef CCompoundTag.iterator it = dereference(self.cpp).find(key) - - if it == dereference(self.cpp).end(): - if raise_errors: - raise KeyError(key) - else: - return default - - cdef AbstractBaseTag tag = wrap_node(&dereference(it).second) - if isinstance(tag, IntTag): - return tag - elif raise_errors: - raise TypeError - else: - return default - - def setdefault_int(self, string key: str | bytes, IntTag default: amulet_nbt.IntTag | None = None) -> amulet_nbt.IntTag: - """Populate key if not defined or value is not IntTag. Return the value stored. - - If default is a IntTag then it will be stored under key else a default instance will be created. - - :param key: The key to populate and get - :param default: The default value to use. If None, the default IntTag is used. - :return: The IntTag stored in key - """ - cdef AbstractBaseTag tag - try: - tag = self[key] - except KeyError as e: - if default is None: - tag = self[key] = IntTag() - else: - tag = self[key] = default - else: - if not isinstance(tag, IntTag): - if default is None: - tag = self[key] = IntTag() - else: - tag = self[key] = default - return tag - - @overload - def pop_int(self, key: str | bytes) -> amulet_nbt.IntTag | None: ... - @overload - def pop_int(self, key: str | bytes, default: None) -> amulet_nbt.IntTag | None: ... - @overload - def pop_int(self, key: str | bytes, default: amulet_nbt.IntTag) -> amulet_nbt.IntTag: ... - @overload - def pop_int(self, key: str | bytes, default: None, raise_errors: Literal[False]) -> amulet_nbt.IntTag | None: ... - @overload - def pop_int(self, key: str | bytes, default: amulet_nbt.IntTag, raise_errors: Literal[False]) -> amulet_nbt.IntTag: ... - @overload - def pop_int(self, key: str | bytes, default: amulet_nbt.IntTag | None, raise_errors: Literal[True]) -> amulet_nbt.IntTag: ... - @overload - def pop_int(self, key: str | bytes, *, raise_errors: Literal[False]) -> amulet_nbt.IntTag | None: ... - @overload - def pop_int(self, key: str | bytes, *, raise_errors: Literal[True]) -> amulet_nbt.IntTag: ... - - def pop_int(self, string key: str | bytes, IntTag default: _T = None, bool raise_errors: bool = False) -> amulet_nbt.IntTag | _T: - """Remove the specified key and return the corresponding value if it is a IntTag. - - If the key exists but the type is incorrect, the value will not be removed. - - :param key: The key to get and remove - :param default: The value to return if the key does not exist or the type is wrong. - :param raise_errors: If True, KeyError and TypeError are raise on error. If False, default is returned on error. - :return: The IntTag. - :raises: KeyError if the key does not exist and raise_errors is True. - :raises: TypeError if the stored type is not a IntTag and raise_errors is True. - """ - cdef CCompoundTag.iterator it = dereference(self.cpp).find(key) - - if it == dereference(self.cpp).end(): - if raise_errors: - raise KeyError(key) - else: - return default - - cdef AbstractBaseTag tag = wrap_node(&dereference(it).second) - if isinstance(tag, IntTag): - dereference(self.cpp).erase(it) - return tag - elif raise_errors: - raise TypeError - else: - return default - - - @overload - def get_long(self, key: str | bytes) -> amulet_nbt.LongTag | None: ... - @overload - def get_long(self, key: str | bytes, default: None) -> amulet_nbt.LongTag | None: ... - @overload - def get_long(self, key: str | bytes, default: amulet_nbt.LongTag) -> amulet_nbt.LongTag: ... - @overload - def get_long(self, key: str | bytes, default: None, raise_errors: Literal[False]) -> amulet_nbt.LongTag | None: ... - @overload - def get_long(self, key: str | bytes, default: amulet_nbt.LongTag, raise_errors: Literal[False]) -> amulet_nbt.LongTag: ... - @overload - def get_long(self, key: str | bytes, default: amulet_nbt.LongTag | None, raise_errors: Literal[True]) -> amulet_nbt.LongTag: ... - @overload - def get_long(self, key: str | bytes, *, raise_errors: Literal[False]) -> amulet_nbt.LongTag | None: ... - @overload - def get_long(self, key: str | bytes, *, raise_errors: Literal[True]) -> amulet_nbt.LongTag: ... - - def get_long(self, string key: str | bytes, LongTag default: _T = None, bool raise_errors: bool = False) -> amulet_nbt.LongTag | _T: - """Get the tag stored in key if it is a LongTag. - - :param key: The key to get - :param default: The value to return if the key does not exist or the type is wrong. - :param raise_errors: If True, KeyError and TypeError are raise on error. If False, default is returned on error. - :return: The LongTag. - :raises: KeyError if the key does not exist and raise_errors is True. - :raises: TypeError if the stored type is not a LongTag and raise_errors is True. - """ - cdef CCompoundTag.iterator it = dereference(self.cpp).find(key) - - if it == dereference(self.cpp).end(): - if raise_errors: - raise KeyError(key) - else: - return default - - cdef AbstractBaseTag tag = wrap_node(&dereference(it).second) - if isinstance(tag, LongTag): - return tag - elif raise_errors: - raise TypeError - else: - return default - - def setdefault_long(self, string key: str | bytes, LongTag default: amulet_nbt.LongTag | None = None) -> amulet_nbt.LongTag: - """Populate key if not defined or value is not LongTag. Return the value stored. - - If default is a LongTag then it will be stored under key else a default instance will be created. - - :param key: The key to populate and get - :param default: The default value to use. If None, the default LongTag is used. - :return: The LongTag stored in key - """ - cdef AbstractBaseTag tag - try: - tag = self[key] - except KeyError as e: - if default is None: - tag = self[key] = LongTag() - else: - tag = self[key] = default - else: - if not isinstance(tag, LongTag): - if default is None: - tag = self[key] = LongTag() - else: - tag = self[key] = default - return tag - - @overload - def pop_long(self, key: str | bytes) -> amulet_nbt.LongTag | None: ... - @overload - def pop_long(self, key: str | bytes, default: None) -> amulet_nbt.LongTag | None: ... - @overload - def pop_long(self, key: str | bytes, default: amulet_nbt.LongTag) -> amulet_nbt.LongTag: ... - @overload - def pop_long(self, key: str | bytes, default: None, raise_errors: Literal[False]) -> amulet_nbt.LongTag | None: ... - @overload - def pop_long(self, key: str | bytes, default: amulet_nbt.LongTag, raise_errors: Literal[False]) -> amulet_nbt.LongTag: ... - @overload - def pop_long(self, key: str | bytes, default: amulet_nbt.LongTag | None, raise_errors: Literal[True]) -> amulet_nbt.LongTag: ... - @overload - def pop_long(self, key: str | bytes, *, raise_errors: Literal[False]) -> amulet_nbt.LongTag | None: ... - @overload - def pop_long(self, key: str | bytes, *, raise_errors: Literal[True]) -> amulet_nbt.LongTag: ... - - def pop_long(self, string key: str | bytes, LongTag default: _T = None, bool raise_errors: bool = False) -> amulet_nbt.LongTag | _T: - """Remove the specified key and return the corresponding value if it is a LongTag. - - If the key exists but the type is incorrect, the value will not be removed. - - :param key: The key to get and remove - :param default: The value to return if the key does not exist or the type is wrong. - :param raise_errors: If True, KeyError and TypeError are raise on error. If False, default is returned on error. - :return: The LongTag. - :raises: KeyError if the key does not exist and raise_errors is True. - :raises: TypeError if the stored type is not a LongTag and raise_errors is True. - """ - cdef CCompoundTag.iterator it = dereference(self.cpp).find(key) - - if it == dereference(self.cpp).end(): - if raise_errors: - raise KeyError(key) - else: - return default - - cdef AbstractBaseTag tag = wrap_node(&dereference(it).second) - if isinstance(tag, LongTag): - dereference(self.cpp).erase(it) - return tag - elif raise_errors: - raise TypeError - else: - return default - - - @overload - def get_float(self, key: str | bytes) -> amulet_nbt.FloatTag | None: ... - @overload - def get_float(self, key: str | bytes, default: None) -> amulet_nbt.FloatTag | None: ... - @overload - def get_float(self, key: str | bytes, default: amulet_nbt.FloatTag) -> amulet_nbt.FloatTag: ... - @overload - def get_float(self, key: str | bytes, default: None, raise_errors: Literal[False]) -> amulet_nbt.FloatTag | None: ... - @overload - def get_float(self, key: str | bytes, default: amulet_nbt.FloatTag, raise_errors: Literal[False]) -> amulet_nbt.FloatTag: ... - @overload - def get_float(self, key: str | bytes, default: amulet_nbt.FloatTag | None, raise_errors: Literal[True]) -> amulet_nbt.FloatTag: ... - @overload - def get_float(self, key: str | bytes, *, raise_errors: Literal[False]) -> amulet_nbt.FloatTag | None: ... - @overload - def get_float(self, key: str | bytes, *, raise_errors: Literal[True]) -> amulet_nbt.FloatTag: ... - - def get_float(self, string key: str | bytes, FloatTag default: _T = None, bool raise_errors: bool = False) -> amulet_nbt.FloatTag | _T: - """Get the tag stored in key if it is a FloatTag. - - :param key: The key to get - :param default: The value to return if the key does not exist or the type is wrong. - :param raise_errors: If True, KeyError and TypeError are raise on error. If False, default is returned on error. - :return: The FloatTag. - :raises: KeyError if the key does not exist and raise_errors is True. - :raises: TypeError if the stored type is not a FloatTag and raise_errors is True. - """ - cdef CCompoundTag.iterator it = dereference(self.cpp).find(key) - - if it == dereference(self.cpp).end(): - if raise_errors: - raise KeyError(key) - else: - return default - - cdef AbstractBaseTag tag = wrap_node(&dereference(it).second) - if isinstance(tag, FloatTag): - return tag - elif raise_errors: - raise TypeError - else: - return default - - def setdefault_float(self, string key: str | bytes, FloatTag default: amulet_nbt.FloatTag | None = None) -> amulet_nbt.FloatTag: - """Populate key if not defined or value is not FloatTag. Return the value stored. - - If default is a FloatTag then it will be stored under key else a default instance will be created. - - :param key: The key to populate and get - :param default: The default value to use. If None, the default FloatTag is used. - :return: The FloatTag stored in key - """ - cdef AbstractBaseTag tag - try: - tag = self[key] - except KeyError as e: - if default is None: - tag = self[key] = FloatTag() - else: - tag = self[key] = default - else: - if not isinstance(tag, FloatTag): - if default is None: - tag = self[key] = FloatTag() - else: - tag = self[key] = default - return tag - - @overload - def pop_float(self, key: str | bytes) -> amulet_nbt.FloatTag | None: ... - @overload - def pop_float(self, key: str | bytes, default: None) -> amulet_nbt.FloatTag | None: ... - @overload - def pop_float(self, key: str | bytes, default: amulet_nbt.FloatTag) -> amulet_nbt.FloatTag: ... - @overload - def pop_float(self, key: str | bytes, default: None, raise_errors: Literal[False]) -> amulet_nbt.FloatTag | None: ... - @overload - def pop_float(self, key: str | bytes, default: amulet_nbt.FloatTag, raise_errors: Literal[False]) -> amulet_nbt.FloatTag: ... - @overload - def pop_float(self, key: str | bytes, default: amulet_nbt.FloatTag | None, raise_errors: Literal[True]) -> amulet_nbt.FloatTag: ... - @overload - def pop_float(self, key: str | bytes, *, raise_errors: Literal[False]) -> amulet_nbt.FloatTag | None: ... - @overload - def pop_float(self, key: str | bytes, *, raise_errors: Literal[True]) -> amulet_nbt.FloatTag: ... - - def pop_float(self, string key: str | bytes, FloatTag default: _T = None, bool raise_errors: bool = False) -> amulet_nbt.FloatTag | _T: - """Remove the specified key and return the corresponding value if it is a FloatTag. - - If the key exists but the type is incorrect, the value will not be removed. - - :param key: The key to get and remove - :param default: The value to return if the key does not exist or the type is wrong. - :param raise_errors: If True, KeyError and TypeError are raise on error. If False, default is returned on error. - :return: The FloatTag. - :raises: KeyError if the key does not exist and raise_errors is True. - :raises: TypeError if the stored type is not a FloatTag and raise_errors is True. - """ - cdef CCompoundTag.iterator it = dereference(self.cpp).find(key) - - if it == dereference(self.cpp).end(): - if raise_errors: - raise KeyError(key) - else: - return default - - cdef AbstractBaseTag tag = wrap_node(&dereference(it).second) - if isinstance(tag, FloatTag): - dereference(self.cpp).erase(it) - return tag - elif raise_errors: - raise TypeError - else: - return default - - - @overload - def get_double(self, key: str | bytes) -> amulet_nbt.DoubleTag | None: ... - @overload - def get_double(self, key: str | bytes, default: None) -> amulet_nbt.DoubleTag | None: ... - @overload - def get_double(self, key: str | bytes, default: amulet_nbt.DoubleTag) -> amulet_nbt.DoubleTag: ... - @overload - def get_double(self, key: str | bytes, default: None, raise_errors: Literal[False]) -> amulet_nbt.DoubleTag | None: ... - @overload - def get_double(self, key: str | bytes, default: amulet_nbt.DoubleTag, raise_errors: Literal[False]) -> amulet_nbt.DoubleTag: ... - @overload - def get_double(self, key: str | bytes, default: amulet_nbt.DoubleTag | None, raise_errors: Literal[True]) -> amulet_nbt.DoubleTag: ... - @overload - def get_double(self, key: str | bytes, *, raise_errors: Literal[False]) -> amulet_nbt.DoubleTag | None: ... - @overload - def get_double(self, key: str | bytes, *, raise_errors: Literal[True]) -> amulet_nbt.DoubleTag: ... - - def get_double(self, string key: str | bytes, DoubleTag default: _T = None, bool raise_errors: bool = False) -> amulet_nbt.DoubleTag | _T: - """Get the tag stored in key if it is a DoubleTag. - - :param key: The key to get - :param default: The value to return if the key does not exist or the type is wrong. - :param raise_errors: If True, KeyError and TypeError are raise on error. If False, default is returned on error. - :return: The DoubleTag. - :raises: KeyError if the key does not exist and raise_errors is True. - :raises: TypeError if the stored type is not a DoubleTag and raise_errors is True. - """ - cdef CCompoundTag.iterator it = dereference(self.cpp).find(key) - - if it == dereference(self.cpp).end(): - if raise_errors: - raise KeyError(key) - else: - return default - - cdef AbstractBaseTag tag = wrap_node(&dereference(it).second) - if isinstance(tag, DoubleTag): - return tag - elif raise_errors: - raise TypeError - else: - return default - - def setdefault_double(self, string key: str | bytes, DoubleTag default: amulet_nbt.DoubleTag | None = None) -> amulet_nbt.DoubleTag: - """Populate key if not defined or value is not DoubleTag. Return the value stored. - - If default is a DoubleTag then it will be stored under key else a default instance will be created. - - :param key: The key to populate and get - :param default: The default value to use. If None, the default DoubleTag is used. - :return: The DoubleTag stored in key - """ - cdef AbstractBaseTag tag - try: - tag = self[key] - except KeyError as e: - if default is None: - tag = self[key] = DoubleTag() - else: - tag = self[key] = default - else: - if not isinstance(tag, DoubleTag): - if default is None: - tag = self[key] = DoubleTag() - else: - tag = self[key] = default - return tag - - @overload - def pop_double(self, key: str | bytes) -> amulet_nbt.DoubleTag | None: ... - @overload - def pop_double(self, key: str | bytes, default: None) -> amulet_nbt.DoubleTag | None: ... - @overload - def pop_double(self, key: str | bytes, default: amulet_nbt.DoubleTag) -> amulet_nbt.DoubleTag: ... - @overload - def pop_double(self, key: str | bytes, default: None, raise_errors: Literal[False]) -> amulet_nbt.DoubleTag | None: ... - @overload - def pop_double(self, key: str | bytes, default: amulet_nbt.DoubleTag, raise_errors: Literal[False]) -> amulet_nbt.DoubleTag: ... - @overload - def pop_double(self, key: str | bytes, default: amulet_nbt.DoubleTag | None, raise_errors: Literal[True]) -> amulet_nbt.DoubleTag: ... - @overload - def pop_double(self, key: str | bytes, *, raise_errors: Literal[False]) -> amulet_nbt.DoubleTag | None: ... - @overload - def pop_double(self, key: str | bytes, *, raise_errors: Literal[True]) -> amulet_nbt.DoubleTag: ... - - def pop_double(self, string key: str | bytes, DoubleTag default: _T = None, bool raise_errors: bool = False) -> amulet_nbt.DoubleTag | _T: - """Remove the specified key and return the corresponding value if it is a DoubleTag. - - If the key exists but the type is incorrect, the value will not be removed. - - :param key: The key to get and remove - :param default: The value to return if the key does not exist or the type is wrong. - :param raise_errors: If True, KeyError and TypeError are raise on error. If False, default is returned on error. - :return: The DoubleTag. - :raises: KeyError if the key does not exist and raise_errors is True. - :raises: TypeError if the stored type is not a DoubleTag and raise_errors is True. - """ - cdef CCompoundTag.iterator it = dereference(self.cpp).find(key) - - if it == dereference(self.cpp).end(): - if raise_errors: - raise KeyError(key) - else: - return default - - cdef AbstractBaseTag tag = wrap_node(&dereference(it).second) - if isinstance(tag, DoubleTag): - dereference(self.cpp).erase(it) - return tag - elif raise_errors: - raise TypeError - else: - return default - - - @overload - def get_string(self, key: str | bytes) -> amulet_nbt.StringTag | None: ... - @overload - def get_string(self, key: str | bytes, default: None) -> amulet_nbt.StringTag | None: ... - @overload - def get_string(self, key: str | bytes, default: amulet_nbt.StringTag) -> amulet_nbt.StringTag: ... - @overload - def get_string(self, key: str | bytes, default: None, raise_errors: Literal[False]) -> amulet_nbt.StringTag | None: ... - @overload - def get_string(self, key: str | bytes, default: amulet_nbt.StringTag, raise_errors: Literal[False]) -> amulet_nbt.StringTag: ... - @overload - def get_string(self, key: str | bytes, default: amulet_nbt.StringTag | None, raise_errors: Literal[True]) -> amulet_nbt.StringTag: ... - @overload - def get_string(self, key: str | bytes, *, raise_errors: Literal[False]) -> amulet_nbt.StringTag | None: ... - @overload - def get_string(self, key: str | bytes, *, raise_errors: Literal[True]) -> amulet_nbt.StringTag: ... - - def get_string(self, string key: str | bytes, StringTag default: _T = None, bool raise_errors: bool = False) -> amulet_nbt.StringTag | _T: - """Get the tag stored in key if it is a StringTag. - - :param key: The key to get - :param default: The value to return if the key does not exist or the type is wrong. - :param raise_errors: If True, KeyError and TypeError are raise on error. If False, default is returned on error. - :return: The StringTag. - :raises: KeyError if the key does not exist and raise_errors is True. - :raises: TypeError if the stored type is not a StringTag and raise_errors is True. - """ - cdef CCompoundTag.iterator it = dereference(self.cpp).find(key) - - if it == dereference(self.cpp).end(): - if raise_errors: - raise KeyError(key) - else: - return default - - cdef AbstractBaseTag tag = wrap_node(&dereference(it).second) - if isinstance(tag, StringTag): - return tag - elif raise_errors: - raise TypeError - else: - return default - - def setdefault_string(self, string key: str | bytes, StringTag default: amulet_nbt.StringTag | None = None) -> amulet_nbt.StringTag: - """Populate key if not defined or value is not StringTag. Return the value stored. - - If default is a StringTag then it will be stored under key else a default instance will be created. - - :param key: The key to populate and get - :param default: The default value to use. If None, the default StringTag is used. - :return: The StringTag stored in key - """ - cdef AbstractBaseTag tag - try: - tag = self[key] - except KeyError as e: - if default is None: - tag = self[key] = StringTag() - else: - tag = self[key] = default - else: - if not isinstance(tag, StringTag): - if default is None: - tag = self[key] = StringTag() - else: - tag = self[key] = default - return tag - - @overload - def pop_string(self, key: str | bytes) -> amulet_nbt.StringTag | None: ... - @overload - def pop_string(self, key: str | bytes, default: None) -> amulet_nbt.StringTag | None: ... - @overload - def pop_string(self, key: str | bytes, default: amulet_nbt.StringTag) -> amulet_nbt.StringTag: ... - @overload - def pop_string(self, key: str | bytes, default: None, raise_errors: Literal[False]) -> amulet_nbt.StringTag | None: ... - @overload - def pop_string(self, key: str | bytes, default: amulet_nbt.StringTag, raise_errors: Literal[False]) -> amulet_nbt.StringTag: ... - @overload - def pop_string(self, key: str | bytes, default: amulet_nbt.StringTag | None, raise_errors: Literal[True]) -> amulet_nbt.StringTag: ... - @overload - def pop_string(self, key: str | bytes, *, raise_errors: Literal[False]) -> amulet_nbt.StringTag | None: ... - @overload - def pop_string(self, key: str | bytes, *, raise_errors: Literal[True]) -> amulet_nbt.StringTag: ... - - def pop_string(self, string key: str | bytes, StringTag default: _T = None, bool raise_errors: bool = False) -> amulet_nbt.StringTag | _T: - """Remove the specified key and return the corresponding value if it is a StringTag. - - If the key exists but the type is incorrect, the value will not be removed. - - :param key: The key to get and remove - :param default: The value to return if the key does not exist or the type is wrong. - :param raise_errors: If True, KeyError and TypeError are raise on error. If False, default is returned on error. - :return: The StringTag. - :raises: KeyError if the key does not exist and raise_errors is True. - :raises: TypeError if the stored type is not a StringTag and raise_errors is True. - """ - cdef CCompoundTag.iterator it = dereference(self.cpp).find(key) - - if it == dereference(self.cpp).end(): - if raise_errors: - raise KeyError(key) - else: - return default - - cdef AbstractBaseTag tag = wrap_node(&dereference(it).second) - if isinstance(tag, StringTag): - dereference(self.cpp).erase(it) - return tag - elif raise_errors: - raise TypeError - else: - return default - - - @overload - def get_list(self, key: str | bytes) -> amulet_nbt.ListTag | None: ... - @overload - def get_list(self, key: str | bytes, default: None) -> amulet_nbt.ListTag | None: ... - @overload - def get_list(self, key: str | bytes, default: amulet_nbt.ListTag) -> amulet_nbt.ListTag: ... - @overload - def get_list(self, key: str | bytes, default: None, raise_errors: Literal[False]) -> amulet_nbt.ListTag | None: ... - @overload - def get_list(self, key: str | bytes, default: amulet_nbt.ListTag, raise_errors: Literal[False]) -> amulet_nbt.ListTag: ... - @overload - def get_list(self, key: str | bytes, default: amulet_nbt.ListTag | None, raise_errors: Literal[True]) -> amulet_nbt.ListTag: ... - @overload - def get_list(self, key: str | bytes, *, raise_errors: Literal[False]) -> amulet_nbt.ListTag | None: ... - @overload - def get_list(self, key: str | bytes, *, raise_errors: Literal[True]) -> amulet_nbt.ListTag: ... - - def get_list(self, string key: str | bytes, ListTag default: _T = None, bool raise_errors: bool = False) -> amulet_nbt.ListTag | _T: - """Get the tag stored in key if it is a ListTag. - - :param key: The key to get - :param default: The value to return if the key does not exist or the type is wrong. - :param raise_errors: If True, KeyError and TypeError are raise on error. If False, default is returned on error. - :return: The ListTag. - :raises: KeyError if the key does not exist and raise_errors is True. - :raises: TypeError if the stored type is not a ListTag and raise_errors is True. - """ - cdef CCompoundTag.iterator it = dereference(self.cpp).find(key) - - if it == dereference(self.cpp).end(): - if raise_errors: - raise KeyError(key) - else: - return default - - cdef AbstractBaseTag tag = wrap_node(&dereference(it).second) - if isinstance(tag, ListTag): - return tag - elif raise_errors: - raise TypeError - else: - return default - - def setdefault_list(self, string key: str | bytes, ListTag default: amulet_nbt.ListTag | None = None) -> amulet_nbt.ListTag: - """Populate key if not defined or value is not ListTag. Return the value stored. - - If default is a ListTag then it will be stored under key else a default instance will be created. - - :param key: The key to populate and get - :param default: The default value to use. If None, the default ListTag is used. - :return: The ListTag stored in key - """ - cdef AbstractBaseTag tag - try: - tag = self[key] - except KeyError as e: - if default is None: - tag = self[key] = ListTag() - else: - tag = self[key] = default - else: - if not isinstance(tag, ListTag): - if default is None: - tag = self[key] = ListTag() - else: - tag = self[key] = default - return tag - - @overload - def pop_list(self, key: str | bytes) -> amulet_nbt.ListTag | None: ... - @overload - def pop_list(self, key: str | bytes, default: None) -> amulet_nbt.ListTag | None: ... - @overload - def pop_list(self, key: str | bytes, default: amulet_nbt.ListTag) -> amulet_nbt.ListTag: ... - @overload - def pop_list(self, key: str | bytes, default: None, raise_errors: Literal[False]) -> amulet_nbt.ListTag | None: ... - @overload - def pop_list(self, key: str | bytes, default: amulet_nbt.ListTag, raise_errors: Literal[False]) -> amulet_nbt.ListTag: ... - @overload - def pop_list(self, key: str | bytes, default: amulet_nbt.ListTag | None, raise_errors: Literal[True]) -> amulet_nbt.ListTag: ... - @overload - def pop_list(self, key: str | bytes, *, raise_errors: Literal[False]) -> amulet_nbt.ListTag | None: ... - @overload - def pop_list(self, key: str | bytes, *, raise_errors: Literal[True]) -> amulet_nbt.ListTag: ... - - def pop_list(self, string key: str | bytes, ListTag default: _T = None, bool raise_errors: bool = False) -> amulet_nbt.ListTag | _T: - """Remove the specified key and return the corresponding value if it is a ListTag. - - If the key exists but the type is incorrect, the value will not be removed. - - :param key: The key to get and remove - :param default: The value to return if the key does not exist or the type is wrong. - :param raise_errors: If True, KeyError and TypeError are raise on error. If False, default is returned on error. - :return: The ListTag. - :raises: KeyError if the key does not exist and raise_errors is True. - :raises: TypeError if the stored type is not a ListTag and raise_errors is True. - """ - cdef CCompoundTag.iterator it = dereference(self.cpp).find(key) - - if it == dereference(self.cpp).end(): - if raise_errors: - raise KeyError(key) - else: - return default - - cdef AbstractBaseTag tag = wrap_node(&dereference(it).second) - if isinstance(tag, ListTag): - dereference(self.cpp).erase(it) - return tag - elif raise_errors: - raise TypeError - else: - return default - - - @overload - def get_compound(self, key: str | bytes) -> amulet_nbt.CompoundTag | None: ... - @overload - def get_compound(self, key: str | bytes, default: None) -> amulet_nbt.CompoundTag | None: ... - @overload - def get_compound(self, key: str | bytes, default: amulet_nbt.CompoundTag) -> amulet_nbt.CompoundTag: ... - @overload - def get_compound(self, key: str | bytes, default: None, raise_errors: Literal[False]) -> amulet_nbt.CompoundTag | None: ... - @overload - def get_compound(self, key: str | bytes, default: amulet_nbt.CompoundTag, raise_errors: Literal[False]) -> amulet_nbt.CompoundTag: ... - @overload - def get_compound(self, key: str | bytes, default: amulet_nbt.CompoundTag | None, raise_errors: Literal[True]) -> amulet_nbt.CompoundTag: ... - @overload - def get_compound(self, key: str | bytes, *, raise_errors: Literal[False]) -> amulet_nbt.CompoundTag | None: ... - @overload - def get_compound(self, key: str | bytes, *, raise_errors: Literal[True]) -> amulet_nbt.CompoundTag: ... - - def get_compound(self, string key: str | bytes, CompoundTag default: _T = None, bool raise_errors: bool = False) -> amulet_nbt.CompoundTag | _T: - """Get the tag stored in key if it is a CompoundTag. - - :param key: The key to get - :param default: The value to return if the key does not exist or the type is wrong. - :param raise_errors: If True, KeyError and TypeError are raise on error. If False, default is returned on error. - :return: The CompoundTag. - :raises: KeyError if the key does not exist and raise_errors is True. - :raises: TypeError if the stored type is not a CompoundTag and raise_errors is True. - """ - cdef CCompoundTag.iterator it = dereference(self.cpp).find(key) - - if it == dereference(self.cpp).end(): - if raise_errors: - raise KeyError(key) - else: - return default - - cdef AbstractBaseTag tag = wrap_node(&dereference(it).second) - if isinstance(tag, CompoundTag): - return tag - elif raise_errors: - raise TypeError - else: - return default - - def setdefault_compound(self, string key: str | bytes, CompoundTag default: amulet_nbt.CompoundTag | None = None) -> amulet_nbt.CompoundTag: - """Populate key if not defined or value is not CompoundTag. Return the value stored. - - If default is a CompoundTag then it will be stored under key else a default instance will be created. - - :param key: The key to populate and get - :param default: The default value to use. If None, the default CompoundTag is used. - :return: The CompoundTag stored in key - """ - cdef AbstractBaseTag tag - try: - tag = self[key] - except KeyError as e: - if default is None: - tag = self[key] = CompoundTag() - else: - tag = self[key] = default - else: - if not isinstance(tag, CompoundTag): - if default is None: - tag = self[key] = CompoundTag() - else: - tag = self[key] = default - return tag - - @overload - def pop_compound(self, key: str | bytes) -> amulet_nbt.CompoundTag | None: ... - @overload - def pop_compound(self, key: str | bytes, default: None) -> amulet_nbt.CompoundTag | None: ... - @overload - def pop_compound(self, key: str | bytes, default: amulet_nbt.CompoundTag) -> amulet_nbt.CompoundTag: ... - @overload - def pop_compound(self, key: str | bytes, default: None, raise_errors: Literal[False]) -> amulet_nbt.CompoundTag | None: ... - @overload - def pop_compound(self, key: str | bytes, default: amulet_nbt.CompoundTag, raise_errors: Literal[False]) -> amulet_nbt.CompoundTag: ... - @overload - def pop_compound(self, key: str | bytes, default: amulet_nbt.CompoundTag | None, raise_errors: Literal[True]) -> amulet_nbt.CompoundTag: ... - @overload - def pop_compound(self, key: str | bytes, *, raise_errors: Literal[False]) -> amulet_nbt.CompoundTag | None: ... - @overload - def pop_compound(self, key: str | bytes, *, raise_errors: Literal[True]) -> amulet_nbt.CompoundTag: ... - - def pop_compound(self, string key: str | bytes, CompoundTag default: _T = None, bool raise_errors: bool = False) -> amulet_nbt.CompoundTag | _T: - """Remove the specified key and return the corresponding value if it is a CompoundTag. - - If the key exists but the type is incorrect, the value will not be removed. - - :param key: The key to get and remove - :param default: The value to return if the key does not exist or the type is wrong. - :param raise_errors: If True, KeyError and TypeError are raise on error. If False, default is returned on error. - :return: The CompoundTag. - :raises: KeyError if the key does not exist and raise_errors is True. - :raises: TypeError if the stored type is not a CompoundTag and raise_errors is True. - """ - cdef CCompoundTag.iterator it = dereference(self.cpp).find(key) - - if it == dereference(self.cpp).end(): - if raise_errors: - raise KeyError(key) - else: - return default - - cdef AbstractBaseTag tag = wrap_node(&dereference(it).second) - if isinstance(tag, CompoundTag): - dereference(self.cpp).erase(it) - return tag - elif raise_errors: - raise TypeError - else: - return default - - - @overload - def get_byte_array(self, key: str | bytes) -> amulet_nbt.ByteArrayTag | None: ... - @overload - def get_byte_array(self, key: str | bytes, default: None) -> amulet_nbt.ByteArrayTag | None: ... - @overload - def get_byte_array(self, key: str | bytes, default: amulet_nbt.ByteArrayTag) -> amulet_nbt.ByteArrayTag: ... - @overload - def get_byte_array(self, key: str | bytes, default: None, raise_errors: Literal[False]) -> amulet_nbt.ByteArrayTag | None: ... - @overload - def get_byte_array(self, key: str | bytes, default: amulet_nbt.ByteArrayTag, raise_errors: Literal[False]) -> amulet_nbt.ByteArrayTag: ... - @overload - def get_byte_array(self, key: str | bytes, default: amulet_nbt.ByteArrayTag | None, raise_errors: Literal[True]) -> amulet_nbt.ByteArrayTag: ... - @overload - def get_byte_array(self, key: str | bytes, *, raise_errors: Literal[False]) -> amulet_nbt.ByteArrayTag | None: ... - @overload - def get_byte_array(self, key: str | bytes, *, raise_errors: Literal[True]) -> amulet_nbt.ByteArrayTag: ... - - def get_byte_array(self, string key: str | bytes, ByteArrayTag default: _T = None, bool raise_errors: bool = False) -> amulet_nbt.ByteArrayTag | _T: - """Get the tag stored in key if it is a ByteArrayTag. - - :param key: The key to get - :param default: The value to return if the key does not exist or the type is wrong. - :param raise_errors: If True, KeyError and TypeError are raise on error. If False, default is returned on error. - :return: The ByteArrayTag. - :raises: KeyError if the key does not exist and raise_errors is True. - :raises: TypeError if the stored type is not a ByteArrayTag and raise_errors is True. - """ - cdef CCompoundTag.iterator it = dereference(self.cpp).find(key) - - if it == dereference(self.cpp).end(): - if raise_errors: - raise KeyError(key) - else: - return default - - cdef AbstractBaseTag tag = wrap_node(&dereference(it).second) - if isinstance(tag, ByteArrayTag): - return tag - elif raise_errors: - raise TypeError - else: - return default - - def setdefault_byte_array(self, string key: str | bytes, ByteArrayTag default: amulet_nbt.ByteArrayTag | None = None) -> amulet_nbt.ByteArrayTag: - """Populate key if not defined or value is not ByteArrayTag. Return the value stored. - - If default is a ByteArrayTag then it will be stored under key else a default instance will be created. - - :param key: The key to populate and get - :param default: The default value to use. If None, the default ByteArrayTag is used. - :return: The ByteArrayTag stored in key - """ - cdef AbstractBaseTag tag - try: - tag = self[key] - except KeyError as e: - if default is None: - tag = self[key] = ByteArrayTag() - else: - tag = self[key] = default - else: - if not isinstance(tag, ByteArrayTag): - if default is None: - tag = self[key] = ByteArrayTag() - else: - tag = self[key] = default - return tag - - @overload - def pop_byte_array(self, key: str | bytes) -> amulet_nbt.ByteArrayTag | None: ... - @overload - def pop_byte_array(self, key: str | bytes, default: None) -> amulet_nbt.ByteArrayTag | None: ... - @overload - def pop_byte_array(self, key: str | bytes, default: amulet_nbt.ByteArrayTag) -> amulet_nbt.ByteArrayTag: ... - @overload - def pop_byte_array(self, key: str | bytes, default: None, raise_errors: Literal[False]) -> amulet_nbt.ByteArrayTag | None: ... - @overload - def pop_byte_array(self, key: str | bytes, default: amulet_nbt.ByteArrayTag, raise_errors: Literal[False]) -> amulet_nbt.ByteArrayTag: ... - @overload - def pop_byte_array(self, key: str | bytes, default: amulet_nbt.ByteArrayTag | None, raise_errors: Literal[True]) -> amulet_nbt.ByteArrayTag: ... - @overload - def pop_byte_array(self, key: str | bytes, *, raise_errors: Literal[False]) -> amulet_nbt.ByteArrayTag | None: ... - @overload - def pop_byte_array(self, key: str | bytes, *, raise_errors: Literal[True]) -> amulet_nbt.ByteArrayTag: ... - - def pop_byte_array(self, string key: str | bytes, ByteArrayTag default: _T = None, bool raise_errors: bool = False) -> amulet_nbt.ByteArrayTag | _T: - """Remove the specified key and return the corresponding value if it is a ByteArrayTag. - - If the key exists but the type is incorrect, the value will not be removed. - - :param key: The key to get and remove - :param default: The value to return if the key does not exist or the type is wrong. - :param raise_errors: If True, KeyError and TypeError are raise on error. If False, default is returned on error. - :return: The ByteArrayTag. - :raises: KeyError if the key does not exist and raise_errors is True. - :raises: TypeError if the stored type is not a ByteArrayTag and raise_errors is True. - """ - cdef CCompoundTag.iterator it = dereference(self.cpp).find(key) - - if it == dereference(self.cpp).end(): - if raise_errors: - raise KeyError(key) - else: - return default - - cdef AbstractBaseTag tag = wrap_node(&dereference(it).second) - if isinstance(tag, ByteArrayTag): - dereference(self.cpp).erase(it) - return tag - elif raise_errors: - raise TypeError - else: - return default - - - @overload - def get_int_array(self, key: str | bytes) -> amulet_nbt.IntArrayTag | None: ... - @overload - def get_int_array(self, key: str | bytes, default: None) -> amulet_nbt.IntArrayTag | None: ... - @overload - def get_int_array(self, key: str | bytes, default: amulet_nbt.IntArrayTag) -> amulet_nbt.IntArrayTag: ... - @overload - def get_int_array(self, key: str | bytes, default: None, raise_errors: Literal[False]) -> amulet_nbt.IntArrayTag | None: ... - @overload - def get_int_array(self, key: str | bytes, default: amulet_nbt.IntArrayTag, raise_errors: Literal[False]) -> amulet_nbt.IntArrayTag: ... - @overload - def get_int_array(self, key: str | bytes, default: amulet_nbt.IntArrayTag | None, raise_errors: Literal[True]) -> amulet_nbt.IntArrayTag: ... - @overload - def get_int_array(self, key: str | bytes, *, raise_errors: Literal[False]) -> amulet_nbt.IntArrayTag | None: ... - @overload - def get_int_array(self, key: str | bytes, *, raise_errors: Literal[True]) -> amulet_nbt.IntArrayTag: ... - - def get_int_array(self, string key: str | bytes, IntArrayTag default: _T = None, bool raise_errors: bool = False) -> amulet_nbt.IntArrayTag | _T: - """Get the tag stored in key if it is a IntArrayTag. - - :param key: The key to get - :param default: The value to return if the key does not exist or the type is wrong. - :param raise_errors: If True, KeyError and TypeError are raise on error. If False, default is returned on error. - :return: The IntArrayTag. - :raises: KeyError if the key does not exist and raise_errors is True. - :raises: TypeError if the stored type is not a IntArrayTag and raise_errors is True. - """ - cdef CCompoundTag.iterator it = dereference(self.cpp).find(key) - - if it == dereference(self.cpp).end(): - if raise_errors: - raise KeyError(key) - else: - return default - - cdef AbstractBaseTag tag = wrap_node(&dereference(it).second) - if isinstance(tag, IntArrayTag): - return tag - elif raise_errors: - raise TypeError - else: - return default - - def setdefault_int_array(self, string key: str | bytes, IntArrayTag default: amulet_nbt.IntArrayTag | None = None) -> amulet_nbt.IntArrayTag: - """Populate key if not defined or value is not IntArrayTag. Return the value stored. - - If default is a IntArrayTag then it will be stored under key else a default instance will be created. - - :param key: The key to populate and get - :param default: The default value to use. If None, the default IntArrayTag is used. - :return: The IntArrayTag stored in key - """ - cdef AbstractBaseTag tag - try: - tag = self[key] - except KeyError as e: - if default is None: - tag = self[key] = IntArrayTag() - else: - tag = self[key] = default - else: - if not isinstance(tag, IntArrayTag): - if default is None: - tag = self[key] = IntArrayTag() - else: - tag = self[key] = default - return tag - - @overload - def pop_int_array(self, key: str | bytes) -> amulet_nbt.IntArrayTag | None: ... - @overload - def pop_int_array(self, key: str | bytes, default: None) -> amulet_nbt.IntArrayTag | None: ... - @overload - def pop_int_array(self, key: str | bytes, default: amulet_nbt.IntArrayTag) -> amulet_nbt.IntArrayTag: ... - @overload - def pop_int_array(self, key: str | bytes, default: None, raise_errors: Literal[False]) -> amulet_nbt.IntArrayTag | None: ... - @overload - def pop_int_array(self, key: str | bytes, default: amulet_nbt.IntArrayTag, raise_errors: Literal[False]) -> amulet_nbt.IntArrayTag: ... - @overload - def pop_int_array(self, key: str | bytes, default: amulet_nbt.IntArrayTag | None, raise_errors: Literal[True]) -> amulet_nbt.IntArrayTag: ... - @overload - def pop_int_array(self, key: str | bytes, *, raise_errors: Literal[False]) -> amulet_nbt.IntArrayTag | None: ... - @overload - def pop_int_array(self, key: str | bytes, *, raise_errors: Literal[True]) -> amulet_nbt.IntArrayTag: ... - - def pop_int_array(self, string key: str | bytes, IntArrayTag default: _T = None, bool raise_errors: bool = False) -> amulet_nbt.IntArrayTag | _T: - """Remove the specified key and return the corresponding value if it is a IntArrayTag. - - If the key exists but the type is incorrect, the value will not be removed. - - :param key: The key to get and remove - :param default: The value to return if the key does not exist or the type is wrong. - :param raise_errors: If True, KeyError and TypeError are raise on error. If False, default is returned on error. - :return: The IntArrayTag. - :raises: KeyError if the key does not exist and raise_errors is True. - :raises: TypeError if the stored type is not a IntArrayTag and raise_errors is True. - """ - cdef CCompoundTag.iterator it = dereference(self.cpp).find(key) - - if it == dereference(self.cpp).end(): - if raise_errors: - raise KeyError(key) - else: - return default - - cdef AbstractBaseTag tag = wrap_node(&dereference(it).second) - if isinstance(tag, IntArrayTag): - dereference(self.cpp).erase(it) - return tag - elif raise_errors: - raise TypeError - else: - return default - - - @overload - def get_long_array(self, key: str | bytes) -> amulet_nbt.LongArrayTag | None: ... - @overload - def get_long_array(self, key: str | bytes, default: None) -> amulet_nbt.LongArrayTag | None: ... - @overload - def get_long_array(self, key: str | bytes, default: amulet_nbt.LongArrayTag) -> amulet_nbt.LongArrayTag: ... - @overload - def get_long_array(self, key: str | bytes, default: None, raise_errors: Literal[False]) -> amulet_nbt.LongArrayTag | None: ... - @overload - def get_long_array(self, key: str | bytes, default: amulet_nbt.LongArrayTag, raise_errors: Literal[False]) -> amulet_nbt.LongArrayTag: ... - @overload - def get_long_array(self, key: str | bytes, default: amulet_nbt.LongArrayTag | None, raise_errors: Literal[True]) -> amulet_nbt.LongArrayTag: ... - @overload - def get_long_array(self, key: str | bytes, *, raise_errors: Literal[False]) -> amulet_nbt.LongArrayTag | None: ... - @overload - def get_long_array(self, key: str | bytes, *, raise_errors: Literal[True]) -> amulet_nbt.LongArrayTag: ... - - def get_long_array(self, string key: str | bytes, LongArrayTag default: _T = None, bool raise_errors: bool = False) -> amulet_nbt.LongArrayTag | _T: - """Get the tag stored in key if it is a LongArrayTag. - - :param key: The key to get - :param default: The value to return if the key does not exist or the type is wrong. - :param raise_errors: If True, KeyError and TypeError are raise on error. If False, default is returned on error. - :return: The LongArrayTag. - :raises: KeyError if the key does not exist and raise_errors is True. - :raises: TypeError if the stored type is not a LongArrayTag and raise_errors is True. - """ - cdef CCompoundTag.iterator it = dereference(self.cpp).find(key) - - if it == dereference(self.cpp).end(): - if raise_errors: - raise KeyError(key) - else: - return default - - cdef AbstractBaseTag tag = wrap_node(&dereference(it).second) - if isinstance(tag, LongArrayTag): - return tag - elif raise_errors: - raise TypeError - else: - return default - - def setdefault_long_array(self, string key: str | bytes, LongArrayTag default: amulet_nbt.LongArrayTag | None = None) -> amulet_nbt.LongArrayTag: - """Populate key if not defined or value is not LongArrayTag. Return the value stored. - - If default is a LongArrayTag then it will be stored under key else a default instance will be created. - - :param key: The key to populate and get - :param default: The default value to use. If None, the default LongArrayTag is used. - :return: The LongArrayTag stored in key - """ - cdef AbstractBaseTag tag - try: - tag = self[key] - except KeyError as e: - if default is None: - tag = self[key] = LongArrayTag() - else: - tag = self[key] = default - else: - if not isinstance(tag, LongArrayTag): - if default is None: - tag = self[key] = LongArrayTag() - else: - tag = self[key] = default - return tag - - @overload - def pop_long_array(self, key: str | bytes) -> amulet_nbt.LongArrayTag | None: ... - @overload - def pop_long_array(self, key: str | bytes, default: None) -> amulet_nbt.LongArrayTag | None: ... - @overload - def pop_long_array(self, key: str | bytes, default: amulet_nbt.LongArrayTag) -> amulet_nbt.LongArrayTag: ... - @overload - def pop_long_array(self, key: str | bytes, default: None, raise_errors: Literal[False]) -> amulet_nbt.LongArrayTag | None: ... - @overload - def pop_long_array(self, key: str | bytes, default: amulet_nbt.LongArrayTag, raise_errors: Literal[False]) -> amulet_nbt.LongArrayTag: ... - @overload - def pop_long_array(self, key: str | bytes, default: amulet_nbt.LongArrayTag | None, raise_errors: Literal[True]) -> amulet_nbt.LongArrayTag: ... - @overload - def pop_long_array(self, key: str | bytes, *, raise_errors: Literal[False]) -> amulet_nbt.LongArrayTag | None: ... - @overload - def pop_long_array(self, key: str | bytes, *, raise_errors: Literal[True]) -> amulet_nbt.LongArrayTag: ... - - def pop_long_array(self, string key: str | bytes, LongArrayTag default: _T = None, bool raise_errors: bool = False) -> amulet_nbt.LongArrayTag | _T: - """Remove the specified key and return the corresponding value if it is a LongArrayTag. - - If the key exists but the type is incorrect, the value will not be removed. - - :param key: The key to get and remove - :param default: The value to return if the key does not exist or the type is wrong. - :param raise_errors: If True, KeyError and TypeError are raise on error. If False, default is returned on error. - :return: The LongArrayTag. - :raises: KeyError if the key does not exist and raise_errors is True. - :raises: TypeError if the stored type is not a LongArrayTag and raise_errors is True. - """ - cdef CCompoundTag.iterator it = dereference(self.cpp).find(key) - - if it == dereference(self.cpp).end(): - if raise_errors: - raise KeyError(key) - else: - return default - - cdef AbstractBaseTag tag = wrap_node(&dereference(it).second) - if isinstance(tag, LongArrayTag): - dereference(self.cpp).erase(it) - return tag - elif raise_errors: - raise TypeError - else: - return default - diff --git a/src_/amulet_nbt/_tag/compound.pyx.tp b/src_/amulet_nbt/_tag/compound.pyx.tp deleted file mode 100644 index 96e3fb36..00000000 --- a/src_/amulet_nbt/_tag/compound.pyx.tp +++ /dev/null @@ -1,392 +0,0 @@ -{{py: -import base64 -from template import include -}} -{{base64.b64decode("IyMgVGhpcyBmaWxlIGlzIGdlbmVyYXRlZCBmcm9tIGEgdGVtcGxhdGUuCiMjIERvIG5vdCBtb2RpZnkgdGhpcyBmaWxlIGRpcmVjdGx5IG9yIHlvdXIgY2hhbmdlcyB3aWxsIGdldCBvdmVyd3JpdHRlbi4KIyMgRWRpdCB0aGUgYWNjb21wYW55aW5nIC5weXgudHAgZmlsZSBpbnN0ZWFkLg==").decode()}} -# cython: language_level=3, boundscheck=False, wraparound=False -# distutils: language = c++ -# distutils: extra_compile_args = CPPCARGS -# cython: c_string_type=str, c_string_encoding=utf8 -# distutils: sources = [src/amulet_nbt/_string_encoding/_cpp/utf8.cpp, src/amulet_nbt/_nbt_encoding/_binary/_cpp/read_nbt.cpp] - -from __future__ import annotations - -from collections.abc import Mapping, Iterator, Iterable, KeysView, ItemsView, ValuesView -from typing import Any, overload, Type, TypeVar, Literal - -from libcpp.string cimport string -from libcpp cimport bool -from libcpp.pair cimport pair -from libcpp.memory cimport make_shared -from cython.operator cimport dereference, postincrement -import amulet_nbt -from amulet_nbt._libcpp.endian cimport endian -from amulet_nbt._string_encoding._cpp cimport CStringEncode -from amulet_nbt._string_encoding._cpp.utf8 cimport utf8_escape_to_utf8, utf8_to_utf8_escape -from amulet_nbt._nbt_encoding._binary._cpp cimport read_named_tag -from amulet_nbt._nbt_encoding._binary cimport write_named_tag -from amulet_nbt._nbt_encoding._string cimport write_compound_snbt - -from amulet_nbt._tag._cpp cimport CCompoundTag, CCompoundTagPtr, CIntTag, TagNode -from amulet_nbt._libcpp.variant cimport get -from .abc cimport AbstractBaseTag, AbstractBaseMutableTag - -from amulet_nbt._tag._cpp cimport ( - CByteTag, - CShortTag, - CIntTag, - CLongTag, - CFloatTag, - CDoubleTag, - CStringTag, - CCompoundTag, - CListTagPtr, - CCompoundTagPtr, - CByteArrayTagPtr, - CIntArrayTagPtr, - CLongArrayTagPtr, - TagNode, -) - -from .int cimport ByteTag, ShortTag, IntTag, LongTag -from .float cimport FloatTag, DoubleTag -from .string cimport StringTag -from .list cimport is_list_eq, ListTag -from .array cimport ByteArrayTag, IntArrayTag, LongArrayTag -from .deepcopy cimport CCompoundTagPtr_deepcopy - -import amulet_nbt - -_T = TypeVar("_T") - -{{py: -ClassData = ( - #id, C cls, C node cls C list cls py cls, tag var, list var - (1, "CByteTag", "CByteTag", "CByteList", "ByteTag", "byte_tag", "byte_list", ), - (2, "CShortTag", "CShortTag", "CShortList", "ShortTag", "short_tag", "short_list", ), - (3, "CIntTag", "CIntTag", "CIntList", "IntTag", "int_tag", "int_list", ), - (4, "CLongTag", "CLongTag", "CLongList", "LongTag", "long_tag", "long_list", ), - (5, "CFloatTag", "CFloatTag", "CFloatList", "FloatTag", "float_tag", "float_list", ), - (6, "CDoubleTag", "CDoubleTag", "CDoubleList", "DoubleTag", "double_tag", "double_list", ), - (7, "CByteArrayTag", "CByteArrayTagPtr", "CByteArrayList", "ByteArrayTag", "byte_array_tag", "byte_array_list", ), - (8, "CStringTag", "CStringTag", "CStringList", "StringTag", "string_tag", "string_list", ), - (9, "CListTag", "CListTagPtr", "CListList", "ListTag", "list_tag", "list_list", ), - (10, "CCompoundTag", "CCompoundTagPtr", "CCompoundList", "CompoundTag", "compound_tag", "compound_list", ), - (11, "CIntArrayTag", "CIntArrayTagPtr", "CIntArrayList", "IntArrayTag", "int_array_tag", "int_array_list", ), - (12, "CLongArrayTag", "CLongArrayTagPtr", "CLongArrayList", "LongArrayTag", "long_array_tag", "long_array_list", ), -) -}} - -{{ -"\n\n\n".join( -f"""cdef inline bool _is_{tag_var}_node_eq(TagNode* a, TagNode* b) noexcept nogil: - if dereference(b).index() == {index}: - return { - f"is_list_eq(get[{c_node_cls}](dereference(a)), get[{c_node_cls}](dereference(b)))" if index == 9 else - f"is_compound_eq(get[{c_node_cls}](dereference(a)), get[{c_node_cls}](dereference(b)))" if index == 10 else - f"dereference(get[{c_node_cls}](dereference(a))) == dereference(get[{c_node_cls}](dereference(b)))" if index in {7, 11, 12} else - f"get[{c_node_cls}](dereference(a)) == get[{c_node_cls}](dereference(b))" - } - return False""" - for index, c_cls, c_node_cls, c_list_cls, py_cls, tag_var, list_var in ClassData - ) -}} - - -cdef bool is_compound_eq(CCompoundTagPtr a, CCompoundTagPtr b) noexcept nogil: - if dereference(a).size() != dereference(b).size(): - return False - - cdef CCompoundTag.iterator it1 = dereference(a).begin() - cdef CCompoundTag.iterator it2 - cdef string key - cdef TagNode* node - cdef size_t node_index - - while it1 != dereference(a).end(): - key = dereference(it1).first - it2 = dereference(b).find(key) - if it2 == dereference(b).end(): - return False - node = &dereference(it1).second - node_index = dereference(node).index() -{{ -"\n".join( -f""" {"el"*(index!=1)}if node_index == {index}: - if not _is_{tag_var}_node_eq(node, &dereference(it2).second): - return False""" - for index, c_cls, c_node_cls, c_list_cls, py_cls, tag_var, list_var in ClassData -) -}} - postincrement(it1) - return True - - -cdef AbstractBaseTag wrap_node(TagNode* node): - cdef size_t index = dereference(node).index() -{{ -"\n".join( -f""" {"el"*(index!=1)}if index == {index}: - return {py_cls}.wrap(get[{c_node_cls}](dereference(node)))""" - for index, c_cls, c_node_cls, c_list_cls, py_cls, tag_var, list_var in ClassData -) -}} - else: - raise RuntimeError - - -_TagT = TypeVar("_TagT", bound=AbstractBaseTag) - - -def _unpickle(string data) -> CompoundTag: - cdef pair[string, TagNode] named_tag = read_named_tag(data, endian.big, utf8_to_utf8_escape) - return CompoundTag.wrap(get[CCompoundTagPtr](named_tag.second)) - - -cdef class CompoundTag(AbstractBaseMutableTag): - """A Python wrapper around a C++ unordered map. - - Note that this class is not thread safe and inherits all the limitations of a C++ unordered_map. - """ - tag_id: int = 10 - - def __init__( - self, - value: ( - Mapping[str | bytes, AbstractBaseTag] - | Iterable[tuple[str | bytes, AbstractBaseTag]] - | Mapping[str, AbstractBaseTag] - | Mapping[bytes, AbstractBaseTag] - ) = (), - **kwargs: AbstractBaseTag, - ) -> None: - self.cpp = make_shared[CCompoundTag]() - self.update(value, **kwargs) - - @staticmethod - cdef CompoundTag wrap(CCompoundTagPtr cpp): - cdef CompoundTag tag = CompoundTag.__new__(CompoundTag) - tag.cpp = cpp - return tag - - cdef TagNode to_node(self): - cdef TagNode node - node.emplace[CCompoundTagPtr](self.cpp) - return node - - @property - def py_dict(self) -> dict[str, amulet_nbt.AnyNBT]: - """A shallow copy of the CompoundTag as a python dictionary.""" - return dict(self) - - @property - def py_data(self) -> Any: - return dict(self) - - cdef string write_nbt(self, string name, endian endianness, CStringEncode string_encode): - return write_named_tag[CCompoundTagPtr](name, self.cpp, endianness, string_encode) - -{{include("amulet_nbt/tpf/to_snbt_multiline.pyx.tpf", tag="compound")}} - - def __eq__(self, object other: Any) -> bool: - if not isinstance(other, CompoundTag): - return False - cdef CompoundTag tag = other - return is_compound_eq(self.cpp, tag.cpp) - - def __repr__(self) -> str: - return f"CompoundTag({dict(self)})" - - def __str__(self) -> str: - return str(dict(self)) - - def __reduce__(self): - cdef bytes nbt = self.write_nbt(b"", endian.big, utf8_escape_to_utf8) - return _unpickle, (nbt,) - - def __copy__(self) -> CompoundTag: - return CompoundTag.wrap( - make_shared[CCompoundTag](dereference(self.cpp)) - ) - - def __deepcopy__(self, memo=None) -> CompoundTag: - return CompoundTag.wrap(CCompoundTagPtr_deepcopy(self.cpp)) - - # Sized - def __len__(self) -> int: - return dereference(self.cpp).size() - - # Iterable - def __iter__(self) -> Iterator[str | bytes]: - cdef CCompoundTag.iterator it = dereference(self.cpp).begin() - cdef string key - while it != dereference(self.cpp).end(): - key = dereference(it).first - try: - yield key - except UnicodeDecodeError as e: - yield key - postincrement(it) - - # Mapping - def __getitem__(self, string key: str | bytes) -> amulet_nbt.AbstractBaseTag: - cdef CCompoundTag.iterator it = dereference(self.cpp).find(key) - - if it == dereference(self.cpp).end(): - raise KeyError(key) - - return wrap_node(&dereference(it).second) - - @overload - def get(self, key: str | bytes) -> AnyNBT | None: ... - @overload - def get(self, key: str | bytes, default: _T) -> AnyNBT | _T: ... - @overload - def get(self, key: str | bytes, *, cls: Type[_TagT]) -> _TagT | None: ... - @overload - def get(self, key: str | bytes, default: _T, cls: Type[_TagT]) -> _TagT | _T: ... - - def get( - self, - string key: str | bytes, - object default: _T = None, - object cls: Type[_TagT] = AbstractBaseTag - ) -> _TagT | _T: - """Get an item from the CompoundTag. - - :param key: The key to get - :param default: The value to return if the key does not exist or the type is wrong. - :param cls: The class that the stored tag must inherit from. If the type is incorrect default is returned. - :return: The tag stored in the CompoundTag if the type is correct else default. - :raises: KeyError if the key does not exist. - :raises: TypeError if the stored type is not a subclass of cls. - """ - cdef CCompoundTag.iterator it = dereference(self.cpp).find(key) - - if it == dereference(self.cpp).end(): - return default - - cdef AbstractBaseTag tag = wrap_node(&dereference(it).second) - if isinstance(tag, cls): - return tag - else: - return default - - def __contains__(self, string key: str | bytes) -> bool: - return dereference(self.cpp).contains(key) - - def keys(self) -> KeysView[str | bytes]: - return KeysView(self) - - def items(self) -> ItemsView[str | bytes, amulet_nbt.AnyNBT]: - return ItemsView(self) - - def values(self) -> ValuesView[amulet_nbt.AnyNBT]: - return ValuesView(self) - - # MutableMapping - def __setitem__(self, string key: str | bytes, AbstractBaseTag tag not None: amulet_nbt.AnyNBT) -> None: - dereference(self.cpp)[ key] = tag.to_node() - - def __delitem__(self, string key: str | bytes) -> None: - dereference(self.cpp).erase(key) - - __marker = object() - - def pop(self, string key, default=__marker) -> amulet_nbt.AnyNBT: - '''D.pop(k[,d]) -> v, remove specified key and return the corresponding value. - If key is not found, d is returned if given, otherwise KeyError is raised. - ''' - cdef CCompoundTag.iterator it = dereference(self.cpp).find(key) - if it == dereference(self.cpp).end(): - if default is self.__marker: - raise KeyError(key) - else: - return default - - cdef AbstractBaseTag tag = wrap_node(&dereference(it).second) - dereference(self.cpp).erase(it) - return tag - - def popitem(self) -> amulet_nbt.AnyNBT: - '''D.popitem() -> (k, v), remove and return some (key, value) pair - as a 2-tuple; but raise KeyError if D is empty. - ''' - cdef CCompoundTag.iterator it = dereference(self.cpp).begin() - if it == dereference(self.cpp).end(): - raise KeyError - - cdef string key = dereference(it).first - cdef AbstractBaseTag tag = wrap_node(&dereference(it).second) - dereference(self.cpp).erase(it) - return key, tag - - def clear(self) -> None: - dereference(self.cpp).clear() - - def update(self, other=(), /, **kwds) -> None: - ''' D.update([E, ]**F) -> None. Update D from mapping/iterable E and F. - If E present and has a .keys() method, does: for k in E: D[k] = E[k] - If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v - In either case, this is followed by: for k, v in F.items(): D[k] = v - ''' - if isinstance(other, Mapping): - for key in other: - self[key] = other[key] - elif hasattr(other, "keys"): - for key in other.keys(): - self[key] = other[key] - else: - for key, value in other: - self[key] = value - for key, value in kwds.items(): - self[key] = value - - def setdefault(self, string key, AbstractBaseTag tag = None, object cls = AbstractBaseTag) -> amulet_nbt.AnyNBT: - cdef CCompoundTag.iterator it = dereference(self.cpp).find(key) - - if it == dereference(self.cpp).end(): - # if the key does not exist then set it - if tag is None: - raise TypeError("Cannot setdefault a value of None.") - self[key] = tag - return tag - - cdef AbstractBaseTag existing_tag = wrap_node(&dereference(it).second) - - if not isinstance(existing_tag, cls): - # if the key exists but has the wrong type then set it - if tag is None: - raise TypeError("Cannot setdefault a value of None.") - self[key] = tag - return tag - - return existing_tag - - @classmethod - def fromkeys(cls, keys: Iterable[str], AbstractBaseTag value) -> CompoundTag: - return cls(dict.fromkeys(keys, value)) - -{{include("amulet_nbt/tpf/CompoundGetSetdefault.pyx.tpf", py_cls="ByteTag", tag_name="byte")}} - -{{include("amulet_nbt/tpf/CompoundGetSetdefault.pyx.tpf", py_cls="ShortTag", tag_name="short")}} - -{{include("amulet_nbt/tpf/CompoundGetSetdefault.pyx.tpf", py_cls="IntTag", tag_name="int")}} - -{{include("amulet_nbt/tpf/CompoundGetSetdefault.pyx.tpf", py_cls="LongTag", tag_name="long")}} - -{{include("amulet_nbt/tpf/CompoundGetSetdefault.pyx.tpf", py_cls="FloatTag", tag_name="float")}} - -{{include("amulet_nbt/tpf/CompoundGetSetdefault.pyx.tpf", py_cls="DoubleTag", tag_name="double")}} - -{{include("amulet_nbt/tpf/CompoundGetSetdefault.pyx.tpf", py_cls="StringTag", tag_name="string")}} - -{{include("amulet_nbt/tpf/CompoundGetSetdefault.pyx.tpf", py_cls="ListTag", tag_name="list")}} - -{{include("amulet_nbt/tpf/CompoundGetSetdefault.pyx.tpf", py_cls="CompoundTag", tag_name="compound")}} - -{{include("amulet_nbt/tpf/CompoundGetSetdefault.pyx.tpf", py_cls="ByteArrayTag", tag_name="byte_array")}} - -{{include("amulet_nbt/tpf/CompoundGetSetdefault.pyx.tpf", py_cls="IntArrayTag", tag_name="int_array")}} - -{{include("amulet_nbt/tpf/CompoundGetSetdefault.pyx.tpf", py_cls="LongArrayTag", tag_name="long_array")}} diff --git a/src_/amulet_nbt/_tag/deepcopy.pxd b/src_/amulet_nbt/_tag/deepcopy.pxd deleted file mode 100644 index 6632a4e3..00000000 --- a/src_/amulet_nbt/_tag/deepcopy.pxd +++ /dev/null @@ -1,4 +0,0 @@ -from amulet_nbt._tag._cpp cimport CListTagPtr, CCompoundTagPtr - -cdef CCompoundTagPtr CCompoundTagPtr_deepcopy(CCompoundTagPtr) noexcept nogil -cdef CListTagPtr CListTagPtr_deepcopy(CListTagPtr) noexcept nogil diff --git a/src_/amulet_nbt/_tag/deepcopy.pyx b/src_/amulet_nbt/_tag/deepcopy.pyx deleted file mode 100644 index 88be7e4d..00000000 --- a/src_/amulet_nbt/_tag/deepcopy.pyx +++ /dev/null @@ -1,128 +0,0 @@ -from libcpp.memory cimport make_shared -from cython.operator cimport dereference, postincrement - -from amulet_nbt._libcpp.variant cimport get - -from amulet_nbt._tag._cpp cimport ( - CByteTag, - CShortTag, - CIntTag, - CLongTag, - CFloatTag, - CDoubleTag, - CStringTag, - CListTag, - CCompoundTag, - CByteArrayTag, - CIntArrayTag, - CLongArrayTag, - CListTagPtr, - CCompoundTagPtr, - CByteArrayTagPtr, - CIntArrayTagPtr, - CLongArrayTagPtr, - CByteList, - CShortList, - CIntList, - CLongList, - CFloatList, - CDoubleList, - CByteArrayList, - CStringList, - CListList, - CCompoundList, - CIntArrayList, - CLongArrayList, - TagNode, -) - -cdef CCompoundTagPtr CCompoundTagPtr_deepcopy(CCompoundTagPtr tag) noexcept nogil: - # Start with a shallow copy and deep copy items as required - tag = make_shared[CCompoundTag](dereference(tag)) - - cdef CCompoundTag.iterator it = dereference(tag).begin() - cdef size_t index - while it != dereference(tag).end(): - index = dereference(it).second.index() - if index == 7: - dereference(it).second.emplace[CByteArrayTagPtr]( - make_shared[CByteArrayTag]( - dereference(get[CByteArrayTagPtr](dereference(it).second)) - ) - ) - elif index == 9: - dereference(it).second.emplace[CListTagPtr]( - CListTagPtr_deepcopy( - get[CListTagPtr](dereference(it).second) - ) - ) - elif index == 10: - dereference(it).second.emplace[CCompoundTagPtr]( - CCompoundTagPtr_deepcopy( - get[CCompoundTagPtr](dereference(it).second) - ) - ) - elif index == 11: - dereference(it).second.emplace[CIntArrayTagPtr]( - make_shared[CIntArrayTag](dereference(get[CIntArrayTagPtr](dereference(it).second))) - ) - elif index == 12: - dereference(it).second.emplace[CLongArrayTagPtr]( - make_shared[CLongArrayTag](dereference(get[CLongArrayTagPtr](dereference(it).second))) - ) - postincrement(it) - return tag - - -cdef inline void _deepcopy_list_list(CListTagPtr tag) noexcept nogil: - cdef CListList* arr = &get[CListList](dereference(tag)) - cdef size_t index - for index in range(dereference(arr).size()): - dereference(arr)[index] = CListTagPtr_deepcopy(dereference(arr)[index]) - - -cdef inline void _deepcopy_compound_list(CListTagPtr tag) noexcept nogil: - cdef CCompoundList* arr = &get[CCompoundList](dereference(tag)) - cdef size_t index - for index in range(dereference(arr).size()): - dereference(arr)[index] = CCompoundTagPtr_deepcopy(dereference(arr)[index]) - - -cdef inline void _deepcopy_byte_array_list(CListTagPtr tag) noexcept nogil: - cdef CByteArrayList* arr = &get[CByteArrayList](dereference(tag)) - cdef size_t index - for index in range(dereference(arr).size()): - dereference(arr)[index] = make_shared[CByteArrayTag](dereference(dereference(arr)[index])) - - -cdef inline void _deepcopy_int_array_list(CListTagPtr tag) noexcept nogil: - cdef CIntArrayList* arr = &get[CIntArrayList](dereference(tag)) - cdef size_t index - for index in range(dereference(arr).size()): - dereference(arr)[index] = make_shared[CIntArrayTag](dereference(dereference(arr)[index])) - - -cdef inline void _deepcopy_long_array_list(CListTagPtr tag) noexcept nogil: - cdef CLongArrayList* arr = &get[CLongArrayList](dereference(tag)) - cdef size_t index - for index in range(dereference(arr).size()): - dereference(arr)[index] = make_shared[CLongArrayTag](dereference(dereference(arr)[index])) - - -cdef CListTagPtr CListTagPtr_deepcopy(CListTagPtr tag) noexcept nogil: - # Start with a shallow copy and deep copy as required - tag = make_shared[CListTag](dereference(tag)) - - cdef size_t index = dereference(tag).index() - if index == 7: - _deepcopy_byte_array_list(tag) - elif index == 9: - _deepcopy_list_list(tag) - elif index == 10: - _deepcopy_compound_list(tag) - elif index == 11: - _deepcopy_int_array_list(tag) - elif index == 12: - _deepcopy_long_array_list(tag) - - return tag diff --git a/src_/amulet_nbt/_tag/float.pxd b/src_/amulet_nbt/_tag/float.pxd deleted file mode 100644 index 831afbb4..00000000 --- a/src_/amulet_nbt/_tag/float.pxd +++ /dev/null @@ -1,20 +0,0 @@ -from amulet_nbt._tag.numeric cimport AbstractBaseNumericTag -from amulet_nbt._tag._cpp cimport CFloatTag, CDoubleTag - - -cdef class AbstractBaseFloatTag(AbstractBaseNumericTag): - pass - - -cdef class FloatTag(AbstractBaseFloatTag): - cdef CFloatTag cpp - - @staticmethod - cdef FloatTag wrap(CFloatTag) - - -cdef class DoubleTag(AbstractBaseFloatTag): - cdef CDoubleTag cpp - - @staticmethod - cdef DoubleTag wrap(CDoubleTag) diff --git a/src_/amulet_nbt/_tag/float.pyx b/src_/amulet_nbt/_tag/float.pyx deleted file mode 100644 index 233d7265..00000000 --- a/src_/amulet_nbt/_tag/float.pyx +++ /dev/null @@ -1,209 +0,0 @@ -## This file is generated from a template. -## Do not modify this file directly or your changes will get overwritten. -## Edit the accompanying .pyx.tp file instead. -# cython: language_level=3, boundscheck=False, wraparound=False -# distutils: language = c++ -# distutils: extra_compile_args = CPPCARGS -# cython: c_string_type=str, c_string_encoding=utf8 - -from typing import Any, SupportsFloat - -from libcpp.string cimport string -from amulet_nbt._libcpp.endian cimport endian -from amulet_nbt._string_encoding._cpp cimport CStringEncode -from amulet_nbt._nbt_encoding._binary cimport write_named_tag -from amulet_nbt._nbt_encoding._string cimport write_float_snbt, write_double_snbt -from amulet_nbt._tag._cpp cimport TagNode, CFloatTag, CDoubleTag -from .numeric cimport AbstractBaseNumericTag - - -cdef class AbstractBaseFloatTag(AbstractBaseNumericTag): - """Abstract Base Class for all float Tag classes""" - - @property - def py_float(self) -> float: - """A python float representation of the class. - - The returned data is immutable so changes will not mirror the instance. - """ - raise NotImplementedError - - @property - def py_data(self) -> Any: - return self.py_float - - -cdef class FloatTag(AbstractBaseFloatTag): - """A single precision float class.""" - tag_id: int = 5 - - def __init__(self, value: SupportsFloat = 0) -> None: - self.cpp = float(value) - - @staticmethod - cdef FloatTag wrap(CFloatTag cpp): - cdef FloatTag tag = FloatTag.__new__(FloatTag) - tag.cpp = cpp - return tag - - cdef TagNode to_node(self): - cdef TagNode node - node.emplace[CFloatTag](self.cpp) - return node - - @property - def py_float(self) -> float: - return self.cpp - - cdef string write_nbt(self, string name, endian endianness, CStringEncode string_encode): - return write_named_tag[CFloatTag](name, self.cpp, endianness, string_encode) - - def to_snbt(self, object indent: None | str | int = None) -> str: - cdef string snbt - write_float_snbt(snbt, self.cpp) - return snbt - - def __eq__(self, object other: Any) -> bool: - if not isinstance(other, FloatTag): - return NotImplemented - cdef FloatTag other_ = other - return self.cpp == other_.cpp - - def __repr__(self) -> str: - return f"FloatTag({self.cpp})" - - def __str__(self) -> str: - return str(self.cpp) - - def __reduce__(self): - return FloatTag, (self.cpp,) - - def __copy__(self) -> FloatTag: - return FloatTag.wrap(self.cpp) - - def __deepcopy__(self, memo=None) -> FloatTag: - return FloatTag.wrap(self.cpp) - - def __hash__(self) -> int: - return hash((5, self.cpp)) - - def __int__(self) -> int: - return int(self.cpp) - - def __float__(self) -> float: - return float(self.cpp) - - def __bool__(self) -> bool: - return bool(self.cpp) - - def __ge__(self, other: Any) -> bool: - if not isinstance(other, FloatTag): - return NotImplemented - cdef FloatTag other_ = other - return self.cpp >= other_.cpp - - def __gt__(self, other: Any) -> bool: - if not isinstance(other, FloatTag): - return NotImplemented - cdef FloatTag other_ = other - return self.cpp > other_.cpp - - def __le__(self, other: Any) -> bool: - if not isinstance(other, FloatTag): - return NotImplemented - cdef FloatTag other_ = other - return self.cpp <= other_.cpp - - def __lt__(self, other: Any) -> bool: - if not isinstance(other, FloatTag): - return NotImplemented - cdef FloatTag other_ = other - return self.cpp < other_.cpp - - -cdef class DoubleTag(AbstractBaseFloatTag): - """A double precision float class.""" - tag_id: int = 6 - - def __init__(self, value: SupportsFloat = 0) -> None: - self.cpp = float(value) - - @staticmethod - cdef DoubleTag wrap(CDoubleTag cpp): - cdef DoubleTag tag = DoubleTag.__new__(DoubleTag) - tag.cpp = cpp - return tag - - cdef TagNode to_node(self): - cdef TagNode node - node.emplace[CDoubleTag](self.cpp) - return node - - @property - def py_float(self) -> float: - return self.cpp - - cdef string write_nbt(self, string name, endian endianness, CStringEncode string_encode): - return write_named_tag[CDoubleTag](name, self.cpp, endianness, string_encode) - - def to_snbt(self, object indent: None | str | int = None) -> str: - cdef string snbt - write_double_snbt(snbt, self.cpp) - return snbt - - def __eq__(self, object other: Any) -> bool: - if not isinstance(other, DoubleTag): - return NotImplemented - cdef DoubleTag other_ = other - return self.cpp == other_.cpp - - def __repr__(self) -> str: - return f"DoubleTag({self.cpp})" - - def __str__(self) -> str: - return str(self.cpp) - - def __reduce__(self): - return DoubleTag, (self.cpp,) - - def __copy__(self) -> DoubleTag: - return DoubleTag.wrap(self.cpp) - - def __deepcopy__(self, memo=None) -> DoubleTag: - return DoubleTag.wrap(self.cpp) - - def __hash__(self) -> int: - return hash((6, self.cpp)) - - def __int__(self) -> int: - return int(self.cpp) - - def __float__(self) -> float: - return float(self.cpp) - - def __bool__(self) -> bool: - return bool(self.cpp) - - def __ge__(self, other: Any) -> bool: - if not isinstance(other, DoubleTag): - return NotImplemented - cdef DoubleTag other_ = other - return self.cpp >= other_.cpp - - def __gt__(self, other: Any) -> bool: - if not isinstance(other, DoubleTag): - return NotImplemented - cdef DoubleTag other_ = other - return self.cpp > other_.cpp - - def __le__(self, other: Any) -> bool: - if not isinstance(other, DoubleTag): - return NotImplemented - cdef DoubleTag other_ = other - return self.cpp <= other_.cpp - - def __lt__(self, other: Any) -> bool: - if not isinstance(other, DoubleTag): - return NotImplemented - cdef DoubleTag other_ = other - return self.cpp < other_.cpp diff --git a/src_/amulet_nbt/_tag/float.pyx.tp b/src_/amulet_nbt/_tag/float.pyx.tp deleted file mode 100644 index 7d335f53..00000000 --- a/src_/amulet_nbt/_tag/float.pyx.tp +++ /dev/null @@ -1,55 +0,0 @@ -{{py: -import base64 -from template import include -}} -{{base64.b64decode("IyMgVGhpcyBmaWxlIGlzIGdlbmVyYXRlZCBmcm9tIGEgdGVtcGxhdGUuCiMjIERvIG5vdCBtb2RpZnkgdGhpcyBmaWxlIGRpcmVjdGx5IG9yIHlvdXIgY2hhbmdlcyB3aWxsIGdldCBvdmVyd3JpdHRlbi4KIyMgRWRpdCB0aGUgYWNjb21wYW55aW5nIC5weXgudHAgZmlsZSBpbnN0ZWFkLg==").decode()}} -# cython: language_level=3, boundscheck=False, wraparound=False -# distutils: language = c++ -# distutils: extra_compile_args = CPPCARGS -# cython: c_string_type=str, c_string_encoding=utf8 - -from typing import Any, SupportsFloat - -from libcpp.string cimport string -from amulet_nbt._libcpp.endian cimport endian -from amulet_nbt._string_encoding._cpp cimport CStringEncode -from amulet_nbt._nbt_encoding._binary cimport write_named_tag -from amulet_nbt._nbt_encoding._string cimport write_float_snbt, write_double_snbt -from amulet_nbt._tag._cpp cimport TagNode, CFloatTag, CDoubleTag -from .numeric cimport AbstractBaseNumericTag - - -cdef class AbstractBaseFloatTag(AbstractBaseNumericTag): - """Abstract Base Class for all float Tag classes""" - - @property - def py_float(self) -> float: - """A python float representation of the class. - - The returned data is immutable so changes will not mirror the instance. - """ - raise NotImplementedError - - @property - def py_data(self) -> Any: - return self.py_float - - -cdef class FloatTag(AbstractBaseFloatTag): - """A single precision float class.""" - tag_id: int = 5 - - def __init__(self, value: SupportsFloat = 0) -> None: - self.cpp = float(value) - -{{include("amulet_nbt/tpf/FloatTag.pyx.tpf", py_cls="FloatTag", tag_id=5, tag="float")}} - - -cdef class DoubleTag(AbstractBaseFloatTag): - """A double precision float class.""" - tag_id: int = 6 - - def __init__(self, value: SupportsFloat = 0) -> None: - self.cpp = float(value) - -{{include("amulet_nbt/tpf/FloatTag.pyx.tpf", py_cls="DoubleTag", tag_id=6, tag="double")}} diff --git a/src_/amulet_nbt/_tag/int.pxd b/src_/amulet_nbt/_tag/int.pxd deleted file mode 100644 index 47545519..00000000 --- a/src_/amulet_nbt/_tag/int.pxd +++ /dev/null @@ -1,34 +0,0 @@ -from amulet_nbt._tag.numeric cimport AbstractBaseNumericTag -from amulet_nbt._tag._cpp cimport CByteTag, CShortTag, CIntTag, CLongTag - - -cdef class AbstractBaseIntTag(AbstractBaseNumericTag): - pass - - -cdef class ByteTag(AbstractBaseIntTag): - cdef CByteTag cpp - - @staticmethod - cdef ByteTag wrap(CByteTag) - - -cdef class ShortTag(AbstractBaseIntTag): - cdef CShortTag cpp - - @staticmethod - cdef ShortTag wrap(CShortTag) - - -cdef class IntTag(AbstractBaseIntTag): - cdef CIntTag cpp - - @staticmethod - cdef IntTag wrap(CIntTag) - - -cdef class LongTag(AbstractBaseIntTag): - cdef CLongTag cpp - - @staticmethod - cdef LongTag wrap(CLongTag) diff --git a/src_/amulet_nbt/_tag/int.pyx b/src_/amulet_nbt/_tag/int.pyx deleted file mode 100644 index 9b5b1807..00000000 --- a/src_/amulet_nbt/_tag/int.pyx +++ /dev/null @@ -1,417 +0,0 @@ -## This file is generated from a template. -## Do not modify this file directly or your changes will get overwritten. -## Edit the accompanying .pyx.tp file instead. -# cython: language_level=3, boundscheck=False, wraparound=False -# distutils: language = c++ -# distutils: extra_compile_args = CPPCARGS -# cython: c_string_type=str, c_string_encoding=utf8 - -from typing import Any, SupportsInt - -from libcpp.string cimport string -from amulet_nbt._libcpp.endian cimport endian -from amulet_nbt._string_encoding._cpp cimport CStringEncode -from amulet_nbt._nbt_encoding._binary cimport write_named_tag -from amulet_nbt._nbt_encoding._string cimport write_byte_snbt, write_short_snbt, write_int_snbt, write_long_snbt -from amulet_nbt._tag._cpp cimport TagNode, CByteTag, CShortTag, CIntTag, CLongTag -from .numeric cimport AbstractBaseNumericTag - - -cdef class AbstractBaseIntTag(AbstractBaseNumericTag): - """Abstract Base Class for all int Tag classes""" - - @property - def py_int(self) -> int: - """A python int representation of the class. - - The returned data is immutable so changes will not mirror the instance. - """ - raise NotImplementedError - - @property - def py_data(self) -> Any: - return self.py_int - - -cdef class ByteTag(AbstractBaseIntTag): - """A 1 byte integer class. - - Can Store numbers between -(2^7) and (2^7 - 1) - """ - tag_id: int = 1 - - def __init__(self, value: SupportsInt = 0) -> None: - value = int(value) - self.cpp = (value & 0x7F) - (value & 0x80) - - @staticmethod - cdef ByteTag wrap(CByteTag cpp): - cdef ByteTag tag = ByteTag.__new__(ByteTag) - tag.cpp = cpp - return tag - - cdef TagNode to_node(self): - cdef TagNode node - node.emplace[CByteTag](self.cpp) - return node - - @property - def py_int(self) -> int: - """A python int representation of the class. - - The returned data is immutable so changes will not mirror the instance. - """ - return self.cpp - - cdef string write_nbt(self, string name, endian endianness, CStringEncode string_encode): - return write_named_tag[CByteTag](name, self.cpp, endianness, string_encode) - - def to_snbt(self, object indent: None | str | int = None) -> str: - cdef string snbt - write_byte_snbt(snbt, self.cpp) - return snbt - - def __eq__(self, object other: Any) -> bool: - if not isinstance(other, ByteTag): - return NotImplemented - cdef ByteTag other_ = other - return self.cpp == other_.cpp - - def __repr__(self) -> str: - return f"ByteTag({self.cpp})" - - def __str__(self) -> str: - return str(self.cpp) - - def __reduce__(self): - return ByteTag, (self.cpp,) - - def __copy__(self) -> ByteTag: - return ByteTag.wrap(self.cpp) - - def __deepcopy__(self, memo=None) -> ByteTag: - return ByteTag.wrap(self.cpp) - - def __hash__(self) -> int: - return hash((1, self.cpp)) - - def __int__(self) -> int: - return int(self.cpp) - - def __float__(self) -> float: - return float(self.cpp) - - def __bool__(self) -> bool: - return bool(self.cpp) - - def __ge__(self, other: Any) -> bool: - if not isinstance(other, ByteTag): - return NotImplemented - cdef ByteTag other_ = other - return self.cpp >= other_.cpp - - def __gt__(self, other: Any) -> bool: - if not isinstance(other, ByteTag): - return NotImplemented - cdef ByteTag other_ = other - return self.cpp > other_.cpp - - def __le__(self, other: Any) -> bool: - if not isinstance(other, ByteTag): - return NotImplemented - cdef ByteTag other_ = other - return self.cpp <= other_.cpp - - def __lt__(self, other: Any) -> bool: - if not isinstance(other, ByteTag): - return NotImplemented - cdef ByteTag other_ = other - return self.cpp < other_.cpp - - -cdef class ShortTag(AbstractBaseIntTag): - """A 2 byte integer class. - - Can Store numbers between -(2^15) and (2^15 - 1) - """ - tag_id: int = 2 - - def __init__(self, value: SupportsInt = 0) -> None: - value = int(value) - self.cpp = (value & 0x7FFF) - (value & 0x8000) - - @staticmethod - cdef ShortTag wrap(CShortTag cpp): - cdef ShortTag tag = ShortTag.__new__(ShortTag) - tag.cpp = cpp - return tag - - cdef TagNode to_node(self): - cdef TagNode node - node.emplace[CShortTag](self.cpp) - return node - - @property - def py_int(self) -> int: - """A python int representation of the class. - - The returned data is immutable so changes will not mirror the instance. - """ - return self.cpp - - cdef string write_nbt(self, string name, endian endianness, CStringEncode string_encode): - return write_named_tag[CShortTag](name, self.cpp, endianness, string_encode) - - def to_snbt(self, object indent: None | str | int = None) -> str: - cdef string snbt - write_short_snbt(snbt, self.cpp) - return snbt - - def __eq__(self, object other: Any) -> bool: - if not isinstance(other, ShortTag): - return NotImplemented - cdef ShortTag other_ = other - return self.cpp == other_.cpp - - def __repr__(self) -> str: - return f"ShortTag({self.cpp})" - - def __str__(self) -> str: - return str(self.cpp) - - def __reduce__(self): - return ShortTag, (self.cpp,) - - def __copy__(self) -> ShortTag: - return ShortTag.wrap(self.cpp) - - def __deepcopy__(self, memo=None) -> ShortTag: - return ShortTag.wrap(self.cpp) - - def __hash__(self) -> int: - return hash((2, self.cpp)) - - def __int__(self) -> int: - return int(self.cpp) - - def __float__(self) -> float: - return float(self.cpp) - - def __bool__(self) -> bool: - return bool(self.cpp) - - def __ge__(self, other: Any) -> bool: - if not isinstance(other, ShortTag): - return NotImplemented - cdef ShortTag other_ = other - return self.cpp >= other_.cpp - - def __gt__(self, other: Any) -> bool: - if not isinstance(other, ShortTag): - return NotImplemented - cdef ShortTag other_ = other - return self.cpp > other_.cpp - - def __le__(self, other: Any) -> bool: - if not isinstance(other, ShortTag): - return NotImplemented - cdef ShortTag other_ = other - return self.cpp <= other_.cpp - - def __lt__(self, other: Any) -> bool: - if not isinstance(other, ShortTag): - return NotImplemented - cdef ShortTag other_ = other - return self.cpp < other_.cpp - - -cdef class IntTag(AbstractBaseIntTag): - """A 4 byte integer class. - - Can Store numbers between -(2^31) and (2^31 - 1) - """ - tag_id: int = 3 - - def __init__(self, value: SupportsInt = 0) -> None: - value = int(value) - self.cpp = (value & 0x7FFF_FFFF) - (value & 0x8000_0000) - - @staticmethod - cdef IntTag wrap(CIntTag cpp): - cdef IntTag tag = IntTag.__new__(IntTag) - tag.cpp = cpp - return tag - - cdef TagNode to_node(self): - cdef TagNode node - node.emplace[CIntTag](self.cpp) - return node - - @property - def py_int(self) -> int: - """A python int representation of the class. - - The returned data is immutable so changes will not mirror the instance. - """ - return self.cpp - - cdef string write_nbt(self, string name, endian endianness, CStringEncode string_encode): - return write_named_tag[CIntTag](name, self.cpp, endianness, string_encode) - - def to_snbt(self, object indent: None | str | int = None) -> str: - cdef string snbt - write_int_snbt(snbt, self.cpp) - return snbt - - def __eq__(self, object other: Any) -> bool: - if not isinstance(other, IntTag): - return NotImplemented - cdef IntTag other_ = other - return self.cpp == other_.cpp - - def __repr__(self) -> str: - return f"IntTag({self.cpp})" - - def __str__(self) -> str: - return str(self.cpp) - - def __reduce__(self): - return IntTag, (self.cpp,) - - def __copy__(self) -> IntTag: - return IntTag.wrap(self.cpp) - - def __deepcopy__(self, memo=None) -> IntTag: - return IntTag.wrap(self.cpp) - - def __hash__(self) -> int: - return hash((3, self.cpp)) - - def __int__(self) -> int: - return int(self.cpp) - - def __float__(self) -> float: - return float(self.cpp) - - def __bool__(self) -> bool: - return bool(self.cpp) - - def __ge__(self, other: Any) -> bool: - if not isinstance(other, IntTag): - return NotImplemented - cdef IntTag other_ = other - return self.cpp >= other_.cpp - - def __gt__(self, other: Any) -> bool: - if not isinstance(other, IntTag): - return NotImplemented - cdef IntTag other_ = other - return self.cpp > other_.cpp - - def __le__(self, other: Any) -> bool: - if not isinstance(other, IntTag): - return NotImplemented - cdef IntTag other_ = other - return self.cpp <= other_.cpp - - def __lt__(self, other: Any) -> bool: - if not isinstance(other, IntTag): - return NotImplemented - cdef IntTag other_ = other - return self.cpp < other_.cpp - - -cdef class LongTag(AbstractBaseIntTag): - """An 8 byte integer class. - - Can Store numbers between -(2^63) and (2^63 - 1) - """ - tag_id: int = 4 - - def __init__(self, value: SupportsInt = 0) -> None: - value = int(value) - self.cpp = (value & 0x7FFF_FFFF_FFFF_FFFF) - (value & 0x8000_0000_0000_0000) - - @staticmethod - cdef LongTag wrap(CLongTag cpp): - cdef LongTag tag = LongTag.__new__(LongTag) - tag.cpp = cpp - return tag - - cdef TagNode to_node(self): - cdef TagNode node - node.emplace[CLongTag](self.cpp) - return node - - @property - def py_int(self) -> int: - """A python int representation of the class. - - The returned data is immutable so changes will not mirror the instance. - """ - return self.cpp - - cdef string write_nbt(self, string name, endian endianness, CStringEncode string_encode): - return write_named_tag[CLongTag](name, self.cpp, endianness, string_encode) - - def to_snbt(self, object indent: None | str | int = None) -> str: - cdef string snbt - write_long_snbt(snbt, self.cpp) - return snbt - - def __eq__(self, object other: Any) -> bool: - if not isinstance(other, LongTag): - return NotImplemented - cdef LongTag other_ = other - return self.cpp == other_.cpp - - def __repr__(self) -> str: - return f"LongTag({self.cpp})" - - def __str__(self) -> str: - return str(self.cpp) - - def __reduce__(self): - return LongTag, (self.cpp,) - - def __copy__(self) -> LongTag: - return LongTag.wrap(self.cpp) - - def __deepcopy__(self, memo=None) -> LongTag: - return LongTag.wrap(self.cpp) - - def __hash__(self) -> int: - return hash((4, self.cpp)) - - def __int__(self) -> int: - return int(self.cpp) - - def __float__(self) -> float: - return float(self.cpp) - - def __bool__(self) -> bool: - return bool(self.cpp) - - def __ge__(self, other: Any) -> bool: - if not isinstance(other, LongTag): - return NotImplemented - cdef LongTag other_ = other - return self.cpp >= other_.cpp - - def __gt__(self, other: Any) -> bool: - if not isinstance(other, LongTag): - return NotImplemented - cdef LongTag other_ = other - return self.cpp > other_.cpp - - def __le__(self, other: Any) -> bool: - if not isinstance(other, LongTag): - return NotImplemented - cdef LongTag other_ = other - return self.cpp <= other_.cpp - - def __lt__(self, other: Any) -> bool: - if not isinstance(other, LongTag): - return NotImplemented - cdef LongTag other_ = other - return self.cpp < other_.cpp diff --git a/src_/amulet_nbt/_tag/int.pyx.tp b/src_/amulet_nbt/_tag/int.pyx.tp deleted file mode 100644 index fb9c34b8..00000000 --- a/src_/amulet_nbt/_tag/int.pyx.tp +++ /dev/null @@ -1,91 +0,0 @@ -{{py: -import base64 -from template import include -}} -{{base64.b64decode("IyMgVGhpcyBmaWxlIGlzIGdlbmVyYXRlZCBmcm9tIGEgdGVtcGxhdGUuCiMjIERvIG5vdCBtb2RpZnkgdGhpcyBmaWxlIGRpcmVjdGx5IG9yIHlvdXIgY2hhbmdlcyB3aWxsIGdldCBvdmVyd3JpdHRlbi4KIyMgRWRpdCB0aGUgYWNjb21wYW55aW5nIC5weXgudHAgZmlsZSBpbnN0ZWFkLg==").decode()}} -# cython: language_level=3, boundscheck=False, wraparound=False -# distutils: language = c++ -# distutils: extra_compile_args = CPPCARGS -# cython: c_string_type=str, c_string_encoding=utf8 - -from typing import Any, SupportsInt - -from libcpp.string cimport string -from amulet_nbt._libcpp.endian cimport endian -from amulet_nbt._string_encoding._cpp cimport CStringEncode -from amulet_nbt._nbt_encoding._binary cimport write_named_tag -from amulet_nbt._nbt_encoding._string cimport write_byte_snbt, write_short_snbt, write_int_snbt, write_long_snbt -from amulet_nbt._tag._cpp cimport TagNode, CByteTag, CShortTag, CIntTag, CLongTag -from .numeric cimport AbstractBaseNumericTag - - -cdef class AbstractBaseIntTag(AbstractBaseNumericTag): - """Abstract Base Class for all int Tag classes""" - - @property - def py_int(self) -> int: - """A python int representation of the class. - - The returned data is immutable so changes will not mirror the instance. - """ - raise NotImplementedError - - @property - def py_data(self) -> Any: - return self.py_int - - -cdef class ByteTag(AbstractBaseIntTag): - """A 1 byte integer class. - - Can Store numbers between -(2^7) and (2^7 - 1) - """ - tag_id: int = 1 - - def __init__(self, value: SupportsInt = 0) -> None: - value = int(value) - self.cpp = (value & 0x7F) - (value & 0x80) - -{{include("amulet_nbt/tpf/IntTag.pyx.tpf", py_cls="ByteTag", tag_id=1, tag="byte")}} - - -cdef class ShortTag(AbstractBaseIntTag): - """A 2 byte integer class. - - Can Store numbers between -(2^15) and (2^15 - 1) - """ - tag_id: int = 2 - - def __init__(self, value: SupportsInt = 0) -> None: - value = int(value) - self.cpp = (value & 0x7FFF) - (value & 0x8000) - -{{include("amulet_nbt/tpf/IntTag.pyx.tpf", py_cls="ShortTag", tag_id=2, tag="short")}} - - -cdef class IntTag(AbstractBaseIntTag): - """A 4 byte integer class. - - Can Store numbers between -(2^31) and (2^31 - 1) - """ - tag_id: int = 3 - - def __init__(self, value: SupportsInt = 0) -> None: - value = int(value) - self.cpp = (value & 0x7FFF_FFFF) - (value & 0x8000_0000) - -{{include("amulet_nbt/tpf/IntTag.pyx.tpf", py_cls="IntTag", tag_id=3, tag="int")}} - - -cdef class LongTag(AbstractBaseIntTag): - """An 8 byte integer class. - - Can Store numbers between -(2^63) and (2^63 - 1) - """ - tag_id: int = 4 - - def __init__(self, value: SupportsInt = 0) -> None: - value = int(value) - self.cpp = (value & 0x7FFF_FFFF_FFFF_FFFF) - (value & 0x8000_0000_0000_0000) - -{{include("amulet_nbt/tpf/IntTag.pyx.tpf", py_cls="LongTag", tag_id=4, tag="long")}} diff --git a/src_/amulet_nbt/_tag/list.pxd b/src_/amulet_nbt/_tag/list.pxd deleted file mode 100644 index b293f874..00000000 --- a/src_/amulet_nbt/_tag/list.pxd +++ /dev/null @@ -1,19 +0,0 @@ -from libcpp cimport bool -from amulet_nbt._tag.abc cimport AbstractBaseMutableTag, AbstractBaseTag -from amulet_nbt._tag._cpp cimport CListTagPtr - -from amulet_nbt._tag.int cimport ByteTag, ShortTag, IntTag, LongTag -from amulet_nbt._tag.float cimport FloatTag, DoubleTag -from amulet_nbt._tag.string cimport StringTag -from amulet_nbt._tag.compound cimport CompoundTag -from amulet_nbt._tag.array cimport ByteArrayTag, IntArrayTag, LongArrayTag - - -cdef bool is_list_eq(CListTagPtr a, CListTagPtr b) noexcept nogil - - -cdef class ListTag(AbstractBaseMutableTag): - cdef CListTagPtr cpp - - @staticmethod - cdef ListTag wrap(CListTagPtr) diff --git a/src_/amulet_nbt/_tag/list.pyx b/src_/amulet_nbt/_tag/list.pyx deleted file mode 100644 index c912f80f..00000000 --- a/src_/amulet_nbt/_tag/list.pyx +++ /dev/null @@ -1,2469 +0,0 @@ -## This file is generated from a template. -## Do not modify this file directly or your changes will get overwritten. -## Edit the accompanying .pyx.tp file instead. -# cython: language_level=3, boundscheck=False, wraparound=False -# distutils: language = c++ -# distutils: extra_compile_args = CPPCARGS -# cython: c_string_type=str, c_string_encoding=utf8 -# distutils: sources = [src/amulet_nbt/_string_encoding/_cpp/utf8.cpp, src/amulet_nbt/_nbt_encoding/_binary/_cpp/read_nbt.cpp] - -from typing import Any, Type -from collections.abc import Iterable - -from libc.math cimport ceil -from libcpp cimport bool -from libcpp.pair cimport pair -from libcpp.memory cimport make_shared -from libcpp.string cimport string -from cython.operator cimport dereference -import amulet_nbt -from amulet_nbt._libcpp.variant cimport get, monostate -from amulet_nbt._libcpp.endian cimport endian -from amulet_nbt._string_encoding._cpp cimport CStringEncode -from amulet_nbt._string_encoding._cpp.utf8 cimport utf8_escape_to_utf8, utf8_to_utf8_escape -from amulet_nbt._nbt_encoding._binary._cpp cimport read_named_tag -from amulet_nbt._nbt_encoding._binary cimport write_named_tag -from amulet_nbt._nbt_encoding._string cimport write_list_snbt - -from amulet_nbt._tag._cpp cimport ( - TagNode, - CListTag, - CListTagPtr, - CByteList, - CShortList, - CIntList, - CLongList, - CFloatList, - CDoubleList, - CByteArrayList, - CStringList, - CListList, - CCompoundList, - CIntArrayList, - CLongArrayList, -) -from .abc cimport AbstractBaseTag, AbstractBaseMutableTag -from .int cimport ByteTag, ShortTag, IntTag, LongTag -from .float cimport FloatTag, DoubleTag -from .string cimport StringTag -from .compound cimport CompoundTag -from .array cimport ByteArrayTag, IntArrayTag, LongArrayTag -from .deepcopy cimport CListTagPtr_deepcopy -from .compound cimport is_compound_eq - -cdef inline ByteTag ListTag_get_item_byte_tag(CListTagPtr cpp, ptrdiff_t item): - cdef CByteList* byte_list = &get[CByteList](dereference(cpp)) - if item < 0: - item += dereference(byte_list).size() - if item < 0 or item >= dereference(byte_list).size(): - raise IndexError("ListTag index out of range") - return ByteTag.wrap(dereference(byte_list)[item]) - - -cdef inline ShortTag ListTag_get_item_short_tag(CListTagPtr cpp, ptrdiff_t item): - cdef CShortList* short_list = &get[CShortList](dereference(cpp)) - if item < 0: - item += dereference(short_list).size() - if item < 0 or item >= dereference(short_list).size(): - raise IndexError("ListTag index out of range") - return ShortTag.wrap(dereference(short_list)[item]) - - -cdef inline IntTag ListTag_get_item_int_tag(CListTagPtr cpp, ptrdiff_t item): - cdef CIntList* int_list = &get[CIntList](dereference(cpp)) - if item < 0: - item += dereference(int_list).size() - if item < 0 or item >= dereference(int_list).size(): - raise IndexError("ListTag index out of range") - return IntTag.wrap(dereference(int_list)[item]) - - -cdef inline LongTag ListTag_get_item_long_tag(CListTagPtr cpp, ptrdiff_t item): - cdef CLongList* long_list = &get[CLongList](dereference(cpp)) - if item < 0: - item += dereference(long_list).size() - if item < 0 or item >= dereference(long_list).size(): - raise IndexError("ListTag index out of range") - return LongTag.wrap(dereference(long_list)[item]) - - -cdef inline FloatTag ListTag_get_item_float_tag(CListTagPtr cpp, ptrdiff_t item): - cdef CFloatList* float_list = &get[CFloatList](dereference(cpp)) - if item < 0: - item += dereference(float_list).size() - if item < 0 or item >= dereference(float_list).size(): - raise IndexError("ListTag index out of range") - return FloatTag.wrap(dereference(float_list)[item]) - - -cdef inline DoubleTag ListTag_get_item_double_tag(CListTagPtr cpp, ptrdiff_t item): - cdef CDoubleList* double_list = &get[CDoubleList](dereference(cpp)) - if item < 0: - item += dereference(double_list).size() - if item < 0 or item >= dereference(double_list).size(): - raise IndexError("ListTag index out of range") - return DoubleTag.wrap(dereference(double_list)[item]) - - -cdef inline ByteArrayTag ListTag_get_item_byte_array_tag(CListTagPtr cpp, ptrdiff_t item): - cdef CByteArrayList* byte_array_list = &get[CByteArrayList](dereference(cpp)) - if item < 0: - item += dereference(byte_array_list).size() - if item < 0 or item >= dereference(byte_array_list).size(): - raise IndexError("ListTag index out of range") - return ByteArrayTag.wrap(dereference(byte_array_list)[item]) - - -cdef inline StringTag ListTag_get_item_string_tag(CListTagPtr cpp, ptrdiff_t item): - cdef CStringList* string_list = &get[CStringList](dereference(cpp)) - if item < 0: - item += dereference(string_list).size() - if item < 0 or item >= dereference(string_list).size(): - raise IndexError("ListTag index out of range") - return StringTag.wrap(dereference(string_list)[item]) - - -cdef inline ListTag ListTag_get_item_list_tag(CListTagPtr cpp, ptrdiff_t item): - cdef CListList* list_list = &get[CListList](dereference(cpp)) - if item < 0: - item += dereference(list_list).size() - if item < 0 or item >= dereference(list_list).size(): - raise IndexError("ListTag index out of range") - return ListTag.wrap(dereference(list_list)[item]) - - -cdef inline CompoundTag ListTag_get_item_compound_tag(CListTagPtr cpp, ptrdiff_t item): - cdef CCompoundList* compound_list = &get[CCompoundList](dereference(cpp)) - if item < 0: - item += dereference(compound_list).size() - if item < 0 or item >= dereference(compound_list).size(): - raise IndexError("ListTag index out of range") - return CompoundTag.wrap(dereference(compound_list)[item]) - - -cdef inline IntArrayTag ListTag_get_item_int_array_tag(CListTagPtr cpp, ptrdiff_t item): - cdef CIntArrayList* int_array_list = &get[CIntArrayList](dereference(cpp)) - if item < 0: - item += dereference(int_array_list).size() - if item < 0 or item >= dereference(int_array_list).size(): - raise IndexError("ListTag index out of range") - return IntArrayTag.wrap(dereference(int_array_list)[item]) - - -cdef inline LongArrayTag ListTag_get_item_long_array_tag(CListTagPtr cpp, ptrdiff_t item): - cdef CLongArrayList* long_array_list = &get[CLongArrayList](dereference(cpp)) - if item < 0: - item += dereference(long_array_list).size() - if item < 0 or item >= dereference(long_array_list).size(): - raise IndexError("ListTag index out of range") - return LongArrayTag.wrap(dereference(long_array_list)[item]) - - -cdef inline AbstractBaseTag ListTag_get_item(CListTagPtr cpp, ptrdiff_t item): - cdef size_t index = dereference(cpp).index() - if index == 1: - return ListTag_get_item_byte_tag(cpp, item) - elif index == 2: - return ListTag_get_item_short_tag(cpp, item) - elif index == 3: - return ListTag_get_item_int_tag(cpp, item) - elif index == 4: - return ListTag_get_item_long_tag(cpp, item) - elif index == 5: - return ListTag_get_item_float_tag(cpp, item) - elif index == 6: - return ListTag_get_item_double_tag(cpp, item) - elif index == 7: - return ListTag_get_item_byte_array_tag(cpp, item) - elif index == 8: - return ListTag_get_item_string_tag(cpp, item) - elif index == 9: - return ListTag_get_item_list_tag(cpp, item) - elif index == 10: - return ListTag_get_item_compound_tag(cpp, item) - elif index == 11: - return ListTag_get_item_int_array_tag(cpp, item) - elif index == 12: - return ListTag_get_item_long_array_tag(cpp, item) - else: - raise IndexError("ListTag index out of range.") - - -cdef (size_t, size_t, ptrdiff_t) _slice_to_range(size_t target_len, object s): - cdef ptrdiff_t start - cdef ptrdiff_t stop - cdef ptrdiff_t step - - if s.step is None: - step = 1 - else: - step = s.step - - if step > 0: - if s.start is None: - start = 0 - elif s.start < 0: - start = s.start + target_len - else: - start = s.start - start = min(max(0, start), target_len) - if s.stop is None: - stop = target_len - elif s.stop < 0: - stop = s.stop + target_len - else: - stop = s.stop - stop = min(max(0, stop), target_len) - - elif step < 0: - if s.start is None: - start = target_len - 1 - elif s.start < 0: - start = s.start + target_len - else: - start = s.start - start = min(max(-1, start), target_len - 1) - if s.stop is None: - stop = -1 - elif s.stop < 0: - stop = s.stop + target_len - else: - stop = s.stop - stop = min(max(-1, stop), target_len - 1) - - elif step == 0: - raise ValueError("slice step cannot be zero") - else: - raise RuntimeError - - return start, stop, step - - -cdef inline list ListTag_get_slice_byte_tag(CListTagPtr cpp, object s): - cdef size_t start - cdef size_t stop - cdef ptrdiff_t step - cdef size_t item - - cdef CByteList* byte_list = &get[CByteList](dereference(cpp)) - - start, stop, step = _slice_to_range(dereference(byte_list).size(), s) - return [ - ByteTag.wrap(dereference(byte_list)[item]) - for item in range(start, stop, step) - ] - - -cdef inline list ListTag_get_slice_short_tag(CListTagPtr cpp, object s): - cdef size_t start - cdef size_t stop - cdef ptrdiff_t step - cdef size_t item - - cdef CShortList* short_list = &get[CShortList](dereference(cpp)) - - start, stop, step = _slice_to_range(dereference(short_list).size(), s) - return [ - ShortTag.wrap(dereference(short_list)[item]) - for item in range(start, stop, step) - ] - - -cdef inline list ListTag_get_slice_int_tag(CListTagPtr cpp, object s): - cdef size_t start - cdef size_t stop - cdef ptrdiff_t step - cdef size_t item - - cdef CIntList* int_list = &get[CIntList](dereference(cpp)) - - start, stop, step = _slice_to_range(dereference(int_list).size(), s) - return [ - IntTag.wrap(dereference(int_list)[item]) - for item in range(start, stop, step) - ] - - -cdef inline list ListTag_get_slice_long_tag(CListTagPtr cpp, object s): - cdef size_t start - cdef size_t stop - cdef ptrdiff_t step - cdef size_t item - - cdef CLongList* long_list = &get[CLongList](dereference(cpp)) - - start, stop, step = _slice_to_range(dereference(long_list).size(), s) - return [ - LongTag.wrap(dereference(long_list)[item]) - for item in range(start, stop, step) - ] - - -cdef inline list ListTag_get_slice_float_tag(CListTagPtr cpp, object s): - cdef size_t start - cdef size_t stop - cdef ptrdiff_t step - cdef size_t item - - cdef CFloatList* float_list = &get[CFloatList](dereference(cpp)) - - start, stop, step = _slice_to_range(dereference(float_list).size(), s) - return [ - FloatTag.wrap(dereference(float_list)[item]) - for item in range(start, stop, step) - ] - - -cdef inline list ListTag_get_slice_double_tag(CListTagPtr cpp, object s): - cdef size_t start - cdef size_t stop - cdef ptrdiff_t step - cdef size_t item - - cdef CDoubleList* double_list = &get[CDoubleList](dereference(cpp)) - - start, stop, step = _slice_to_range(dereference(double_list).size(), s) - return [ - DoubleTag.wrap(dereference(double_list)[item]) - for item in range(start, stop, step) - ] - - -cdef inline list ListTag_get_slice_byte_array_tag(CListTagPtr cpp, object s): - cdef size_t start - cdef size_t stop - cdef ptrdiff_t step - cdef size_t item - - cdef CByteArrayList* byte_array_list = &get[CByteArrayList](dereference(cpp)) - - start, stop, step = _slice_to_range(dereference(byte_array_list).size(), s) - return [ - ByteArrayTag.wrap(dereference(byte_array_list)[item]) - for item in range(start, stop, step) - ] - - -cdef inline list ListTag_get_slice_string_tag(CListTagPtr cpp, object s): - cdef size_t start - cdef size_t stop - cdef ptrdiff_t step - cdef size_t item - - cdef CStringList* string_list = &get[CStringList](dereference(cpp)) - - start, stop, step = _slice_to_range(dereference(string_list).size(), s) - return [ - StringTag.wrap(dereference(string_list)[item]) - for item in range(start, stop, step) - ] - - -cdef inline list ListTag_get_slice_list_tag(CListTagPtr cpp, object s): - cdef size_t start - cdef size_t stop - cdef ptrdiff_t step - cdef size_t item - - cdef CListList* list_list = &get[CListList](dereference(cpp)) - - start, stop, step = _slice_to_range(dereference(list_list).size(), s) - return [ - ListTag.wrap(dereference(list_list)[item]) - for item in range(start, stop, step) - ] - - -cdef inline list ListTag_get_slice_compound_tag(CListTagPtr cpp, object s): - cdef size_t start - cdef size_t stop - cdef ptrdiff_t step - cdef size_t item - - cdef CCompoundList* compound_list = &get[CCompoundList](dereference(cpp)) - - start, stop, step = _slice_to_range(dereference(compound_list).size(), s) - return [ - CompoundTag.wrap(dereference(compound_list)[item]) - for item in range(start, stop, step) - ] - - -cdef inline list ListTag_get_slice_int_array_tag(CListTagPtr cpp, object s): - cdef size_t start - cdef size_t stop - cdef ptrdiff_t step - cdef size_t item - - cdef CIntArrayList* int_array_list = &get[CIntArrayList](dereference(cpp)) - - start, stop, step = _slice_to_range(dereference(int_array_list).size(), s) - return [ - IntArrayTag.wrap(dereference(int_array_list)[item]) - for item in range(start, stop, step) - ] - - -cdef inline list ListTag_get_slice_long_array_tag(CListTagPtr cpp, object s): - cdef size_t start - cdef size_t stop - cdef ptrdiff_t step - cdef size_t item - - cdef CLongArrayList* long_array_list = &get[CLongArrayList](dereference(cpp)) - - start, stop, step = _slice_to_range(dereference(long_array_list).size(), s) - return [ - LongArrayTag.wrap(dereference(long_array_list)[item]) - for item in range(start, stop, step) - ] - - -cdef inline list ListTag_get_slice(CListTagPtr cpp, object s): - cdef size_t index = dereference(cpp).index() - if index == 1: - return ListTag_get_slice_byte_tag(cpp, s) - elif index == 2: - return ListTag_get_slice_short_tag(cpp, s) - elif index == 3: - return ListTag_get_slice_int_tag(cpp, s) - elif index == 4: - return ListTag_get_slice_long_tag(cpp, s) - elif index == 5: - return ListTag_get_slice_float_tag(cpp, s) - elif index == 6: - return ListTag_get_slice_double_tag(cpp, s) - elif index == 7: - return ListTag_get_slice_byte_array_tag(cpp, s) - elif index == 8: - return ListTag_get_slice_string_tag(cpp, s) - elif index == 9: - return ListTag_get_slice_list_tag(cpp, s) - elif index == 10: - return ListTag_get_slice_compound_tag(cpp, s) - elif index == 11: - return ListTag_get_slice_int_array_tag(cpp, s) - elif index == 12: - return ListTag_get_slice_long_array_tag(cpp, s) - else: - return [] - - -cdef inline void ListTag_set_item_byte_tag(CListTagPtr cpp, ptrdiff_t item, ByteTag value): - cdef CByteList* byte_list - - if dereference(cpp).index() == 1: - byte_list = &get[CByteList](dereference(cpp)) - if item < 0: - item += dereference(byte_list).size() - if item < 0 or item >= dereference(byte_list).size(): - raise IndexError("ListTag assignment index out of range") - dereference(byte_list)[item] = value.cpp - elif ListTag_len(cpp) == 1 and (item == 0 or item == -1): - dereference(cpp).emplace[CByteList]() - byte_list = &get[CByteList](dereference(cpp)) - dereference(byte_list).push_back(value.cpp) - else: - raise TypeError("NBT ListTag item mismatch.") - - -cdef inline void ListTag_set_item_short_tag(CListTagPtr cpp, ptrdiff_t item, ShortTag value): - cdef CShortList* short_list - - if dereference(cpp).index() == 2: - short_list = &get[CShortList](dereference(cpp)) - if item < 0: - item += dereference(short_list).size() - if item < 0 or item >= dereference(short_list).size(): - raise IndexError("ListTag assignment index out of range") - dereference(short_list)[item] = value.cpp - elif ListTag_len(cpp) == 1 and (item == 0 or item == -1): - dereference(cpp).emplace[CShortList]() - short_list = &get[CShortList](dereference(cpp)) - dereference(short_list).push_back(value.cpp) - else: - raise TypeError("NBT ListTag item mismatch.") - - -cdef inline void ListTag_set_item_int_tag(CListTagPtr cpp, ptrdiff_t item, IntTag value): - cdef CIntList* int_list - - if dereference(cpp).index() == 3: - int_list = &get[CIntList](dereference(cpp)) - if item < 0: - item += dereference(int_list).size() - if item < 0 or item >= dereference(int_list).size(): - raise IndexError("ListTag assignment index out of range") - dereference(int_list)[item] = value.cpp - elif ListTag_len(cpp) == 1 and (item == 0 or item == -1): - dereference(cpp).emplace[CIntList]() - int_list = &get[CIntList](dereference(cpp)) - dereference(int_list).push_back(value.cpp) - else: - raise TypeError("NBT ListTag item mismatch.") - - -cdef inline void ListTag_set_item_long_tag(CListTagPtr cpp, ptrdiff_t item, LongTag value): - cdef CLongList* long_list - - if dereference(cpp).index() == 4: - long_list = &get[CLongList](dereference(cpp)) - if item < 0: - item += dereference(long_list).size() - if item < 0 or item >= dereference(long_list).size(): - raise IndexError("ListTag assignment index out of range") - dereference(long_list)[item] = value.cpp - elif ListTag_len(cpp) == 1 and (item == 0 or item == -1): - dereference(cpp).emplace[CLongList]() - long_list = &get[CLongList](dereference(cpp)) - dereference(long_list).push_back(value.cpp) - else: - raise TypeError("NBT ListTag item mismatch.") - - -cdef inline void ListTag_set_item_float_tag(CListTagPtr cpp, ptrdiff_t item, FloatTag value): - cdef CFloatList* float_list - - if dereference(cpp).index() == 5: - float_list = &get[CFloatList](dereference(cpp)) - if item < 0: - item += dereference(float_list).size() - if item < 0 or item >= dereference(float_list).size(): - raise IndexError("ListTag assignment index out of range") - dereference(float_list)[item] = value.cpp - elif ListTag_len(cpp) == 1 and (item == 0 or item == -1): - dereference(cpp).emplace[CFloatList]() - float_list = &get[CFloatList](dereference(cpp)) - dereference(float_list).push_back(value.cpp) - else: - raise TypeError("NBT ListTag item mismatch.") - - -cdef inline void ListTag_set_item_double_tag(CListTagPtr cpp, ptrdiff_t item, DoubleTag value): - cdef CDoubleList* double_list - - if dereference(cpp).index() == 6: - double_list = &get[CDoubleList](dereference(cpp)) - if item < 0: - item += dereference(double_list).size() - if item < 0 or item >= dereference(double_list).size(): - raise IndexError("ListTag assignment index out of range") - dereference(double_list)[item] = value.cpp - elif ListTag_len(cpp) == 1 and (item == 0 or item == -1): - dereference(cpp).emplace[CDoubleList]() - double_list = &get[CDoubleList](dereference(cpp)) - dereference(double_list).push_back(value.cpp) - else: - raise TypeError("NBT ListTag item mismatch.") - - -cdef inline void ListTag_set_item_byte_array_tag(CListTagPtr cpp, ptrdiff_t item, ByteArrayTag value): - cdef CByteArrayList* byte_array_list - - if dereference(cpp).index() == 7: - byte_array_list = &get[CByteArrayList](dereference(cpp)) - if item < 0: - item += dereference(byte_array_list).size() - if item < 0 or item >= dereference(byte_array_list).size(): - raise IndexError("ListTag assignment index out of range") - dereference(byte_array_list)[item] = value.cpp - elif ListTag_len(cpp) == 1 and (item == 0 or item == -1): - dereference(cpp).emplace[CByteArrayList]() - byte_array_list = &get[CByteArrayList](dereference(cpp)) - dereference(byte_array_list).push_back(value.cpp) - else: - raise TypeError("NBT ListTag item mismatch.") - - -cdef inline void ListTag_set_item_string_tag(CListTagPtr cpp, ptrdiff_t item, StringTag value): - cdef CStringList* string_list - - if dereference(cpp).index() == 8: - string_list = &get[CStringList](dereference(cpp)) - if item < 0: - item += dereference(string_list).size() - if item < 0 or item >= dereference(string_list).size(): - raise IndexError("ListTag assignment index out of range") - dereference(string_list)[item] = value.cpp - elif ListTag_len(cpp) == 1 and (item == 0 or item == -1): - dereference(cpp).emplace[CStringList]() - string_list = &get[CStringList](dereference(cpp)) - dereference(string_list).push_back(value.cpp) - else: - raise TypeError("NBT ListTag item mismatch.") - - -cdef inline void ListTag_set_item_list_tag(CListTagPtr cpp, ptrdiff_t item, ListTag value): - cdef CListList* list_list - - if dereference(cpp).index() == 9: - list_list = &get[CListList](dereference(cpp)) - if item < 0: - item += dereference(list_list).size() - if item < 0 or item >= dereference(list_list).size(): - raise IndexError("ListTag assignment index out of range") - dereference(list_list)[item] = value.cpp - elif ListTag_len(cpp) == 1 and (item == 0 or item == -1): - dereference(cpp).emplace[CListList]() - list_list = &get[CListList](dereference(cpp)) - dereference(list_list).push_back(value.cpp) - else: - raise TypeError("NBT ListTag item mismatch.") - - -cdef inline void ListTag_set_item_compound_tag(CListTagPtr cpp, ptrdiff_t item, CompoundTag value): - cdef CCompoundList* compound_list - - if dereference(cpp).index() == 10: - compound_list = &get[CCompoundList](dereference(cpp)) - if item < 0: - item += dereference(compound_list).size() - if item < 0 or item >= dereference(compound_list).size(): - raise IndexError("ListTag assignment index out of range") - dereference(compound_list)[item] = value.cpp - elif ListTag_len(cpp) == 1 and (item == 0 or item == -1): - dereference(cpp).emplace[CCompoundList]() - compound_list = &get[CCompoundList](dereference(cpp)) - dereference(compound_list).push_back(value.cpp) - else: - raise TypeError("NBT ListTag item mismatch.") - - -cdef inline void ListTag_set_item_int_array_tag(CListTagPtr cpp, ptrdiff_t item, IntArrayTag value): - cdef CIntArrayList* int_array_list - - if dereference(cpp).index() == 11: - int_array_list = &get[CIntArrayList](dereference(cpp)) - if item < 0: - item += dereference(int_array_list).size() - if item < 0 or item >= dereference(int_array_list).size(): - raise IndexError("ListTag assignment index out of range") - dereference(int_array_list)[item] = value.cpp - elif ListTag_len(cpp) == 1 and (item == 0 or item == -1): - dereference(cpp).emplace[CIntArrayList]() - int_array_list = &get[CIntArrayList](dereference(cpp)) - dereference(int_array_list).push_back(value.cpp) - else: - raise TypeError("NBT ListTag item mismatch.") - - -cdef inline void ListTag_set_item_long_array_tag(CListTagPtr cpp, ptrdiff_t item, LongArrayTag value): - cdef CLongArrayList* long_array_list - - if dereference(cpp).index() == 12: - long_array_list = &get[CLongArrayList](dereference(cpp)) - if item < 0: - item += dereference(long_array_list).size() - if item < 0 or item >= dereference(long_array_list).size(): - raise IndexError("ListTag assignment index out of range") - dereference(long_array_list)[item] = value.cpp - elif ListTag_len(cpp) == 1 and (item == 0 or item == -1): - dereference(cpp).emplace[CLongArrayList]() - long_array_list = &get[CLongArrayList](dereference(cpp)) - dereference(long_array_list).push_back(value.cpp) - else: - raise TypeError("NBT ListTag item mismatch.") - - -cdef inline void ListTag_set_item(CListTagPtr cpp, ptrdiff_t item, AbstractBaseTag value): - if isinstance(value, ByteTag): - ListTag_set_item_byte_tag(cpp, item, value) - elif isinstance(value, ShortTag): - ListTag_set_item_short_tag(cpp, item, value) - elif isinstance(value, IntTag): - ListTag_set_item_int_tag(cpp, item, value) - elif isinstance(value, LongTag): - ListTag_set_item_long_tag(cpp, item, value) - elif isinstance(value, FloatTag): - ListTag_set_item_float_tag(cpp, item, value) - elif isinstance(value, DoubleTag): - ListTag_set_item_double_tag(cpp, item, value) - elif isinstance(value, ByteArrayTag): - ListTag_set_item_byte_array_tag(cpp, item, value) - elif isinstance(value, StringTag): - ListTag_set_item_string_tag(cpp, item, value) - elif isinstance(value, ListTag): - ListTag_set_item_list_tag(cpp, item, value) - elif isinstance(value, CompoundTag): - ListTag_set_item_compound_tag(cpp, item, value) - elif isinstance(value, IntArrayTag): - ListTag_set_item_int_array_tag(cpp, item, value) - elif isinstance(value, LongArrayTag): - ListTag_set_item_long_array_tag(cpp, item, value) - else: - raise TypeError(f"Unsupported type {type(value)}") - - -cdef inline size_t _iter_count(size_t start, size_t stop, ptrdiff_t step): - cdef double iter_count = ceil((stop - start)/step) - if iter_count < 0: - return 0 - else: - return iter_count - - -cdef inline void ListTag_set_slice_byte_tag(CListTagPtr cpp, object s, list value): - if not all(isinstance(v, ByteTag) for v in value): - raise TypeError("All elements of a ListTag must have the same type.") - - cdef CByteList* byte_list - cdef size_t start - cdef size_t stop - cdef ptrdiff_t step - cdef size_t item - cdef size_t iter_count - cdef ByteTag el - cdef size_t size - - if dereference(cpp).index() == 1: - byte_list = &get[CByteList](dereference(cpp)) - - start, stop, step = _slice_to_range(dereference(byte_list).size(), s) - iter_count = _iter_count(start, stop, step) - - if iter_count == len(value): - for item, el in zip(range(start, stop, step), value): - dereference(byte_list)[item] = el.cpp - elif step == 1: - dereference(byte_list).erase( - dereference(byte_list).begin() + start, - dereference(byte_list).begin() + stop, - ) - for item, el in enumerate(value): - dereference(byte_list).insert(dereference(byte_list).begin() + start + item, el.cpp) - else: - raise ValueError(f"attempt to assign sequence of size {len(value)} to extended slice of size {{iter_count}}") - - else: - size = ListTag_len(cpp) - start, stop, step = _slice_to_range(size, s) - iter_count = _iter_count(start, stop, step) - if size == iter_count: - if step == -1: - value = reversed(value) - elif step != 1: - raise RuntimeError - - dereference(cpp).emplace[CByteList]() - byte_list = &get[CByteList](dereference(cpp)) - for el in value: - dereference(byte_list).push_back(el.cpp) - else: - raise TypeError("NBT ListTag item mismatch.") - - -cdef inline void ListTag_set_slice_short_tag(CListTagPtr cpp, object s, list value): - if not all(isinstance(v, ShortTag) for v in value): - raise TypeError("All elements of a ListTag must have the same type.") - - cdef CShortList* short_list - cdef size_t start - cdef size_t stop - cdef ptrdiff_t step - cdef size_t item - cdef size_t iter_count - cdef ShortTag el - cdef size_t size - - if dereference(cpp).index() == 2: - short_list = &get[CShortList](dereference(cpp)) - - start, stop, step = _slice_to_range(dereference(short_list).size(), s) - iter_count = _iter_count(start, stop, step) - - if iter_count == len(value): - for item, el in zip(range(start, stop, step), value): - dereference(short_list)[item] = el.cpp - elif step == 1: - dereference(short_list).erase( - dereference(short_list).begin() + start, - dereference(short_list).begin() + stop, - ) - for item, el in enumerate(value): - dereference(short_list).insert(dereference(short_list).begin() + start + item, el.cpp) - else: - raise ValueError(f"attempt to assign sequence of size {len(value)} to extended slice of size {{iter_count}}") - - else: - size = ListTag_len(cpp) - start, stop, step = _slice_to_range(size, s) - iter_count = _iter_count(start, stop, step) - if size == iter_count: - if step == -1: - value = reversed(value) - elif step != 1: - raise RuntimeError - - dereference(cpp).emplace[CShortList]() - short_list = &get[CShortList](dereference(cpp)) - for el in value: - dereference(short_list).push_back(el.cpp) - else: - raise TypeError("NBT ListTag item mismatch.") - - -cdef inline void ListTag_set_slice_int_tag(CListTagPtr cpp, object s, list value): - if not all(isinstance(v, IntTag) for v in value): - raise TypeError("All elements of a ListTag must have the same type.") - - cdef CIntList* int_list - cdef size_t start - cdef size_t stop - cdef ptrdiff_t step - cdef size_t item - cdef size_t iter_count - cdef IntTag el - cdef size_t size - - if dereference(cpp).index() == 3: - int_list = &get[CIntList](dereference(cpp)) - - start, stop, step = _slice_to_range(dereference(int_list).size(), s) - iter_count = _iter_count(start, stop, step) - - if iter_count == len(value): - for item, el in zip(range(start, stop, step), value): - dereference(int_list)[item] = el.cpp - elif step == 1: - dereference(int_list).erase( - dereference(int_list).begin() + start, - dereference(int_list).begin() + stop, - ) - for item, el in enumerate(value): - dereference(int_list).insert(dereference(int_list).begin() + start + item, el.cpp) - else: - raise ValueError(f"attempt to assign sequence of size {len(value)} to extended slice of size {{iter_count}}") - - else: - size = ListTag_len(cpp) - start, stop, step = _slice_to_range(size, s) - iter_count = _iter_count(start, stop, step) - if size == iter_count: - if step == -1: - value = reversed(value) - elif step != 1: - raise RuntimeError - - dereference(cpp).emplace[CIntList]() - int_list = &get[CIntList](dereference(cpp)) - for el in value: - dereference(int_list).push_back(el.cpp) - else: - raise TypeError("NBT ListTag item mismatch.") - - -cdef inline void ListTag_set_slice_long_tag(CListTagPtr cpp, object s, list value): - if not all(isinstance(v, LongTag) for v in value): - raise TypeError("All elements of a ListTag must have the same type.") - - cdef CLongList* long_list - cdef size_t start - cdef size_t stop - cdef ptrdiff_t step - cdef size_t item - cdef size_t iter_count - cdef LongTag el - cdef size_t size - - if dereference(cpp).index() == 4: - long_list = &get[CLongList](dereference(cpp)) - - start, stop, step = _slice_to_range(dereference(long_list).size(), s) - iter_count = _iter_count(start, stop, step) - - if iter_count == len(value): - for item, el in zip(range(start, stop, step), value): - dereference(long_list)[item] = el.cpp - elif step == 1: - dereference(long_list).erase( - dereference(long_list).begin() + start, - dereference(long_list).begin() + stop, - ) - for item, el in enumerate(value): - dereference(long_list).insert(dereference(long_list).begin() + start + item, el.cpp) - else: - raise ValueError(f"attempt to assign sequence of size {len(value)} to extended slice of size {{iter_count}}") - - else: - size = ListTag_len(cpp) - start, stop, step = _slice_to_range(size, s) - iter_count = _iter_count(start, stop, step) - if size == iter_count: - if step == -1: - value = reversed(value) - elif step != 1: - raise RuntimeError - - dereference(cpp).emplace[CLongList]() - long_list = &get[CLongList](dereference(cpp)) - for el in value: - dereference(long_list).push_back(el.cpp) - else: - raise TypeError("NBT ListTag item mismatch.") - - -cdef inline void ListTag_set_slice_float_tag(CListTagPtr cpp, object s, list value): - if not all(isinstance(v, FloatTag) for v in value): - raise TypeError("All elements of a ListTag must have the same type.") - - cdef CFloatList* float_list - cdef size_t start - cdef size_t stop - cdef ptrdiff_t step - cdef size_t item - cdef size_t iter_count - cdef FloatTag el - cdef size_t size - - if dereference(cpp).index() == 5: - float_list = &get[CFloatList](dereference(cpp)) - - start, stop, step = _slice_to_range(dereference(float_list).size(), s) - iter_count = _iter_count(start, stop, step) - - if iter_count == len(value): - for item, el in zip(range(start, stop, step), value): - dereference(float_list)[item] = el.cpp - elif step == 1: - dereference(float_list).erase( - dereference(float_list).begin() + start, - dereference(float_list).begin() + stop, - ) - for item, el in enumerate(value): - dereference(float_list).insert(dereference(float_list).begin() + start + item, el.cpp) - else: - raise ValueError(f"attempt to assign sequence of size {len(value)} to extended slice of size {{iter_count}}") - - else: - size = ListTag_len(cpp) - start, stop, step = _slice_to_range(size, s) - iter_count = _iter_count(start, stop, step) - if size == iter_count: - if step == -1: - value = reversed(value) - elif step != 1: - raise RuntimeError - - dereference(cpp).emplace[CFloatList]() - float_list = &get[CFloatList](dereference(cpp)) - for el in value: - dereference(float_list).push_back(el.cpp) - else: - raise TypeError("NBT ListTag item mismatch.") - - -cdef inline void ListTag_set_slice_double_tag(CListTagPtr cpp, object s, list value): - if not all(isinstance(v, DoubleTag) for v in value): - raise TypeError("All elements of a ListTag must have the same type.") - - cdef CDoubleList* double_list - cdef size_t start - cdef size_t stop - cdef ptrdiff_t step - cdef size_t item - cdef size_t iter_count - cdef DoubleTag el - cdef size_t size - - if dereference(cpp).index() == 6: - double_list = &get[CDoubleList](dereference(cpp)) - - start, stop, step = _slice_to_range(dereference(double_list).size(), s) - iter_count = _iter_count(start, stop, step) - - if iter_count == len(value): - for item, el in zip(range(start, stop, step), value): - dereference(double_list)[item] = el.cpp - elif step == 1: - dereference(double_list).erase( - dereference(double_list).begin() + start, - dereference(double_list).begin() + stop, - ) - for item, el in enumerate(value): - dereference(double_list).insert(dereference(double_list).begin() + start + item, el.cpp) - else: - raise ValueError(f"attempt to assign sequence of size {len(value)} to extended slice of size {{iter_count}}") - - else: - size = ListTag_len(cpp) - start, stop, step = _slice_to_range(size, s) - iter_count = _iter_count(start, stop, step) - if size == iter_count: - if step == -1: - value = reversed(value) - elif step != 1: - raise RuntimeError - - dereference(cpp).emplace[CDoubleList]() - double_list = &get[CDoubleList](dereference(cpp)) - for el in value: - dereference(double_list).push_back(el.cpp) - else: - raise TypeError("NBT ListTag item mismatch.") - - -cdef inline void ListTag_set_slice_byte_array_tag(CListTagPtr cpp, object s, list value): - if not all(isinstance(v, ByteArrayTag) for v in value): - raise TypeError("All elements of a ListTag must have the same type.") - - cdef CByteArrayList* byte_array_list - cdef size_t start - cdef size_t stop - cdef ptrdiff_t step - cdef size_t item - cdef size_t iter_count - cdef ByteArrayTag el - cdef size_t size - - if dereference(cpp).index() == 7: - byte_array_list = &get[CByteArrayList](dereference(cpp)) - - start, stop, step = _slice_to_range(dereference(byte_array_list).size(), s) - iter_count = _iter_count(start, stop, step) - - if iter_count == len(value): - for item, el in zip(range(start, stop, step), value): - dereference(byte_array_list)[item] = el.cpp - elif step == 1: - dereference(byte_array_list).erase( - dereference(byte_array_list).begin() + start, - dereference(byte_array_list).begin() + stop, - ) - for item, el in enumerate(value): - dereference(byte_array_list).insert(dereference(byte_array_list).begin() + start + item, el.cpp) - else: - raise ValueError(f"attempt to assign sequence of size {len(value)} to extended slice of size {{iter_count}}") - - else: - size = ListTag_len(cpp) - start, stop, step = _slice_to_range(size, s) - iter_count = _iter_count(start, stop, step) - if size == iter_count: - if step == -1: - value = reversed(value) - elif step != 1: - raise RuntimeError - - dereference(cpp).emplace[CByteArrayList]() - byte_array_list = &get[CByteArrayList](dereference(cpp)) - for el in value: - dereference(byte_array_list).push_back(el.cpp) - else: - raise TypeError("NBT ListTag item mismatch.") - - -cdef inline void ListTag_set_slice_string_tag(CListTagPtr cpp, object s, list value): - if not all(isinstance(v, StringTag) for v in value): - raise TypeError("All elements of a ListTag must have the same type.") - - cdef CStringList* string_list - cdef size_t start - cdef size_t stop - cdef ptrdiff_t step - cdef size_t item - cdef size_t iter_count - cdef StringTag el - cdef size_t size - - if dereference(cpp).index() == 8: - string_list = &get[CStringList](dereference(cpp)) - - start, stop, step = _slice_to_range(dereference(string_list).size(), s) - iter_count = _iter_count(start, stop, step) - - if iter_count == len(value): - for item, el in zip(range(start, stop, step), value): - dereference(string_list)[item] = el.cpp - elif step == 1: - dereference(string_list).erase( - dereference(string_list).begin() + start, - dereference(string_list).begin() + stop, - ) - for item, el in enumerate(value): - dereference(string_list).insert(dereference(string_list).begin() + start + item, el.cpp) - else: - raise ValueError(f"attempt to assign sequence of size {len(value)} to extended slice of size {{iter_count}}") - - else: - size = ListTag_len(cpp) - start, stop, step = _slice_to_range(size, s) - iter_count = _iter_count(start, stop, step) - if size == iter_count: - if step == -1: - value = reversed(value) - elif step != 1: - raise RuntimeError - - dereference(cpp).emplace[CStringList]() - string_list = &get[CStringList](dereference(cpp)) - for el in value: - dereference(string_list).push_back(el.cpp) - else: - raise TypeError("NBT ListTag item mismatch.") - - -cdef inline void ListTag_set_slice_list_tag(CListTagPtr cpp, object s, list value): - if not all(isinstance(v, ListTag) for v in value): - raise TypeError("All elements of a ListTag must have the same type.") - - cdef CListList* list_list - cdef size_t start - cdef size_t stop - cdef ptrdiff_t step - cdef size_t item - cdef size_t iter_count - cdef ListTag el - cdef size_t size - - if dereference(cpp).index() == 9: - list_list = &get[CListList](dereference(cpp)) - - start, stop, step = _slice_to_range(dereference(list_list).size(), s) - iter_count = _iter_count(start, stop, step) - - if iter_count == len(value): - for item, el in zip(range(start, stop, step), value): - dereference(list_list)[item] = el.cpp - elif step == 1: - dereference(list_list).erase( - dereference(list_list).begin() + start, - dereference(list_list).begin() + stop, - ) - for item, el in enumerate(value): - dereference(list_list).insert(dereference(list_list).begin() + start + item, el.cpp) - else: - raise ValueError(f"attempt to assign sequence of size {len(value)} to extended slice of size {{iter_count}}") - - else: - size = ListTag_len(cpp) - start, stop, step = _slice_to_range(size, s) - iter_count = _iter_count(start, stop, step) - if size == iter_count: - if step == -1: - value = reversed(value) - elif step != 1: - raise RuntimeError - - dereference(cpp).emplace[CListList]() - list_list = &get[CListList](dereference(cpp)) - for el in value: - dereference(list_list).push_back(el.cpp) - else: - raise TypeError("NBT ListTag item mismatch.") - - -cdef inline void ListTag_set_slice_compound_tag(CListTagPtr cpp, object s, list value): - if not all(isinstance(v, CompoundTag) for v in value): - raise TypeError("All elements of a ListTag must have the same type.") - - cdef CCompoundList* compound_list - cdef size_t start - cdef size_t stop - cdef ptrdiff_t step - cdef size_t item - cdef size_t iter_count - cdef CompoundTag el - cdef size_t size - - if dereference(cpp).index() == 10: - compound_list = &get[CCompoundList](dereference(cpp)) - - start, stop, step = _slice_to_range(dereference(compound_list).size(), s) - iter_count = _iter_count(start, stop, step) - - if iter_count == len(value): - for item, el in zip(range(start, stop, step), value): - dereference(compound_list)[item] = el.cpp - elif step == 1: - dereference(compound_list).erase( - dereference(compound_list).begin() + start, - dereference(compound_list).begin() + stop, - ) - for item, el in enumerate(value): - dereference(compound_list).insert(dereference(compound_list).begin() + start + item, el.cpp) - else: - raise ValueError(f"attempt to assign sequence of size {len(value)} to extended slice of size {{iter_count}}") - - else: - size = ListTag_len(cpp) - start, stop, step = _slice_to_range(size, s) - iter_count = _iter_count(start, stop, step) - if size == iter_count: - if step == -1: - value = reversed(value) - elif step != 1: - raise RuntimeError - - dereference(cpp).emplace[CCompoundList]() - compound_list = &get[CCompoundList](dereference(cpp)) - for el in value: - dereference(compound_list).push_back(el.cpp) - else: - raise TypeError("NBT ListTag item mismatch.") - - -cdef inline void ListTag_set_slice_int_array_tag(CListTagPtr cpp, object s, list value): - if not all(isinstance(v, IntArrayTag) for v in value): - raise TypeError("All elements of a ListTag must have the same type.") - - cdef CIntArrayList* int_array_list - cdef size_t start - cdef size_t stop - cdef ptrdiff_t step - cdef size_t item - cdef size_t iter_count - cdef IntArrayTag el - cdef size_t size - - if dereference(cpp).index() == 11: - int_array_list = &get[CIntArrayList](dereference(cpp)) - - start, stop, step = _slice_to_range(dereference(int_array_list).size(), s) - iter_count = _iter_count(start, stop, step) - - if iter_count == len(value): - for item, el in zip(range(start, stop, step), value): - dereference(int_array_list)[item] = el.cpp - elif step == 1: - dereference(int_array_list).erase( - dereference(int_array_list).begin() + start, - dereference(int_array_list).begin() + stop, - ) - for item, el in enumerate(value): - dereference(int_array_list).insert(dereference(int_array_list).begin() + start + item, el.cpp) - else: - raise ValueError(f"attempt to assign sequence of size {len(value)} to extended slice of size {{iter_count}}") - - else: - size = ListTag_len(cpp) - start, stop, step = _slice_to_range(size, s) - iter_count = _iter_count(start, stop, step) - if size == iter_count: - if step == -1: - value = reversed(value) - elif step != 1: - raise RuntimeError - - dereference(cpp).emplace[CIntArrayList]() - int_array_list = &get[CIntArrayList](dereference(cpp)) - for el in value: - dereference(int_array_list).push_back(el.cpp) - else: - raise TypeError("NBT ListTag item mismatch.") - - -cdef inline void ListTag_set_slice_long_array_tag(CListTagPtr cpp, object s, list value): - if not all(isinstance(v, LongArrayTag) for v in value): - raise TypeError("All elements of a ListTag must have the same type.") - - cdef CLongArrayList* long_array_list - cdef size_t start - cdef size_t stop - cdef ptrdiff_t step - cdef size_t item - cdef size_t iter_count - cdef LongArrayTag el - cdef size_t size - - if dereference(cpp).index() == 12: - long_array_list = &get[CLongArrayList](dereference(cpp)) - - start, stop, step = _slice_to_range(dereference(long_array_list).size(), s) - iter_count = _iter_count(start, stop, step) - - if iter_count == len(value): - for item, el in zip(range(start, stop, step), value): - dereference(long_array_list)[item] = el.cpp - elif step == 1: - dereference(long_array_list).erase( - dereference(long_array_list).begin() + start, - dereference(long_array_list).begin() + stop, - ) - for item, el in enumerate(value): - dereference(long_array_list).insert(dereference(long_array_list).begin() + start + item, el.cpp) - else: - raise ValueError(f"attempt to assign sequence of size {len(value)} to extended slice of size {{iter_count}}") - - else: - size = ListTag_len(cpp) - start, stop, step = _slice_to_range(size, s) - iter_count = _iter_count(start, stop, step) - if size == iter_count: - if step == -1: - value = reversed(value) - elif step != 1: - raise RuntimeError - - dereference(cpp).emplace[CLongArrayList]() - long_array_list = &get[CLongArrayList](dereference(cpp)) - for el in value: - dereference(long_array_list).push_back(el.cpp) - else: - raise TypeError("NBT ListTag item mismatch.") - - -cdef inline void _set_slice_empty(CListTagPtr cpp, object s): - cdef size_t index = dereference(cpp).index() - if index == 1: - ListTag_set_slice_byte_tag(cpp, s, []) - elif index == 2: - ListTag_set_slice_short_tag(cpp, s, []) - elif index == 3: - ListTag_set_slice_int_tag(cpp, s, []) - elif index == 4: - ListTag_set_slice_long_tag(cpp, s, []) - elif index == 5: - ListTag_set_slice_float_tag(cpp, s, []) - elif index == 6: - ListTag_set_slice_double_tag(cpp, s, []) - elif index == 7: - ListTag_set_slice_byte_array_tag(cpp, s, []) - elif index == 8: - ListTag_set_slice_string_tag(cpp, s, []) - elif index == 9: - ListTag_set_slice_list_tag(cpp, s, []) - elif index == 10: - ListTag_set_slice_compound_tag(cpp, s, []) - elif index == 11: - ListTag_set_slice_int_array_tag(cpp, s, []) - elif index == 12: - ListTag_set_slice_long_array_tag(cpp, s, []) - - -cdef inline void ListTag_set_slice(CListTagPtr cpp, object s, object value): - cdef list arr = value - if arr: - # Items in the array - if isinstance(arr[0], ByteTag): - ListTag_set_slice_byte_tag(cpp, s, arr) - elif isinstance(arr[0], ShortTag): - ListTag_set_slice_short_tag(cpp, s, arr) - elif isinstance(arr[0], IntTag): - ListTag_set_slice_int_tag(cpp, s, arr) - elif isinstance(arr[0], LongTag): - ListTag_set_slice_long_tag(cpp, s, arr) - elif isinstance(arr[0], FloatTag): - ListTag_set_slice_float_tag(cpp, s, arr) - elif isinstance(arr[0], DoubleTag): - ListTag_set_slice_double_tag(cpp, s, arr) - elif isinstance(arr[0], ByteArrayTag): - ListTag_set_slice_byte_array_tag(cpp, s, arr) - elif isinstance(arr[0], StringTag): - ListTag_set_slice_string_tag(cpp, s, arr) - elif isinstance(arr[0], ListTag): - ListTag_set_slice_list_tag(cpp, s, arr) - elif isinstance(arr[0], CompoundTag): - ListTag_set_slice_compound_tag(cpp, s, arr) - elif isinstance(arr[0], IntArrayTag): - ListTag_set_slice_int_array_tag(cpp, s, arr) - elif isinstance(arr[0], LongArrayTag): - ListTag_set_slice_long_array_tag(cpp, s, arr) - else: - raise TypeError(f"Unsupported type {type(value)}") - else: - # array is empty - _set_slice_empty(cpp, s) - - -cdef inline void ListTag_del_item_byte_tag(CListTagPtr cpp, ptrdiff_t item): - cdef CByteList* byte_list = &get[CByteList](dereference(cpp)) - if item < 0: - item += dereference(byte_list).size() - if item < 0 or item >= dereference(byte_list).size(): - raise IndexError("ListTag assignment index out of range") - dereference(byte_list).erase(dereference(byte_list).begin() + item) - - -cdef inline void ListTag_del_item_short_tag(CListTagPtr cpp, ptrdiff_t item): - cdef CShortList* short_list = &get[CShortList](dereference(cpp)) - if item < 0: - item += dereference(short_list).size() - if item < 0 or item >= dereference(short_list).size(): - raise IndexError("ListTag assignment index out of range") - dereference(short_list).erase(dereference(short_list).begin() + item) - - -cdef inline void ListTag_del_item_int_tag(CListTagPtr cpp, ptrdiff_t item): - cdef CIntList* int_list = &get[CIntList](dereference(cpp)) - if item < 0: - item += dereference(int_list).size() - if item < 0 or item >= dereference(int_list).size(): - raise IndexError("ListTag assignment index out of range") - dereference(int_list).erase(dereference(int_list).begin() + item) - - -cdef inline void ListTag_del_item_long_tag(CListTagPtr cpp, ptrdiff_t item): - cdef CLongList* long_list = &get[CLongList](dereference(cpp)) - if item < 0: - item += dereference(long_list).size() - if item < 0 or item >= dereference(long_list).size(): - raise IndexError("ListTag assignment index out of range") - dereference(long_list).erase(dereference(long_list).begin() + item) - - -cdef inline void ListTag_del_item_float_tag(CListTagPtr cpp, ptrdiff_t item): - cdef CFloatList* float_list = &get[CFloatList](dereference(cpp)) - if item < 0: - item += dereference(float_list).size() - if item < 0 or item >= dereference(float_list).size(): - raise IndexError("ListTag assignment index out of range") - dereference(float_list).erase(dereference(float_list).begin() + item) - - -cdef inline void ListTag_del_item_double_tag(CListTagPtr cpp, ptrdiff_t item): - cdef CDoubleList* double_list = &get[CDoubleList](dereference(cpp)) - if item < 0: - item += dereference(double_list).size() - if item < 0 or item >= dereference(double_list).size(): - raise IndexError("ListTag assignment index out of range") - dereference(double_list).erase(dereference(double_list).begin() + item) - - -cdef inline void ListTag_del_item_byte_array_tag(CListTagPtr cpp, ptrdiff_t item): - cdef CByteArrayList* byte_array_list = &get[CByteArrayList](dereference(cpp)) - if item < 0: - item += dereference(byte_array_list).size() - if item < 0 or item >= dereference(byte_array_list).size(): - raise IndexError("ListTag assignment index out of range") - dereference(byte_array_list).erase(dereference(byte_array_list).begin() + item) - - -cdef inline void ListTag_del_item_string_tag(CListTagPtr cpp, ptrdiff_t item): - cdef CStringList* string_list = &get[CStringList](dereference(cpp)) - if item < 0: - item += dereference(string_list).size() - if item < 0 or item >= dereference(string_list).size(): - raise IndexError("ListTag assignment index out of range") - dereference(string_list).erase(dereference(string_list).begin() + item) - - -cdef inline void ListTag_del_item_list_tag(CListTagPtr cpp, ptrdiff_t item): - cdef CListList* list_list = &get[CListList](dereference(cpp)) - if item < 0: - item += dereference(list_list).size() - if item < 0 or item >= dereference(list_list).size(): - raise IndexError("ListTag assignment index out of range") - dereference(list_list).erase(dereference(list_list).begin() + item) - - -cdef inline void ListTag_del_item_compound_tag(CListTagPtr cpp, ptrdiff_t item): - cdef CCompoundList* compound_list = &get[CCompoundList](dereference(cpp)) - if item < 0: - item += dereference(compound_list).size() - if item < 0 or item >= dereference(compound_list).size(): - raise IndexError("ListTag assignment index out of range") - dereference(compound_list).erase(dereference(compound_list).begin() + item) - - -cdef inline void ListTag_del_item_int_array_tag(CListTagPtr cpp, ptrdiff_t item): - cdef CIntArrayList* int_array_list = &get[CIntArrayList](dereference(cpp)) - if item < 0: - item += dereference(int_array_list).size() - if item < 0 or item >= dereference(int_array_list).size(): - raise IndexError("ListTag assignment index out of range") - dereference(int_array_list).erase(dereference(int_array_list).begin() + item) - - -cdef inline void ListTag_del_item_long_array_tag(CListTagPtr cpp, ptrdiff_t item): - cdef CLongArrayList* long_array_list = &get[CLongArrayList](dereference(cpp)) - if item < 0: - item += dereference(long_array_list).size() - if item < 0 or item >= dereference(long_array_list).size(): - raise IndexError("ListTag assignment index out of range") - dereference(long_array_list).erase(dereference(long_array_list).begin() + item) - - -cdef inline void ListTag_del_item(CListTagPtr cpp, ptrdiff_t item): - cdef size_t index = dereference(cpp).index() - if index == 1: - ListTag_del_item_byte_tag(cpp, item) - elif index == 2: - ListTag_del_item_short_tag(cpp, item) - elif index == 3: - ListTag_del_item_int_tag(cpp, item) - elif index == 4: - ListTag_del_item_long_tag(cpp, item) - elif index == 5: - ListTag_del_item_float_tag(cpp, item) - elif index == 6: - ListTag_del_item_double_tag(cpp, item) - elif index == 7: - ListTag_del_item_byte_array_tag(cpp, item) - elif index == 8: - ListTag_del_item_string_tag(cpp, item) - elif index == 9: - ListTag_del_item_list_tag(cpp, item) - elif index == 10: - ListTag_del_item_compound_tag(cpp, item) - elif index == 11: - ListTag_del_item_int_array_tag(cpp, item) - elif index == 12: - ListTag_del_item_long_array_tag(cpp, item) - else: - raise IndexError("ListTag assignment index out of range.") - - -cdef inline void ListTag_del_slice_byte_tag(CListTagPtr cpp, object s): - cdef size_t start - cdef size_t stop - cdef size_t step - cdef size_t item - - cdef CByteList* byte_list - byte_list = &get[CByteList](dereference(cpp)) - - start, stop, step = _slice_to_range(dereference(byte_list).size(), s) - - if step == 1: - dereference(byte_list).erase( - dereference(byte_list).begin() + start, - dereference(byte_list).begin() + stop, - ) - else: - for item in range(start, stop, step): - dereference(byte_list).erase(dereference(byte_list).begin() + item) - - -cdef inline void ListTag_del_slice_short_tag(CListTagPtr cpp, object s): - cdef size_t start - cdef size_t stop - cdef size_t step - cdef size_t item - - cdef CShortList* short_list - short_list = &get[CShortList](dereference(cpp)) - - start, stop, step = _slice_to_range(dereference(short_list).size(), s) - - if step == 1: - dereference(short_list).erase( - dereference(short_list).begin() + start, - dereference(short_list).begin() + stop, - ) - else: - for item in range(start, stop, step): - dereference(short_list).erase(dereference(short_list).begin() + item) - - -cdef inline void ListTag_del_slice_int_tag(CListTagPtr cpp, object s): - cdef size_t start - cdef size_t stop - cdef size_t step - cdef size_t item - - cdef CIntList* int_list - int_list = &get[CIntList](dereference(cpp)) - - start, stop, step = _slice_to_range(dereference(int_list).size(), s) - - if step == 1: - dereference(int_list).erase( - dereference(int_list).begin() + start, - dereference(int_list).begin() + stop, - ) - else: - for item in range(start, stop, step): - dereference(int_list).erase(dereference(int_list).begin() + item) - - -cdef inline void ListTag_del_slice_long_tag(CListTagPtr cpp, object s): - cdef size_t start - cdef size_t stop - cdef size_t step - cdef size_t item - - cdef CLongList* long_list - long_list = &get[CLongList](dereference(cpp)) - - start, stop, step = _slice_to_range(dereference(long_list).size(), s) - - if step == 1: - dereference(long_list).erase( - dereference(long_list).begin() + start, - dereference(long_list).begin() + stop, - ) - else: - for item in range(start, stop, step): - dereference(long_list).erase(dereference(long_list).begin() + item) - - -cdef inline void ListTag_del_slice_float_tag(CListTagPtr cpp, object s): - cdef size_t start - cdef size_t stop - cdef size_t step - cdef size_t item - - cdef CFloatList* float_list - float_list = &get[CFloatList](dereference(cpp)) - - start, stop, step = _slice_to_range(dereference(float_list).size(), s) - - if step == 1: - dereference(float_list).erase( - dereference(float_list).begin() + start, - dereference(float_list).begin() + stop, - ) - else: - for item in range(start, stop, step): - dereference(float_list).erase(dereference(float_list).begin() + item) - - -cdef inline void ListTag_del_slice_double_tag(CListTagPtr cpp, object s): - cdef size_t start - cdef size_t stop - cdef size_t step - cdef size_t item - - cdef CDoubleList* double_list - double_list = &get[CDoubleList](dereference(cpp)) - - start, stop, step = _slice_to_range(dereference(double_list).size(), s) - - if step == 1: - dereference(double_list).erase( - dereference(double_list).begin() + start, - dereference(double_list).begin() + stop, - ) - else: - for item in range(start, stop, step): - dereference(double_list).erase(dereference(double_list).begin() + item) - - -cdef inline void ListTag_del_slice_byte_array_tag(CListTagPtr cpp, object s): - cdef size_t start - cdef size_t stop - cdef size_t step - cdef size_t item - - cdef CByteArrayList* byte_array_list - byte_array_list = &get[CByteArrayList](dereference(cpp)) - - start, stop, step = _slice_to_range(dereference(byte_array_list).size(), s) - - if step == 1: - dereference(byte_array_list).erase( - dereference(byte_array_list).begin() + start, - dereference(byte_array_list).begin() + stop, - ) - else: - for item in range(start, stop, step): - dereference(byte_array_list).erase(dereference(byte_array_list).begin() + item) - - -cdef inline void ListTag_del_slice_string_tag(CListTagPtr cpp, object s): - cdef size_t start - cdef size_t stop - cdef size_t step - cdef size_t item - - cdef CStringList* string_list - string_list = &get[CStringList](dereference(cpp)) - - start, stop, step = _slice_to_range(dereference(string_list).size(), s) - - if step == 1: - dereference(string_list).erase( - dereference(string_list).begin() + start, - dereference(string_list).begin() + stop, - ) - else: - for item in range(start, stop, step): - dereference(string_list).erase(dereference(string_list).begin() + item) - - -cdef inline void ListTag_del_slice_list_tag(CListTagPtr cpp, object s): - cdef size_t start - cdef size_t stop - cdef size_t step - cdef size_t item - - cdef CListList* list_list - list_list = &get[CListList](dereference(cpp)) - - start, stop, step = _slice_to_range(dereference(list_list).size(), s) - - if step == 1: - dereference(list_list).erase( - dereference(list_list).begin() + start, - dereference(list_list).begin() + stop, - ) - else: - for item in range(start, stop, step): - dereference(list_list).erase(dereference(list_list).begin() + item) - - -cdef inline void ListTag_del_slice_compound_tag(CListTagPtr cpp, object s): - cdef size_t start - cdef size_t stop - cdef size_t step - cdef size_t item - - cdef CCompoundList* compound_list - compound_list = &get[CCompoundList](dereference(cpp)) - - start, stop, step = _slice_to_range(dereference(compound_list).size(), s) - - if step == 1: - dereference(compound_list).erase( - dereference(compound_list).begin() + start, - dereference(compound_list).begin() + stop, - ) - else: - for item in range(start, stop, step): - dereference(compound_list).erase(dereference(compound_list).begin() + item) - - -cdef inline void ListTag_del_slice_int_array_tag(CListTagPtr cpp, object s): - cdef size_t start - cdef size_t stop - cdef size_t step - cdef size_t item - - cdef CIntArrayList* int_array_list - int_array_list = &get[CIntArrayList](dereference(cpp)) - - start, stop, step = _slice_to_range(dereference(int_array_list).size(), s) - - if step == 1: - dereference(int_array_list).erase( - dereference(int_array_list).begin() + start, - dereference(int_array_list).begin() + stop, - ) - else: - for item in range(start, stop, step): - dereference(int_array_list).erase(dereference(int_array_list).begin() + item) - - -cdef inline void ListTag_del_slice_long_array_tag(CListTagPtr cpp, object s): - cdef size_t start - cdef size_t stop - cdef size_t step - cdef size_t item - - cdef CLongArrayList* long_array_list - long_array_list = &get[CLongArrayList](dereference(cpp)) - - start, stop, step = _slice_to_range(dereference(long_array_list).size(), s) - - if step == 1: - dereference(long_array_list).erase( - dereference(long_array_list).begin() + start, - dereference(long_array_list).begin() + stop, - ) - else: - for item in range(start, stop, step): - dereference(long_array_list).erase(dereference(long_array_list).begin() + item) - - -cdef inline void ListTag_del_slice(CListTagPtr cpp, object s): - cdef size_t index = dereference(cpp).index() - if index == 1: - ListTag_del_slice_byte_tag(cpp, s) - elif index == 2: - ListTag_del_slice_short_tag(cpp, s) - elif index == 3: - ListTag_del_slice_int_tag(cpp, s) - elif index == 4: - ListTag_del_slice_long_tag(cpp, s) - elif index == 5: - ListTag_del_slice_float_tag(cpp, s) - elif index == 6: - ListTag_del_slice_double_tag(cpp, s) - elif index == 7: - ListTag_del_slice_byte_array_tag(cpp, s) - elif index == 8: - ListTag_del_slice_string_tag(cpp, s) - elif index == 9: - ListTag_del_slice_list_tag(cpp, s) - elif index == 10: - ListTag_del_slice_compound_tag(cpp, s) - elif index == 11: - ListTag_del_slice_int_array_tag(cpp, s) - elif index == 12: - ListTag_del_slice_long_array_tag(cpp, s) - - -cdef inline void ListTag_insert_byte_tag(CListTagPtr cpp, ptrdiff_t item, ByteTag value): - cdef CByteList* byte_list - - if dereference(cpp).index() == 1: - byte_list = &get[CByteList](dereference(cpp)) - elif ListTag_len(cpp) == 0: - dereference(cpp).emplace[CByteList]() - byte_list = &get[CByteList](dereference(cpp)) - else: - raise TypeError("ListTag can only contain one NBT data type.") - - if item < 0: - item += dereference(byte_list).size() - item = min(max(0, item), dereference(byte_list).size()) - - dereference(byte_list).insert(dereference(byte_list).begin() + item, value.cpp) - - -cdef inline void ListTag_insert_short_tag(CListTagPtr cpp, ptrdiff_t item, ShortTag value): - cdef CShortList* short_list - - if dereference(cpp).index() == 2: - short_list = &get[CShortList](dereference(cpp)) - elif ListTag_len(cpp) == 0: - dereference(cpp).emplace[CShortList]() - short_list = &get[CShortList](dereference(cpp)) - else: - raise TypeError("ListTag can only contain one NBT data type.") - - if item < 0: - item += dereference(short_list).size() - item = min(max(0, item), dereference(short_list).size()) - - dereference(short_list).insert(dereference(short_list).begin() + item, value.cpp) - - -cdef inline void ListTag_insert_int_tag(CListTagPtr cpp, ptrdiff_t item, IntTag value): - cdef CIntList* int_list - - if dereference(cpp).index() == 3: - int_list = &get[CIntList](dereference(cpp)) - elif ListTag_len(cpp) == 0: - dereference(cpp).emplace[CIntList]() - int_list = &get[CIntList](dereference(cpp)) - else: - raise TypeError("ListTag can only contain one NBT data type.") - - if item < 0: - item += dereference(int_list).size() - item = min(max(0, item), dereference(int_list).size()) - - dereference(int_list).insert(dereference(int_list).begin() + item, value.cpp) - - -cdef inline void ListTag_insert_long_tag(CListTagPtr cpp, ptrdiff_t item, LongTag value): - cdef CLongList* long_list - - if dereference(cpp).index() == 4: - long_list = &get[CLongList](dereference(cpp)) - elif ListTag_len(cpp) == 0: - dereference(cpp).emplace[CLongList]() - long_list = &get[CLongList](dereference(cpp)) - else: - raise TypeError("ListTag can only contain one NBT data type.") - - if item < 0: - item += dereference(long_list).size() - item = min(max(0, item), dereference(long_list).size()) - - dereference(long_list).insert(dereference(long_list).begin() + item, value.cpp) - - -cdef inline void ListTag_insert_float_tag(CListTagPtr cpp, ptrdiff_t item, FloatTag value): - cdef CFloatList* float_list - - if dereference(cpp).index() == 5: - float_list = &get[CFloatList](dereference(cpp)) - elif ListTag_len(cpp) == 0: - dereference(cpp).emplace[CFloatList]() - float_list = &get[CFloatList](dereference(cpp)) - else: - raise TypeError("ListTag can only contain one NBT data type.") - - if item < 0: - item += dereference(float_list).size() - item = min(max(0, item), dereference(float_list).size()) - - dereference(float_list).insert(dereference(float_list).begin() + item, value.cpp) - - -cdef inline void ListTag_insert_double_tag(CListTagPtr cpp, ptrdiff_t item, DoubleTag value): - cdef CDoubleList* double_list - - if dereference(cpp).index() == 6: - double_list = &get[CDoubleList](dereference(cpp)) - elif ListTag_len(cpp) == 0: - dereference(cpp).emplace[CDoubleList]() - double_list = &get[CDoubleList](dereference(cpp)) - else: - raise TypeError("ListTag can only contain one NBT data type.") - - if item < 0: - item += dereference(double_list).size() - item = min(max(0, item), dereference(double_list).size()) - - dereference(double_list).insert(dereference(double_list).begin() + item, value.cpp) - - -cdef inline void ListTag_insert_byte_array_tag(CListTagPtr cpp, ptrdiff_t item, ByteArrayTag value): - cdef CByteArrayList* byte_array_list - - if dereference(cpp).index() == 7: - byte_array_list = &get[CByteArrayList](dereference(cpp)) - elif ListTag_len(cpp) == 0: - dereference(cpp).emplace[CByteArrayList]() - byte_array_list = &get[CByteArrayList](dereference(cpp)) - else: - raise TypeError("ListTag can only contain one NBT data type.") - - if item < 0: - item += dereference(byte_array_list).size() - item = min(max(0, item), dereference(byte_array_list).size()) - - dereference(byte_array_list).insert(dereference(byte_array_list).begin() + item, value.cpp) - - -cdef inline void ListTag_insert_string_tag(CListTagPtr cpp, ptrdiff_t item, StringTag value): - cdef CStringList* string_list - - if dereference(cpp).index() == 8: - string_list = &get[CStringList](dereference(cpp)) - elif ListTag_len(cpp) == 0: - dereference(cpp).emplace[CStringList]() - string_list = &get[CStringList](dereference(cpp)) - else: - raise TypeError("ListTag can only contain one NBT data type.") - - if item < 0: - item += dereference(string_list).size() - item = min(max(0, item), dereference(string_list).size()) - - dereference(string_list).insert(dereference(string_list).begin() + item, value.cpp) - - -cdef inline void ListTag_insert_list_tag(CListTagPtr cpp, ptrdiff_t item, ListTag value): - cdef CListList* list_list - - if dereference(cpp).index() == 9: - list_list = &get[CListList](dereference(cpp)) - elif ListTag_len(cpp) == 0: - dereference(cpp).emplace[CListList]() - list_list = &get[CListList](dereference(cpp)) - else: - raise TypeError("ListTag can only contain one NBT data type.") - - if item < 0: - item += dereference(list_list).size() - item = min(max(0, item), dereference(list_list).size()) - - dereference(list_list).insert(dereference(list_list).begin() + item, value.cpp) - - -cdef inline void ListTag_insert_compound_tag(CListTagPtr cpp, ptrdiff_t item, CompoundTag value): - cdef CCompoundList* compound_list - - if dereference(cpp).index() == 10: - compound_list = &get[CCompoundList](dereference(cpp)) - elif ListTag_len(cpp) == 0: - dereference(cpp).emplace[CCompoundList]() - compound_list = &get[CCompoundList](dereference(cpp)) - else: - raise TypeError("ListTag can only contain one NBT data type.") - - if item < 0: - item += dereference(compound_list).size() - item = min(max(0, item), dereference(compound_list).size()) - - dereference(compound_list).insert(dereference(compound_list).begin() + item, value.cpp) - - -cdef inline void ListTag_insert_int_array_tag(CListTagPtr cpp, ptrdiff_t item, IntArrayTag value): - cdef CIntArrayList* int_array_list - - if dereference(cpp).index() == 11: - int_array_list = &get[CIntArrayList](dereference(cpp)) - elif ListTag_len(cpp) == 0: - dereference(cpp).emplace[CIntArrayList]() - int_array_list = &get[CIntArrayList](dereference(cpp)) - else: - raise TypeError("ListTag can only contain one NBT data type.") - - if item < 0: - item += dereference(int_array_list).size() - item = min(max(0, item), dereference(int_array_list).size()) - - dereference(int_array_list).insert(dereference(int_array_list).begin() + item, value.cpp) - - -cdef inline void ListTag_insert_long_array_tag(CListTagPtr cpp, ptrdiff_t item, LongArrayTag value): - cdef CLongArrayList* long_array_list - - if dereference(cpp).index() == 12: - long_array_list = &get[CLongArrayList](dereference(cpp)) - elif ListTag_len(cpp) == 0: - dereference(cpp).emplace[CLongArrayList]() - long_array_list = &get[CLongArrayList](dereference(cpp)) - else: - raise TypeError("ListTag can only contain one NBT data type.") - - if item < 0: - item += dereference(long_array_list).size() - item = min(max(0, item), dereference(long_array_list).size()) - - dereference(long_array_list).insert(dereference(long_array_list).begin() + item, value.cpp) - - -cdef inline void ListTag_insert(CListTagPtr cpp, ptrdiff_t item, AbstractBaseTag value): - if isinstance(value, ByteTag): - ListTag_insert_byte_tag(cpp, item, value) - elif isinstance(value, ShortTag): - ListTag_insert_short_tag(cpp, item, value) - elif isinstance(value, IntTag): - ListTag_insert_int_tag(cpp, item, value) - elif isinstance(value, LongTag): - ListTag_insert_long_tag(cpp, item, value) - elif isinstance(value, FloatTag): - ListTag_insert_float_tag(cpp, item, value) - elif isinstance(value, DoubleTag): - ListTag_insert_double_tag(cpp, item, value) - elif isinstance(value, ByteArrayTag): - ListTag_insert_byte_array_tag(cpp, item, value) - elif isinstance(value, StringTag): - ListTag_insert_string_tag(cpp, item, value) - elif isinstance(value, ListTag): - ListTag_insert_list_tag(cpp, item, value) - elif isinstance(value, CompoundTag): - ListTag_insert_compound_tag(cpp, item, value) - elif isinstance(value, IntArrayTag): - ListTag_insert_int_array_tag(cpp, item, value) - elif isinstance(value, LongArrayTag): - ListTag_insert_long_array_tag(cpp, item, value) - else: - raise TypeError(f"Unsupported type {type(value)}") - - -def _unpickle(string data) -> ListTag: - cdef pair[string, TagNode] named_tag = read_named_tag(data, endian.big, utf8_to_utf8_escape) - return ListTag.wrap(get[CListTagPtr](named_tag.second)) - - -cdef class ListTag(AbstractBaseMutableTag): - """A Python wrapper around a C++ vector. - - All contained data must be of the same NBT data type. - """ - tag_id: int = 9 - - def __init__(self, object value: Iterable[AbstractBaseTag] = (), char element_tag_id = 1) -> None: - self.cpp = make_shared[CListTag]() - if element_tag_id == 0: - dereference(self.cpp).emplace[monostate]() - elif element_tag_id == 1: - dereference(self.cpp).emplace[CByteList]() - elif element_tag_id == 2: - dereference(self.cpp).emplace[CShortList]() - elif element_tag_id == 3: - dereference(self.cpp).emplace[CIntList]() - elif element_tag_id == 4: - dereference(self.cpp).emplace[CLongList]() - elif element_tag_id == 5: - dereference(self.cpp).emplace[CFloatList]() - elif element_tag_id == 6: - dereference(self.cpp).emplace[CDoubleList]() - elif element_tag_id == 7: - dereference(self.cpp).emplace[CByteArrayList]() - elif element_tag_id == 8: - dereference(self.cpp).emplace[CStringList]() - elif element_tag_id == 9: - dereference(self.cpp).emplace[CListList]() - elif element_tag_id == 10: - dereference(self.cpp).emplace[CCompoundList]() - elif element_tag_id == 11: - dereference(self.cpp).emplace[CIntArrayList]() - elif element_tag_id == 12: - dereference(self.cpp).emplace[CLongArrayList]() - else: - raise ValueError(f"element_tag_id must be between 0 and 12. Got {element_tag_id}") - - for tag in value: - self.append(tag) - - @staticmethod - cdef ListTag wrap(CListTagPtr cpp): - cdef ListTag tag = ListTag.__new__(ListTag) - tag.cpp = cpp - return tag - - cdef TagNode to_node(self): - cdef TagNode node - node.emplace[CListTagPtr](self.cpp) - return node - - def __class_getitem__(cls, key: Any) -> type[ListTag]: - return cls - - @property - def py_list(self) -> list[ByteTag] | list[ShortTag] | list[IntTag] | list[LongTag] | list[FloatTag] | list[ - DoubleTag] | list[StringTag] | list[CompoundTag] | list[ByteArrayTag] | list[IntArrayTag] | list[LongArrayTag]: - """A python list representation of the class. - - The returned list is a shallow copy of the class, meaning changes will not mirror the instance. - Use the public API to modify the internal data. - """ - return list(self) - - @property - def py_data(self) -> Any: - return list(self) - - cdef string write_nbt(self, string name, endian endianness, CStringEncode string_encode): - return write_named_tag[CListTagPtr](name, self.cpp, endianness, string_encode) - - def to_snbt(self, object indent: None | str | int = None) -> str: - cdef string snbt - cdef string indent_str - if indent is None: - write_list_snbt(snbt, self.cpp) - else: - if isinstance(indent, int): - indent_str = " " * indent - elif isinstance(indent, str): - indent_str = indent - else: - raise TypeError("indent must be a str, int or None") - write_list_snbt(snbt, self.cpp, indent_str, 0) - return snbt - - def __eq__(self, object other: Any) -> bool: - if not isinstance(other, ListTag): - return False - cdef ListTag tag = other - return is_list_eq(self.cpp, tag.cpp) - - def __repr__(self) -> str: - return f"ListTag({list(self)!r}, {self.element_tag_id})" - - def __str__(self) -> str: - return str(list(self)) - - def __reduce__(self): - cdef bytes nbt = self.write_nbt(b"", endian.big, utf8_escape_to_utf8) - return _unpickle, (nbt,) - - def __copy__(self) -> ListTag: - return ListTag.wrap( - make_shared[CListTag](dereference(self.cpp)) - ) - - def __deepcopy__(self, memo=None) -> ListTag: - return ListTag.wrap(CListTagPtr_deepcopy(self.cpp)) - - @property - def element_tag_id(self) -> int: - """The numerical id of the element type in this list. - - Will be an int in the range 0-12. - """ - return dereference(self.cpp).index() - - @property - def element_class(self) -> ( - None | - Type[ByteTag] | - Type[ShortTag] | - Type[IntTag] | - Type[LongTag] | - Type[FloatTag] | - Type[DoubleTag] | - Type[StringTag] | - Type[ByteArrayTag] | - Type[ListTag] | - Type[CompoundTag] | - Type[IntArrayTag] | - Type[LongArrayTag] - ): - """The python class for the tag type contained in this list or None if the list tag is in the 0 state.""" - return ( - None, - ByteTag, - ShortTag, - IntTag, - LongTag, - FloatTag, - DoubleTag, - StringTag, - ByteArrayTag, - ListTag, - CompoundTag, - IntArrayTag, - LongArrayTag, - )[self.element_tag_id] - - # Sized - def __len__(self) -> int: - """The number of elements in the list.""" - return ListTag_len(self.cpp) - - # Sequence - def __getitem__(self, object item): - """Get an item or slice of items from the list.""" - if isinstance(item, int): - return ListTag_get_item(self.cpp, item) - elif isinstance(item, slice): - return ListTag_get_slice(self.cpp, item) - else: - raise TypeError(f"Unsupported item type {type(item)}") - - def __iter__(self): - """Iterate through items in the list.""" - i = 0 - try: - while True: - v = self[i] - yield v - i += 1 - except IndexError: - return - - def __contains__(self, value): - """Check if the item is in the list.""" - for v in self: - if v is value or v == value: - return True - return False - - def __reversed__(self): - """A reversed iterator for the list.""" - for i in reversed(range(len(self))): - yield self[i] - - def index(self, value, start=0, stop=None): - '''S.index(value, [start, [stop]]) -> integer -- return first index of value. - Raises ValueError if the value is not present. - - Supporting start and stop arguments is optional, but - recommended. - ''' - if start is not None and start < 0: - start = max(len(self) + start, 0) - if stop is not None and stop < 0: - stop += len(self) - - i = start - while stop is None or i < stop: - try: - v = self[i] - except IndexError: - break - if v is value or v == value: - return i - i += 1 - raise ValueError - - def count(self, value): - 'S.count(value) -> integer -- return number of occurrences of value' - return sum(1 for v in self if v is value or v == value) - - # MutableSequence - def __setitem__(self, object item, object value): - if isinstance(item, int): - ListTag_set_item(self.cpp, item, value) - elif isinstance(item, slice): - ListTag_set_slice(self.cpp, item, value) - else: - raise TypeError(f"Unsupported item type {type(item)}") - - def __delitem__(self, object item): - if isinstance(item, int): - ListTag_del_item(self.cpp, item) - elif isinstance(item, slice): - ListTag_del_slice(self.cpp, item) - else: - raise TypeError(f"Unsupported item type {type(item)}") - - def insert(self, ptrdiff_t index, AbstractBaseTag value not None): - ListTag_insert(self.cpp, index, value) - - def append(self, AbstractBaseTag value not None): - 'S.append(value) -- append value to the end of the sequence' - ListTag_append(self.cpp, value) - - def clear(self): - cdef size_t index = dereference(self.cpp).index() - if index == 1: - get[CByteList](dereference(self.cpp)).clear() - elif index == 2: - get[CShortList](dereference(self.cpp)).clear() - elif index == 3: - get[CIntList](dereference(self.cpp)).clear() - elif index == 4: - get[CLongList](dereference(self.cpp)).clear() - elif index == 5: - get[CFloatList](dereference(self.cpp)).clear() - elif index == 6: - get[CDoubleList](dereference(self.cpp)).clear() - elif index == 7: - get[CByteArrayList](dereference(self.cpp)).clear() - elif index == 8: - get[CStringList](dereference(self.cpp)).clear() - elif index == 9: - get[CListList](dereference(self.cpp)).clear() - elif index == 10: - get[CCompoundList](dereference(self.cpp)).clear() - elif index == 11: - get[CIntArrayList](dereference(self.cpp)).clear() - elif index == 12: - get[CLongArrayList](dereference(self.cpp)).clear() - - def reverse(self): - 'S.reverse() -- reverse *IN PLACE*' - n = len(self) - for i in range(n//2): - self[i], self[n-i-1] = self[n-i-1], self[i] - - def extend(self, values): - 'S.extend(iterable) -- extend sequence by appending elements from the iterable' - if values is self: - values = list(values) - for v in values: - self.append(v) - - def pop(self, index=-1): - '''S.pop([index]) -> item -- remove and return item at index (default last). - Raise IndexError if list is empty or index is out of range. - ''' - v = self[index] - del self[index] - return v - - def remove(self, value): - '''S.remove(value) -- remove first occurrence of value. - Raise ValueError if the value is not present. - ''' - del self[self.index(value)] - - def __iadd__(self, values): - self.extend(values) - return self - - def copy(self) -> ListTag: - """Return a shallow copy of the class""" - return ListTag(self, dereference(self.cpp).index()) - - def get_byte(self, ptrdiff_t index) -> amulet_nbt.ByteTag: - """Get the tag at index if it is a ByteTag. - - :param index: The index to get - :return: The ByteTag. - :raises: IndexError if the index is outside the list. - :raises: TypeError if the stored type is not a ByteTag - """ - cdef ByteTag tag = ListTag_get_item(self.cpp, index) - return tag - - def get_short(self, ptrdiff_t index) -> amulet_nbt.ShortTag: - """Get the tag at index if it is a ShortTag. - - :param index: The index to get - :return: The ShortTag. - :raises: IndexError if the index is outside the list. - :raises: TypeError if the stored type is not a ShortTag - """ - cdef ShortTag tag = ListTag_get_item(self.cpp, index) - return tag - - def get_int(self, ptrdiff_t index) -> amulet_nbt.IntTag: - """Get the tag at index if it is a IntTag. - - :param index: The index to get - :return: The IntTag. - :raises: IndexError if the index is outside the list. - :raises: TypeError if the stored type is not a IntTag - """ - cdef IntTag tag = ListTag_get_item(self.cpp, index) - return tag - - def get_long(self, ptrdiff_t index) -> amulet_nbt.LongTag: - """Get the tag at index if it is a LongTag. - - :param index: The index to get - :return: The LongTag. - :raises: IndexError if the index is outside the list. - :raises: TypeError if the stored type is not a LongTag - """ - cdef LongTag tag = ListTag_get_item(self.cpp, index) - return tag - - def get_float(self, ptrdiff_t index) -> amulet_nbt.FloatTag: - """Get the tag at index if it is a FloatTag. - - :param index: The index to get - :return: The FloatTag. - :raises: IndexError if the index is outside the list. - :raises: TypeError if the stored type is not a FloatTag - """ - cdef FloatTag tag = ListTag_get_item(self.cpp, index) - return tag - - def get_double(self, ptrdiff_t index) -> amulet_nbt.DoubleTag: - """Get the tag at index if it is a DoubleTag. - - :param index: The index to get - :return: The DoubleTag. - :raises: IndexError if the index is outside the list. - :raises: TypeError if the stored type is not a DoubleTag - """ - cdef DoubleTag tag = ListTag_get_item(self.cpp, index) - return tag - - def get_string(self, ptrdiff_t index) -> amulet_nbt.StringTag: - """Get the tag at index if it is a StringTag. - - :param index: The index to get - :return: The StringTag. - :raises: IndexError if the index is outside the list. - :raises: TypeError if the stored type is not a StringTag - """ - cdef StringTag tag = ListTag_get_item(self.cpp, index) - return tag - - def get_list(self, ptrdiff_t index) -> amulet_nbt.ListTag: - """Get the tag at index if it is a ListTag. - - :param index: The index to get - :return: The ListTag. - :raises: IndexError if the index is outside the list. - :raises: TypeError if the stored type is not a ListTag - """ - cdef ListTag tag = ListTag_get_item(self.cpp, index) - return tag - - def get_compound(self, ptrdiff_t index) -> amulet_nbt.CompoundTag: - """Get the tag at index if it is a CompoundTag. - - :param index: The index to get - :return: The CompoundTag. - :raises: IndexError if the index is outside the list. - :raises: TypeError if the stored type is not a CompoundTag - """ - cdef CompoundTag tag = ListTag_get_item(self.cpp, index) - return tag - - def get_byte_array(self, ptrdiff_t index) -> amulet_nbt.ByteArrayTag: - """Get the tag at index if it is a ByteArrayTag. - - :param index: The index to get - :return: The ByteArrayTag. - :raises: IndexError if the index is outside the list. - :raises: TypeError if the stored type is not a ByteArrayTag - """ - cdef ByteArrayTag tag = ListTag_get_item(self.cpp, index) - return tag - - def get_int_array(self, ptrdiff_t index) -> amulet_nbt.IntArrayTag: - """Get the tag at index if it is a IntArrayTag. - - :param index: The index to get - :return: The IntArrayTag. - :raises: IndexError if the index is outside the list. - :raises: TypeError if the stored type is not a IntArrayTag - """ - cdef IntArrayTag tag = ListTag_get_item(self.cpp, index) - return tag - - def get_long_array(self, ptrdiff_t index) -> amulet_nbt.LongArrayTag: - """Get the tag at index if it is a LongArrayTag. - - :param index: The index to get - :return: The LongArrayTag. - :raises: IndexError if the index is outside the list. - :raises: TypeError if the stored type is not a LongArrayTag - """ - cdef LongArrayTag tag = ListTag_get_item(self.cpp, index) - return tag diff --git a/src_/amulet_nbt/_tag/list.pyx.tp b/src_/amulet_nbt/_tag/list.pyx.tp deleted file mode 100644 index 48f7210a..00000000 --- a/src_/amulet_nbt/_tag/list.pyx.tp +++ /dev/null @@ -1,776 +0,0 @@ -{{py: -import base64 -from template import include -}} -{{base64.b64decode("IyMgVGhpcyBmaWxlIGlzIGdlbmVyYXRlZCBmcm9tIGEgdGVtcGxhdGUuCiMjIERvIG5vdCBtb2RpZnkgdGhpcyBmaWxlIGRpcmVjdGx5IG9yIHlvdXIgY2hhbmdlcyB3aWxsIGdldCBvdmVyd3JpdHRlbi4KIyMgRWRpdCB0aGUgYWNjb21wYW55aW5nIC5weXgudHAgZmlsZSBpbnN0ZWFkLg==").decode()}} -# cython: language_level=3, boundscheck=False, wraparound=False -# distutils: language = c++ -# distutils: extra_compile_args = CPPCARGS -# cython: c_string_type=str, c_string_encoding=utf8 -# distutils: sources = [src/amulet_nbt/_string_encoding/_cpp/utf8.cpp, src/amulet_nbt/_nbt_encoding/_binary/_cpp/read_nbt.cpp] - -from typing import Any, Type -from collections.abc import Iterable - -from libc.math cimport ceil -from libcpp cimport bool -from libcpp.pair cimport pair -from libcpp.memory cimport make_shared -from libcpp.string cimport string -from cython.operator cimport dereference -import amulet_nbt -from amulet_nbt._libcpp.variant cimport get, monostate -from amulet_nbt._libcpp.endian cimport endian -from amulet_nbt._string_encoding._cpp cimport CStringEncode -from amulet_nbt._string_encoding._cpp.utf8 cimport utf8_escape_to_utf8, utf8_to_utf8_escape -from amulet_nbt._nbt_encoding._binary._cpp cimport read_named_tag -from amulet_nbt._nbt_encoding._binary cimport write_named_tag -from amulet_nbt._nbt_encoding._string cimport write_list_snbt - -from amulet_nbt._tag._cpp cimport ( - TagNode, - CListTag, - CListTagPtr, - CByteList, - CShortList, - CIntList, - CLongList, - CFloatList, - CDoubleList, - CByteArrayList, - CStringList, - CListList, - CCompoundList, - CIntArrayList, - CLongArrayList, -) -from .abc cimport AbstractBaseTag, AbstractBaseMutableTag -from .int cimport ByteTag, ShortTag, IntTag, LongTag -from .float cimport FloatTag, DoubleTag -from .string cimport StringTag -from .compound cimport CompoundTag -from .array cimport ByteArrayTag, IntArrayTag, LongArrayTag -from .deepcopy cimport CListTagPtr_deepcopy -from .compound cimport is_compound_eq -{{py: -ClassData = ( - #id, C cls, C node cls C list cls py cls, tag var, list var - (1, "CByteTag", "CByteTag", "CByteList", "ByteTag", "byte_tag", "byte_list", ), - (2, "CShortTag", "CShortTag", "CShortList", "ShortTag", "short_tag", "short_list", ), - (3, "CIntTag", "CIntTag", "CIntList", "IntTag", "int_tag", "int_list", ), - (4, "CLongTag", "CLongTag", "CLongList", "LongTag", "long_tag", "long_list", ), - (5, "CFloatTag", "CFloatTag", "CFloatList", "FloatTag", "float_tag", "float_list", ), - (6, "CDoubleTag", "CDoubleTag", "CDoubleList", "DoubleTag", "double_tag", "double_list", ), - (7, "CByteArrayTag", "CByteArrayTagPtr", "CByteArrayList", "ByteArrayTag", "byte_array_tag", "byte_array_list", ), - (8, "CStringTag", "CStringTag", "CStringList", "StringTag", "string_tag", "string_list", ), - (9, "CListTag", "CListTagPtr", "CListList", "ListTag", "list_tag", "list_list", ), - (10, "CCompoundTag", "CCompoundTagPtr", "CCompoundList", "CompoundTag", "compound_tag", "compound_list", ), - (11, "CIntArrayTag", "CIntArrayTagPtr", "CIntArrayList", "IntArrayTag", "int_array_tag", "int_array_list", ), - (12, "CLongArrayTag", "CLongArrayTagPtr", "CLongArrayList", "LongArrayTag", "long_array_tag", "long_array_list", ), -) -}} - - -{{ -"\n\n\n".join( -f"""cdef inline bool _is_{tag_var}_list_eq(CListTagPtr a, CListTagPtr b) noexcept nogil: - cdef {c_list_cls}* {list_var}_a = &get[{c_list_cls}](dereference(a)) - if dereference(b).index() != {index}: - return dereference({list_var}_a).size() == 0 and ListTag_len(b) == 0 - cdef {c_list_cls}* {list_var}_b = &get[{c_list_cls}](dereference(b)) - cdef size_t size = dereference({list_var}_a).size() - cdef size_t i - - if size != dereference({list_var}_b).size(): - return False - - for i in range(size): - if { - f"not is_list_eq(dereference({list_var}_a)[i], dereference({list_var}_b)[i])" if index == 9 else - f"not is_compound_eq(dereference({list_var}_a)[i], dereference({list_var}_b)[i])" if index == 10 else - f"dereference(dereference({list_var}_a)[i]) != dereference(dereference({list_var}_b)[i])" if index in {7, 11, 12} else - f"dereference({list_var}_a)[i] != dereference({list_var}_b)[i]" - }: - return False - return True""" - for index, c_cls, c_node_cls, c_list_cls, py_cls, tag_var, list_var in ClassData - ) -}} - - -cdef bool is_list_eq(CListTagPtr a, CListTagPtr b) noexcept nogil: - cdef size_t index = dereference(a).index() - if index == 0: - return ListTag_len(b) == 0 -{{ -"\n".join( -f""" elif index == {index}: - return _is_{tag_var}_list_eq(a, b)""" - for index, c_cls, c_node_cls, c_list_cls, py_cls, tag_var, list_var in ClassData -) -}} - return False - - -cdef inline size_t ListTag_len(CListTagPtr cpp) noexcept nogil: - cdef size_t index = dereference(cpp).index() -{{ -"".join( - f" {'el'*(index!=1)}if index == {index}:\n return get[{c_list_cls}](dereference(cpp)).size()\n" - for index, c_cls, c_node_cls, c_list_cls, py_cls, tag_var, list_var in ClassData -) -}} - return 0 - - -{{ -"\n\n\n".join( -f"""cdef inline {py_cls} ListTag_get_item_{tag_var}(CListTagPtr cpp, ptrdiff_t item): - cdef {c_list_cls}* {list_var} = &get[{c_list_cls}](dereference(cpp)) - if item < 0: - item += dereference({list_var}).size() - if item < 0 or item >= dereference({list_var}).size(): - raise IndexError("ListTag index out of range") - return {py_cls}.wrap(dereference({list_var})[item])""" - for index, c_cls, c_node_cls, c_list_cls, py_cls, tag_var, list_var in ClassData -) -}} - - -cdef inline AbstractBaseTag ListTag_get_item(CListTagPtr cpp, ptrdiff_t item): - cdef size_t index = dereference(cpp).index() -{{ -"\n".join( -f""" {"el"*(index!=1)}if index == {index}: - return ListTag_get_item_{tag_var}(cpp, item)""" - for index, c_cls, c_node_cls, c_list_cls, py_cls, tag_var, list_var in ClassData -) -}} - else: - raise IndexError("ListTag index out of range.") - - -cdef (size_t, size_t, ptrdiff_t) _slice_to_range(size_t target_len, object s): - cdef ptrdiff_t start - cdef ptrdiff_t stop - cdef ptrdiff_t step - - if s.step is None: - step = 1 - else: - step = s.step - - if step > 0: - if s.start is None: - start = 0 - elif s.start < 0: - start = s.start + target_len - else: - start = s.start - start = min(max(0, start), target_len) - if s.stop is None: - stop = target_len - elif s.stop < 0: - stop = s.stop + target_len - else: - stop = s.stop - stop = min(max(0, stop), target_len) - - elif step < 0: - if s.start is None: - start = target_len - 1 - elif s.start < 0: - start = s.start + target_len - else: - start = s.start - start = min(max(-1, start), target_len - 1) - if s.stop is None: - stop = -1 - elif s.stop < 0: - stop = s.stop + target_len - else: - stop = s.stop - stop = min(max(-1, stop), target_len - 1) - - elif step == 0: - raise ValueError("slice step cannot be zero") - else: - raise RuntimeError - - return start, stop, step - - -{{ -"\n\n\n".join( -f"""cdef inline list ListTag_get_slice_{tag_var}(CListTagPtr cpp, object s): - cdef size_t start - cdef size_t stop - cdef ptrdiff_t step - cdef size_t item - - cdef {c_list_cls}* {list_var} = &get[{c_list_cls}](dereference(cpp)) - - start, stop, step = _slice_to_range(dereference({list_var}).size(), s) - return [ - {py_cls}.wrap(dereference({list_var})[item]) - for item in range(start, stop, step) - ]""" - for index, c_cls, c_node_cls, c_list_cls, py_cls, tag_var, list_var in ClassData -) -}} - - -cdef inline list ListTag_get_slice(CListTagPtr cpp, object s): - cdef size_t index = dereference(cpp).index() -{{ -"\n".join( -f""" {"el"*(index!=1)}if index == {index}: - return ListTag_get_slice_{tag_var}(cpp, s)""" - for index, c_cls, c_node_cls, c_list_cls, py_cls, tag_var, list_var in ClassData -) -}} - else: - return [] - - -{{ -"\n\n\n".join( -f"""cdef inline void ListTag_set_item_{tag_var}(CListTagPtr cpp, ptrdiff_t item, {py_cls} value): - cdef {c_list_cls}* {list_var} - - if dereference(cpp).index() == {index}: - {list_var} = &get[{c_list_cls}](dereference(cpp)) - if item < 0: - item += dereference({list_var}).size() - if item < 0 or item >= dereference({list_var}).size(): - raise IndexError("ListTag assignment index out of range") - dereference({list_var})[item] = value.cpp - elif ListTag_len(cpp) == 1 and (item == 0 or item == -1): - dereference(cpp).emplace[{c_list_cls}]() - {list_var} = &get[{c_list_cls}](dereference(cpp)) - dereference({list_var}).push_back(value.cpp) - else: - raise TypeError("NBT ListTag item mismatch.")""" - for index, c_cls, c_node_cls, c_list_cls, py_cls, tag_var, list_var in ClassData -) -}} - - -cdef inline void ListTag_set_item(CListTagPtr cpp, ptrdiff_t item, AbstractBaseTag value): -{{ -"\n".join( - f""" {"el" * (index != 1)}if isinstance(value, {py_cls}): - ListTag_set_item_{tag_var}(cpp, item, value)""" - for index, c_cls, c_node_cls, c_list_cls, py_cls, tag_var, list_var in ClassData -) -}} - else: - raise TypeError(f"Unsupported type {{'{'}}type(value){{'}'}}") - - -cdef inline size_t _iter_count(size_t start, size_t stop, ptrdiff_t step): - cdef double iter_count = ceil((stop - start)/step) - if iter_count < 0: - return 0 - else: - return iter_count - - -{{ -"\n\n\n".join( -f"""cdef inline void ListTag_set_slice_{tag_var}(CListTagPtr cpp, object s, list value): - if not all(isinstance(v, {py_cls}) for v in value): - raise TypeError("All elements of a ListTag must have the same type.") - - cdef {c_list_cls}* {list_var} - cdef size_t start - cdef size_t stop - cdef ptrdiff_t step - cdef size_t item - cdef size_t iter_count - cdef {py_cls} el - cdef size_t size - - if dereference(cpp).index() == {index}: - {list_var} = &get[{c_list_cls}](dereference(cpp)) - - start, stop, step = _slice_to_range(dereference({list_var}).size(), s) - iter_count = _iter_count(start, stop, step) - - if iter_count == len(value): - for item, el in zip(range(start, stop, step), value): - dereference({list_var})[item] = el.cpp - elif step == 1: - dereference({list_var}).erase( - dereference({list_var}).begin() + start, - dereference({list_var}).begin() + stop, - ) - for item, el in enumerate(value): - dereference({list_var}).insert(dereference({list_var}).begin() + start + item, el.cpp) - else: - raise ValueError(f"attempt to assign sequence of size {"{"}len(value){"}"} to extended slice of size {"{"*2}iter_count{"}"*2}") - - else: - size = ListTag_len(cpp) - start, stop, step = _slice_to_range(size, s) - iter_count = _iter_count(start, stop, step) - if size == iter_count: - if step == -1: - value = reversed(value) - elif step != 1: - raise RuntimeError - - dereference(cpp).emplace[{c_list_cls}]() - {list_var} = &get[{c_list_cls}](dereference(cpp)) - for el in value: - dereference({list_var}).push_back(el.cpp) - else: - raise TypeError("NBT ListTag item mismatch.")""" - for index, c_cls, c_node_cls, c_list_cls, py_cls, tag_var, list_var in ClassData -) -}} - - -cdef inline void _set_slice_empty(CListTagPtr cpp, object s): - cdef size_t index = dereference(cpp).index() -{{ -"\n".join( -f""" {'el' * (index != 1)}if index == {index}: - ListTag_set_slice_{tag_var}(cpp, s, [])""" - for index, c_cls, c_node_cls, c_list_cls, py_cls, tag_var, list_var in ClassData -) -}} - - -cdef inline void ListTag_set_slice(CListTagPtr cpp, object s, object value): - cdef list arr = value - if arr: - # Items in the array -{{ -"\n".join( -f""" {"el" * (index != 1)}if isinstance(arr[0], {py_cls}): - ListTag_set_slice_{tag_var}(cpp, s, arr)""" - for index, c_cls, c_node_cls, c_list_cls, py_cls, tag_var, list_var in ClassData -) -}} - else: - raise TypeError(f"Unsupported type {{'{'}}type(value){{'}'}}") - else: - # array is empty - _set_slice_empty(cpp, s) - - -{{ -"\n\n\n".join( -f"""cdef inline void ListTag_del_item_{tag_var}(CListTagPtr cpp, ptrdiff_t item): - cdef {c_list_cls}* {list_var} = &get[{c_list_cls}](dereference(cpp)) - if item < 0: - item += dereference({list_var}).size() - if item < 0 or item >= dereference({list_var}).size(): - raise IndexError("ListTag assignment index out of range") - dereference({list_var}).erase(dereference({list_var}).begin() + item)""" - for index, c_cls, c_node_cls, c_list_cls, py_cls, tag_var, list_var in ClassData -) -}} - - -cdef inline void ListTag_del_item(CListTagPtr cpp, ptrdiff_t item): - cdef size_t index = dereference(cpp).index() -{{ -"\n".join( -f""" {"el"*(index!=1)}if index == {index}: - ListTag_del_item_{tag_var}(cpp, item)""" - for index, c_cls, c_node_cls, c_list_cls, py_cls, tag_var, list_var in ClassData -) -}} - else: - raise IndexError("ListTag assignment index out of range.") - - -{{ -"\n\n\n".join( -f"""cdef inline void ListTag_del_slice_{tag_var}(CListTagPtr cpp, object s): - cdef size_t start - cdef size_t stop - cdef size_t step - cdef size_t item - - cdef {c_list_cls}* {list_var} - {list_var} = &get[{c_list_cls}](dereference(cpp)) - - start, stop, step = _slice_to_range(dereference({list_var}).size(), s) - - if step == 1: - dereference({list_var}).erase( - dereference({list_var}).begin() + start, - dereference({list_var}).begin() + stop, - ) - else: - for item in range(start, stop, step): - dereference({list_var}).erase(dereference({list_var}).begin() + item)""" - for index, c_cls, c_node_cls, c_list_cls, py_cls, tag_var, list_var in ClassData -) -}} - - -cdef inline void ListTag_del_slice(CListTagPtr cpp, object s): - cdef size_t index = dereference(cpp).index() -{{ -"\n".join( - f""" {"el" * (index != 1)}if index == {index}: - ListTag_del_slice_{tag_var}(cpp, s)""" - for index, c_cls, c_node_cls, c_list_cls, py_cls, tag_var, list_var in ClassData -) -}} - - -{{ -"\n\n\n".join( -f"""cdef inline void ListTag_insert_{tag_var}(CListTagPtr cpp, ptrdiff_t item, {py_cls} value): - cdef {c_list_cls}* {list_var} - - if dereference(cpp).index() == {index}: - {list_var} = &get[{c_list_cls}](dereference(cpp)) - elif ListTag_len(cpp) == 0: - dereference(cpp).emplace[{c_list_cls}]() - {list_var} = &get[{c_list_cls}](dereference(cpp)) - else: - raise TypeError("ListTag can only contain one NBT data type.") - - if item < 0: - item += dereference({list_var}).size() - item = min(max(0, item), dereference({list_var}).size()) - - dereference({list_var}).insert(dereference({list_var}).begin() + item, value.cpp)""" - for index, c_cls, c_node_cls, c_list_cls, py_cls, tag_var, list_var in ClassData -) -}} - - -cdef inline void ListTag_insert(CListTagPtr cpp, ptrdiff_t item, AbstractBaseTag value): -{{ -"\n".join( - f""" {"el" * (index != 1)}if isinstance(value, {py_cls}): - ListTag_insert_{tag_var}(cpp, item, value)""" - for index, c_cls, c_node_cls, c_list_cls, py_cls, tag_var, list_var in ClassData -) -}} - else: - raise TypeError(f"Unsupported type {{'{'}}type(value){{'}'}}") - - -{{ -"\n\n\n".join( -f"""cdef inline void ListTag_append_{tag_var}(CListTagPtr cpp, {py_cls} value): - cdef {c_list_cls}* {list_var} - - if dereference(cpp).index() == {index}: - {list_var} = &get[{c_list_cls}](dereference(cpp)) - elif ListTag_len(cpp) == 0: - dereference(cpp).emplace[{c_list_cls}]() - {list_var} = &get[{c_list_cls}](dereference(cpp)) - else: - raise TypeError("ListTag can only contain one NBT data type.") - - dereference({list_var}).push_back(value.cpp)""" - for index, c_cls, c_node_cls, c_list_cls, py_cls, tag_var, list_var in ClassData -) -}} - - -cdef inline void ListTag_append(CListTagPtr cpp, AbstractBaseTag value): -{{ -"\n".join( - f""" {"el" * (index != 1)}if isinstance(value, {py_cls}): - ListTag_append_{tag_var}(cpp, value)""" - for index, c_cls, c_node_cls, c_list_cls, py_cls, tag_var, list_var in ClassData -) -}} - else: - raise TypeError(f"Unsupported type {{'{'}}type(value){{'}'}}") - - -def _unpickle(string data) -> ListTag: - cdef pair[string, TagNode] named_tag = read_named_tag(data, endian.big, utf8_to_utf8_escape) - return ListTag.wrap(get[CListTagPtr](named_tag.second)) - - -cdef class ListTag(AbstractBaseMutableTag): - """A Python wrapper around a C++ vector. - - All contained data must be of the same NBT data type. - """ - tag_id: int = 9 - - def __init__(self, object value: Iterable[AbstractBaseTag] = (), char element_tag_id = 1) -> None: - self.cpp = make_shared[CListTag]() - if element_tag_id == 0: - dereference(self.cpp).emplace[monostate]() -{{ -"\n".join( - f""" elif element_tag_id == {index}: - dereference(self.cpp).emplace[{c_list_cls}]()""" - for index, c_cls, c_node_cls, c_list_cls, py_cls, tag_var, list_var in ClassData -) -}} - else: - raise ValueError(f"element_tag_id must be between 0 and 12. Got {{'{'}}element_tag_id{{'}'}}") - - for tag in value: - self.append(tag) - - @staticmethod - cdef ListTag wrap(CListTagPtr cpp): - cdef ListTag tag = ListTag.__new__(ListTag) - tag.cpp = cpp - return tag - - cdef TagNode to_node(self): - cdef TagNode node - node.emplace[CListTagPtr](self.cpp) - return node - - def __class_getitem__(cls, key: Any) -> type[ListTag]: - return cls - - @property - def py_list(self) -> list[ByteTag] | list[ShortTag] | list[IntTag] | list[LongTag] | list[FloatTag] | list[ - DoubleTag] | list[StringTag] | list[CompoundTag] | list[ByteArrayTag] | list[IntArrayTag] | list[LongArrayTag]: - """A python list representation of the class. - - The returned list is a shallow copy of the class, meaning changes will not mirror the instance. - Use the public API to modify the internal data. - """ - return list(self) - - @property - def py_data(self) -> Any: - return list(self) - - cdef string write_nbt(self, string name, endian endianness, CStringEncode string_encode): - return write_named_tag[CListTagPtr](name, self.cpp, endianness, string_encode) - -{{include("amulet_nbt/tpf/to_snbt_multiline.pyx.tpf", tag="list")}} - - def __eq__(self, object other: Any) -> bool: - if not isinstance(other, ListTag): - return False - cdef ListTag tag = other - return is_list_eq(self.cpp, tag.cpp) - - def __repr__(self) -> str: - return f"ListTag({list(self)!r}, {self.element_tag_id})" - - def __str__(self) -> str: - return str(list(self)) - - def __reduce__(self): - cdef bytes nbt = self.write_nbt(b"", endian.big, utf8_escape_to_utf8) - return _unpickle, (nbt,) - - def __copy__(self) -> ListTag: - return ListTag.wrap( - make_shared[CListTag](dereference(self.cpp)) - ) - - def __deepcopy__(self, memo=None) -> ListTag: - return ListTag.wrap(CListTagPtr_deepcopy(self.cpp)) - - @property - def element_tag_id(self) -> int: - """The numerical id of the element type in this list. - - Will be an int in the range 0-12. - """ - return dereference(self.cpp).index() - - @property - def element_class(self) -> ( - None | - Type[ByteTag] | - Type[ShortTag] | - Type[IntTag] | - Type[LongTag] | - Type[FloatTag] | - Type[DoubleTag] | - Type[StringTag] | - Type[ByteArrayTag] | - Type[ListTag] | - Type[CompoundTag] | - Type[IntArrayTag] | - Type[LongArrayTag] - ): - """The python class for the tag type contained in this list or None if the list tag is in the 0 state.""" - return ( - None, - ByteTag, - ShortTag, - IntTag, - LongTag, - FloatTag, - DoubleTag, - StringTag, - ByteArrayTag, - ListTag, - CompoundTag, - IntArrayTag, - LongArrayTag, - )[self.element_tag_id] - - # Sized - def __len__(self) -> int: - """The number of elements in the list.""" - return ListTag_len(self.cpp) - - # Sequence - def __getitem__(self, object item): - """Get an item or slice of items from the list.""" - if isinstance(item, int): - return ListTag_get_item(self.cpp, item) - elif isinstance(item, slice): - return ListTag_get_slice(self.cpp, item) - else: - raise TypeError(f"Unsupported item type {{'{'}}type(item){{'}'}}") - - def __iter__(self): - """Iterate through items in the list.""" - i = 0 - try: - while True: - v = self[i] - yield v - i += 1 - except IndexError: - return - - def __contains__(self, value): - """Check if the item is in the list.""" - for v in self: - if v is value or v == value: - return True - return False - - def __reversed__(self): - """A reversed iterator for the list.""" - for i in reversed(range(len(self))): - yield self[i] - - def index(self, value, start=0, stop=None): - '''S.index(value, [start, [stop]]) -> integer -- return first index of value. - Raises ValueError if the value is not present. - - Supporting start and stop arguments is optional, but - recommended. - ''' - if start is not None and start < 0: - start = max(len(self) + start, 0) - if stop is not None and stop < 0: - stop += len(self) - - i = start - while stop is None or i < stop: - try: - v = self[i] - except IndexError: - break - if v is value or v == value: - return i - i += 1 - raise ValueError - - def count(self, value): - 'S.count(value) -> integer -- return number of occurrences of value' - return sum(1 for v in self if v is value or v == value) - - # MutableSequence - def __setitem__(self, object item, object value): - if isinstance(item, int): - ListTag_set_item(self.cpp, item, value) - elif isinstance(item, slice): - ListTag_set_slice(self.cpp, item, value) - else: - raise TypeError(f"Unsupported item type {{'{'}}type(item){{'}'}}") - - def __delitem__(self, object item): - if isinstance(item, int): - ListTag_del_item(self.cpp, item) - elif isinstance(item, slice): - ListTag_del_slice(self.cpp, item) - else: - raise TypeError(f"Unsupported item type {{'{'}}type(item){{'}'}}") - - def insert(self, ptrdiff_t index, AbstractBaseTag value not None): - ListTag_insert(self.cpp, index, value) - - def append(self, AbstractBaseTag value not None): - 'S.append(value) -- append value to the end of the sequence' - ListTag_append(self.cpp, value) - - def clear(self): - cdef size_t index = dereference(self.cpp).index() -{{ -"\n".join( - f""" {"el" * (index != 1)}if index == {index}: - get[{c_list_cls}](dereference(self.cpp)).clear()""" - for index, c_cls, c_node_cls, c_list_cls, py_cls, tag_var, list_var in ClassData -) -}} - - def reverse(self): - 'S.reverse() -- reverse *IN PLACE*' - n = len(self) - for i in range(n//2): - self[i], self[n-i-1] = self[n-i-1], self[i] - - def extend(self, values): - 'S.extend(iterable) -- extend sequence by appending elements from the iterable' - if values is self: - values = list(values) - for v in values: - self.append(v) - - def pop(self, index=-1): - '''S.pop([index]) -> item -- remove and return item at index (default last). - Raise IndexError if list is empty or index is out of range. - ''' - v = self[index] - del self[index] - return v - - def remove(self, value): - '''S.remove(value) -- remove first occurrence of value. - Raise ValueError if the value is not present. - ''' - del self[self.index(value)] - - def __iadd__(self, values): - self.extend(values) - return self - - def copy(self) -> ListTag: - """Return a shallow copy of the class""" - return ListTag(self, dereference(self.cpp).index()) - -{{include("amulet_nbt/tpf/ListGet.pyx.tpf", py_cls="ByteTag", tag_name="byte")}} - -{{include("amulet_nbt/tpf/ListGet.pyx.tpf", py_cls="ShortTag", tag_name="short")}} - -{{include("amulet_nbt/tpf/ListGet.pyx.tpf", py_cls="IntTag", tag_name="int")}} - -{{include("amulet_nbt/tpf/ListGet.pyx.tpf", py_cls="LongTag", tag_name="long")}} - -{{include("amulet_nbt/tpf/ListGet.pyx.tpf", py_cls="FloatTag", tag_name="float")}} - -{{include("amulet_nbt/tpf/ListGet.pyx.tpf", py_cls="DoubleTag", tag_name="double")}} - -{{include("amulet_nbt/tpf/ListGet.pyx.tpf", py_cls="StringTag", tag_name="string")}} - -{{include("amulet_nbt/tpf/ListGet.pyx.tpf", py_cls="ListTag", tag_name="list")}} - -{{include("amulet_nbt/tpf/ListGet.pyx.tpf", py_cls="CompoundTag", tag_name="compound")}} - -{{include("amulet_nbt/tpf/ListGet.pyx.tpf", py_cls="ByteArrayTag", tag_name="byte_array")}} - -{{include("amulet_nbt/tpf/ListGet.pyx.tpf", py_cls="IntArrayTag", tag_name="int_array")}} - -{{include("amulet_nbt/tpf/ListGet.pyx.tpf", py_cls="LongArrayTag", tag_name="long_array")}} diff --git a/src_/amulet_nbt/_tag/named_tag.pxd b/src_/amulet_nbt/_tag/named_tag.pxd deleted file mode 100644 index 50f7c3b3..00000000 --- a/src_/amulet_nbt/_tag/named_tag.pxd +++ /dev/null @@ -1,13 +0,0 @@ -from libcpp.string cimport string -from amulet_nbt._tag.abc cimport AbstractBase -from amulet_nbt._tag._cpp cimport TagNode -from amulet_nbt._libcpp.endian cimport endian -from amulet_nbt._string_encoding._cpp cimport CStringEncode - - -cdef class NamedTag(AbstractBase): - cdef string tag_name - cdef TagNode tag_node - cdef string write_nbt(self, endian endianness, CStringEncode string_encode) - @staticmethod - cdef NamedTag wrap(string name, TagNode node) diff --git a/src_/amulet_nbt/_tag/named_tag.pyx b/src_/amulet_nbt/_tag/named_tag.pyx deleted file mode 100644 index 13446178..00000000 --- a/src_/amulet_nbt/_tag/named_tag.pyx +++ /dev/null @@ -1,323 +0,0 @@ -## This file is generated from a template. -## Do not modify this file directly or your changes will get overwritten. -## Edit the accompanying .pyx.tp file instead. -# cython: language_level=3, boundscheck=False, wraparound=False -# distutils: language = c++ -# distutils: extra_compile_args = CPPCARGS -# cython: c_string_type=str, c_string_encoding=utf8 -# distutils: sources = [src/amulet_nbt/_string_encoding/_cpp/utf8.cpp, src/amulet_nbt/_nbt_encoding/_binary/_cpp/read_nbt.cpp] - -from typing import Any -import copy -import gzip -from libcpp.string cimport string -from libcpp cimport bool -from libcpp.pair cimport pair -import amulet_nbt -from amulet_nbt._libcpp.endian cimport endian -from amulet_nbt._string_encoding cimport StringEncoding -from amulet_nbt._string_encoding import mutf8_encoding -from amulet_nbt._string_encoding._cpp cimport CStringEncode -from amulet_nbt._string_encoding._cpp.utf8 cimport utf8_escape_to_utf8, utf8_to_utf8_escape -from amulet_nbt._nbt_encoding._binary._cpp cimport read_named_tag -from amulet_nbt._nbt_encoding._binary cimport write_named_tag -from amulet_nbt._nbt_encoding._binary.encoding_preset cimport EncodingPreset -from amulet_nbt._nbt_encoding._string cimport write_node_snbt - -from .abc cimport AbstractBase, AbstractBaseTag -from .int cimport ByteTag, ShortTag, IntTag, LongTag -from .float cimport FloatTag, DoubleTag -from .string cimport StringTag -from .list cimport ListTag -from .compound cimport wrap_node, CompoundTag -from .array cimport ByteArrayTag, IntArrayTag, LongArrayTag - - -def _unpickle(string data): - cdef pair[string, TagNode] named_tag = read_named_tag(data, endian.big, utf8_to_utf8_escape) - return NamedTag.wrap(named_tag.first, named_tag.second) - - -cdef class NamedTag(AbstractBase): - def __init__(self, AbstractBaseTag tag: amulet_nbt.AbstractBaseTag = None, string name: str | bytes = b"") -> None: - if tag is None: - tag = CompoundTag() - self.tag_node = tag.to_node() - self.tag_name = name - - @staticmethod - cdef NamedTag wrap(string name, TagNode node): - cdef NamedTag self = NamedTag.__new__(NamedTag) - self.tag_name = name - self.tag_node = node - return self - - @property - def tag(self) -> AbstractBaseTag: - return wrap_node(&self.tag_node) - - @tag.setter - def tag(self, AbstractBaseTag tag not None) -> None: - self.tag_node = tag.to_node() - - @property - def name(self) -> str | bytes: - try: - return self.tag_name - except UnicodeDecodeError as e: - return self.tag_name - - @name.setter - def name(self, name) -> None: - self.tag_name = name - - cdef string write_nbt(self, endian endianness, CStringEncode string_encode): - return write_named_tag[TagNode](self.tag_name, self.tag_node, endianness, string_encode) - - def to_nbt( - self, - *, - EncodingPreset preset: amulet_nbt.EncodingPreset = None, - bool compressed: bool = True, - bool little_endian: bool = False, - StringEncoding string_encoding: amulet_nbt.StringEncoding = mutf8_encoding, - ) -> bytes: - """Get the data in binary NBT format. - - :param preset: A class containing endianness and encoding presets. - :param compressed: Should the bytes be compressed with gzip. - :param little_endian: Should the bytes be saved in little endian format. - :param string_encoding: A function to encode strings to bytes. - :return: The binary NBT representation of the class. - """ - cdef endian endianness - - if preset is not None: - endianness = preset.endianness - compressed = preset.compressed - string_encoding = preset.string_encoding - else: - endianness = endian.little if little_endian else endian.big - - cdef bytes data = self.write_nbt( - endianness, - string_encoding.encode_cpp - ) - - if compressed: - return gzip.compress(data) - return data - - def save_to( - self, - object filepath_or_buffer=None, - *, - EncodingPreset preset: amulet_nbt.EncodingPreset = None, - bool compressed: bool = True, - bool little_endian: bool = False, - StringEncoding string_encoding: amulet_nbt.StringEncoding = mutf8_encoding, - ) -> bytes: - """Convert the data to the binary NBT format. Optionally write to a file. - - If filepath_or_buffer is a valid file path in string form the data will be written to that file. - - If filepath_or_buffer is a file like object the bytes will be written to it using .write method. - - :param filepath_or_buffer: A path or writeable object to write the data to. - :param preset: A class containing endianness and encoding presets. - :param compressed: Should the bytes be compressed with gzip. - :param little_endian: Should the bytes be saved in little endian format. Ignored if preset is defined. - :param string_encoding: The StringEncoding to use. Ignored if preset is defined. - :return: The binary NBT representation of the class. - """ - data = self.to_nbt( - preset=preset, - compressed=compressed, - little_endian=little_endian, - string_encoding=string_encoding, - ) - - if filepath_or_buffer is not None: - if isinstance(filepath_or_buffer, str): - with open(filepath_or_buffer, 'wb') as fp: - fp.write(data) - else: - filepath_or_buffer.write(data) - return data - - def to_snbt(self, object indent = None) -> str: - """Convert the data to the Stringified NBT format. - - :param indent: - If None (the default) the SNBT will be on one line. - If an int will be multi-line SNBT with this many spaces per indentation. - If a string will be multi-line SNBT with this string as the indentation. - :return: The SNBT string. - """ - cdef string snbt - cdef string indent_str - if indent is None: - write_node_snbt(snbt, self.tag_node) - else: - if isinstance(indent, int): - indent_str = " " * indent - elif isinstance(indent, str): - indent_str = indent - else: - raise TypeError("indent must be a str, int or None") - write_node_snbt(snbt, self.tag_node, indent_str, 0) - return snbt - - def __eq__(self, object other: Any) -> bool: - cdef NamedTag other_ - if isinstance(other, NamedTag): - other_ = other - return self.name == other_.name and self.tag == other_.tag - return NotImplemented - - def __repr__(self) -> str: - return f'NamedTag({self.tag!r}, "{self.name}")' - - def __reduce__(self): - cdef bytes nbt = self.write_nbt(endian.big, utf8_escape_to_utf8) - return _unpickle, (nbt,) - - def __copy__(self) -> NamedTag: - return NamedTag(self.tag, self.name) - - def __deepcopy__(self, memodict={}) -> NamedTag: - return NamedTag( - copy.deepcopy(self.tag), - self.name - ) - - def __getitem__(self, ptrdiff_t item): - if item < 0: - item += 2 - if not 0 <= item <= 1: - raise IndexError("Index out of range") - return (self.name, self.tag)[item] - - def __iter__(self): - yield self.name - yield self.tag - - @property - def byte(self) -> ByteTag: - """Get the tag if it is a ByteTag. - - :return: The ByteTag. - :raises: TypeError if the stored type is not a ByteTag - """ - cdef ByteTag tag = self.tag - return tag - - @property - def short(self) -> ShortTag: - """Get the tag if it is a ShortTag. - - :return: The ShortTag. - :raises: TypeError if the stored type is not a ShortTag - """ - cdef ShortTag tag = self.tag - return tag - - @property - def int(self) -> IntTag: - """Get the tag if it is a IntTag. - - :return: The IntTag. - :raises: TypeError if the stored type is not a IntTag - """ - cdef IntTag tag = self.tag - return tag - - @property - def long(self) -> LongTag: - """Get the tag if it is a LongTag. - - :return: The LongTag. - :raises: TypeError if the stored type is not a LongTag - """ - cdef LongTag tag = self.tag - return tag - - @property - def float(self) -> FloatTag: - """Get the tag if it is a FloatTag. - - :return: The FloatTag. - :raises: TypeError if the stored type is not a FloatTag - """ - cdef FloatTag tag = self.tag - return tag - - @property - def double(self) -> DoubleTag: - """Get the tag if it is a DoubleTag. - - :return: The DoubleTag. - :raises: TypeError if the stored type is not a DoubleTag - """ - cdef DoubleTag tag = self.tag - return tag - - @property - def string(self) -> StringTag: - """Get the tag if it is a StringTag. - - :return: The StringTag. - :raises: TypeError if the stored type is not a StringTag - """ - cdef StringTag tag = self.tag - return tag - - @property - def list(self) -> ListTag: - """Get the tag if it is a ListTag. - - :return: The ListTag. - :raises: TypeError if the stored type is not a ListTag - """ - cdef ListTag tag = self.tag - return tag - - @property - def compound(self) -> CompoundTag: - """Get the tag if it is a CompoundTag. - - :return: The CompoundTag. - :raises: TypeError if the stored type is not a CompoundTag - """ - cdef CompoundTag tag = self.tag - return tag - - @property - def byte_array(self) -> ByteArrayTag: - """Get the tag if it is a ByteArrayTag. - - :return: The ByteArrayTag. - :raises: TypeError if the stored type is not a ByteArrayTag - """ - cdef ByteArrayTag tag = self.tag - return tag - - @property - def int_array(self) -> IntArrayTag: - """Get the tag if it is a IntArrayTag. - - :return: The IntArrayTag. - :raises: TypeError if the stored type is not a IntArrayTag - """ - cdef IntArrayTag tag = self.tag - return tag - - @property - def long_array(self) -> LongArrayTag: - """Get the tag if it is a LongArrayTag. - - :return: The LongArrayTag. - :raises: TypeError if the stored type is not a LongArrayTag - """ - cdef LongArrayTag tag = self.tag - return tag diff --git a/src_/amulet_nbt/_tag/named_tag.pyx.tp b/src_/amulet_nbt/_tag/named_tag.pyx.tp deleted file mode 100644 index 5b1a27a3..00000000 --- a/src_/amulet_nbt/_tag/named_tag.pyx.tp +++ /dev/null @@ -1,229 +0,0 @@ -{{py: -import base64 -from template import include -}} -{{base64.b64decode("IyMgVGhpcyBmaWxlIGlzIGdlbmVyYXRlZCBmcm9tIGEgdGVtcGxhdGUuCiMjIERvIG5vdCBtb2RpZnkgdGhpcyBmaWxlIGRpcmVjdGx5IG9yIHlvdXIgY2hhbmdlcyB3aWxsIGdldCBvdmVyd3JpdHRlbi4KIyMgRWRpdCB0aGUgYWNjb21wYW55aW5nIC5weXgudHAgZmlsZSBpbnN0ZWFkLg==").decode()}} -# cython: language_level=3, boundscheck=False, wraparound=False -# distutils: language = c++ -# distutils: extra_compile_args = CPPCARGS -# cython: c_string_type=str, c_string_encoding=utf8 -# distutils: sources = [src/amulet_nbt/_string_encoding/_cpp/utf8.cpp, src/amulet_nbt/_nbt_encoding/_binary/_cpp/read_nbt.cpp] - -from typing import Any -import copy -import gzip -from libcpp.string cimport string -from libcpp cimport bool -from libcpp.pair cimport pair -import amulet_nbt -from amulet_nbt._libcpp.endian cimport endian -from amulet_nbt._string_encoding cimport StringEncoding -from amulet_nbt._string_encoding import mutf8_encoding -from amulet_nbt._string_encoding._cpp cimport CStringEncode -from amulet_nbt._string_encoding._cpp.utf8 cimport utf8_escape_to_utf8, utf8_to_utf8_escape -from amulet_nbt._nbt_encoding._binary._cpp cimport read_named_tag -from amulet_nbt._nbt_encoding._binary cimport write_named_tag -from amulet_nbt._nbt_encoding._binary.encoding_preset cimport EncodingPreset -from amulet_nbt._nbt_encoding._string cimport write_node_snbt - -from .abc cimport AbstractBase, AbstractBaseTag -from .int cimport ByteTag, ShortTag, IntTag, LongTag -from .float cimport FloatTag, DoubleTag -from .string cimport StringTag -from .list cimport ListTag -from .compound cimport wrap_node, CompoundTag -from .array cimport ByteArrayTag, IntArrayTag, LongArrayTag - - -def _unpickle(string data): - cdef pair[string, TagNode] named_tag = read_named_tag(data, endian.big, utf8_to_utf8_escape) - return NamedTag.wrap(named_tag.first, named_tag.second) - - -cdef class NamedTag(AbstractBase): - def __init__(self, AbstractBaseTag tag: amulet_nbt.AbstractBaseTag = None, string name: str | bytes = b"") -> None: - if tag is None: - tag = CompoundTag() - self.tag_node = tag.to_node() - self.tag_name = name - - @staticmethod - cdef NamedTag wrap(string name, TagNode node): - cdef NamedTag self = NamedTag.__new__(NamedTag) - self.tag_name = name - self.tag_node = node - return self - - @property - def tag(self) -> AbstractBaseTag: - return wrap_node(&self.tag_node) - - @tag.setter - def tag(self, AbstractBaseTag tag not None) -> None: - self.tag_node = tag.to_node() - - @property - def name(self) -> str | bytes: - try: - return self.tag_name - except UnicodeDecodeError as e: - return self.tag_name - - @name.setter - def name(self, name) -> None: - self.tag_name = name - - cdef string write_nbt(self, endian endianness, CStringEncode string_encode): - return write_named_tag[TagNode](self.tag_name, self.tag_node, endianness, string_encode) - - def to_nbt( - self, - *, - EncodingPreset preset: amulet_nbt.EncodingPreset = None, - bool compressed: bool = True, - bool little_endian: bool = False, - StringEncoding string_encoding: amulet_nbt.StringEncoding = mutf8_encoding, - ) -> bytes: - """Get the data in binary NBT format. - - :param preset: A class containing endianness and encoding presets. - :param compressed: Should the bytes be compressed with gzip. - :param little_endian: Should the bytes be saved in little endian format. - :param string_encoding: A function to encode strings to bytes. - :return: The binary NBT representation of the class. - """ - cdef endian endianness - - if preset is not None: - endianness = preset.endianness - compressed = preset.compressed - string_encoding = preset.string_encoding - else: - endianness = endian.little if little_endian else endian.big - - cdef bytes data = self.write_nbt( - endianness, - string_encoding.encode_cpp - ) - - if compressed: - return gzip.compress(data) - return data - - def save_to( - self, - object filepath_or_buffer=None, - *, - EncodingPreset preset: amulet_nbt.EncodingPreset = None, - bool compressed: bool = True, - bool little_endian: bool = False, - StringEncoding string_encoding: amulet_nbt.StringEncoding = mutf8_encoding, - ) -> bytes: - """Convert the data to the binary NBT format. Optionally write to a file. - - If filepath_or_buffer is a valid file path in string form the data will be written to that file. - - If filepath_or_buffer is a file like object the bytes will be written to it using .write method. - - :param filepath_or_buffer: A path or writeable object to write the data to. - :param preset: A class containing endianness and encoding presets. - :param compressed: Should the bytes be compressed with gzip. - :param little_endian: Should the bytes be saved in little endian format. Ignored if preset is defined. - :param string_encoding: The StringEncoding to use. Ignored if preset is defined. - :return: The binary NBT representation of the class. - """ - data = self.to_nbt( - preset=preset, - compressed=compressed, - little_endian=little_endian, - string_encoding=string_encoding, - ) - - if filepath_or_buffer is not None: - if isinstance(filepath_or_buffer, str): - with open(filepath_or_buffer, 'wb') as fp: - fp.write(data) - else: - filepath_or_buffer.write(data) - return data - - def to_snbt(self, object indent = None) -> str: - """Convert the data to the Stringified NBT format. - - :param indent: - If None (the default) the SNBT will be on one line. - If an int will be multi-line SNBT with this many spaces per indentation. - If a string will be multi-line SNBT with this string as the indentation. - :return: The SNBT string. - """ - cdef string snbt - cdef string indent_str - if indent is None: - write_node_snbt(snbt, self.tag_node) - else: - if isinstance(indent, int): - indent_str = " " * indent - elif isinstance(indent, str): - indent_str = indent - else: - raise TypeError("indent must be a str, int or None") - write_node_snbt(snbt, self.tag_node, indent_str, 0) - return snbt - - def __eq__(self, object other: Any) -> bool: - cdef NamedTag other_ - if isinstance(other, NamedTag): - other_ = other - return self.name == other_.name and self.tag == other_.tag - return NotImplemented - - def __repr__(self) -> str: - return f'NamedTag({self.tag!r}, "{self.name}")' - - def __reduce__(self): - cdef bytes nbt = self.write_nbt(endian.big, utf8_escape_to_utf8) - return _unpickle, (nbt,) - - def __copy__(self) -> NamedTag: - return NamedTag(self.tag, self.name) - - def __deepcopy__(self, memodict={}) -> NamedTag: - return NamedTag( - copy.deepcopy(self.tag), - self.name - ) - - def __getitem__(self, ptrdiff_t item): - if item < 0: - item += 2 - if not 0 <= item <= 1: - raise IndexError("Index out of range") - return (self.name, self.tag)[item] - - def __iter__(self): - yield self.name - yield self.tag - -{{include("amulet_nbt/tpf/NamedTagGet.pyx.tpf", py_cls="ByteTag", tag_name="byte")}} - -{{include("amulet_nbt/tpf/NamedTagGet.pyx.tpf", py_cls="ShortTag", tag_name="short")}} - -{{include("amulet_nbt/tpf/NamedTagGet.pyx.tpf", py_cls="IntTag", tag_name="int")}} - -{{include("amulet_nbt/tpf/NamedTagGet.pyx.tpf", py_cls="LongTag", tag_name="long")}} - -{{include("amulet_nbt/tpf/NamedTagGet.pyx.tpf", py_cls="FloatTag", tag_name="float")}} - -{{include("amulet_nbt/tpf/NamedTagGet.pyx.tpf", py_cls="DoubleTag", tag_name="double")}} - -{{include("amulet_nbt/tpf/NamedTagGet.pyx.tpf", py_cls="StringTag", tag_name="string")}} - -{{include("amulet_nbt/tpf/NamedTagGet.pyx.tpf", py_cls="ListTag", tag_name="list")}} - -{{include("amulet_nbt/tpf/NamedTagGet.pyx.tpf", py_cls="CompoundTag", tag_name="compound")}} - -{{include("amulet_nbt/tpf/NamedTagGet.pyx.tpf", py_cls="ByteArrayTag", tag_name="byte_array")}} - -{{include("amulet_nbt/tpf/NamedTagGet.pyx.tpf", py_cls="IntArrayTag", tag_name="int_array")}} - -{{include("amulet_nbt/tpf/NamedTagGet.pyx.tpf", py_cls="LongArrayTag", tag_name="long_array")}} diff --git a/src_/amulet_nbt/_tag/numeric.pxd b/src_/amulet_nbt/_tag/numeric.pxd deleted file mode 100644 index 441162fc..00000000 --- a/src_/amulet_nbt/_tag/numeric.pxd +++ /dev/null @@ -1,5 +0,0 @@ -from amulet_nbt._tag.abc cimport AbstractBaseImmutableTag - - -cdef class AbstractBaseNumericTag(AbstractBaseImmutableTag): - pass diff --git a/src_/amulet_nbt/_tag/numeric.pyx b/src_/amulet_nbt/_tag/numeric.pyx deleted file mode 100644 index 1b4d1381..00000000 --- a/src_/amulet_nbt/_tag/numeric.pyx +++ /dev/null @@ -1,16 +0,0 @@ -from amulet_nbt._tag.abc cimport AbstractBaseImmutableTag - - -cdef class AbstractBaseNumericTag(AbstractBaseImmutableTag): - """Abstract Base Class for all numeric Tag classes""" - def __int__(self): - """Get a python int representation of the class.""" - raise NotImplementedError - - def __float__(self): - """Get a python float representation of the class.""" - raise NotImplementedError - - def __bool__(self): - """Get a python bool representation of the class.""" - raise NotImplementedError diff --git a/src_/amulet_nbt/_tag/string.pxd b/src_/amulet_nbt/_tag/string.pxd deleted file mode 100644 index ce7afe6e..00000000 --- a/src_/amulet_nbt/_tag/string.pxd +++ /dev/null @@ -1,10 +0,0 @@ -from libcpp.string cimport string -from amulet_nbt._tag.abc cimport AbstractBaseImmutableTag -from amulet_nbt._tag._cpp cimport CStringTag - - -cdef class StringTag(AbstractBaseImmutableTag): - cdef CStringTag cpp - - @staticmethod - cdef StringTag wrap(CStringTag) diff --git a/src_/amulet_nbt/_tag/string.pyx b/src_/amulet_nbt/_tag/string.pyx deleted file mode 100644 index d1e24f17..00000000 --- a/src_/amulet_nbt/_tag/string.pyx +++ /dev/null @@ -1,124 +0,0 @@ -## This file is generated from a template. -## Do not modify this file directly or your changes will get overwritten. -## Edit the accompanying .pyx.tp file instead. -# cython: language_level=3, boundscheck=False, wraparound=False -# distutils: language = c++ -# distutils: extra_compile_args = CPPCARGS -# cython: c_string_type=str, c_string_encoding=utf8 - -from typing import Any -from collections.abc import Iterator - -from libcpp.string cimport string -from amulet_nbt._libcpp.endian cimport endian -from amulet_nbt._string_encoding._cpp cimport CStringEncode -from amulet_nbt._nbt_encoding._binary cimport write_named_tag -from amulet_nbt._nbt_encoding._string cimport write_string_snbt -from amulet_nbt._tag._cpp cimport TagNode, CStringTag -from .abc cimport AbstractBaseImmutableTag - - -cdef inline escape(str s): - return s.replace('\\', '\\\\').replace('"', '\\"') - - -cdef class StringTag(AbstractBaseImmutableTag): - """A class that behaves like a string.""" - tag_id: int = 8 - - def __init__(self, object value: str | bytes = b"") -> None: - if isinstance(value, (str, bytes)): - self.cpp = value - else: - self.cpp = str(value) - - @staticmethod - cdef StringTag wrap(CStringTag cpp): - cdef StringTag tag = StringTag.__new__(StringTag) - tag.cpp = cpp - return tag - - cdef TagNode to_node(self): - cdef TagNode node - node.emplace[CStringTag](self.cpp) - return node - - @property - def py_str(self) -> str: - """The data stored in the class as a python string. - - In some rare cases the data cannot be decoded to a string and this will raise a UnicodeDecodeError. - """ - return self.cpp - - @property - def py_bytes(self) -> bytes: - """The bytes stored in the class.""" - return self.cpp - - @property - def py_data(self) -> Any: - return self.py_str - - cdef string write_nbt(self, string name, endian endianness, CStringEncode string_encode): - return write_named_tag[CStringTag](name, self.cpp, endianness, string_encode) - - def to_snbt(self, object indent: None | str | int = None) -> str: - cdef string snbt - write_string_snbt(snbt, self.cpp) - return snbt - - def __eq__(self, object other: Any) -> bool: - if not isinstance(other, StringTag): - return NotImplemented - cdef StringTag other_ = other - return self.cpp == other_.cpp - - def __repr__(self) -> str: - return f"StringTag(\"{escape(self.py_str)}\")" - - def __str__(self) -> str: - return self.cpp - - def __reduce__(self): - return StringTag, (self.cpp,) - - def __copy__(self) -> StringTag: - return StringTag.wrap(self.cpp) - - def __deepcopy__(self, memo=None) -> StringTag: - return StringTag.wrap(self.cpp) - - def __hash__(self) -> int: - return hash((8, self.cpp)) - - # cdef str _to_snbt(self): - # return f"\"{escape(self.py_str)}\"" - - def __ge__(self, other: Any) -> bool: - cdef StringTag other_ - if isinstance(other, StringTag): - other_ = other - return str(self.cpp) >= str(other_.cpp) - return NotImplemented - - def __gt__(self, other: Any) -> bool: - cdef StringTag other_ - if isinstance(other, StringTag): - other_ = other - return str(self.cpp) > str(other_.cpp) - return NotImplemented - - def __le__(self, other: Any) -> bool: - cdef StringTag other_ - if isinstance(other, StringTag): - other_ = other - return str(self.cpp) <= str(other_.cpp) - return NotImplemented - - def __lt__(self, other: Any) -> bool: - cdef StringTag other_ - if isinstance(other, StringTag): - other_ = other - return str(self.cpp) < str(other_.cpp) - return NotImplemented diff --git a/src_/amulet_nbt/_tag/string.pyx.tp b/src_/amulet_nbt/_tag/string.pyx.tp deleted file mode 100644 index 9b54b57a..00000000 --- a/src_/amulet_nbt/_tag/string.pyx.tp +++ /dev/null @@ -1,119 +0,0 @@ -{{py: -import base64 -from template import include -}} -{{base64.b64decode("IyMgVGhpcyBmaWxlIGlzIGdlbmVyYXRlZCBmcm9tIGEgdGVtcGxhdGUuCiMjIERvIG5vdCBtb2RpZnkgdGhpcyBmaWxlIGRpcmVjdGx5IG9yIHlvdXIgY2hhbmdlcyB3aWxsIGdldCBvdmVyd3JpdHRlbi4KIyMgRWRpdCB0aGUgYWNjb21wYW55aW5nIC5weXgudHAgZmlsZSBpbnN0ZWFkLg==").decode()}} -# cython: language_level=3, boundscheck=False, wraparound=False -# distutils: language = c++ -# distutils: extra_compile_args = CPPCARGS -# cython: c_string_type=str, c_string_encoding=utf8 - -from typing import Any -from collections.abc import Iterator - -from libcpp.string cimport string -from amulet_nbt._libcpp.endian cimport endian -from amulet_nbt._string_encoding._cpp cimport CStringEncode -from amulet_nbt._nbt_encoding._binary cimport write_named_tag -from amulet_nbt._nbt_encoding._string cimport write_string_snbt -from amulet_nbt._tag._cpp cimport TagNode, CStringTag -from .abc cimport AbstractBaseImmutableTag - - -cdef inline escape(str s): - return s.replace('\\', '\\\\').replace('"', '\\"') - - -cdef class StringTag(AbstractBaseImmutableTag): - """A class that behaves like a string.""" - tag_id: int = 8 - - def __init__(self, object value: str | bytes = b"") -> None: - if isinstance(value, (str, bytes)): - self.cpp = value - else: - self.cpp = str(value) - - @staticmethod - cdef StringTag wrap(CStringTag cpp): - cdef StringTag tag = StringTag.__new__(StringTag) - tag.cpp = cpp - return tag - - cdef TagNode to_node(self): - cdef TagNode node - node.emplace[CStringTag](self.cpp) - return node - - @property - def py_str(self) -> str: - """The data stored in the class as a python string. - - In some rare cases the data cannot be decoded to a string and this will raise a UnicodeDecodeError. - """ - return self.cpp - - @property - def py_bytes(self) -> bytes: - """The bytes stored in the class.""" - return self.cpp - - @property - def py_data(self) -> Any: - return self.py_str - - cdef string write_nbt(self, string name, endian endianness, CStringEncode string_encode): - return write_named_tag[CStringTag](name, self.cpp, endianness, string_encode) - -{{include("amulet_nbt/tpf/to_snbt.pyx.tpf", cpp_cls_ptr="CStringTag", tag="string")}} - -{{include("amulet_nbt/tpf/ImmutableTag.pyx.tpf", py_cls="StringTag")}} - - def __repr__(self) -> str: - return f"StringTag(\"{escape(self.py_str)}\")" - - def __str__(self) -> str: - return self.cpp - - def __reduce__(self): - return StringTag, (self.cpp,) - - def __copy__(self) -> StringTag: - return StringTag.wrap(self.cpp) - - def __deepcopy__(self, memo=None) -> StringTag: - return StringTag.wrap(self.cpp) - - def __hash__(self) -> int: - return hash((8, self.cpp)) - - # cdef str _to_snbt(self): - # return f"\"{escape(self.py_str)}\"" - - def __ge__(self, other: Any) -> bool: - cdef StringTag other_ - if isinstance(other, StringTag): - other_ = other - return str(self.cpp) >= str(other_.cpp) - return NotImplemented - - def __gt__(self, other: Any) -> bool: - cdef StringTag other_ - if isinstance(other, StringTag): - other_ = other - return str(self.cpp) > str(other_.cpp) - return NotImplemented - - def __le__(self, other: Any) -> bool: - cdef StringTag other_ - if isinstance(other, StringTag): - other_ = other - return str(self.cpp) <= str(other_.cpp) - return NotImplemented - - def __lt__(self, other: Any) -> bool: - cdef StringTag other_ - if isinstance(other, StringTag): - other_ = other - return str(self.cpp) < str(other_.cpp) - return NotImplemented diff --git a/src_/amulet_nbt/tpf/ArrayTag.pyx.tpf b/src_/amulet_nbt/tpf/ArrayTag.pyx.tpf deleted file mode 100644 index 89946243..00000000 --- a/src_/amulet_nbt/tpf/ArrayTag.pyx.tpf +++ /dev/null @@ -1,175 +0,0 @@ -{{py: -from template import include -}} -cdef class {{py_cls}}(AbstractBaseArrayTag): - """This class behaves like an 1D Numpy signed integer array with each value stored in a {{dtype}}.""" - tag_id: int = {{tag_id}} - - def __init__(self, object value: Iterable[SupportsInt] = ()) -> None: - """Construct a new {{py_cls}} object from an array-like object.""" - cdef numpy.ndarray arr = numpy.asarray(value, {{native_data_type}}).ravel() - self.cpp = make_shared[{{cpp_cls}}](arr.size) - cdef size_t i - for i in range(arr.size): - dereference(self.cpp)[i] = arr[i] - - @staticmethod - cdef {{py_cls}} wrap({{cpp_cls_ptr}} cpp): - cdef {{py_cls}} tag = {{py_cls}}.__new__({{py_cls}}) - tag.cpp = cpp - return tag - - cdef TagNode to_node(self): - cdef TagNode node - node.emplace[{{cpp_cls_ptr}}](self.cpp) - return node - - @property - def np_array(self) -> NDArray[numpy.int{{int_byte_width*8}}]: - return numpy.asarray(self) - - cdef string write_nbt(self, string name, endian endianness, CStringEncode string_encode): - return write_named_tag[{{cpp_cls_ptr}}](name, self.cpp, endianness, string_encode) - -{{include("amulet_nbt/tpf/to_snbt.pyx.tpf", tag=dtype + "_array", **locals())}} - - def __eq__(self, object other: Any) -> bool: - if not isinstance(other, {{py_cls}}): - return False - cdef {{py_cls}} tag = other - return dereference(self.cpp) == dereference(tag.cpp) - - def __repr__(self) -> str: - return f"{{py_cls}}({list(self)})" - - def __str__(self) -> str: - return str(list(self)) - - def __reduce__(self): - return {{py_cls}}, (list(self),) - - def __copy__(self) -> {{py_cls}}: - return {{py_cls}}.wrap( - make_shared[{{cpp_cls}}](dereference(self.cpp)) - ) - - def __deepcopy__(self, memo=None) -> {{py_cls}}: - return {{py_cls}}.wrap( - make_shared[{{cpp_cls}}](dereference(self.cpp)) - ) - - # Sized - def __len__(self) -> int: - """The length of the array. - - >>> from amulet_nbt import {{py_cls}} - >>> tag = {{py_cls}}([1, 2, 3]) - >>> len(tag) # 3 - """ - return dereference(self.cpp).size() - - # Sequence - @overload - def __getitem__(self, item: int) -> numpy.int{{int_byte_width*8}}: - ... - - @overload - def __getitem__(self, item: slice) -> NDArray[numpy.int{{int_byte_width*8}}]: - ... - - @overload - def __getitem__(self, item: NDArray[numpy.integer]) -> NDArray[numpy.int{{int_byte_width*8}}]: - ... - - def __getitem__(self, object item): - """Get item(s) from the array. - - This supports the full numpy protocol. - If a numpy array is returned, the array data is the same as the data contained in this class. - - >>> from amulet_nbt import {{py_cls}} - >>> import numpy - >>> tag = {{py_cls}}([1, 2, 3]) - >>> tag[0] # 1 - >>> tag[:1] # numpy.array([1], dtype=numpy.int8) - >>> tag[numpy.array([1, 2])] # numpy.array([2, 3], dtype=int8) - """ - return numpy.asarray(self)[item] - - def __iter__(self) -> Iterator[numpy.int{{int_byte_width*8}}]: - """Iterate through the items in the array. - - >>> from amulet_nbt import {{py_cls}} - >>> tag = {{py_cls}}([1, 2, 3]) - >>> for num in tag: - >>> pass - >>> iter(tag) - """ - return iter(numpy.asarray(self)) - - def __reversed__(self) -> Iterator[numpy.int{{int_byte_width*8}}]: - """Iterate through the items in the array in reverse order. - - >>> from amulet_nbt import {{py_cls}} - >>> tag = {{py_cls}}([1, 2, 3]) - >>> for num in reversed(tag): - >>> pass - - :return: A reversed iterator. - """ - return reversed(numpy.asarray(self)) - - def __contains__(self, value: int) -> bool: - """Check if an item is in the array. - - >>> from amulet_nbt import {{py_cls}} - >>> tag = {{py_cls}}([1, 2, 3]) - >>> 1 in tag # True - """ - return value in numpy.asarray(self) - - # MutableSequence - @overload - def __setitem__(self, item: int, value: numpy.integer) -> None: - ... - - @overload - def __setitem__(self, item: slice, value: NDArray[numpy.integer]) -> None: - ... - - @overload - def __setitem__(self, item: ArrayLike, value: NDArray[numpy.integer]) -> None: - ... - - def __setitem__(self, object item, object value): - """Set item(s) in the array. - - This supports the full numpy protocol. - - >>> from amulet_nbt import {{py_cls}} - >>> import numpy - >>> tag = {{py_cls}}([1, 2, 3]) - >>> tag[0] = 10 # [10, 2, 3] - >>> tag[:2] = [4, 5] # [4, 5, 3] - >>> tag[numpy.array([1, 2])] = [6, 7] # [4, 6, 7] - """ - numpy.asarray(self)[item] = value - - # Array interface - def __array__(self, dtype: Any = None) -> NDArray[numpy.int{{int_byte_width*8}}]: - """Get a numpy array representation of the stored data. - - >>> from amulet_nbt import {{py_cls}} - >>> import numpy - >>> tag = {{py_cls}}([1, 2, 3]) - >>> arr = numpy.asarray(tag) - - :param dtype: This is ignored but is part of the array interace - :return: A numpy array that shares the memory with this instance. - """ - cdef numpy.npy_intp shape[1] - shape[0] = dereference(self.cpp).size() - cdef numpy.ndarray ndarray = numpy.PyArray_SimpleNewFromData(1, shape, numpy.{{npy_c}}, dereference(self.cpp).data()) - Py_INCREF(self) - numpy.PyArray_SetBaseObject(ndarray, self) - return ndarray diff --git a/src_/amulet_nbt/tpf/Comparison.pyx.tpf b/src_/amulet_nbt/tpf/Comparison.pyx.tpf deleted file mode 100644 index cdfc7413..00000000 --- a/src_/amulet_nbt/tpf/Comparison.pyx.tpf +++ /dev/null @@ -1,15 +0,0 @@ -{{ -"\n\n".join( - f""" def {meth}(self, other: Any) -> bool: - if not isinstance(other, {py_cls}): - return NotImplemented - cdef {py_cls} other_ = other - return self.cpp {op} other_.cpp""" - for meth, op, py_cls in ( - ("__ge__", ">=", py_cls), - ("__gt__", ">", py_cls), - ("__le__", "<=", py_cls), - ("__lt__", "<", py_cls), - ) -) -}} \ No newline at end of file diff --git a/src_/amulet_nbt/tpf/CompoundGetSetdefault.pyx.tpf b/src_/amulet_nbt/tpf/CompoundGetSetdefault.pyx.tpf deleted file mode 100644 index 9713710e..00000000 --- a/src_/amulet_nbt/tpf/CompoundGetSetdefault.pyx.tpf +++ /dev/null @@ -1,113 +0,0 @@ - @overload - def get_{{tag_name}}(self, key: str | bytes) -> amulet_nbt.{{py_cls}} | None: ... - @overload - def get_{{tag_name}}(self, key: str | bytes, default: None) -> amulet_nbt.{{py_cls}} | None: ... - @overload - def get_{{tag_name}}(self, key: str | bytes, default: amulet_nbt.{{py_cls}}) -> amulet_nbt.{{py_cls}}: ... - @overload - def get_{{tag_name}}(self, key: str | bytes, default: None, raise_errors: Literal[False]) -> amulet_nbt.{{py_cls}} | None: ... - @overload - def get_{{tag_name}}(self, key: str | bytes, default: amulet_nbt.{{py_cls}}, raise_errors: Literal[False]) -> amulet_nbt.{{py_cls}}: ... - @overload - def get_{{tag_name}}(self, key: str | bytes, default: amulet_nbt.{{py_cls}} | None, raise_errors: Literal[True]) -> amulet_nbt.{{py_cls}}: ... - @overload - def get_{{tag_name}}(self, key: str | bytes, *, raise_errors: Literal[False]) -> amulet_nbt.{{py_cls}} | None: ... - @overload - def get_{{tag_name}}(self, key: str | bytes, *, raise_errors: Literal[True]) -> amulet_nbt.{{py_cls}}: ... - - def get_{{tag_name}}(self, string key: str | bytes, {{py_cls}} default: _T = None, bool raise_errors: bool = False) -> amulet_nbt.{{py_cls}} | _T: - """Get the tag stored in key if it is a {{py_cls}}. - - :param key: The key to get - :param default: The value to return if the key does not exist or the type is wrong. - :param raise_errors: If True, KeyError and TypeError are raise on error. If False, default is returned on error. - :return: The {{py_cls}}. - :raises: KeyError if the key does not exist and raise_errors is True. - :raises: TypeError if the stored type is not a {{py_cls}} and raise_errors is True. - """ - cdef CCompoundTag.iterator it = dereference(self.cpp).find(key) - - if it == dereference(self.cpp).end(): - if raise_errors: - raise KeyError(key) - else: - return default - - cdef AbstractBaseTag tag = wrap_node(&dereference(it).second) - if isinstance(tag, {{py_cls}}): - return tag - elif raise_errors: - raise TypeError - else: - return default - - def setdefault_{{tag_name}}(self, string key: str | bytes, {{py_cls}} default: amulet_nbt.{{py_cls}} | None = None) -> amulet_nbt.{{py_cls}}: - """Populate key if not defined or value is not {{py_cls}}. Return the value stored. - - If default is a {{py_cls}} then it will be stored under key else a default instance will be created. - - :param key: The key to populate and get - :param default: The default value to use. If None, the default {{py_cls}} is used. - :return: The {{py_cls}} stored in key - """ - cdef AbstractBaseTag tag - try: - tag = self[key] - except KeyError as e: - if default is None: - tag = self[key] = {{py_cls}}() - else: - tag = self[key] = default - else: - if not isinstance(tag, {{py_cls}}): - if default is None: - tag = self[key] = {{py_cls}}() - else: - tag = self[key] = default - return tag - - @overload - def pop_{{tag_name}}(self, key: str | bytes) -> amulet_nbt.{{py_cls}} | None: ... - @overload - def pop_{{tag_name}}(self, key: str | bytes, default: None) -> amulet_nbt.{{py_cls}} | None: ... - @overload - def pop_{{tag_name}}(self, key: str | bytes, default: amulet_nbt.{{py_cls}}) -> amulet_nbt.{{py_cls}}: ... - @overload - def pop_{{tag_name}}(self, key: str | bytes, default: None, raise_errors: Literal[False]) -> amulet_nbt.{{py_cls}} | None: ... - @overload - def pop_{{tag_name}}(self, key: str | bytes, default: amulet_nbt.{{py_cls}}, raise_errors: Literal[False]) -> amulet_nbt.{{py_cls}}: ... - @overload - def pop_{{tag_name}}(self, key: str | bytes, default: amulet_nbt.{{py_cls}} | None, raise_errors: Literal[True]) -> amulet_nbt.{{py_cls}}: ... - @overload - def pop_{{tag_name}}(self, key: str | bytes, *, raise_errors: Literal[False]) -> amulet_nbt.{{py_cls}} | None: ... - @overload - def pop_{{tag_name}}(self, key: str | bytes, *, raise_errors: Literal[True]) -> amulet_nbt.{{py_cls}}: ... - - def pop_{{tag_name}}(self, string key: str | bytes, {{py_cls}} default: _T = None, bool raise_errors: bool = False) -> amulet_nbt.{{py_cls}} | _T: - """Remove the specified key and return the corresponding value if it is a {{py_cls}}. - - If the key exists but the type is incorrect, the value will not be removed. - - :param key: The key to get and remove - :param default: The value to return if the key does not exist or the type is wrong. - :param raise_errors: If True, KeyError and TypeError are raise on error. If False, default is returned on error. - :return: The {{py_cls}}. - :raises: KeyError if the key does not exist and raise_errors is True. - :raises: TypeError if the stored type is not a {{py_cls}} and raise_errors is True. - """ - cdef CCompoundTag.iterator it = dereference(self.cpp).find(key) - - if it == dereference(self.cpp).end(): - if raise_errors: - raise KeyError(key) - else: - return default - - cdef AbstractBaseTag tag = wrap_node(&dereference(it).second) - if isinstance(tag, {{py_cls}}): - dereference(self.cpp).erase(it) - return tag - elif raise_errors: - raise TypeError - else: - return default diff --git a/src_/amulet_nbt/tpf/FloatTag.pyx.tpf b/src_/amulet_nbt/tpf/FloatTag.pyx.tpf deleted file mode 100644 index 74bf3f48..00000000 --- a/src_/amulet_nbt/tpf/FloatTag.pyx.tpf +++ /dev/null @@ -1,17 +0,0 @@ -{{py:from template import include}} - @staticmethod - cdef {{py_cls}} wrap(C{{py_cls}} cpp): - cdef {{py_cls}} tag = {{py_cls}}.__new__({{py_cls}}) - tag.cpp = cpp - return tag - - cdef TagNode to_node(self): - cdef TagNode node - node.emplace[C{{py_cls}}](self.cpp) - return node - - @property - def py_float(self) -> float: - return self.cpp - -{{include("amulet_nbt/tpf/NumericTag.pyx.tpf", **locals())}} \ No newline at end of file diff --git a/src_/amulet_nbt/tpf/ImmutableTag.pyx.tpf b/src_/amulet_nbt/tpf/ImmutableTag.pyx.tpf deleted file mode 100644 index 4dd47109..00000000 --- a/src_/amulet_nbt/tpf/ImmutableTag.pyx.tpf +++ /dev/null @@ -1,5 +0,0 @@ - def __eq__(self, object other: Any) -> bool: - if not isinstance(other, {{py_cls}}): - return NotImplemented - cdef {{py_cls}} other_ = other - return self.cpp == other_.cpp \ No newline at end of file diff --git a/src_/amulet_nbt/tpf/IntTag.pyx.tpf b/src_/amulet_nbt/tpf/IntTag.pyx.tpf deleted file mode 100644 index 4ba0a7a4..00000000 --- a/src_/amulet_nbt/tpf/IntTag.pyx.tpf +++ /dev/null @@ -1,21 +0,0 @@ -{{py:from template import include}} - @staticmethod - cdef {{py_cls}} wrap(C{{py_cls}} cpp): - cdef {{py_cls}} tag = {{py_cls}}.__new__({{py_cls}}) - tag.cpp = cpp - return tag - - cdef TagNode to_node(self): - cdef TagNode node - node.emplace[C{{py_cls}}](self.cpp) - return node - - @property - def py_int(self) -> int: - """A python int representation of the class. - - The returned data is immutable so changes will not mirror the instance. - """ - return self.cpp - -{{include("amulet_nbt/tpf/NumericTag.pyx.tpf", **locals())}} \ No newline at end of file diff --git a/src_/amulet_nbt/tpf/ListGet.pyx.tpf b/src_/amulet_nbt/tpf/ListGet.pyx.tpf deleted file mode 100644 index ae349c82..00000000 --- a/src_/amulet_nbt/tpf/ListGet.pyx.tpf +++ /dev/null @@ -1,10 +0,0 @@ - def get_{{tag_name}}(self, ptrdiff_t index) -> amulet_nbt.{{py_cls}}: - """Get the tag at index if it is a {{py_cls}}. - - :param index: The index to get - :return: The {{py_cls}}. - :raises: IndexError if the index is outside the list. - :raises: TypeError if the stored type is not a {{py_cls}} - """ - cdef {{py_cls}} tag = ListTag_get_item(self.cpp, index) - return tag \ No newline at end of file diff --git a/src_/amulet_nbt/tpf/NamedTagGet.pyx.tpf b/src_/amulet_nbt/tpf/NamedTagGet.pyx.tpf deleted file mode 100644 index db91a240..00000000 --- a/src_/amulet_nbt/tpf/NamedTagGet.pyx.tpf +++ /dev/null @@ -1,9 +0,0 @@ - @property - def {{tag_name}}(self) -> {{py_cls}}: - """Get the tag if it is a {{py_cls}}. - - :return: The {{py_cls}}. - :raises: TypeError if the stored type is not a {{py_cls}} - """ - cdef {{py_cls}} tag = self.tag - return tag \ No newline at end of file diff --git a/src_/amulet_nbt/tpf/NumericTag.pyx.tpf b/src_/amulet_nbt/tpf/NumericTag.pyx.tpf deleted file mode 100644 index ecdc74eb..00000000 --- a/src_/amulet_nbt/tpf/NumericTag.pyx.tpf +++ /dev/null @@ -1,36 +0,0 @@ -{{py:from template import include}} - cdef string write_nbt(self, string name, endian endianness, CStringEncode string_encode): - return write_named_tag[C{{py_cls}}](name, self.cpp, endianness, string_encode) - -{{include("amulet_nbt/tpf/to_snbt.pyx.tpf", cpp_cls_ptr="C" + py_cls, tag=tag)}} - -{{include("amulet_nbt/tpf/ImmutableTag.pyx.tpf", **locals())}} - - def __repr__(self) -> str: - return f"{{py_cls}}({self.cpp})" - - def __str__(self) -> str: - return str(self.cpp) - - def __reduce__(self): - return {{py_cls}}, (self.cpp,) - - def __copy__(self) -> {{py_cls}}: - return {{py_cls}}.wrap(self.cpp) - - def __deepcopy__(self, memo=None) -> {{py_cls}}: - return {{py_cls}}.wrap(self.cpp) - - def __hash__(self) -> int: - return hash(({{tag_id}}, self.cpp)) - - def __int__(self) -> int: - return int(self.cpp) - - def __float__(self) -> float: - return float(self.cpp) - - def __bool__(self) -> bool: - return bool(self.cpp) - -{{include("amulet_nbt/tpf/Comparison.pyx.tpf", **locals())}} \ No newline at end of file diff --git a/src_/amulet_nbt/tpf/to_snbt.pyx.tpf b/src_/amulet_nbt/tpf/to_snbt.pyx.tpf deleted file mode 100644 index af5b924e..00000000 --- a/src_/amulet_nbt/tpf/to_snbt.pyx.tpf +++ /dev/null @@ -1,4 +0,0 @@ - def to_snbt(self, object indent: None | str | int = None) -> str: - cdef string snbt - write_{{tag}}_snbt(snbt, self.cpp) - return snbt \ No newline at end of file diff --git a/src_/amulet_nbt/tpf/to_snbt_multiline.pyx.tpf b/src_/amulet_nbt/tpf/to_snbt_multiline.pyx.tpf deleted file mode 100644 index 9b31c461..00000000 --- a/src_/amulet_nbt/tpf/to_snbt_multiline.pyx.tpf +++ /dev/null @@ -1,14 +0,0 @@ - def to_snbt(self, object indent: None | str | int = None) -> str: - cdef string snbt - cdef string indent_str - if indent is None: - write_{{tag}}_snbt(snbt, self.cpp) - else: - if isinstance(indent, int): - indent_str = " " * indent - elif isinstance(indent, str): - indent_str = indent - else: - raise TypeError("indent must be a str, int or None") - write_{{tag}}_snbt(snbt, self.cpp, indent_str, 0) - return snbt \ No newline at end of file From 151c6a6e9dc9757a33a77e6e6aa872fff51298ee Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Mon, 15 Jul 2024 14:56:41 +0100 Subject: [PATCH 119/121] Remove tests from sdist --- MANIFEST.in | 1 + 1 file changed, 1 insertion(+) diff --git a/MANIFEST.in b/MANIFEST.in index ba5807f1..303049bb 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1 +1,2 @@ +prune tests recursive-include src *.pyi py.typed *.py *.cpp *.hpp From 5689dd32474f8b20d78a6d142e6ec79a811bb6c4 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Mon, 15 Jul 2024 14:58:15 +0100 Subject: [PATCH 120/121] Changed package finding The package now has a normal __init__.py --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 375528df..289042cd 100644 --- a/setup.cfg +++ b/setup.cfg @@ -15,7 +15,7 @@ platforms = any [options] package_dir= =src -packages = find_namespace: +packages = find: zip_safe = False python_requires = ~=3.11 install_requires = From 8dbe6f4393538168cdb5e91678d32486ea6e5b68 Mon Sep 17 00:00:00 2001 From: gentlegiantJGC Date: Mon, 15 Jul 2024 15:33:00 +0100 Subject: [PATCH 121/121] Include source code release --- setup.cfg | 3 +++ 1 file changed, 3 insertions(+) diff --git a/setup.cfg b/setup.cfg index 289042cd..d2f648be 100644 --- a/setup.cfg +++ b/setup.cfg @@ -30,6 +30,9 @@ amulet_nbt = py.typed *.pyd *.so + *.dylib + **/*.hpp + cpp/**/*.cpp [options.extras_require]