amulet-core 2.0a7__cp312-cp312-win_amd64.whl → 2.0.1.0.1297307203.19.43.34808.0a0__cp312-cp312-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of amulet-core might be problematic. Click here for more details.
- amulet/core/__init__.py +36 -0
- amulet/core/__pyinstaller/hook-amulet.core.py +4 -0
- amulet/core/_amulet_core.cp312-win_amd64.pyd +0 -0
- amulet/core/_amulet_core.pyi +7 -0
- amulet/{_version.py → core/_version.py} +3 -3
- amulet/core/amulet_core.dll +0 -0
- amulet/core/amulet_core.lib +0 -0
- amulet/core/amulet_coreConfig.cmake +18 -0
- amulet/{biome.pyi → core/biome/__init__.pyi} +3 -3
- amulet/core/biome/biome.hpp +53 -0
- amulet/{block.pyi → core/block/__init__.pyi} +25 -26
- amulet/core/block/block.hpp +156 -0
- amulet/{block_entity.pyi → core/block_entity/__init__.pyi} +7 -7
- amulet/core/block_entity/block_entity.hpp +84 -0
- amulet/{errors.py → core/chunk/__init__.pyi} +37 -33
- amulet/core/chunk/chunk.hpp +126 -0
- amulet/core/chunk/component/__init__.pyi +18 -0
- amulet/core/chunk/component/biome_3d_component.hpp +96 -0
- amulet/core/chunk/component/block_component.hpp +101 -0
- amulet/core/chunk/component/block_component.pyi +28 -0
- amulet/core/chunk/component/block_entity_component.hpp +119 -0
- amulet/core/chunk/component/section_array_map.hpp +129 -0
- amulet/{chunk_components.pyi → core/chunk/component/section_array_map.pyi} +4 -24
- amulet/core/dll.hpp +21 -0
- amulet/core/entity/__init__.pyi +105 -0
- amulet/core/entity/entity.hpp +100 -0
- amulet/{palette → core/palette}/__init__.pyi +2 -2
- amulet/core/palette/biome_palette.hpp +65 -0
- amulet/{palette → core/palette}/biome_palette.pyi +8 -8
- amulet/core/palette/block_palette.hpp +71 -0
- amulet/{palette → core/palette}/block_palette.pyi +12 -10
- amulet/core/selection/__init__.pyi +8 -0
- amulet/core/selection/box.hpp +86 -0
- amulet/core/selection/box.pyi +215 -0
- amulet/core/selection/group.hpp +80 -0
- amulet/core/selection/group.pyi +213 -0
- amulet/{version.pyi → core/version/__init__.pyi} +58 -10
- amulet/core/version/version.hpp +204 -0
- {amulet_core-2.0a7.dist-info → amulet_core-2.0.1.0.1297307203.19.43.34808.0a0.dist-info}/METADATA +25 -20
- amulet_core-2.0.1.0.1297307203.19.43.34808.0a0.dist-info/RECORD +45 -0
- {amulet_core-2.0a7.dist-info → amulet_core-2.0.1.0.1297307203.19.43.34808.0a0.dist-info}/WHEEL +1 -1
- amulet_core-2.0.1.0.1297307203.19.43.34808.0a0.dist-info/entry_points.txt +2 -0
- amulet/__init__.cp312-win_amd64.pyd +0 -0
- amulet/__init__.py.cpp +0 -43
- amulet/__init__.pyi +0 -28
- amulet/__pyinstaller/hook-amulet.py +0 -4
- amulet/_init.py +0 -26
- amulet/biome.cpp +0 -36
- amulet/biome.hpp +0 -43
- amulet/biome.py.cpp +0 -122
- amulet/block.cpp +0 -435
- amulet/block.hpp +0 -119
- amulet/block.py.cpp +0 -377
- amulet/block_entity.cpp +0 -12
- amulet/block_entity.hpp +0 -56
- amulet/block_entity.py.cpp +0 -115
- amulet/chunk.cpp +0 -16
- amulet/chunk.hpp +0 -99
- amulet/chunk.py.cpp +0 -80
- amulet/chunk.pyi +0 -28
- amulet/chunk_components/biome_3d_component.cpp +0 -5
- amulet/chunk_components/biome_3d_component.hpp +0 -79
- amulet/chunk_components/block_component.cpp +0 -41
- amulet/chunk_components/block_component.hpp +0 -88
- amulet/chunk_components/block_entity_component.cpp +0 -5
- amulet/chunk_components/block_entity_component.hpp +0 -147
- amulet/chunk_components/section_array_map.cpp +0 -129
- amulet/chunk_components/section_array_map.hpp +0 -147
- amulet/collections/eq.py.hpp +0 -37
- amulet/collections/hash.py.hpp +0 -27
- amulet/collections/holder.py.hpp +0 -37
- amulet/collections/iterator.py.hpp +0 -80
- amulet/collections/mapping.py.hpp +0 -199
- amulet/collections/mutable_mapping.py.hpp +0 -226
- amulet/collections/sequence.py.hpp +0 -163
- amulet/collections.pyi +0 -40
- amulet/data_types.py +0 -29
- amulet/entity.py +0 -182
- amulet/game/__init__.py +0 -7
- amulet/game/_game.py +0 -152
- amulet/game/_universal/__init__.py +0 -1
- amulet/game/_universal/_biome.py +0 -17
- amulet/game/_universal/_block.py +0 -47
- amulet/game/_universal/_version.py +0 -68
- amulet/game/abc/__init__.py +0 -22
- amulet/game/abc/_block_specification.py +0 -150
- amulet/game/abc/biome.py +0 -213
- amulet/game/abc/block.py +0 -331
- amulet/game/abc/game_version_container.py +0 -25
- amulet/game/abc/json_interface.py +0 -27
- amulet/game/abc/version.py +0 -44
- amulet/game/bedrock/__init__.py +0 -1
- amulet/game/bedrock/_biome.py +0 -35
- amulet/game/bedrock/_block.py +0 -42
- amulet/game/bedrock/_version.py +0 -165
- amulet/game/java/__init__.py +0 -2
- amulet/game/java/_biome.py +0 -35
- amulet/game/java/_block.py +0 -60
- amulet/game/java/_version.py +0 -176
- amulet/game/translate/__init__.py +0 -12
- amulet/game/translate/_functions/__init__.py +0 -15
- amulet/game/translate/_functions/_code_functions/__init__.py +0 -0
- amulet/game/translate/_functions/_code_functions/_text.py +0 -553
- amulet/game/translate/_functions/_code_functions/banner_pattern.py +0 -67
- amulet/game/translate/_functions/_code_functions/bedrock_chest_connection.py +0 -152
- amulet/game/translate/_functions/_code_functions/bedrock_moving_block_pos.py +0 -88
- amulet/game/translate/_functions/_code_functions/bedrock_sign.py +0 -152
- amulet/game/translate/_functions/_code_functions/bedrock_skull_rotation.py +0 -16
- amulet/game/translate/_functions/_code_functions/custom_name.py +0 -146
- amulet/game/translate/_functions/_frozen.py +0 -66
- amulet/game/translate/_functions/_state.py +0 -54
- amulet/game/translate/_functions/_typing.py +0 -98
- amulet/game/translate/_functions/abc.py +0 -123
- amulet/game/translate/_functions/carry_nbt.py +0 -160
- amulet/game/translate/_functions/carry_properties.py +0 -80
- amulet/game/translate/_functions/code.py +0 -143
- amulet/game/translate/_functions/map_block_name.py +0 -66
- amulet/game/translate/_functions/map_nbt.py +0 -111
- amulet/game/translate/_functions/map_properties.py +0 -93
- amulet/game/translate/_functions/multiblock.py +0 -112
- amulet/game/translate/_functions/new_block.py +0 -42
- amulet/game/translate/_functions/new_entity.py +0 -43
- amulet/game/translate/_functions/new_nbt.py +0 -206
- amulet/game/translate/_functions/new_properties.py +0 -64
- amulet/game/translate/_functions/sequence.py +0 -51
- amulet/game/translate/_functions/walk_input_nbt.py +0 -331
- amulet/game/translate/_translator.py +0 -433
- amulet/img/__init__.py +0 -10
- amulet/img/missing_no.png +0 -0
- amulet/img/missing_pack.png +0 -0
- amulet/img/missing_world.png +0 -0
- amulet/io/binary_reader.hpp +0 -45
- amulet/io/binary_writer.hpp +0 -30
- amulet/item.py +0 -75
- amulet/level/__init__.pyi +0 -23
- amulet/level/_load.py +0 -100
- amulet/level/abc/__init__.py +0 -12
- amulet/level/abc/_chunk_handle.py +0 -335
- amulet/level/abc/_dimension.py +0 -86
- amulet/level/abc/_history/__init__.py +0 -1
- amulet/level/abc/_history/_cache.py +0 -224
- amulet/level/abc/_history/_history_manager.py +0 -291
- amulet/level/abc/_level/__init__.py +0 -5
- amulet/level/abc/_level/_compactable_level.py +0 -10
- amulet/level/abc/_level/_creatable_level.py +0 -28
- amulet/level/abc/_level/_disk_level.py +0 -17
- amulet/level/abc/_level/_level.py +0 -449
- amulet/level/abc/_level/_loadable_level.py +0 -42
- amulet/level/abc/_player_storage.py +0 -7
- amulet/level/abc/_raw_level.py +0 -187
- amulet/level/abc/_registry.py +0 -40
- amulet/level/java/__init__.pyi +0 -16
- amulet/level/java/_chunk_handle.py +0 -17
- amulet/level/java/_dimension.py +0 -20
- amulet/level/java/_level.py +0 -184
- amulet/level/java/_raw/__init__.pyi +0 -15
- amulet/level/java/_raw/_chunk.pyi +0 -23
- amulet/level/java/_raw/_constant.py +0 -9
- amulet/level/java/_raw/_data_pack/__init__.py +0 -2
- amulet/level/java/_raw/_data_pack/data_pack.py +0 -241
- amulet/level/java/_raw/_data_pack/data_pack_manager.py +0 -77
- amulet/level/java/_raw/_dimension.py +0 -86
- amulet/level/java/_raw/_level.py +0 -507
- amulet/level/java/_raw/_typing.py +0 -3
- amulet/level/java/_raw/java_chunk_decode.cpp +0 -531
- amulet/level/java/_raw/java_chunk_decode.hpp +0 -23
- amulet/level/java/_raw/java_chunk_encode.cpp +0 -25
- amulet/level/java/_raw/java_chunk_encode.hpp +0 -23
- amulet/level/java/anvil/__init__.py +0 -2
- amulet/level/java/anvil/_dimension.py +0 -170
- amulet/level/java/anvil/_region.py +0 -421
- amulet/level/java/anvil/_sector_manager.py +0 -223
- amulet/level/java/chunk.pyi +0 -81
- amulet/level/java/chunk_/_chunk.py +0 -260
- amulet/level/java/chunk_/components/inhabited_time.py +0 -12
- amulet/level/java/chunk_/components/last_update.py +0 -12
- amulet/level/java/chunk_/components/legacy_version.py +0 -12
- amulet/level/java/chunk_/components/light_populated.py +0 -12
- amulet/level/java/chunk_/components/named_height_2d.py +0 -37
- amulet/level/java/chunk_/components/status.py +0 -11
- amulet/level/java/chunk_/components/terrain_populated.py +0 -12
- amulet/level/java/chunk_components/data_version_component.cpp +0 -32
- amulet/level/java/chunk_components/data_version_component.hpp +0 -31
- amulet/level/java/chunk_components/java_raw_chunk_component.cpp +0 -56
- amulet/level/java/chunk_components/java_raw_chunk_component.hpp +0 -45
- amulet/level/java/chunk_components.pyi +0 -22
- amulet/level/java/java_chunk.cpp +0 -170
- amulet/level/java/java_chunk.hpp +0 -141
- amulet/level/java/long_array.hpp +0 -175
- amulet/level/java/long_array.pyi +0 -39
- amulet/level/temporary_level/__init__.py +0 -1
- amulet/level/temporary_level/_level.py +0 -16
- amulet/mesh/__init__.py +0 -0
- amulet/mesh/block/__init__.py +0 -1
- amulet/mesh/block/block_mesh.py +0 -369
- amulet/mesh/block/cube.py +0 -149
- amulet/mesh/block/missing_block.py +0 -20
- amulet/mesh/util.py +0 -17
- amulet/palette/biome_palette.hpp +0 -85
- amulet/palette/block_palette.cpp +0 -32
- amulet/palette/block_palette.hpp +0 -93
- amulet/player.py +0 -62
- amulet/pybind11/collections.hpp +0 -118
- amulet/pybind11/numpy.hpp +0 -26
- amulet/pybind11/py_module.hpp +0 -34
- amulet/pybind11/type_hints.hpp +0 -51
- amulet/pybind11/types.hpp +0 -25
- amulet/pybind11/typing.hpp +0 -7
- amulet/resource_pack/__init__.py +0 -62
- amulet/resource_pack/abc/__init__.py +0 -2
- amulet/resource_pack/abc/resource_pack.py +0 -38
- amulet/resource_pack/abc/resource_pack_manager.py +0 -87
- amulet/resource_pack/bedrock/__init__.py +0 -2
- amulet/resource_pack/bedrock/bedrock_vanilla_fix/pack_icon.png +0 -0
- amulet/resource_pack/bedrock/bedrock_vanilla_fix/textures/blocks/grass_carried.png +0 -0
- amulet/resource_pack/bedrock/bedrock_vanilla_fix/textures/blocks/grass_side_carried.png +0 -0
- amulet/resource_pack/bedrock/bedrock_vanilla_fix/textures/blocks/water.png +0 -0
- amulet/resource_pack/bedrock/blockshapes/__init__.py +0 -31
- amulet/resource_pack/bedrock/blockshapes/air.py +0 -35
- amulet/resource_pack/bedrock/blockshapes/base_blockshape.py +0 -29
- amulet/resource_pack/bedrock/blockshapes/bubble_column.py +0 -29
- amulet/resource_pack/bedrock/blockshapes/cake.py +0 -46
- amulet/resource_pack/bedrock/blockshapes/chest.py +0 -54
- amulet/resource_pack/bedrock/blockshapes/comparator.py +0 -51
- amulet/resource_pack/bedrock/blockshapes/cross_texture.py +0 -186
- amulet/resource_pack/bedrock/blockshapes/cross_texture0.py +0 -17
- amulet/resource_pack/bedrock/blockshapes/cross_texture_green.py +0 -16
- amulet/resource_pack/bedrock/blockshapes/cube.py +0 -38
- amulet/resource_pack/bedrock/blockshapes/default.py +0 -14
- amulet/resource_pack/bedrock/blockshapes/door.py +0 -38
- amulet/resource_pack/bedrock/blockshapes/door1.py +0 -14
- amulet/resource_pack/bedrock/blockshapes/door2.py +0 -14
- amulet/resource_pack/bedrock/blockshapes/door3.py +0 -14
- amulet/resource_pack/bedrock/blockshapes/door4.py +0 -14
- amulet/resource_pack/bedrock/blockshapes/door5.py +0 -14
- amulet/resource_pack/bedrock/blockshapes/door6.py +0 -14
- amulet/resource_pack/bedrock/blockshapes/double_plant.py +0 -40
- amulet/resource_pack/bedrock/blockshapes/enchanting_table.py +0 -22
- amulet/resource_pack/bedrock/blockshapes/farmland.py +0 -22
- amulet/resource_pack/bedrock/blockshapes/fence.py +0 -22
- amulet/resource_pack/bedrock/blockshapes/flat.py +0 -55
- amulet/resource_pack/bedrock/blockshapes/flat_wall.py +0 -55
- amulet/resource_pack/bedrock/blockshapes/furnace.py +0 -44
- amulet/resource_pack/bedrock/blockshapes/furnace_lit.py +0 -14
- amulet/resource_pack/bedrock/blockshapes/green_cube.py +0 -39
- amulet/resource_pack/bedrock/blockshapes/ladder.py +0 -36
- amulet/resource_pack/bedrock/blockshapes/lilypad.py +0 -14
- amulet/resource_pack/bedrock/blockshapes/partial_block.py +0 -57
- amulet/resource_pack/bedrock/blockshapes/piston.py +0 -44
- amulet/resource_pack/bedrock/blockshapes/piston_arm.py +0 -72
- amulet/resource_pack/bedrock/blockshapes/portal_frame.py +0 -22
- amulet/resource_pack/bedrock/blockshapes/pressure_plate.py +0 -29
- amulet/resource_pack/bedrock/blockshapes/pumpkin.py +0 -36
- amulet/resource_pack/bedrock/blockshapes/pumpkin_carved.py +0 -14
- amulet/resource_pack/bedrock/blockshapes/pumpkin_lit.py +0 -14
- amulet/resource_pack/bedrock/blockshapes/red_dust.py +0 -14
- amulet/resource_pack/bedrock/blockshapes/repeater.py +0 -53
- amulet/resource_pack/bedrock/blockshapes/slab.py +0 -33
- amulet/resource_pack/bedrock/blockshapes/slab_double.py +0 -15
- amulet/resource_pack/bedrock/blockshapes/tree.py +0 -41
- amulet/resource_pack/bedrock/blockshapes/turtle_egg.py +0 -15
- amulet/resource_pack/bedrock/blockshapes/vine.py +0 -52
- amulet/resource_pack/bedrock/blockshapes/wall.py +0 -22
- amulet/resource_pack/bedrock/blockshapes/water.py +0 -38
- amulet/resource_pack/bedrock/download_resources.py +0 -147
- amulet/resource_pack/bedrock/resource_pack.py +0 -40
- amulet/resource_pack/bedrock/resource_pack_manager.py +0 -361
- amulet/resource_pack/bedrock/sort_blockshapes.py +0 -15
- amulet/resource_pack/java/__init__.py +0 -2
- amulet/resource_pack/java/download_resources.py +0 -212
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_black.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_blue.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_brown.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_cyan.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_gray.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_green.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_light_blue.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_light_gray.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_lime.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_magenta.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_orange.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_pink.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_purple.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_red.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_white.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/banner/banner_yellow.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/barrier.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/end_portal.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/grass.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/lava.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/structure_void.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/assets/minecraft/textures/block/water.png +0 -0
- amulet/resource_pack/java/java_vanilla_fix/pack.png +0 -0
- amulet/resource_pack/java/resource_pack.py +0 -44
- amulet/resource_pack/java/resource_pack_manager.py +0 -551
- amulet/resource_pack/unknown_resource_pack.py +0 -10
- amulet/selection/__init__.py +0 -2
- amulet/selection/abstract_selection.py +0 -342
- amulet/selection/box.py +0 -852
- amulet/selection/group.py +0 -481
- amulet/utils/__init__.pyi +0 -23
- amulet/utils/call_spec/__init__.py +0 -24
- amulet/utils/call_spec/_call_spec.py +0 -257
- amulet/utils/comment_json.py +0 -188
- amulet/utils/format_utils.py +0 -41
- amulet/utils/generator.py +0 -18
- amulet/utils/matrix.py +0 -243
- amulet/utils/numpy.hpp +0 -36
- amulet/utils/numpy.pyi +0 -11
- amulet/utils/numpy_helpers.py +0 -19
- amulet/utils/shareable_lock.py +0 -335
- amulet/utils/signal/__init__.py +0 -10
- amulet/utils/signal/_signal.py +0 -228
- amulet/utils/task_manager.py +0 -235
- amulet/utils/typed_property.py +0 -111
- amulet/utils/weakref.py +0 -70
- amulet/utils/world_utils.py +0 -102
- amulet/version.cpp +0 -136
- amulet/version.hpp +0 -142
- amulet/version.py.cpp +0 -281
- amulet_core-2.0a7.dist-info/RECORD +0 -295
- amulet_core-2.0a7.dist-info/entry_points.txt +0 -2
- /amulet/{__pyinstaller → core/__pyinstaller}/__init__.py +0 -0
- /amulet/{py.typed → core/py.typed} +0 -0
- {amulet_core-2.0a7.dist-info → amulet_core-2.0.1.0.1297307203.19.43.34808.0a0.dist-info}/top_level.txt +0 -0
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include <tuple>
|
|
4
|
-
#include <unordered_map>
|
|
5
|
-
#include <variant>
|
|
6
|
-
#include <cstdint>
|
|
7
|
-
#include <vector>
|
|
8
|
-
#include <span>
|
|
9
|
-
#include <cstdlib>
|
|
10
|
-
#include <type_traits>
|
|
11
|
-
#include <memory>
|
|
12
|
-
#include <stdexcept>
|
|
13
|
-
|
|
14
|
-
#include <amulet/io/binary_writer.hpp>
|
|
15
|
-
#include <amulet/io/binary_reader.hpp>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
namespace Amulet {
|
|
19
|
-
namespace detail {
|
|
20
|
-
template <typename T>
|
|
21
|
-
inline std::unique_ptr<T*> new_buffer(size_t count) {
|
|
22
|
-
T* buffer = (T*) std::malloc(sizeof(T) * count);
|
|
23
|
-
if (buffer == nullptr) {
|
|
24
|
-
throw std::runtime_error("Could not allocate buffer");
|
|
25
|
-
}
|
|
26
|
-
return std::make_unique<T*>(buffer);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
typedef std::tuple<std::uint16_t, std::uint16_t, std::uint16_t> SectionShape;
|
|
31
|
-
|
|
32
|
-
class IndexArray3D {
|
|
33
|
-
private:
|
|
34
|
-
SectionShape _shape;
|
|
35
|
-
size_t _size;
|
|
36
|
-
std::unique_ptr<std::uint32_t*> _buffer;
|
|
37
|
-
public:
|
|
38
|
-
IndexArray3D(const SectionShape& shape) :
|
|
39
|
-
_shape(shape),
|
|
40
|
-
_size(std::get<0>(shape)* std::get<1>(shape)* std::get<2>(shape)),
|
|
41
|
-
_buffer(detail::new_buffer<std::uint32_t>(_size))
|
|
42
|
-
{}
|
|
43
|
-
IndexArray3D(const SectionShape& shape, std::uint32_t value) :
|
|
44
|
-
IndexArray3D(shape) {
|
|
45
|
-
std::fill_n(*_buffer, _size, value);
|
|
46
|
-
}
|
|
47
|
-
IndexArray3D(const IndexArray3D& other):
|
|
48
|
-
IndexArray3D(other.get_shape())
|
|
49
|
-
{
|
|
50
|
-
std::memcpy(*_buffer, *other._buffer, sizeof(std::uint32_t) * other.get_size());
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
void serialise(BinaryWriter&) const;
|
|
54
|
-
static std::shared_ptr<IndexArray3D> deserialise(BinaryReader&);
|
|
55
|
-
|
|
56
|
-
const SectionShape& get_shape() const {
|
|
57
|
-
return _shape;
|
|
58
|
-
}
|
|
59
|
-
const size_t& get_size() const { return _size; }
|
|
60
|
-
std::uint32_t* get_buffer() const { return *_buffer; }
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
namespace detail {
|
|
64
|
-
inline void validate_array_shape(
|
|
65
|
-
const std::shared_ptr<IndexArray3D>& default_array,
|
|
66
|
-
const SectionShape& array_shape
|
|
67
|
-
) {
|
|
68
|
-
if (default_array->get_shape() != array_shape) {
|
|
69
|
-
throw std::invalid_argument("Array shape does not match required shape.");
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
inline void validate_array_shape(
|
|
74
|
-
const std::variant<std::uint32_t, std::shared_ptr<IndexArray3D>>& default_array,
|
|
75
|
-
const SectionShape& array_shape
|
|
76
|
-
) {
|
|
77
|
-
if (std::holds_alternative<std::shared_ptr<IndexArray3D>>(default_array)) {
|
|
78
|
-
validate_array_shape(std::get<std::shared_ptr<IndexArray3D>>(default_array), array_shape);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
class SectionArrayMap {
|
|
84
|
-
private:
|
|
85
|
-
SectionShape _array_shape;
|
|
86
|
-
std::variant<std::uint32_t, std::shared_ptr<IndexArray3D>> _default_array;
|
|
87
|
-
std::unordered_map<std::int64_t, std::shared_ptr<IndexArray3D>> _arrays;
|
|
88
|
-
public:
|
|
89
|
-
SectionArrayMap(
|
|
90
|
-
const SectionShape& array_shape,
|
|
91
|
-
std::variant<std::uint32_t, std::shared_ptr<IndexArray3D>> default_array
|
|
92
|
-
) : _array_shape(array_shape), _default_array(default_array), _arrays() {
|
|
93
|
-
detail::validate_array_shape(_default_array, _array_shape);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
void serialise(BinaryWriter&) const;
|
|
97
|
-
static std::shared_ptr<SectionArrayMap> deserialise(BinaryReader&);
|
|
98
|
-
|
|
99
|
-
const SectionShape& get_array_shape() const { return _array_shape; }
|
|
100
|
-
|
|
101
|
-
std::variant<std::uint32_t, std::shared_ptr<IndexArray3D>> get_default_array() const { return _default_array; }
|
|
102
|
-
|
|
103
|
-
void set_default_array(std::variant<std::uint32_t, std::shared_ptr<IndexArray3D>> default_array) {
|
|
104
|
-
detail::validate_array_shape(default_array, _array_shape);
|
|
105
|
-
_default_array = default_array;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
const std::unordered_map<std::int64_t, std::shared_ptr<IndexArray3D>>& get_arrays() const {
|
|
109
|
-
return _arrays;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
size_t get_size() const { return _arrays.size(); }
|
|
113
|
-
|
|
114
|
-
bool contains_section(std::int64_t cy) const {
|
|
115
|
-
return _arrays.contains(cy);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
std::shared_ptr<IndexArray3D> get_section(std::int64_t cy) const {
|
|
119
|
-
return _arrays.at(cy);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
void set_section(std::int64_t cy, std::shared_ptr<IndexArray3D> section) {
|
|
123
|
-
detail::validate_array_shape(section, _array_shape);
|
|
124
|
-
_arrays[cy] = section;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
void populate_section(std::int64_t cy) {
|
|
128
|
-
if (_arrays.contains(cy)) {
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
std::visit([this, &cy](auto&& arg) {
|
|
132
|
-
using T = std::decay_t<decltype(arg)>;
|
|
133
|
-
if constexpr (std::is_same_v<T, std::uint32_t>) {
|
|
134
|
-
_arrays[cy] = std::make_shared<IndexArray3D>(_array_shape, arg);
|
|
135
|
-
}
|
|
136
|
-
else {
|
|
137
|
-
_arrays[cy] = std::make_shared<IndexArray3D>(*arg);
|
|
138
|
-
}
|
|
139
|
-
}, _default_array);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
void del_section(std::int64_t cy) {
|
|
143
|
-
_arrays.erase(cy);
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
}
|
amulet/collections/eq.py.hpp
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
// Better type hinting for equality methods that pybind11 has natively
|
|
3
|
-
|
|
4
|
-
#include <variant>
|
|
5
|
-
#include <amulet/pybind11/types.hpp>
|
|
6
|
-
|
|
7
|
-
#include <pybind11/pybind11.h>
|
|
8
|
-
|
|
9
|
-
namespace py = pybind11;
|
|
10
|
-
|
|
11
|
-
template <typename R, typename clsT>
|
|
12
|
-
void Eq(clsT cls) {
|
|
13
|
-
cls.def(
|
|
14
|
-
"__eq__",
|
|
15
|
-
[](const typename clsT::type& self, R other) {
|
|
16
|
-
return self == other;
|
|
17
|
-
}
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
template <typename clsT>
|
|
23
|
-
void Eq(clsT cls) {
|
|
24
|
-
Eq<const typename clsT::type&>(cls);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
template <typename clsT>
|
|
29
|
-
void Eq_default(clsT cls) {
|
|
30
|
-
py::object NotImplemented = py::module::import("builtins").attr("NotImplemented");
|
|
31
|
-
cls.def(
|
|
32
|
-
"__eq__",
|
|
33
|
-
[NotImplemented](const typename clsT::type& self, py::object other) -> std::variant<bool, Amulet::pybind11::types::NotImplementedType> {
|
|
34
|
-
return NotImplemented;
|
|
35
|
-
}
|
|
36
|
-
);
|
|
37
|
-
}
|
amulet/collections/hash.py.hpp
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include <pybind11/pybind11.h>
|
|
4
|
-
|
|
5
|
-
namespace py = pybind11;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
template <typename clsT>
|
|
9
|
-
void hash_default(clsT cls) {
|
|
10
|
-
cls.def(
|
|
11
|
-
"__hash__",
|
|
12
|
-
[](py::object self) -> py::int_ {
|
|
13
|
-
return py::module::import("builtins").attr("id")(self);
|
|
14
|
-
}
|
|
15
|
-
);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
template <typename clsT>
|
|
20
|
-
void hash_disable(clsT cls) {
|
|
21
|
-
cls.def(
|
|
22
|
-
"__hash__",
|
|
23
|
-
[](py::object self) -> size_t {
|
|
24
|
-
throw py::type_error("This class is not hashable.");
|
|
25
|
-
}
|
|
26
|
-
);
|
|
27
|
-
}
|
amulet/collections/holder.py.hpp
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include <memory>
|
|
4
|
-
#include <pybind11/pybind11.h>
|
|
5
|
-
|
|
6
|
-
namespace py = pybind11;
|
|
7
|
-
|
|
8
|
-
namespace Amulet {
|
|
9
|
-
namespace collections {
|
|
10
|
-
|
|
11
|
-
// A class to allow python to hold a reference to a smart pointer
|
|
12
|
-
class Holder {
|
|
13
|
-
public:
|
|
14
|
-
virtual ~Holder() {}
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
template <typename T>
|
|
18
|
-
class HolderTemplate: public Holder {
|
|
19
|
-
private:
|
|
20
|
-
T value;
|
|
21
|
-
public:
|
|
22
|
-
HolderTemplate(T&& value): value(std::move(value)){}
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
template <typename T>
|
|
26
|
-
static py::object make_holder(T&& value) {
|
|
27
|
-
return py::cast(
|
|
28
|
-
static_cast<std::unique_ptr<Holder>>(
|
|
29
|
-
std::make_unique<HolderTemplate<T>>(
|
|
30
|
-
std::move(value)
|
|
31
|
-
)
|
|
32
|
-
)
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
#include <stdexcept>
|
|
3
|
-
|
|
4
|
-
#include <pybind11/pybind11.h>
|
|
5
|
-
|
|
6
|
-
namespace py = pybind11;
|
|
7
|
-
|
|
8
|
-
namespace Amulet {
|
|
9
|
-
namespace collections {
|
|
10
|
-
class Iterator {
|
|
11
|
-
public:
|
|
12
|
-
virtual ~Iterator() {};
|
|
13
|
-
virtual bool has_next() = 0;
|
|
14
|
-
virtual py::object next() = 0;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
// An iterator for the collections.abc.Sequence protocol.
|
|
18
|
-
class PySequenceIterator: public Iterator {
|
|
19
|
-
private:
|
|
20
|
-
py::object obj;
|
|
21
|
-
size_t index;
|
|
22
|
-
std::ptrdiff_t step;
|
|
23
|
-
public:
|
|
24
|
-
PySequenceIterator(
|
|
25
|
-
py::object obj,
|
|
26
|
-
size_t start,
|
|
27
|
-
std::ptrdiff_t step
|
|
28
|
-
) : obj(obj), index(start), step(step) {};
|
|
29
|
-
bool has_next() override{
|
|
30
|
-
return 0 <= index && index < py::len(obj);
|
|
31
|
-
};
|
|
32
|
-
py::object next() override {
|
|
33
|
-
py::object item = obj.attr("__getitem__")(index);
|
|
34
|
-
index += step;
|
|
35
|
-
return item;
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
// An iterator for a C++ map-like object.
|
|
40
|
-
template <typename mapT>
|
|
41
|
-
class MapIterator: public Iterator {
|
|
42
|
-
private:
|
|
43
|
-
py::object owner;
|
|
44
|
-
const mapT& map;
|
|
45
|
-
typename mapT::const_iterator begin;
|
|
46
|
-
typename mapT::const_iterator end;
|
|
47
|
-
typename mapT::const_iterator pos;
|
|
48
|
-
size_t size;
|
|
49
|
-
|
|
50
|
-
public:
|
|
51
|
-
MapIterator(const mapT& map, py::object owner = py::none()) :
|
|
52
|
-
owner(owner),
|
|
53
|
-
map(map),
|
|
54
|
-
begin(map.begin()),
|
|
55
|
-
end(map.end()),
|
|
56
|
-
pos(map.begin()),
|
|
57
|
-
size(map.size())
|
|
58
|
-
{}
|
|
59
|
-
|
|
60
|
-
bool has_next() override {
|
|
61
|
-
return pos != end;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
bool is_valid() {
|
|
65
|
-
// This is not fool proof.
|
|
66
|
-
// There are cases where this is true but the iterator is invalid.
|
|
67
|
-
// The programmer should write good code and this will catch some of the bad cases.
|
|
68
|
-
return size == map.size() && begin == map.begin() && end == map.end();
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
py::object next() override {
|
|
72
|
-
if (!is_valid()) {
|
|
73
|
-
throw std::runtime_error("map changed size during iteration.");
|
|
74
|
-
}
|
|
75
|
-
return py::cast((pos++)->first);
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
}
|
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include <memory>
|
|
4
|
-
|
|
5
|
-
#include <pybind11/pybind11.h>
|
|
6
|
-
#include <pybind11/typing.h>
|
|
7
|
-
|
|
8
|
-
#include <amulet/pybind11/types.hpp>
|
|
9
|
-
#include <amulet/pybind11/type_hints.hpp>
|
|
10
|
-
#include <amulet/pybind11/collections.hpp>
|
|
11
|
-
#include "iterator.py.hpp"
|
|
12
|
-
|
|
13
|
-
namespace py = pybind11;
|
|
14
|
-
|
|
15
|
-
namespace Amulet {
|
|
16
|
-
namespace collections {
|
|
17
|
-
template <typename clsT>
|
|
18
|
-
void PyMapping_repr(clsT cls) {
|
|
19
|
-
cls.def(
|
|
20
|
-
"__repr__",
|
|
21
|
-
[](py::object self) {
|
|
22
|
-
std::string repr = "{";
|
|
23
|
-
bool is_first = true;
|
|
24
|
-
for (auto it = self.begin(); it != self.end(); it++) {
|
|
25
|
-
if (is_first) {
|
|
26
|
-
is_first = false;
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
repr += ", ";
|
|
30
|
-
}
|
|
31
|
-
repr += py::repr(*it);
|
|
32
|
-
repr += ": ";
|
|
33
|
-
repr += py::repr(self.attr("__getitem__")(*it));
|
|
34
|
-
}
|
|
35
|
-
repr += "}";
|
|
36
|
-
return repr;
|
|
37
|
-
}
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
template <typename KT = py::object, typename clsT>
|
|
42
|
-
void PyMapping_contains(clsT cls) {
|
|
43
|
-
cls.def(
|
|
44
|
-
"__contains__",
|
|
45
|
-
[](py::object self, Amulet::pybind11::type_hints::PyObjectCpp<KT> key) {
|
|
46
|
-
try {
|
|
47
|
-
self.attr("__getitem__")(key);
|
|
48
|
-
return true;
|
|
49
|
-
}
|
|
50
|
-
catch (const py::error_already_set& e) {
|
|
51
|
-
if (e.matches(PyExc_KeyError)) {
|
|
52
|
-
return false;
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
throw;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
template <typename KT = py::object, typename clsT>
|
|
63
|
-
void PyMapping_keys(clsT cls) {
|
|
64
|
-
py::object KeysView = py::module::import("collections.abc").attr("KeysView");
|
|
65
|
-
cls.def(
|
|
66
|
-
"keys",
|
|
67
|
-
[KeysView](py::object self) -> Amulet::pybind11::collections::KeysView<KT> { return KeysView(self); }
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
template <typename VT = py::object, typename clsT>
|
|
72
|
-
void PyMapping_values(clsT cls) {
|
|
73
|
-
py::object ValuesView = py::module::import("collections.abc").attr("ValuesView");
|
|
74
|
-
cls.def(
|
|
75
|
-
"values",
|
|
76
|
-
[ValuesView](py::object self) -> Amulet::pybind11::collections::ValuesView<VT> { return ValuesView(self); }
|
|
77
|
-
);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
template <typename KT = py::object, typename VT = py::object, typename clsT>
|
|
81
|
-
void PyMapping_items(clsT cls) {
|
|
82
|
-
py::object ItemsView = py::module::import("collections.abc").attr("ItemsView");
|
|
83
|
-
cls.def(
|
|
84
|
-
"items",
|
|
85
|
-
[ItemsView](py::object self) -> Amulet::pybind11::collections::ItemsView<KT, VT> { return ItemsView(self); }
|
|
86
|
-
);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
template <typename KT = py::object, typename VT = py::object, typename clsT>
|
|
90
|
-
void PyMapping_get(clsT cls) {
|
|
91
|
-
cls.def(
|
|
92
|
-
"get",
|
|
93
|
-
[](
|
|
94
|
-
py::object self,
|
|
95
|
-
Amulet::pybind11::type_hints::PyObjectCpp<KT> key,
|
|
96
|
-
py::typing::Optional<VT> default_ = py::none()
|
|
97
|
-
) -> py::typing::Optional<VT> {
|
|
98
|
-
try {
|
|
99
|
-
return self.attr("__getitem__")(key);
|
|
100
|
-
}
|
|
101
|
-
catch (const py::error_already_set& e) {
|
|
102
|
-
if (e.matches(PyExc_KeyError)) {
|
|
103
|
-
return default_;
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
106
|
-
throw;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
template <typename clsT>
|
|
114
|
-
void PyMapping_eq(clsT cls) {
|
|
115
|
-
py::object dict = py::module::import("builtins").attr("dict");
|
|
116
|
-
py::object isinstance = py::module::import("builtins").attr("isinstance");
|
|
117
|
-
py::object NotImplemented = py::module::import("builtins").attr("NotImplemented");
|
|
118
|
-
py::object PyMapping = py::module::import("collections.abc").attr("Mapping");
|
|
119
|
-
cls.def(
|
|
120
|
-
"__eq__",
|
|
121
|
-
[
|
|
122
|
-
dict,
|
|
123
|
-
isinstance,
|
|
124
|
-
NotImplemented,
|
|
125
|
-
PyMapping
|
|
126
|
-
](
|
|
127
|
-
py::object self,
|
|
128
|
-
py::object other
|
|
129
|
-
) -> std::variant<bool, Amulet::pybind11::types::NotImplementedType> {
|
|
130
|
-
if (!isinstance(other, PyMapping)) {
|
|
131
|
-
return NotImplemented;
|
|
132
|
-
}
|
|
133
|
-
return dict(self.attr("items")()).equal(dict(other.attr("items")()).cast<py::dict>());
|
|
134
|
-
}
|
|
135
|
-
);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
template <typename clsT>
|
|
139
|
-
void PyMapping_hash(clsT cls) {
|
|
140
|
-
cls.def(
|
|
141
|
-
"__hash__",
|
|
142
|
-
[](
|
|
143
|
-
py::object self
|
|
144
|
-
) -> size_t {
|
|
145
|
-
throw py::type_error("Mapping is not hashable");
|
|
146
|
-
}
|
|
147
|
-
);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
template <typename clsT>
|
|
151
|
-
void PyMapping_register(clsT cls) {
|
|
152
|
-
py::module::import("collections.abc").attr("Mapping").attr("register")(cls);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
class Mapping {
|
|
156
|
-
public:
|
|
157
|
-
virtual ~Mapping() {};
|
|
158
|
-
virtual py::object getitem(py::object py_key) const = 0;
|
|
159
|
-
virtual std::shared_ptr<Iterator> iter() const = 0;
|
|
160
|
-
virtual size_t size() const = 0;
|
|
161
|
-
virtual bool contains(py::object py_key) const = 0;
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
template <typename mapT>
|
|
165
|
-
class ConstMap : public Mapping {
|
|
166
|
-
private:
|
|
167
|
-
py::object _owner;
|
|
168
|
-
const mapT& _map;
|
|
169
|
-
public:
|
|
170
|
-
ConstMap(
|
|
171
|
-
const mapT& map,
|
|
172
|
-
py::object owner = py::none()
|
|
173
|
-
) : _owner(owner), _map(map) {}
|
|
174
|
-
|
|
175
|
-
py::object getitem(py::object py_key) const override {
|
|
176
|
-
return py::cast(_map.at(py_key.cast<typename mapT::key_type>()));
|
|
177
|
-
}
|
|
178
|
-
std::shared_ptr<Iterator> iter() const override {
|
|
179
|
-
return std::make_shared<MapIterator<mapT>>(_map, _owner);
|
|
180
|
-
}
|
|
181
|
-
size_t size() const override {
|
|
182
|
-
return _map.size();
|
|
183
|
-
}
|
|
184
|
-
bool contains(py::object py_key) const override {
|
|
185
|
-
return _map.contains(py_key.cast<typename mapT::key_type>());
|
|
186
|
-
}
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
template <typename mapT>
|
|
190
|
-
static py::object make_const_map(const mapT& value, py::object owner = py::none()) {
|
|
191
|
-
return py::cast(
|
|
192
|
-
static_cast<std::shared_ptr<Mapping>>(
|
|
193
|
-
std::make_shared<ConstMap<mapT>>(value, owner)
|
|
194
|
-
)
|
|
195
|
-
);
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
}
|
|
199
|
-
}
|