obstruct 0.4.0__tar.gz → 0.5.0__tar.gz
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.
- {obstruct-0.4.0 → obstruct-0.5.0}/.idea/workspace.xml +21 -9
- {obstruct-0.4.0 → obstruct-0.5.0}/PKG-INFO +3 -1
- {obstruct-0.4.0 → obstruct-0.5.0}/README.md +2 -0
- obstruct-0.5.0/src/obstruct/__version__.py +1 -0
- {obstruct-0.4.0 → obstruct-0.5.0}/src/obstruct/struct_type.py +3 -23
- {obstruct-0.4.0 → obstruct-0.5.0}/test/test_speed.py +2 -2
- obstruct-0.4.0/src/obstruct/__version__.py +0 -1
- {obstruct-0.4.0 → obstruct-0.5.0}/.idea/.gitignore +0 -0
- {obstruct-0.4.0 → obstruct-0.5.0}/.idea/inspectionProfiles/Project_Default.xml +0 -0
- {obstruct-0.4.0 → obstruct-0.5.0}/.idea/inspectionProfiles/profiles_settings.xml +0 -0
- {obstruct-0.4.0 → obstruct-0.5.0}/.idea/misc.xml +0 -0
- {obstruct-0.4.0 → obstruct-0.5.0}/.idea/modules.xml +0 -0
- {obstruct-0.4.0 → obstruct-0.5.0}/.idea/obstruct.iml +0 -0
- {obstruct-0.4.0 → obstruct-0.5.0}/.idea/vcs.xml +0 -0
- {obstruct-0.4.0 → obstruct-0.5.0}/BENCHMARK_TEST.md +0 -0
- {obstruct-0.4.0 → obstruct-0.5.0}/pyproject.toml +0 -0
- {obstruct-0.4.0 → obstruct-0.5.0}/src/obstruct/__init__.py +0 -0
- {obstruct-0.4.0 → obstruct-0.5.0}/src/obstruct/aot/__init__.py +0 -0
- {obstruct-0.4.0 → obstruct-0.5.0}/src/obstruct/aot/aot.py +0 -0
- {obstruct-0.4.0 → obstruct-0.5.0}/src/obstruct/aot/base.py +0 -0
- {obstruct-0.4.0 → obstruct-0.5.0}/src/obstruct/aot/pack.py +0 -0
- {obstruct-0.4.0 → obstruct-0.5.0}/src/obstruct/aot/unpack.py +0 -0
- {obstruct-0.4.0 → obstruct-0.5.0}/src/obstruct/metadata_marks.py +0 -0
- {obstruct-0.4.0 → obstruct-0.5.0}/src/obstruct/methods.py +0 -0
- {obstruct-0.4.0 → obstruct-0.5.0}/src/obstruct/types/__init__.py +0 -0
- {obstruct-0.4.0 → obstruct-0.5.0}/src/obstruct/types/base.py +0 -0
- {obstruct-0.4.0 → obstruct-0.5.0}/src/obstruct/types/types.py +0 -0
- {obstruct-0.4.0 → obstruct-0.5.0}/src/obstruct/types/types.pyi +0 -0
- {obstruct-0.4.0 → obstruct-0.5.0}/test/test.py +0 -0
- {obstruct-0.4.0 → obstruct-0.5.0}/uv.lock +0 -0
|
@@ -4,13 +4,7 @@
|
|
|
4
4
|
<option name="autoReloadType" value="SELECTIVE" />
|
|
5
5
|
</component>
|
|
6
6
|
<component name="ChangeListManager">
|
|
7
|
-
<list default="true" id="b482b6b4-48ce-4be1-bf3c-a72ec254fa35" name="更改" comment="
|
|
8
|
-
<change afterPath="$PROJECT_DIR$/BENCHMARK_TEST.md" afterDir="false" />
|
|
9
|
-
<change beforePath="$PROJECT_DIR$/src/obstruct/__version__.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/obstruct/__version__.py" afterDir="false" />
|
|
10
|
-
<change beforePath="$PROJECT_DIR$/src/obstruct/aot/base.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/obstruct/aot/base.py" afterDir="false" />
|
|
11
|
-
<change beforePath="$PROJECT_DIR$/src/obstruct/aot/unpack.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/obstruct/aot/unpack.py" afterDir="false" />
|
|
12
|
-
<change beforePath="$PROJECT_DIR$/test/test_speed.py" beforeDir="false" afterPath="$PROJECT_DIR$/test/test_speed.py" afterDir="false" />
|
|
13
|
-
</list>
|
|
7
|
+
<list default="true" id="b482b6b4-48ce-4be1-bf3c-a72ec254fa35" name="更改" comment="chore: 更新测速脚本,添加新增的测试结果" />
|
|
14
8
|
<option name="SHOW_DIALOG" value="false" />
|
|
15
9
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
16
10
|
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
|
@@ -290,7 +284,23 @@
|
|
|
290
284
|
<option name="project" value="LOCAL" />
|
|
291
285
|
<updated>1786971691114</updated>
|
|
292
286
|
</task>
|
|
293
|
-
<
|
|
287
|
+
<task id="LOCAL-00020" summary="feat: 添加可选的 post_unpack 钩子 (注意:此功能会导致解包相关功能速度降低,请按需使用) + 更新版本号至 0.4.0">
|
|
288
|
+
<option name="closed" value="true" />
|
|
289
|
+
<created>1787038015671</created>
|
|
290
|
+
<option name="number" value="00020" />
|
|
291
|
+
<option name="presentableId" value="LOCAL-00020" />
|
|
292
|
+
<option name="project" value="LOCAL" />
|
|
293
|
+
<updated>1787038015671</updated>
|
|
294
|
+
</task>
|
|
295
|
+
<task id="LOCAL-00021" summary="chore: 更新测速脚本,添加新增的测试结果">
|
|
296
|
+
<option name="closed" value="true" />
|
|
297
|
+
<created>1787038095094</created>
|
|
298
|
+
<option name="number" value="00021" />
|
|
299
|
+
<option name="presentableId" value="LOCAL-00021" />
|
|
300
|
+
<option name="project" value="LOCAL" />
|
|
301
|
+
<updated>1787038095094</updated>
|
|
302
|
+
</task>
|
|
303
|
+
<option name="localTasksCounter" value="22" />
|
|
294
304
|
<servers />
|
|
295
305
|
</component>
|
|
296
306
|
<component name="TypeScriptGeneratedFilesManager">
|
|
@@ -326,6 +336,8 @@
|
|
|
326
336
|
<MESSAGE value="fix: 更新版本号至 0.2.13,修复类变量识别错误的问题" />
|
|
327
337
|
<MESSAGE value="fix: 更新版本号至 0.2.14,修复 __cendian__ 类变量识别错误的问题" />
|
|
328
338
|
<MESSAGE value="fix: 更新版本号至 0.2.15,修复延迟加载不会应用到类属性的问题" />
|
|
329
|
-
<
|
|
339
|
+
<MESSAGE value="feat: 添加可选的 post_unpack 钩子 (注意:此功能会导致解包相关功能速度降低,请按需使用) + 更新版本号至 0.4.0" />
|
|
340
|
+
<MESSAGE value="chore: 更新测速脚本,添加新增的测试结果" />
|
|
341
|
+
<option name="LAST_COMMIT_MESSAGE" value="chore: 更新测速脚本,添加新增的测试结果" />
|
|
330
342
|
</component>
|
|
331
343
|
</project>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: obstruct
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.0
|
|
4
4
|
Author-email: LittleNightSong <LittleNightSongYO@outlook.com>
|
|
5
5
|
Classifier: Development Status :: 3 - Alpha
|
|
6
6
|
Classifier: Programming Language :: Python
|
|
@@ -50,6 +50,8 @@ _一个简单、纯粹、极速的二进制解析库_
|
|
|
50
50
|
- 打包:269.639ns 一次操作
|
|
51
51
|
- 解包:582.185ns 一次操作
|
|
52
52
|
|
|
53
|
+
> 新的测试报告请参见 [BENCHMARK_TEST](BENCHMARK_TEST.md)
|
|
54
|
+
|
|
53
55
|
## 安装
|
|
54
56
|
|
|
55
57
|
```commandline
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
version = "0.5.0"
|
|
@@ -31,29 +31,6 @@ class StructMeta(type):
|
|
|
31
31
|
'__cfields__',
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
def __new__(cls, name, bases, attrs, *, endian='little'):
|
|
35
|
-
slots = set(attrs.get('__slots__', ()))
|
|
36
|
-
|
|
37
|
-
annotations = attrs.get('__annotations__')
|
|
38
|
-
|
|
39
|
-
if annotations is None:
|
|
40
|
-
import annotationlib
|
|
41
|
-
annotate = annotationlib.get_annotate_from_class_namespace(attrs)
|
|
42
|
-
assert annotate is not None
|
|
43
|
-
|
|
44
|
-
annotations = annotationlib.call_annotate_function(
|
|
45
|
-
annotate,
|
|
46
|
-
format=annotationlib.Format.STRING
|
|
47
|
-
)
|
|
48
|
-
|
|
49
|
-
slots |= {k for k in annotations.keys()}
|
|
50
|
-
slots -= cls.__struct_methods__
|
|
51
|
-
|
|
52
|
-
attrs['__slots__'] = slots
|
|
53
|
-
attrs['__cendian__'] = endian
|
|
54
|
-
|
|
55
|
-
return super().__new__(cls, name, bases, attrs)
|
|
56
|
-
|
|
57
34
|
def __compile_struct__(cls):
|
|
58
35
|
from obstruct.methods import to_format_string
|
|
59
36
|
fields = [
|
|
@@ -108,6 +85,9 @@ class Struct(metaclass=StructMeta):
|
|
|
108
85
|
__cstruct__: ClassVar[struct.Struct]
|
|
109
86
|
__cendian__: ClassVar[str]
|
|
110
87
|
|
|
88
|
+
def __init_subclass__(cls, *, endian='little') -> None:
|
|
89
|
+
cls.__cendian__ = endian
|
|
90
|
+
|
|
111
91
|
if typing.TYPE_CHECKING:
|
|
112
92
|
def pack(self) -> bytes:
|
|
113
93
|
...
|
|
@@ -10,7 +10,7 @@ def run_iterator(iterator):
|
|
|
10
10
|
[i for i in iterator]
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
@dataclasses.dataclass()
|
|
13
|
+
@dataclasses.dataclass(slots=True)
|
|
14
14
|
class MyStruct(obs.Struct):
|
|
15
15
|
a: int
|
|
16
16
|
b: int
|
|
@@ -30,7 +30,7 @@ class MyStruct(obs.Struct):
|
|
|
30
30
|
is_post_unpack_called = True
|
|
31
31
|
|
|
32
32
|
|
|
33
|
-
@dataclasses.dataclass()
|
|
33
|
+
@dataclasses.dataclass(slots=True)
|
|
34
34
|
class AnotherStruct(obs.Struct):
|
|
35
35
|
x: MyStruct
|
|
36
36
|
y: Annotated[array[int], 100]
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
version = "0.4.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|