obstruct 0.2.8__tar.gz → 0.2.10__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.
Files changed (29) hide show
  1. {obstruct-0.2.8 → obstruct-0.2.10}/.idea/workspace.xml +77 -22
  2. {obstruct-0.2.8 → obstruct-0.2.10}/PKG-INFO +1 -1
  3. obstruct-0.2.10/src/obstruct/__version__.py +1 -0
  4. obstruct-0.2.10/src/obstruct/metadata_marks.py +5 -0
  5. {obstruct-0.2.8 → obstruct-0.2.10}/src/obstruct/struct_type.py +10 -2
  6. {obstruct-0.2.8 → obstruct-0.2.10}/test/test_speed.py +0 -2
  7. obstruct-0.2.8/src/obstruct/__version__.py +0 -1
  8. {obstruct-0.2.8 → obstruct-0.2.10}/.idea/.gitignore +0 -0
  9. {obstruct-0.2.8 → obstruct-0.2.10}/.idea/inspectionProfiles/Project_Default.xml +0 -0
  10. {obstruct-0.2.8 → obstruct-0.2.10}/.idea/inspectionProfiles/profiles_settings.xml +0 -0
  11. {obstruct-0.2.8 → obstruct-0.2.10}/.idea/misc.xml +0 -0
  12. {obstruct-0.2.8 → obstruct-0.2.10}/.idea/modules.xml +0 -0
  13. {obstruct-0.2.8 → obstruct-0.2.10}/.idea/obstruct.iml +0 -0
  14. {obstruct-0.2.8 → obstruct-0.2.10}/.idea/vcs.xml +0 -0
  15. {obstruct-0.2.8 → obstruct-0.2.10}/README.md +0 -0
  16. {obstruct-0.2.8 → obstruct-0.2.10}/pyproject.toml +0 -0
  17. {obstruct-0.2.8 → obstruct-0.2.10}/src/obstruct/__init__.py +0 -0
  18. {obstruct-0.2.8 → obstruct-0.2.10}/src/obstruct/aot/__init__.py +0 -0
  19. {obstruct-0.2.8 → obstruct-0.2.10}/src/obstruct/aot/aot.py +0 -0
  20. {obstruct-0.2.8 → obstruct-0.2.10}/src/obstruct/aot/base.py +0 -0
  21. {obstruct-0.2.8 → obstruct-0.2.10}/src/obstruct/aot/pack.py +0 -0
  22. {obstruct-0.2.8 → obstruct-0.2.10}/src/obstruct/aot/unpack.py +0 -0
  23. {obstruct-0.2.8 → obstruct-0.2.10}/src/obstruct/methods.py +0 -0
  24. {obstruct-0.2.8 → obstruct-0.2.10}/src/obstruct/types/__init__.py +0 -0
  25. {obstruct-0.2.8 → obstruct-0.2.10}/src/obstruct/types/base.py +0 -0
  26. {obstruct-0.2.8 → obstruct-0.2.10}/src/obstruct/types/types.py +0 -0
  27. {obstruct-0.2.8 → obstruct-0.2.10}/src/obstruct/types/types.pyi +0 -0
  28. {obstruct-0.2.8 → obstruct-0.2.10}/test/test.py +0 -0
  29. {obstruct-0.2.8 → obstruct-0.2.10}/uv.lock +0 -0
@@ -4,7 +4,8 @@
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="增强 array 类型的支持 x2">
7
+ <list default="true" id="b482b6b4-48ce-4be1-bf3c-a72ec254fa35" name="更改" comment="fix: 修复 slots 的生成逻辑">
8
+ <change afterPath="$PROJECT_DIR$/src/obstruct/metadata_marks.py" afterDir="false" />
8
9
  <change beforePath="$PROJECT_DIR$/src/obstruct/__version__.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/obstruct/__version__.py" afterDir="false" />
9
10
  <change beforePath="$PROJECT_DIR$/src/obstruct/struct_type.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/obstruct/struct_type.py" afterDir="false" />
10
11
  </list>
@@ -44,26 +45,26 @@
44
45
  <option name="hideEmptyMiddlePackages" value="true" />
45
46
  <option name="showLibraryContents" value="true" />
46
47
  </component>
47
- <component name="PropertiesComponent"><![CDATA[{
48
- "keyToString": {
49
- "ModuleVcsDetector.initialDetectionPerformed": "true",
50
- "Python.test.executor": "Run",
51
- "Python.test_speed.executor": "Run",
52
- "RunOnceActivity.ShowReadmeOnStart": "true",
53
- "RunOnceActivity.git.unshallow": "true",
54
- "RunOnceActivity.typescript.service.memoryLimit.init": "true",
55
- "codeWithMe.voiceChat.enabledByDefault": "false",
56
- "git-widget-placeholder": "main",
57
- "last_opened_file_path": "E:/.projects/obstruct",
58
- "node.js.detected.package.eslint": "true",
59
- "node.js.detected.package.jshint": "true",
60
- "node.js.detected.package.tslint": "true",
61
- "node.js.selected.package.eslint": "(autodetect)",
62
- "node.js.selected.package.jshint": "",
63
- "node.js.selected.package.tslint": "(autodetect)",
64
- "nodejs_package_manager_path": "npm"
48
+ <component name="PropertiesComponent">{
49
+ &quot;keyToString&quot;: {
50
+ &quot;ModuleVcsDetector.initialDetectionPerformed&quot;: &quot;true&quot;,
51
+ &quot;Python.test.executor&quot;: &quot;Run&quot;,
52
+ &quot;Python.test_speed.executor&quot;: &quot;Run&quot;,
53
+ &quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
54
+ &quot;RunOnceActivity.git.unshallow&quot;: &quot;true&quot;,
55
+ &quot;RunOnceActivity.typescript.service.memoryLimit.init&quot;: &quot;true&quot;,
56
+ &quot;codeWithMe.voiceChat.enabledByDefault&quot;: &quot;false&quot;,
57
+ &quot;git-widget-placeholder&quot;: &quot;main&quot;,
58
+ &quot;last_opened_file_path&quot;: &quot;E:/.projects/obstruct&quot;,
59
+ &quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
60
+ &quot;node.js.detected.package.jshint&quot;: &quot;true&quot;,
61
+ &quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
62
+ &quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
63
+ &quot;node.js.selected.package.jshint&quot;: &quot;&quot;,
64
+ &quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
65
+ &quot;nodejs_package_manager_path&quot;: &quot;npm&quot;
65
66
  }
66
- }]]></component>
67
+ }</component>
67
68
  <component name="RunManager" selected="Python.test_speed">
68
69
  <configuration name="test" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
69
70
  <module name="obstruct" />
@@ -183,7 +184,55 @@
183
184
  <option name="project" value="LOCAL" />
184
185
  <updated>1786883898686</updated>
185
186
  </task>
186
- <option name="localTasksCounter" value="7" />
187
+ <task id="LOCAL-00007" summary="修复:不参与初始化方法的属性不应作为结构体的字段">
188
+ <option name="closed" value="true" />
189
+ <created>1786884236136</created>
190
+ <option name="number" value="00007" />
191
+ <option name="presentableId" value="LOCAL-00007" />
192
+ <option name="project" value="LOCAL" />
193
+ <updated>1786884236136</updated>
194
+ </task>
195
+ <task id="LOCAL-00008" summary="功能:添加 `compile_struct` 函数,透明编译过程">
196
+ <option name="closed" value="true" />
197
+ <created>1786884539584</created>
198
+ <option name="number" value="00008" />
199
+ <option name="presentableId" value="LOCAL-00008" />
200
+ <option name="project" value="LOCAL" />
201
+ <updated>1786884539584</updated>
202
+ </task>
203
+ <task id="LOCAL-00009" summary="修复:unpack.py 中没有移除的调试逻辑">
204
+ <option name="closed" value="true" />
205
+ <created>1786884559640</created>
206
+ <option name="number" value="00009" />
207
+ <option name="presentableId" value="LOCAL-00009" />
208
+ <option name="project" value="LOCAL" />
209
+ <updated>1786884559640</updated>
210
+ </task>
211
+ <task id="LOCAL-00010" summary="修复:unpack.py 中没有移除的调试逻辑">
212
+ <option name="closed" value="true" />
213
+ <created>1786884576538</created>
214
+ <option name="number" value="00010" />
215
+ <option name="presentableId" value="LOCAL-00010" />
216
+ <option name="project" value="LOCAL" />
217
+ <updated>1786884576538</updated>
218
+ </task>
219
+ <task id="LOCAL-00011" summary="chore: 移除 test_speed.py 中的调试逻辑">
220
+ <option name="closed" value="true" />
221
+ <created>1786884643125</created>
222
+ <option name="number" value="00011" />
223
+ <option name="presentableId" value="LOCAL-00011" />
224
+ <option name="project" value="LOCAL" />
225
+ <updated>1786884643125</updated>
226
+ </task>
227
+ <task id="LOCAL-00012" summary="fix: 修复 slots 的生成逻辑">
228
+ <option name="closed" value="true" />
229
+ <created>1786966736534</created>
230
+ <option name="number" value="00012" />
231
+ <option name="presentableId" value="LOCAL-00012" />
232
+ <option name="project" value="LOCAL" />
233
+ <updated>1786966736535</updated>
234
+ </task>
235
+ <option name="localTasksCounter" value="13" />
187
236
  <servers />
188
237
  </component>
189
238
  <component name="TypeScriptGeneratedFilesManager">
@@ -207,6 +256,12 @@
207
256
  <MESSAGE value="修正了一些命名" />
208
257
  <MESSAGE value="增强 array 类型的支持" />
209
258
  <MESSAGE value="增强 array 类型的支持 x2" />
210
- <option name="LAST_COMMIT_MESSAGE" value="增强 array 类型的支持 x2" />
259
+ <MESSAGE value="修复:不参与初始化方法的属性不应作为结构体的字段" />
260
+ <MESSAGE value="功能:添加 `compile_struct` 函数,透明编译过程" />
261
+ <MESSAGE value="修复:unpack.py 中没有移除的调试逻辑" />
262
+ <MESSAGE value="修复:unpack.py 中没有移除的调试逻辑&#10;更新版本号至 0.2.8" />
263
+ <MESSAGE value="chore: 移除 test_speed.py 中的调试逻辑" />
264
+ <MESSAGE value="fix: 修复 slots 的生成逻辑" />
265
+ <option name="LAST_COMMIT_MESSAGE" value="fix: 修复 slots 的生成逻辑" />
211
266
  </component>
212
267
  </project>
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: obstruct
3
- Version: 0.2.8
3
+ Version: 0.2.10
4
4
  Author-email: LittleNightSong <LittleNightSongYO@outlook.com>
5
5
  Classifier: Development Status :: 3 - Alpha
6
6
  Classifier: Programming Language :: Python
@@ -0,0 +1 @@
1
+ version = "0.2.10"
@@ -0,0 +1,5 @@
1
+ from enum import Enum
2
+
3
+
4
+ class Marks(Enum):
5
+ NOT_A_CFIELD = 0
@@ -5,6 +5,7 @@ from collections.abc import Buffer
5
5
  from typing import Self, Generator, Any, ClassVar
6
6
 
7
7
  from obstruct.aot import create_pack_methods, create_unpack_methods
8
+ from obstruct.metadata_marks import Marks
8
9
 
9
10
 
10
11
  class CType(typing.Protocol):
@@ -44,7 +45,7 @@ class StructMeta(type):
44
45
  format=annotationlib.Format.STRING
45
46
  )
46
47
 
47
- slots |= {k for k in annotations.keys() if not k.startswith('_')}
48
+ slots |= {k for k in annotations.keys()}
48
49
 
49
50
  attrs['__slots__'] = slots
50
51
  attrs['__cendian__'] = endian
@@ -53,7 +54,14 @@ class StructMeta(type):
53
54
 
54
55
  def __compile_struct__(cls):
55
56
  from obstruct.methods import to_format_string
56
- fields = [i for i in dataclasses.fields(cls) if i.init]
57
+ fields = [
58
+ i for i in dataclasses.fields(cls)
59
+
60
+ if (
61
+ typing.get_origin(i.type) is not typing.Annotated
62
+ or Marks.NOT_A_CFIELD not in i.type.__metadata__
63
+ )
64
+ ]
57
65
  real_annotations = typing.get_type_hints(cls)
58
66
 
59
67
  for field in fields:
@@ -36,8 +36,6 @@ print('MyStruct size', MyStruct.__cstruct__.size)
36
36
  print('AnotherStruct size', AnotherStruct.__cstruct__.size)
37
37
 
38
38
 
39
- exit()
40
-
41
39
  data = MyStruct(
42
40
  1,2,1.0,4,5,6,7,8,9,b'8',1,2
43
41
  )
@@ -1 +0,0 @@
1
- version = "0.2.8"
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