amulet-core 2.0a6__cp311-cp311-win_amd64.whl → 2.0a7__cp311-cp311-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/__init__.cp311-win_amd64.pyd +0 -0
- amulet/__init__.py.cpp +4 -0
- amulet/__init__.pyi +0 -2
- amulet/_init.py +0 -2
- amulet/_version.py +3 -3
- amulet/biome.pyi +0 -2
- amulet/block.pyi +0 -2
- amulet/block_entity.pyi +0 -2
- amulet/chunk.pyi +0 -2
- amulet/chunk_components.pyi +20 -18
- amulet/collections/eq.py.hpp +1 -1
- amulet/collections/mapping.py.hpp +18 -11
- amulet/collections/mutable_mapping.py.hpp +17 -6
- amulet/collections/sequence.py.hpp +5 -6
- amulet/collections.pyi +8 -5
- amulet/entity.py +22 -20
- amulet/game/translate/_functions/_code_functions/_text.py +2 -2
- amulet/game/translate/_functions/abc.py +10 -3
- amulet/img/__init__.py +10 -0
- amulet/img/missing_no.png +0 -0
- amulet/img/missing_pack.png +0 -0
- amulet/level/__init__.pyi +2 -6
- amulet/level/abc/_level/_creatable_level.py +1 -2
- amulet/level/abc/_level/_level.py +1 -5
- amulet/level/java/__init__.pyi +0 -5
- amulet/level/java/_raw/__init__.pyi +0 -4
- amulet/level/java/_raw/java_chunk_decode.cpp +2 -4
- amulet/level/java/long_array.pyi +2 -1
- amulet/mesh/block/__init__.py +1 -0
- amulet/mesh/block/block_mesh.py +369 -0
- amulet/mesh/block/cube.py +149 -0
- amulet/mesh/block/missing_block.py +20 -0
- amulet/mesh/util.py +17 -0
- amulet/player.py +4 -6
- amulet/pybind11/collections.hpp +80 -38
- amulet/pybind11/numpy.hpp +26 -0
- amulet/pybind11/py_module.hpp +16 -51
- amulet/pybind11/type_hints.hpp +51 -0
- amulet/pybind11/types.hpp +14 -6
- amulet/pybind11/typing.hpp +7 -0
- amulet/resource_pack/__init__.py +62 -0
- amulet/resource_pack/abc/__init__.py +2 -0
- amulet/resource_pack/abc/resource_pack.py +38 -0
- amulet/resource_pack/abc/resource_pack_manager.py +87 -0
- amulet/resource_pack/bedrock/__init__.py +2 -0
- 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 +31 -0
- amulet/resource_pack/bedrock/blockshapes/air.py +35 -0
- amulet/resource_pack/bedrock/blockshapes/base_blockshape.py +29 -0
- amulet/resource_pack/bedrock/blockshapes/bubble_column.py +29 -0
- amulet/resource_pack/bedrock/blockshapes/cake.py +46 -0
- amulet/resource_pack/bedrock/blockshapes/chest.py +54 -0
- amulet/resource_pack/bedrock/blockshapes/comparator.py +51 -0
- amulet/resource_pack/bedrock/blockshapes/cross_texture.py +186 -0
- amulet/resource_pack/bedrock/blockshapes/cross_texture0.py +17 -0
- amulet/resource_pack/bedrock/blockshapes/cross_texture_green.py +16 -0
- amulet/resource_pack/bedrock/blockshapes/cube.py +38 -0
- amulet/resource_pack/bedrock/blockshapes/default.py +14 -0
- amulet/resource_pack/bedrock/blockshapes/door.py +38 -0
- amulet/resource_pack/bedrock/blockshapes/door1.py +14 -0
- amulet/resource_pack/bedrock/blockshapes/door2.py +14 -0
- amulet/resource_pack/bedrock/blockshapes/door3.py +14 -0
- amulet/resource_pack/bedrock/blockshapes/door4.py +14 -0
- amulet/resource_pack/bedrock/blockshapes/door5.py +14 -0
- amulet/resource_pack/bedrock/blockshapes/door6.py +14 -0
- amulet/resource_pack/bedrock/blockshapes/double_plant.py +40 -0
- amulet/resource_pack/bedrock/blockshapes/enchanting_table.py +22 -0
- amulet/resource_pack/bedrock/blockshapes/farmland.py +22 -0
- amulet/resource_pack/bedrock/blockshapes/fence.py +22 -0
- amulet/resource_pack/bedrock/blockshapes/flat.py +55 -0
- amulet/resource_pack/bedrock/blockshapes/flat_wall.py +55 -0
- amulet/resource_pack/bedrock/blockshapes/furnace.py +44 -0
- amulet/resource_pack/bedrock/blockshapes/furnace_lit.py +14 -0
- amulet/resource_pack/bedrock/blockshapes/green_cube.py +39 -0
- amulet/resource_pack/bedrock/blockshapes/ladder.py +36 -0
- amulet/resource_pack/bedrock/blockshapes/lilypad.py +14 -0
- amulet/resource_pack/bedrock/blockshapes/partial_block.py +57 -0
- amulet/resource_pack/bedrock/blockshapes/piston.py +44 -0
- amulet/resource_pack/bedrock/blockshapes/piston_arm.py +72 -0
- amulet/resource_pack/bedrock/blockshapes/portal_frame.py +22 -0
- amulet/resource_pack/bedrock/blockshapes/pressure_plate.py +29 -0
- amulet/resource_pack/bedrock/blockshapes/pumpkin.py +36 -0
- amulet/resource_pack/bedrock/blockshapes/pumpkin_carved.py +14 -0
- amulet/resource_pack/bedrock/blockshapes/pumpkin_lit.py +14 -0
- amulet/resource_pack/bedrock/blockshapes/red_dust.py +14 -0
- amulet/resource_pack/bedrock/blockshapes/repeater.py +53 -0
- amulet/resource_pack/bedrock/blockshapes/slab.py +33 -0
- amulet/resource_pack/bedrock/blockshapes/slab_double.py +15 -0
- amulet/resource_pack/bedrock/blockshapes/tree.py +41 -0
- amulet/resource_pack/bedrock/blockshapes/turtle_egg.py +15 -0
- amulet/resource_pack/bedrock/blockshapes/vine.py +52 -0
- amulet/resource_pack/bedrock/blockshapes/wall.py +22 -0
- amulet/resource_pack/bedrock/blockshapes/water.py +38 -0
- amulet/resource_pack/bedrock/download_resources.py +147 -0
- amulet/resource_pack/bedrock/resource_pack.py +40 -0
- amulet/resource_pack/bedrock/resource_pack_manager.py +361 -0
- amulet/resource_pack/bedrock/sort_blockshapes.py +15 -0
- amulet/resource_pack/java/__init__.py +2 -0
- amulet/resource_pack/java/download_resources.py +212 -0
- 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 +44 -0
- amulet/resource_pack/java/resource_pack_manager.py +551 -0
- amulet/resource_pack/unknown_resource_pack.py +10 -0
- amulet/utils/__init__.pyi +0 -5
- amulet/utils/call_spec/_call_spec.py +2 -7
- amulet/utils/comment_json.py +188 -0
- amulet/utils/matrix.py +3 -3
- amulet/utils/numpy_helpers.py +2 -2
- amulet/utils/world_utils.py +2 -2
- amulet/version.pyi +0 -8
- {amulet_core-2.0a6.dist-info → amulet_core-2.0a7.dist-info}/METADATA +2 -2
- amulet_core-2.0a7.dist-info/RECORD +295 -0
- amulet/chunk_/components/biome.py +0 -155
- amulet/chunk_/components/block_entity.py +0 -117
- amulet/chunk_/components/entity.py +0 -64
- amulet/chunk_/components/height_2d.py +0 -16
- amulet/level/bedrock/__init__.py +0 -2
- amulet/level/bedrock/_chunk_handle.py +0 -19
- amulet/level/bedrock/_dimension.py +0 -22
- amulet/level/bedrock/_level.py +0 -187
- amulet/level/bedrock/_raw/__init__.py +0 -5
- amulet/level/bedrock/_raw/_actor_counter.py +0 -53
- amulet/level/bedrock/_raw/_chunk.py +0 -54
- amulet/level/bedrock/_raw/_chunk_decode.py +0 -668
- amulet/level/bedrock/_raw/_chunk_encode.py +0 -602
- amulet/level/bedrock/_raw/_constant.py +0 -9
- amulet/level/bedrock/_raw/_dimension.py +0 -343
- amulet/level/bedrock/_raw/_level.py +0 -463
- amulet/level/bedrock/_raw/_level_dat.py +0 -90
- amulet/level/bedrock/_raw/_typing.py +0 -6
- amulet/level/bedrock/_raw/leveldb_chunk_versions.py +0 -83
- amulet/level/bedrock/chunk/__init__.py +0 -1
- amulet/level/bedrock/chunk/_chunk.py +0 -126
- amulet/level/bedrock/chunk/components/chunk_version.py +0 -12
- amulet/level/bedrock/chunk/components/finalised_state.py +0 -13
- amulet/level/bedrock/chunk/components/raw_chunk.py +0 -15
- amulet/level/construction/__init__.py +0 -0
- amulet/level/java/_chunk_handle.pyi +0 -15
- amulet/level/java/_dimension.pyi +0 -13
- amulet/level/java/_level.pyi +0 -120
- amulet/level/java/_raw/_chunk_decode.py +0 -561
- amulet/level/java/_raw/_chunk_encode.py +0 -463
- amulet/level/java/_raw/_constant.pyi +0 -20
- amulet/level/java/_raw/_data_pack/__init__.pyi +0 -8
- amulet/level/java/_raw/_data_pack/data_pack.pyi +0 -197
- amulet/level/java/_raw/_data_pack/data_pack_manager.pyi +0 -75
- amulet/level/java/_raw/_dimension.pyi +0 -72
- amulet/level/java/_raw/_level.pyi +0 -238
- amulet/level/java/_raw/_typing.pyi +0 -5
- amulet/level/java/anvil/__init__.pyi +0 -11
- amulet/level/java/anvil/_dimension.pyi +0 -109
- amulet/level/java/anvil/_region.pyi +0 -197
- amulet/level/java/anvil/_sector_manager.pyi +0 -142
- amulet/level/java_forge/__init__.py +0 -0
- amulet/level/mcstructure/__init__.py +0 -0
- amulet/level/nbt/__init__.py +0 -0
- amulet/level/schematic/__init__.py +0 -0
- amulet/level/sponge_schematic/__init__.py +0 -0
- amulet/pybind11/python.hpp +0 -14
- amulet/utils/call_spec/__init__.pyi +0 -53
- amulet/utils/call_spec/_call_spec.pyi +0 -272
- amulet/utils/matrix.pyi +0 -177
- amulet/utils/shareable_lock.pyi +0 -190
- amulet/utils/signal/__init__.pyi +0 -25
- amulet/utils/signal/_signal.pyi +0 -84
- amulet/utils/task_manager.pyi +0 -168
- amulet/utils/typing.py +0 -4
- amulet/utils/typing.pyi +0 -6
- amulet/utils/weakref.pyi +0 -50
- amulet/utils/world_utils.pyi +0 -109
- amulet_core-2.0a6.dist-info/RECORD +0 -253
- /amulet/img/{missing_world_icon.png → missing_world.png} +0 -0
- /amulet/{level/bedrock/chunk/components → mesh}/__init__.py +0 -0
- {amulet_core-2.0a6.dist-info → amulet_core-2.0a7.dist-info}/WHEEL +0 -0
- {amulet_core-2.0a6.dist-info → amulet_core-2.0a7.dist-info}/entry_points.txt +0 -0
- {amulet_core-2.0a6.dist-info → amulet_core-2.0a7.dist-info}/top_level.txt +0 -0
amulet/utils/shareable_lock.pyi
DELETED
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
import logging as logging
|
|
4
|
-
import time as time
|
|
5
|
-
from _thread import allocate_lock as Lock
|
|
6
|
-
from _thread import get_ident
|
|
7
|
-
from contextlib import contextmanager
|
|
8
|
-
from threading import Condition
|
|
9
|
-
|
|
10
|
-
import amulet.utils.task_manager
|
|
11
|
-
from amulet.utils.task_manager import (
|
|
12
|
-
AbstractCancelManager,
|
|
13
|
-
TaskCancelled,
|
|
14
|
-
VoidCancelManager,
|
|
15
|
-
)
|
|
16
|
-
|
|
17
|
-
__all__ = [
|
|
18
|
-
"AbstractCancelManager",
|
|
19
|
-
"Condition",
|
|
20
|
-
"Lock",
|
|
21
|
-
"LockNotAcquired",
|
|
22
|
-
"ShareableRLock",
|
|
23
|
-
"TaskCancelled",
|
|
24
|
-
"VoidCancelManager",
|
|
25
|
-
"contextmanager",
|
|
26
|
-
"get_ident",
|
|
27
|
-
"log",
|
|
28
|
-
"logging",
|
|
29
|
-
"time",
|
|
30
|
-
]
|
|
31
|
-
|
|
32
|
-
class LockNotAcquired(amulet.utils.task_manager.TaskCancelled):
|
|
33
|
-
"""
|
|
34
|
-
An exception raised if the lock was not acquired.
|
|
35
|
-
"""
|
|
36
|
-
|
|
37
|
-
class ShareableRLock:
|
|
38
|
-
"""
|
|
39
|
-
|
|
40
|
-
This is a custom lock implementation that can be acquired in
|
|
41
|
-
1) unique mode.
|
|
42
|
-
- This is the normal mode where only this thread can use the resource.
|
|
43
|
-
- All other acquires block until this releases it.
|
|
44
|
-
2) shared mode.
|
|
45
|
-
- This allows multiple threads to acquire the resource at the same time.
|
|
46
|
-
- This is useful if multiple threads want to read a resource but not write to it.
|
|
47
|
-
- If the resource is locked in unique mode this will block
|
|
48
|
-
- Once locked in shared mode it
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
"""
|
|
52
|
-
|
|
53
|
-
@staticmethod
|
|
54
|
-
def shared(*args, **kwds) -> typing.Iterator[NoneType]:
|
|
55
|
-
"""
|
|
56
|
-
|
|
57
|
-
Acquire the lock in shared mode.
|
|
58
|
-
This is used as follows
|
|
59
|
-
|
|
60
|
-
>>> lock: ShareableRLock
|
|
61
|
-
>>> with lock.shared():
|
|
62
|
-
>>> # code with lock acquired
|
|
63
|
-
>>> # the lock will automatically be released here
|
|
64
|
-
|
|
65
|
-
If the lock is acquired by a different thread in unique mode then this will block until it is finished.
|
|
66
|
-
If the lock is acquired in unique mode by this thread or by otherthreads in shared mode then this will acquire
|
|
67
|
-
the lock.
|
|
68
|
-
|
|
69
|
-
If another thread wants to acquire the lock in unique mode it will block until all threads have finished in
|
|
70
|
-
shared mode.
|
|
71
|
-
|
|
72
|
-
:param blocking: Should this block until the lock can be acquired. Default is True.
|
|
73
|
-
If false and the lock cannot be acquired on the first try, this returns False.
|
|
74
|
-
:param timeout: Maximum amount of time to block for. Has no effect is blocking is False. Default is forever.
|
|
75
|
-
:param task_manager: A custom object through which acquiring can be cancelled.
|
|
76
|
-
This effectively manually triggers timeout.
|
|
77
|
-
This is useful for GUIs so that the user can cancel an operation that may otherwise block for a while.
|
|
78
|
-
:return: None
|
|
79
|
-
:raises: LockNotAcquired if the lock could not be acquired.
|
|
80
|
-
|
|
81
|
-
"""
|
|
82
|
-
|
|
83
|
-
@staticmethod
|
|
84
|
-
def unique(*args, **kwds) -> typing.Iterator[NoneType]:
|
|
85
|
-
"""
|
|
86
|
-
|
|
87
|
-
Acquire the lock in unique mode.
|
|
88
|
-
This is used as follows
|
|
89
|
-
|
|
90
|
-
>>> lock: ShareableRLock
|
|
91
|
-
>>> with lock.unique():
|
|
92
|
-
>>> # code with lock acquired
|
|
93
|
-
>>> # the lock will automatically be released here
|
|
94
|
-
|
|
95
|
-
This will block while all other threads using the resource finish
|
|
96
|
-
and once acquired block all other threads until the lock is released.
|
|
97
|
-
|
|
98
|
-
:param blocking: Should this block until the lock can be acquired. Default is True.
|
|
99
|
-
If false and the lock cannot be acquired on the first try, this returns False.
|
|
100
|
-
:param timeout: Maximum amount of time to block for. Has no effect is blocking is False. Default is forever.
|
|
101
|
-
:param task_manager: A custom object through which acquiring can be cancelled.
|
|
102
|
-
This effectively manually triggers timeout.
|
|
103
|
-
This is useful for GUIs so that the user can cancel an operation that may otherwise block for a while.
|
|
104
|
-
:return: None
|
|
105
|
-
:raises: LockNotAcquired if the lock could not be acquired.
|
|
106
|
-
|
|
107
|
-
"""
|
|
108
|
-
|
|
109
|
-
def __init__(self) -> None: ...
|
|
110
|
-
def _wait(
|
|
111
|
-
self,
|
|
112
|
-
exit_condition: typing.Callable[[], bool],
|
|
113
|
-
blocking: bool = True,
|
|
114
|
-
timeout: float = -1,
|
|
115
|
-
task_manager: amulet.utils.task_manager.AbstractCancelManager = ...,
|
|
116
|
-
) -> bool:
|
|
117
|
-
"""
|
|
118
|
-
Wait until a condition is False.
|
|
119
|
-
|
|
120
|
-
:param exit_condition: The condition to check.
|
|
121
|
-
:param blocking: Should this block until the lock can be acquired. Default is True.
|
|
122
|
-
If false and the lock cannot be acquired on the first try, this returns False.
|
|
123
|
-
:param timeout: Maximum amount of time to block for. Has no effect is blocking is False. Default is forever.
|
|
124
|
-
:param task_manager: A custom object through which acquiring can be cancelled.
|
|
125
|
-
This effectively manually triggers timeout.
|
|
126
|
-
This is useful for GUIs so that the user can cancel an operation that may otherwise block for a while.
|
|
127
|
-
:return: True if the lock was acquired, otherwise False.
|
|
128
|
-
|
|
129
|
-
"""
|
|
130
|
-
|
|
131
|
-
def acquire_shared(
|
|
132
|
-
self,
|
|
133
|
-
blocking: bool = True,
|
|
134
|
-
timeout: float = -1,
|
|
135
|
-
task_manager: amulet.utils.task_manager.AbstractCancelManager = ...,
|
|
136
|
-
) -> bool:
|
|
137
|
-
"""
|
|
138
|
-
|
|
139
|
-
Only use this if you know what you are doing. Consider using :meth:`shared` instead
|
|
140
|
-
Acquire the lock in shared mode.
|
|
141
|
-
:param blocking: Should this block until the lock can be acquired. Default is True.
|
|
142
|
-
If false and the lock cannot be acquired on the first try, this returns False.
|
|
143
|
-
:param timeout: Maximum amount of time to block for. Has no effect is blocking is False. Default is forever.
|
|
144
|
-
:param task_manager: A custom object through which acquiring can be cancelled.
|
|
145
|
-
This effectively manually triggers timeout.
|
|
146
|
-
This is useful for GUIs so that the user can cancel an operation that may otherwise block for a while.
|
|
147
|
-
:return: True if the lock was acquired otherwise False.
|
|
148
|
-
|
|
149
|
-
"""
|
|
150
|
-
|
|
151
|
-
def acquire_unique(
|
|
152
|
-
self,
|
|
153
|
-
blocking: bool = True,
|
|
154
|
-
timeout: float = -1,
|
|
155
|
-
task_manager: amulet.utils.task_manager.AbstractCancelManager = ...,
|
|
156
|
-
) -> bool:
|
|
157
|
-
"""
|
|
158
|
-
|
|
159
|
-
Only use this if you know what you are doing. Consider using :meth:`unique` instead
|
|
160
|
-
Acquire the lock in unique mode. This is equivalent to threading.RLock.acquire
|
|
161
|
-
With improper use this can lead to a deadlock.
|
|
162
|
-
:param blocking: Should this block until the lock can be acquired. Default is True.
|
|
163
|
-
If false and the lock cannot be acquired on the first try, this returns False.
|
|
164
|
-
:param timeout: Maximum amount of time to block for. Has no effect is blocking is False. Default is forever.
|
|
165
|
-
:param task_manager: A custom object through which acquiring can be cancelled.
|
|
166
|
-
This effectively manually triggers timeout.
|
|
167
|
-
This is useful for GUIs so that the user can cancel an operation that may otherwise block for a while.
|
|
168
|
-
:return: True if the lock was acquired otherwise False.
|
|
169
|
-
|
|
170
|
-
"""
|
|
171
|
-
|
|
172
|
-
def release_shared(self) -> None:
|
|
173
|
-
"""
|
|
174
|
-
|
|
175
|
-
Only use this if you know what you are doing. Consider using :meth:`shared` instead
|
|
176
|
-
Release the shared hold on the lock. This must be called by the same thread that acquired it.
|
|
177
|
-
This must be called exactly the same number of times as :meth:`acquire_shared` was called.
|
|
178
|
-
|
|
179
|
-
"""
|
|
180
|
-
|
|
181
|
-
def release_unique(self) -> None:
|
|
182
|
-
"""
|
|
183
|
-
|
|
184
|
-
Only use this if you know what you are doing. Consider using :meth:`unique` instead
|
|
185
|
-
Release the unique hold on the lock. This must be called by the same thread that acquired it.
|
|
186
|
-
This must be called exactly the same number of times as :meth:`acquire_unique` was called.
|
|
187
|
-
|
|
188
|
-
"""
|
|
189
|
-
|
|
190
|
-
log: logging.Logger # value = <Logger amulet.utils.shareable_lock (INFO)>
|
amulet/utils/signal/__init__.pyi
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from amulet.utils.signal._signal import (
|
|
4
|
-
Signal,
|
|
5
|
-
SignalInstance,
|
|
6
|
-
SignalInstanceConstructor,
|
|
7
|
-
create_signal_instance,
|
|
8
|
-
get_fallback_signal_instance_constructor,
|
|
9
|
-
get_pyside6_signal_instance_constructor,
|
|
10
|
-
set_signal_instance_constructor,
|
|
11
|
-
)
|
|
12
|
-
|
|
13
|
-
from . import _signal
|
|
14
|
-
|
|
15
|
-
__all__ = [
|
|
16
|
-
"Signal",
|
|
17
|
-
"SignalInstance",
|
|
18
|
-
"SignalInstanceCacheName",
|
|
19
|
-
"SignalInstanceConstructor",
|
|
20
|
-
"create_signal_instance",
|
|
21
|
-
"get_fallback_signal_instance_constructor",
|
|
22
|
-
"get_pyside6_signal_instance_constructor",
|
|
23
|
-
"set_signal_instance_constructor",
|
|
24
|
-
]
|
|
25
|
-
SignalInstanceCacheName: str
|
amulet/utils/signal/_signal.pyi
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
import logging as logging
|
|
4
|
-
import typing
|
|
5
|
-
from collections.abc import Sequence
|
|
6
|
-
from inspect import ismethod
|
|
7
|
-
from typing import Any, Generic, Protocol, TypeVarTuple, overload
|
|
8
|
-
from weakref import WeakMethod
|
|
9
|
-
|
|
10
|
-
__all__ = [
|
|
11
|
-
"Any",
|
|
12
|
-
"CallArgs",
|
|
13
|
-
"Generic",
|
|
14
|
-
"Protocol",
|
|
15
|
-
"Sequence",
|
|
16
|
-
"Signal",
|
|
17
|
-
"SignalInstance",
|
|
18
|
-
"SignalInstanceCacheName",
|
|
19
|
-
"SignalInstanceConstructor",
|
|
20
|
-
"TypeVarTuple",
|
|
21
|
-
"WeakMethod",
|
|
22
|
-
"create_signal_instance",
|
|
23
|
-
"get_fallback_signal_instance_constructor",
|
|
24
|
-
"get_pyside6_signal_instance_constructor",
|
|
25
|
-
"ismethod",
|
|
26
|
-
"logging",
|
|
27
|
-
"overload",
|
|
28
|
-
"set_signal_instance_constructor",
|
|
29
|
-
]
|
|
30
|
-
|
|
31
|
-
class Signal(typing.Generic):
|
|
32
|
-
def __get__(self, instance: typing.Any, owner: typing.Any) -> typing.Any: ...
|
|
33
|
-
def __init__(
|
|
34
|
-
self, *types: type, name: str, arguments: typing.Sequence[str] = tuple()
|
|
35
|
-
): ...
|
|
36
|
-
|
|
37
|
-
class SignalInstance(typing.Protocol):
|
|
38
|
-
@classmethod
|
|
39
|
-
def __subclasshook__(cls, other): ...
|
|
40
|
-
def __init__(self, *args, **kwargs): ...
|
|
41
|
-
def connect(
|
|
42
|
-
self,
|
|
43
|
-
slot: typing.Callable[[*CallArgs], None] | SignalInstance[*CallArgs,] | None,
|
|
44
|
-
type: PySide6.QtCore.Qt.ConnectionType | None = ...,
|
|
45
|
-
) -> None: ...
|
|
46
|
-
def disconnect(
|
|
47
|
-
self,
|
|
48
|
-
slot: (
|
|
49
|
-
typing.Callable[[*CallArgs], None] | SignalInstance[*CallArgs,] | None
|
|
50
|
-
) = None,
|
|
51
|
-
) -> None: ...
|
|
52
|
-
def emit(self, *args: *CallArgs) -> None: ...
|
|
53
|
-
|
|
54
|
-
class SignalInstanceConstructor(typing.Protocol):
|
|
55
|
-
@classmethod
|
|
56
|
-
def __subclasshook__(cls, other): ...
|
|
57
|
-
def __call__(
|
|
58
|
-
self,
|
|
59
|
-
*,
|
|
60
|
-
types: tuple[type, ...],
|
|
61
|
-
name: str,
|
|
62
|
-
arguments: typing.Sequence[str],
|
|
63
|
-
instance: typing.Any,
|
|
64
|
-
) -> SignalInstance[*CallArgs,]: ...
|
|
65
|
-
def __init__(self, *args, **kwargs): ...
|
|
66
|
-
|
|
67
|
-
def _get_signal_instances(instance: typing.Any) -> dict[Signal, SignalInstance]: ...
|
|
68
|
-
def create_signal_instance(
|
|
69
|
-
*types: type,
|
|
70
|
-
instance: typing.Any,
|
|
71
|
-
name: str,
|
|
72
|
-
arguments: typing.Sequence[str] = tuple(),
|
|
73
|
-
) -> SignalInstance[*CallArgs,]:
|
|
74
|
-
"""
|
|
75
|
-
Create a new signal instance
|
|
76
|
-
"""
|
|
77
|
-
|
|
78
|
-
def get_fallback_signal_instance_constructor() -> SignalInstanceConstructor: ...
|
|
79
|
-
def get_pyside6_signal_instance_constructor() -> SignalInstanceConstructor: ...
|
|
80
|
-
def set_signal_instance_constructor(constructor: SignalInstanceConstructor) -> None: ...
|
|
81
|
-
|
|
82
|
-
CallArgs: typing.TypeVarTuple # value = CallArgs
|
|
83
|
-
SignalInstanceCacheName: str
|
|
84
|
-
_signal_instance_constructor = None
|
amulet/utils/task_manager.pyi
DELETED
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
import abc
|
|
4
|
-
import typing
|
|
5
|
-
from abc import ABC, abstractmethod
|
|
6
|
-
from typing import Generic, TypeVar
|
|
7
|
-
|
|
8
|
-
from amulet.utils.signal._signal import Signal, SignalInstance
|
|
9
|
-
|
|
10
|
-
__all__ = [
|
|
11
|
-
"ABC",
|
|
12
|
-
"AbstractCancelManager",
|
|
13
|
-
"AbstractProgressManager",
|
|
14
|
-
"AbstractTaskManager",
|
|
15
|
-
"CancelManager",
|
|
16
|
-
"Generic",
|
|
17
|
-
"Pointer",
|
|
18
|
-
"ProgressManager",
|
|
19
|
-
"Signal",
|
|
20
|
-
"SignalInstance",
|
|
21
|
-
"T",
|
|
22
|
-
"TaskCancelled",
|
|
23
|
-
"TaskManager",
|
|
24
|
-
"TypeVar",
|
|
25
|
-
"VoidCancelManager",
|
|
26
|
-
"VoidProgressManager",
|
|
27
|
-
"VoidTaskManager",
|
|
28
|
-
"abstractmethod",
|
|
29
|
-
]
|
|
30
|
-
|
|
31
|
-
class AbstractCancelManager(abc.ABC):
|
|
32
|
-
def cancel(self) -> None:
|
|
33
|
-
"""
|
|
34
|
-
Request the operation be canceled.
|
|
35
|
-
|
|
36
|
-
It is down to the operation to implement support for this.
|
|
37
|
-
|
|
38
|
-
"""
|
|
39
|
-
|
|
40
|
-
def is_cancel_requested(self) -> bool:
|
|
41
|
-
"""
|
|
42
|
-
Has cancel been called to signal that the operation should be canceled.
|
|
43
|
-
"""
|
|
44
|
-
|
|
45
|
-
def register_on_cancel(self, callback: typing.Callable[[], None]) -> None:
|
|
46
|
-
"""
|
|
47
|
-
Register a function to get called when :meth:`cancel` is called.
|
|
48
|
-
"""
|
|
49
|
-
|
|
50
|
-
def unregister_on_cancel(self, callback: typing.Callable[[], None]) -> None:
|
|
51
|
-
"""
|
|
52
|
-
Unregister a registered function from being called when :meth:`cancel` is called.
|
|
53
|
-
"""
|
|
54
|
-
|
|
55
|
-
class AbstractProgressManager(abc.ABC):
|
|
56
|
-
def get_child(
|
|
57
|
-
self, progress_min: float, progress_max: float
|
|
58
|
-
) -> AbstractProgressManager:
|
|
59
|
-
"""
|
|
60
|
-
Get a child ExecutionContext.
|
|
61
|
-
|
|
62
|
-
If calling multiple functions, this allows segmenting the reported time.
|
|
63
|
-
|
|
64
|
-
:param progress_min: The minimum progress for the child to use 0.0-1.0
|
|
65
|
-
:param progress_max: The maximum progress for the child to use 0.0-1.0
|
|
66
|
-
:return: A new ExecutionContext
|
|
67
|
-
|
|
68
|
-
"""
|
|
69
|
-
|
|
70
|
-
def update_progress(self, progress: float) -> None:
|
|
71
|
-
"""
|
|
72
|
-
Notify the caller of the updated progress.
|
|
73
|
-
|
|
74
|
-
:param progress: The new progress to relay to the caller. 0.0-1.0
|
|
75
|
-
|
|
76
|
-
"""
|
|
77
|
-
|
|
78
|
-
def update_progress_text(self, text: str) -> None:
|
|
79
|
-
"""
|
|
80
|
-
Notify the caller of the updated progress.
|
|
81
|
-
|
|
82
|
-
:param text: The new message to relay to the caller.
|
|
83
|
-
|
|
84
|
-
"""
|
|
85
|
-
|
|
86
|
-
class AbstractTaskManager(AbstractCancelManager, AbstractProgressManager, abc.ABC):
|
|
87
|
-
pass
|
|
88
|
-
|
|
89
|
-
class CancelManager(_CancelManager):
|
|
90
|
-
@staticmethod
|
|
91
|
-
def _cancel_signal(*args, **kwargs): ...
|
|
92
|
-
def __init__(self) -> None: ...
|
|
93
|
-
|
|
94
|
-
class Pointer(typing.Generic):
|
|
95
|
-
def __init__(self, value: T) -> None: ...
|
|
96
|
-
|
|
97
|
-
class ProgressManager(_ProgressManager):
|
|
98
|
-
@staticmethod
|
|
99
|
-
def progress_change(*args, **kwargs): ...
|
|
100
|
-
@staticmethod
|
|
101
|
-
def progress_text_change(*args, **kwargs): ...
|
|
102
|
-
def __init__(self) -> None: ...
|
|
103
|
-
|
|
104
|
-
class TaskCancelled(Exception):
|
|
105
|
-
"""
|
|
106
|
-
Exception to be raised by the callee when a task is cancelled.
|
|
107
|
-
|
|
108
|
-
The callee may define a custom return instead of using this.
|
|
109
|
-
|
|
110
|
-
"""
|
|
111
|
-
|
|
112
|
-
class TaskManager(_TaskManager):
|
|
113
|
-
def __init__(self) -> None: ...
|
|
114
|
-
|
|
115
|
-
class VoidCancelManager(AbstractCancelManager):
|
|
116
|
-
def cancel(self) -> None: ...
|
|
117
|
-
def is_cancel_requested(self) -> bool: ...
|
|
118
|
-
def register_on_cancel(self, callback: typing.Callable[[], None]) -> None: ...
|
|
119
|
-
def unregister_on_cancel(self, callback: typing.Callable[[], None]) -> None: ...
|
|
120
|
-
|
|
121
|
-
class VoidProgressManager(AbstractProgressManager):
|
|
122
|
-
def get_child(
|
|
123
|
-
self, progress_min: float, progress_max: float
|
|
124
|
-
) -> VoidProgressManager: ...
|
|
125
|
-
def update_progress(self, progress: float) -> None: ...
|
|
126
|
-
def update_progress_text(self, text: str) -> None: ...
|
|
127
|
-
|
|
128
|
-
class VoidTaskManager(VoidCancelManager, VoidProgressManager, AbstractTaskManager):
|
|
129
|
-
"""
|
|
130
|
-
An empty Execution Context that ignores all calls.
|
|
131
|
-
"""
|
|
132
|
-
|
|
133
|
-
class _CancelManager(AbstractCancelManager):
|
|
134
|
-
def __init__(
|
|
135
|
-
self, cancelled: Pointer[bool], cancel_signal: SignalInstance[()]
|
|
136
|
-
) -> None: ...
|
|
137
|
-
def cancel(self) -> None: ...
|
|
138
|
-
def is_cancel_requested(self) -> bool: ...
|
|
139
|
-
def register_on_cancel(self, callback: typing.Callable[[], None]) -> None: ...
|
|
140
|
-
def unregister_on_cancel(self, callback: typing.Callable[[], None]) -> None: ...
|
|
141
|
-
|
|
142
|
-
class _ProgressManager(AbstractProgressManager):
|
|
143
|
-
def __init__(
|
|
144
|
-
self,
|
|
145
|
-
progress_change: SignalInstance[float],
|
|
146
|
-
progress_text_change: SignalInstance[str],
|
|
147
|
-
progress_min: float,
|
|
148
|
-
progress_max: float,
|
|
149
|
-
) -> None: ...
|
|
150
|
-
def get_child(
|
|
151
|
-
self, progress_min: float, progress_max: float
|
|
152
|
-
) -> _ProgressManager: ...
|
|
153
|
-
def update_progress(self, progress: float) -> None: ...
|
|
154
|
-
def update_progress_text(self, text: str) -> None: ...
|
|
155
|
-
|
|
156
|
-
class _TaskManager(CancelManager, ProgressManager, AbstractTaskManager):
|
|
157
|
-
def __init__(
|
|
158
|
-
self,
|
|
159
|
-
cancelled: Pointer[bool],
|
|
160
|
-
cancel_signal: SignalInstance[()],
|
|
161
|
-
progress_change: SignalInstance[float],
|
|
162
|
-
progress_text_change: SignalInstance[str],
|
|
163
|
-
progress_min: float,
|
|
164
|
-
progress_max: float,
|
|
165
|
-
) -> None: ...
|
|
166
|
-
def get_child(self, progress_min: float, progress_max: float) -> _TaskManager: ...
|
|
167
|
-
|
|
168
|
-
T: typing.TypeVar # value = ~T
|
amulet/utils/typing.py
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
# There are cases where it would be useful to type hint a class that must inherit from two or more ABCs.
|
|
2
|
-
# Python doesn't currently have an intersection type but all cases that need it should refer here to make renaming
|
|
3
|
-
# easier if Python implements it.
|
|
4
|
-
from typing import Union as Intersection # noqa
|
amulet/utils/typing.pyi
DELETED
amulet/utils/weakref.pyi
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Extension to the builtin weakref module.
|
|
3
|
-
"""
|
|
4
|
-
|
|
5
|
-
from __future__ import annotations
|
|
6
|
-
|
|
7
|
-
import typing
|
|
8
|
-
import weakref
|
|
9
|
-
from typing import Any, Generic, TypeVar, final
|
|
10
|
-
|
|
11
|
-
__all__ = [
|
|
12
|
-
"Any",
|
|
13
|
-
"CallableWeakMethod",
|
|
14
|
-
"DetachableWeakRef",
|
|
15
|
-
"Generic",
|
|
16
|
-
"T",
|
|
17
|
-
"TypeVar",
|
|
18
|
-
"final",
|
|
19
|
-
]
|
|
20
|
-
|
|
21
|
-
class CallableWeakMethod(weakref.WeakMethod):
|
|
22
|
-
"""
|
|
23
|
-
|
|
24
|
-
A wrapper around WeakMethod that makes the method directly callable.
|
|
25
|
-
If the method no longer exists, this does nothing.
|
|
26
|
-
|
|
27
|
-
"""
|
|
28
|
-
|
|
29
|
-
__final__: typing.ClassVar[bool] = True
|
|
30
|
-
def __call__(self, *args: typing.Any, **kwargs: typing.Any) -> typing.Any: ...
|
|
31
|
-
|
|
32
|
-
class DetachableWeakRef(typing.Generic):
|
|
33
|
-
"""
|
|
34
|
-
A weak reference that can be detached by the creator before the object is deleted.
|
|
35
|
-
"""
|
|
36
|
-
|
|
37
|
-
__final__: typing.ClassVar[bool] = True
|
|
38
|
-
@classmethod
|
|
39
|
-
def new(cls, obj: T) -> tuple[DetachableWeakRef[T], typing.Callable[[], None]]:
|
|
40
|
-
"""
|
|
41
|
-
Get a new weak reference and a callable to detach the object.
|
|
42
|
-
Once called the reference will always return None.
|
|
43
|
-
|
|
44
|
-
"""
|
|
45
|
-
|
|
46
|
-
def __call__(self) -> T | None: ...
|
|
47
|
-
def __init__(self, obj: T) -> None: ...
|
|
48
|
-
def _detach(self) -> None: ...
|
|
49
|
-
|
|
50
|
-
T: typing.TypeVar # value = ~T
|
amulet/utils/world_utils.pyi
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
import math as math
|
|
4
|
-
import types
|
|
5
|
-
|
|
6
|
-
import numpy as numpy
|
|
7
|
-
from numpy import ndarray, uint8, zeros
|
|
8
|
-
|
|
9
|
-
__all__ = [
|
|
10
|
-
"ChunkCoordinates",
|
|
11
|
-
"block_coords_to_chunk_coords",
|
|
12
|
-
"blocks_slice_to_chunk_slice",
|
|
13
|
-
"chunk_coords_to_block_coords",
|
|
14
|
-
"chunk_coords_to_region_coords",
|
|
15
|
-
"from_nibble_array",
|
|
16
|
-
"math",
|
|
17
|
-
"ndarray",
|
|
18
|
-
"numpy",
|
|
19
|
-
"region_coords_to_chunk_coords",
|
|
20
|
-
"to_nibble_array",
|
|
21
|
-
"uint8",
|
|
22
|
-
"zeros",
|
|
23
|
-
]
|
|
24
|
-
|
|
25
|
-
def block_coords_to_chunk_coords(
|
|
26
|
-
*args: int, sub_chunk_size: int = 16
|
|
27
|
-
) -> tuple[int, ...]:
|
|
28
|
-
"""
|
|
29
|
-
|
|
30
|
-
Converts the supplied block coordinates into chunk coordinates
|
|
31
|
-
|
|
32
|
-
:param args: The coordinate of the block(s)
|
|
33
|
-
:param sub_chunk_size: The dimension of the chunk (Optional. Default 16)
|
|
34
|
-
:return: The resulting chunk coordinates in (x, z) order
|
|
35
|
-
|
|
36
|
-
"""
|
|
37
|
-
|
|
38
|
-
def blocks_slice_to_chunk_slice(
|
|
39
|
-
blocks_slice: slice, chunk_shape: int, chunk_coord: int
|
|
40
|
-
) -> slice:
|
|
41
|
-
"""
|
|
42
|
-
|
|
43
|
-
Converts the supplied blocks slice into chunk slice
|
|
44
|
-
|
|
45
|
-
:param blocks_slice: The slice of the blocks
|
|
46
|
-
:param chunk_shape: The shape of the chunk in this direction
|
|
47
|
-
:param chunk_coord: The coordinate of the chunk in this direction
|
|
48
|
-
:return: The resulting chunk slice
|
|
49
|
-
|
|
50
|
-
"""
|
|
51
|
-
|
|
52
|
-
def chunk_coords_to_block_coords(
|
|
53
|
-
x: int, z: int, chunk_x_size: int = 16, chunk_z_size: int = 16
|
|
54
|
-
) -> ChunkCoordinates:
|
|
55
|
-
"""
|
|
56
|
-
|
|
57
|
-
Converts the supplied chunk coordinates into block coordinates
|
|
58
|
-
|
|
59
|
-
:param x: The x coordinate of the chunk
|
|
60
|
-
:param z: The z coordinate of the chunk
|
|
61
|
-
:param chunk_x_size: The dimension of the chunk in the x direction (Optional. Default 16)
|
|
62
|
-
:param chunk_z_size: The dimension of the chunk in the z direction (Optional. Default 16)
|
|
63
|
-
:return: The resulting block coordinates in (x, z) order
|
|
64
|
-
|
|
65
|
-
"""
|
|
66
|
-
|
|
67
|
-
def chunk_coords_to_region_coords(cx: int, cz: int) -> ChunkCoordinates:
|
|
68
|
-
"""
|
|
69
|
-
|
|
70
|
-
Converts the supplied chunk coordinates into region coordinates
|
|
71
|
-
|
|
72
|
-
:param cx: The x coordinate of the chunk
|
|
73
|
-
:param cz: The z coordinate of the chunk
|
|
74
|
-
:return: The resulting region coordinates in (x, z) order
|
|
75
|
-
|
|
76
|
-
"""
|
|
77
|
-
|
|
78
|
-
def from_nibble_array(arr: ndarray) -> ndarray:
|
|
79
|
-
"""
|
|
80
|
-
|
|
81
|
-
Unpacks a flat nibble array into a full size numpy array
|
|
82
|
-
|
|
83
|
-
:param arr: The nibble array
|
|
84
|
-
:return: The resulting array
|
|
85
|
-
|
|
86
|
-
"""
|
|
87
|
-
|
|
88
|
-
def region_coords_to_chunk_coords(rx: int, rz: int) -> ChunkCoordinates:
|
|
89
|
-
"""
|
|
90
|
-
|
|
91
|
-
Converts the supplied region coordinates into the minimum chunk coordinates of that region
|
|
92
|
-
|
|
93
|
-
:param rx: The x coordinate of the region
|
|
94
|
-
:param rz: The y coordinate of the region
|
|
95
|
-
:return: The resulting minimum chunk coordinates of that region in (x, z) order
|
|
96
|
-
|
|
97
|
-
"""
|
|
98
|
-
|
|
99
|
-
def to_nibble_array(arr: ndarray) -> ndarray:
|
|
100
|
-
"""
|
|
101
|
-
|
|
102
|
-
packs a full size numpy array into a nibble array.
|
|
103
|
-
|
|
104
|
-
:param arr: Full numpy array
|
|
105
|
-
:return: The nibble array
|
|
106
|
-
|
|
107
|
-
"""
|
|
108
|
-
|
|
109
|
-
ChunkCoordinates: types.GenericAlias # value = tuple[int, int]
|