physicsLab 1.6.0__tar.gz → 1.6.2__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 (58) hide show
  1. {physicslab-1.6.0 → physicslab-1.6.2}/LICENSE +1 -1
  2. {physicslab-1.6.0 → physicslab-1.6.2}/PKG-INFO +2 -2
  3. {physicslab-1.6.0 → physicslab-1.6.2}/physicsLab/Experiment.py +13 -14
  4. {physicslab-1.6.0 → physicslab-1.6.2}/physicsLab/_element_base.py +2 -1
  5. physicslab-1.6.2/physicsLab/celestial/_element.py +1 -0
  6. physicslab-1.6.2/physicsLab/celestial/_experiment.py +1 -0
  7. {physicslab-1.6.0 → physicslab-1.6.2}/physicsLab/celestial/_planetbase.py +3 -1
  8. {physicslab-1.6.0 → physicslab-1.6.2}/physicsLab/celestial/planets.py +13 -1
  9. {physicslab-1.6.0 → physicslab-1.6.2}/physicsLab/chart.py +2 -1
  10. physicslab-1.6.2/physicsLab/circuit/_element.py +1 -0
  11. physicslab-1.6.2/physicsLab/circuit/_experiment.py +1 -0
  12. {physicslab-1.6.0 → physicslab-1.6.2}/physicsLab/circuit/elements/_circuitbase.py +8 -3
  13. {physicslab-1.6.0 → physicslab-1.6.2}/physicsLab/circuit/elements/artificialCircuit.py +21 -21
  14. {physicslab-1.6.0 → physicslab-1.6.2}/physicsLab/circuit/elements/basicCircuit.py +19 -19
  15. {physicslab-1.6.0 → physicslab-1.6.2}/physicsLab/circuit/elements/logicCircuit.py +35 -30
  16. {physicslab-1.6.0 → physicslab-1.6.2}/physicsLab/circuit/elements/otherCircuit.py +15 -15
  17. {physicslab-1.6.0 → physicslab-1.6.2}/physicsLab/circuit/elements/sensor.py +7 -7
  18. {physicslab-1.6.0 → physicslab-1.6.2}/physicsLab/electromagnetism/_electromagnetismBase.py +2 -2
  19. physicslab-1.6.2/physicsLab/electromagnetism/_element.py +1 -0
  20. physicslab-1.6.2/physicsLab/electromagnetism/_experiment.py +1 -0
  21. {physicslab-1.6.0 → physicslab-1.6.2}/physicsLab/electromagnetism/elements.py +5 -5
  22. {physicslab-1.6.0 → physicslab-1.6.2}/physicsLab/element.py +4 -4
  23. {physicslab-1.6.0 → physicslab-1.6.2}/physicsLab/errors.py +8 -0
  24. {physicslab-1.6.0 → physicslab-1.6.2}/physicsLab/music/music.py +3 -4
  25. physicslab-1.6.2/physicsLab/plAR.py +43 -0
  26. {physicslab-1.6.0 → physicslab-1.6.2}/physicsLab/utils.py +1 -0
  27. {physicslab-1.6.0 → physicslab-1.6.2}/physicsLab/web/_async_tool.py +9 -11
  28. {physicslab-1.6.0 → physicslab-1.6.2}/physicsLab/web/api.py +51 -38
  29. {physicslab-1.6.0 → physicslab-1.6.2}/physicsLab/web/webutils.py +28 -31
  30. {physicslab-1.6.0 → physicslab-1.6.2}/physicsLab.egg-info/PKG-INFO +2 -2
  31. {physicslab-1.6.0 → physicslab-1.6.2}/physicsLab.egg-info/SOURCES.txt +7 -3
  32. {physicslab-1.6.0 → physicslab-1.6.2}/setup.py +3 -3
  33. physicslab-1.6.0/physicsLab/plAR.py +0 -39
  34. physicslab-1.6.0/test/test_physicsLab.py +0 -348
  35. physicslab-1.6.0/test/test_pl_web.py +0 -11
  36. {physicslab-1.6.0 → physicslab-1.6.2}/README.md +0 -0
  37. {physicslab-1.6.0 → physicslab-1.6.2}/physicsLab/__init__.py +0 -0
  38. {physicslab-1.6.0 → physicslab-1.6.2}/physicsLab/_colorUtils.py +0 -0
  39. {physicslab-1.6.0 → physicslab-1.6.2}/physicsLab/_tools.py +0 -0
  40. {physicslab-1.6.0 → physicslab-1.6.2}/physicsLab/celestial/__init__.py +0 -0
  41. {physicslab-1.6.0 → physicslab-1.6.2}/physicsLab/circuit/__init__.py +0 -0
  42. {physicslab-1.6.0 → physicslab-1.6.2}/physicsLab/circuit/elementXYZ.py +0 -0
  43. {physicslab-1.6.0 → physicslab-1.6.2}/physicsLab/circuit/elements/__init__.py +0 -0
  44. {physicslab-1.6.0 → physicslab-1.6.2}/physicsLab/circuit/wire.py +0 -0
  45. {physicslab-1.6.0 → physicslab-1.6.2}/physicsLab/electromagnetism/__init__.py +0 -0
  46. {physicslab-1.6.0 → physicslab-1.6.2}/physicsLab/enums.py +0 -0
  47. {physicslab-1.6.0 → physicslab-1.6.2}/physicsLab/lib/__init__.py +0 -0
  48. {physicslab-1.6.0 → physicslab-1.6.2}/physicsLab/lib/edge_trigger.py +0 -0
  49. {physicslab-1.6.0 → physicslab-1.6.2}/physicsLab/lib/logic.py +0 -0
  50. {physicslab-1.6.0 → physicslab-1.6.2}/physicsLab/lib/wires.py +0 -0
  51. {physicslab-1.6.0 → physicslab-1.6.2}/physicsLab/music/__init__.py +0 -0
  52. {physicslab-1.6.0 → physicslab-1.6.2}/physicsLab/savTemplate.py +0 -0
  53. {physicslab-1.6.0 → physicslab-1.6.2}/physicsLab/typehint.py +0 -0
  54. {physicslab-1.6.0 → physicslab-1.6.2}/physicsLab/web/__init__.py +0 -0
  55. {physicslab-1.6.0 → physicslab-1.6.2}/physicsLab.egg-info/dependency_links.txt +0 -0
  56. {physicslab-1.6.0 → physicslab-1.6.2}/physicsLab.egg-info/requires.txt +0 -0
  57. {physicslab-1.6.0 → physicslab-1.6.2}/physicsLab.egg-info/top_level.txt +0 -0
  58. {physicslab-1.6.0 → physicslab-1.6.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2023 Goodenough
3
+ Copyright (c) 2024 Arendelle
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: physicsLab
3
- Version: 1.6.0
4
- Summary: Python API for Physics-Lab-AR
3
+ Version: 1.6.2
4
+ Summary: Python API for Quantum-Physics App
5
5
  Home-page: https://github.com/GoodenoughPhysicsLab/physicsLab
6
6
  Author: Arendelle
7
7
  Author-email: 2381642961@qq.com
@@ -24,7 +24,7 @@ from .savTemplate import Generate
24
24
  from .enums import ExperimentType
25
25
  from .typehint import Union, Optional, List, Dict, numType, Self
26
26
 
27
- class _StackExperiment:
27
+ class _ExperimentStack:
28
28
  data: List["Experiment"] = []
29
29
 
30
30
  def __new__(cls):
@@ -52,7 +52,7 @@ class _StackExperiment:
52
52
 
53
53
  def get_current_experiment() -> "Experiment":
54
54
  ''' 获取当前正在操作的存档 '''
55
- return _StackExperiment.top()
55
+ return _ExperimentStack.top()
56
56
 
57
57
  # TODO: 将Experiment作为基类, 子类为三大类型的实验?
58
58
  class Experiment:
@@ -61,8 +61,7 @@ class Experiment:
61
61
  SAV_ROOT_DIR = os.environ["PHYSICSLAB_HOME_PATH"]
62
62
  else:
63
63
  if platform.system() == "Windows":
64
- from getpass import getuser
65
- SAV_ROOT_DIR = f"C:/Users/{getuser()}/AppData/LocalLow/CIVITAS/Quantum Physics/Circuit"
64
+ SAV_ROOT_DIR = os.path.join(plAR.WIN_PLAR_HOME_DIR, "Circuit")
66
65
  else:
67
66
  SAV_ROOT_DIR = "physicsLabSav"
68
67
 
@@ -103,7 +102,7 @@ class Experiment:
103
102
  return element
104
103
  raise errors.ExperimentError
105
104
 
106
- def __read_CameraSave(self, camera_save: str) -> None:
105
+ def _read_CameraSave(self, camera_save: str) -> None:
107
106
  self.CameraSave = json.loads(camera_save)
108
107
  temp = eval(f"({self.CameraSave['VisionCenter']})")
109
108
  self.VisionCenter: _tools.position = _tools.position(temp[0], temp[2], temp[1]) # x, z, y
@@ -112,7 +111,7 @@ class Experiment:
112
111
 
113
112
  def __open(self) -> None:
114
113
  self.is_opened = True
115
- self.__read_CameraSave(self.PlSav["Experiment"]["CameraSave"])
114
+ self._read_CameraSave(self.PlSav["Experiment"]["CameraSave"])
116
115
 
117
116
  if self.PlSav["Summary"] is None:
118
117
  self.PlSav["Summary"] = savTemplate.Circuit["Summary"]
@@ -155,7 +154,7 @@ class Experiment:
155
154
  or not isinstance(path_load_mode, Experiment.PathLoadMode):
156
155
  raise TypeError
157
156
 
158
- _StackExperiment.push(self)
157
+ _ExperimentStack.push(self)
159
158
 
160
159
  # 直接通过文件路径进行导入
161
160
  if path_load_mode == Experiment.PathLoadMode.file_name \
@@ -166,7 +165,7 @@ class Experiment:
166
165
  self.SAV_PATH = os.path.abspath(sav_name)
167
166
 
168
167
  if not os.path.exists(self.SAV_PATH):
169
- _StackExperiment.pop()
168
+ _ExperimentStack.pop()
170
169
  raise errors.ExperimentNotExistError(f"{self.SAV_PATH} not found")
171
170
 
172
171
  _temp = _open_sav(self.SAV_PATH)
@@ -191,7 +190,7 @@ class Experiment:
191
190
  filename = search_experiment(sav_name)
192
191
 
193
192
  if filename is None:
194
- _StackExperiment.pop()
193
+ _ExperimentStack.pop()
195
194
  raise errors.ExperimentNotExistError(f'No such experiment "{sav_name}"')
196
195
 
197
196
  self.SAV_PATH = os.path.join(Experiment.SAV_ROOT_DIR, filename)
@@ -281,7 +280,7 @@ class Experiment:
281
280
  if os.path.exists(path.replace(".sav", ".jpg")): # 用存档生成的实验无图片,因此可能删除失败
282
281
  os.remove(path.replace(".sav", ".jpg"))
283
282
 
284
- _StackExperiment.push(self)
283
+ _ExperimentStack.push(self)
285
284
 
286
285
  self.__crt(sav_name, experiment_type)
287
286
  return self
@@ -302,7 +301,7 @@ class Experiment:
302
301
  or not isinstance(experiment_type, ExperimentType):
303
302
  raise TypeError
304
303
 
305
- _StackExperiment.push(self)
304
+ _ExperimentStack.push(self)
306
305
 
307
306
  filename = search_experiment(sav_name)
308
307
  if filename is not None:
@@ -384,7 +383,7 @@ class Experiment:
384
383
  if not no_pop:
385
384
  self.is_opened = False
386
385
  self.is_crted = False
387
- _StackExperiment.pop()
386
+ _ExperimentStack.pop()
388
387
 
389
388
  self.__write()
390
389
 
@@ -438,11 +437,11 @@ class Experiment:
438
437
  if os.path.exists(self.SAV_PATH.replace(".sav", ".jpg")): # 用存档生成的实验无图片,因此可能删除失败
439
438
  os.remove(self.SAV_PATH.replace(".sav", ".jpg"))
440
439
 
441
- _StackExperiment.pop()
440
+ _ExperimentStack.pop()
442
441
 
443
442
  def exit(self) -> None:
444
443
  ''' 立刻退出对该存档的操作, 对该存档的任何改动都会失效 '''
445
- _StackExperiment.pop()
444
+ _ExperimentStack.pop()
446
445
 
447
446
  def entitle(self, sav_name: str) -> Self:
448
447
  ''' 对存档名进行重命名 '''
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  import copy
3
3
 
4
- from physicsLab.typehint import numType, Self
4
+ from physicsLab.typehint import numType, Self, final
5
5
  from physicsLab import _tools
6
6
 
7
7
  class ElementBase:
@@ -34,6 +34,7 @@ class ElementBase:
34
34
 
35
35
  return self
36
36
 
37
+ @final
37
38
  def get_position(self) -> tuple:
38
39
  ''' 获取原件的坐标 '''
39
40
  assert hasattr(self, '_position')
@@ -0,0 +1 @@
1
+ # -*- coding: utf-8 -*-
@@ -0,0 +1 @@
1
+ # -*- coding: utf-8 -*-
@@ -1,7 +1,8 @@
1
+ # -*- coding: utf-8 -*-
1
2
  from physicsLab import _tools
2
3
  from physicsLab import errors
3
4
  from physicsLab._element_base import ElementBase
4
- from physicsLab.typehint import numType, Self, final
5
+ from physicsLab.typehint import numType, Self, override, final
5
6
  from physicsLab.enums import ExperimentType
6
7
  from physicsLab.Experiment import get_current_experiment
7
8
 
@@ -47,6 +48,7 @@ class PlanetBase(ElementBase, metaclass=_PlanetMeta):
47
48
  self.data: dict = data
48
49
 
49
50
  @final
51
+ @override
50
52
  def set_position(self, x: numType, y: numType, z: numType) -> Self:
51
53
  ''' 设置位置坐标 '''
52
54
  if not isinstance(x, (int, float)) or \
@@ -265,7 +265,19 @@ class Blackhole(PlanetBase):
265
265
  class Fantasy_Star(PlanetBase):
266
266
  def __init__(self, x: numType, y: numType, z: numType) -> None:
267
267
  self.data = {
268
- "Identifier": Generate, "Model": "Fantasy Star", "Override": None, "Name": "幻想恒星", "Parent": None, "Type": 0, "Changed": False, "Extras": {}, "Radius": 651325.063, "RadiusVisible": 4.353841, "RotationPeriod": 0.0, "RotationPhase": 0.0, "AxialTilt": 0.0, "Mass": 2762263.0, "OrbitType": 0, "OrbitEstimation": 3, "Density": 2.3866187453169605, "Gravity": 434.5711132851481, "Luminosity": 3.719063854941033, "Temperature": 8284.134151462116, "Albedo": 0.0, "PowerAbsorbtion": 0.0, "PlanetariumBalance": 0.0, "Position": Generate, "Velocity": Generate, "Acceleration": Generate, "Period": 0.0, "Eccentricity": "NaN", "OmegaUC": 0.0, "OmegaLC": "NaN", "Inclination": "NaN", "Phase": 0.0, "PhaseCurrent": "NaN", "AxisSemi": "NaN", "Perihelion": "NaN", "Aphelion": "NaN", "LeavingKepler": False}
268
+ "Identifier": Generate, "Model": "Fantasy Star", "Override": None,
269
+ "Name": "幻想恒星", "Parent": None, "Type": 0, "Changed": False,
270
+ "Extras": {}, "Radius": 651325.063, "RadiusVisible": 4.353841,
271
+ "RotationPeriod": 0.0, "RotationPhase": 0.0, "AxialTilt": 0.0,
272
+ "Mass": 2762263.0, "OrbitType": 0, "OrbitEstimation": 3,
273
+ "Density": 2.3866187453169605, "Gravity": 434.5711132851481,
274
+ "Luminosity": 3.719063854941033, "Temperature": 8284.134151462116,
275
+ "Albedo": 0.0, "PowerAbsorbtion": 0.0, "PlanetariumBalance": 0.0,
276
+ "Position": Generate, "Velocity": Generate, "Acceleration": Generate,
277
+ "Period": 0.0, "Eccentricity": "NaN", "OmegaUC": 0.0, "OmegaLC": "NaN",
278
+ "Inclination": "NaN", "Phase": 0.0, "PhaseCurrent": "NaN", "AxisSemi": "NaN",
279
+ "Perihelion": "NaN", "Aphelion": "NaN", "LeavingKepler": False
280
+ }
269
281
 
270
282
  class Moon(PlanetBase):
271
283
  def __init__(self, x: numType, y: numType, z: numType) -> None:
@@ -1,7 +1,8 @@
1
+ # -*- coding: utf-8 -*-
1
2
  import base64
2
3
 
3
4
  from physicsLab import errors
4
- from physicsLab.experiment import Experiment
5
+ from physicsLab.Experiment import Experiment
5
6
  from physicsLab.circuit.elements import CircuitBase
6
7
  from physicsLab.typehint import TypedDict, Self, List, Optional
7
8
 
@@ -0,0 +1 @@
1
+ # -*- coding: utf-8 -*-
@@ -0,0 +1 @@
1
+ # -*- coding: utf-8 -*-
@@ -10,7 +10,7 @@ import physicsLab.circuit.elementXYZ as _elementXYZ
10
10
  from physicsLab.enums import ExperimentType
11
11
  from physicsLab._tools import roundData, randString
12
12
  from physicsLab.Experiment import Experiment, get_current_experiment
13
- from physicsLab.typehint import Optional, Self, numType, CircuitElementData, Generate, final
13
+ from physicsLab.typehint import Optional, Self, numType, CircuitElementData, Generate, override, final
14
14
 
15
15
  # electricity class's metaClass
16
16
  class CircuitMeta(type):
@@ -70,6 +70,7 @@ class CircuitBase(ElementBase, metaclass=CircuitMeta):
70
70
  f"({self._position.x}, {self._position.y}, {self._position.z}, " \
71
71
  f"elementXYZ={self.is_elementXYZ})"
72
72
 
73
+ @final
73
74
  def set_rotation(
74
75
  self,
75
76
  x_r: numType = 0,
@@ -86,7 +87,7 @@ class CircuitBase(ElementBase, metaclass=CircuitMeta):
86
87
  self.data["Rotation"] = f"{x_r},{z_r},{y_r}"
87
88
  return self
88
89
 
89
- @final
90
+ @override
90
91
  def set_position(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None) -> Self:
91
92
  ''' 设置原件的位置
92
93
  '''
@@ -108,17 +109,20 @@ class CircuitBase(ElementBase, metaclass=CircuitMeta):
108
109
 
109
110
  return super().set_position(x, y, z)
110
111
 
111
- # 获取元件的index(每创建一个元件,index就加1)
112
+ @final
112
113
  def get_index(self) -> int:
114
+ ''' 获取元件的index (每创建一个元件, index就加1) '''
113
115
  return self.experiment.Elements.index(self) + 1
114
116
 
115
117
  @property
118
+ @final
116
119
  def modelID(self) -> str:
117
120
  ''' 存档的modelID '''
118
121
  assert not isinstance(self.data['ModelID'], type(Generate))
119
122
  return self.data['ModelID']
120
123
 
121
124
  @classmethod
125
+ @final
122
126
  def _get_property(cls) -> list:
123
127
  res: list = []
124
128
  for name, _ in inspect.getmembers(cls, lambda i: isinstance(i, property)):
@@ -126,6 +130,7 @@ class CircuitBase(ElementBase, metaclass=CircuitMeta):
126
130
 
127
131
  return res
128
132
 
133
+ @final
129
134
  def rename(self, name: str) -> Self:
130
135
  ''' 重命名元件
131
136
  @param name: 将元件重命名为name
@@ -7,7 +7,7 @@ class NE555(CircuitBase):
7
7
  ''' 555定时器 '''
8
8
  is_bigElement = True
9
9
 
10
- def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None):
10
+ def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None) -> None:
11
11
  self.data: CircuitElementData = {
12
12
  "ModelID": "555 Timer", "Identifier": Generate, "IsBroken": False,
13
13
  "IsLocked": False, "Properties": {"高电平": 3.0, "低电平": 0.0, "锁定": 1.0},
@@ -52,7 +52,7 @@ class NE555(CircuitBase):
52
52
 
53
53
  class Basic_Capacitor(TwoPinMixIn):
54
54
  ''' 电容 '''
55
- def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None):
55
+ def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None) -> None:
56
56
  self.data: CircuitElementData = {
57
57
  "ModelID": "Basic Capacitor", "Identifier": Generate,
58
58
  "IsBroken": False, "IsLocked": False,
@@ -64,7 +64,7 @@ class Basic_Capacitor(TwoPinMixIn):
64
64
 
65
65
  class Basic_Inductor(TwoPinMixIn):
66
66
  ''' 电感 '''
67
- def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None):
67
+ def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None) -> None:
68
68
  self.data: CircuitElementData = {
69
69
  "ModelID": "Basic Inductor", "Identifier": Generate,
70
70
  "IsBroken": False, "IsLocked": False,
@@ -77,7 +77,7 @@ class Basic_Inductor(TwoPinMixIn):
77
77
 
78
78
  class Basic_Diode(TwoPinMixIn):
79
79
  ''' 二极管 '''
80
- def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None):
80
+ def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None) -> None:
81
81
  self.data: CircuitElementData = {
82
82
  "ModelID": "Basic Diode", "Identifier": Generate,
83
83
  "IsBroken": False, "IsLocked": False,
@@ -91,7 +91,7 @@ class Basic_Diode(TwoPinMixIn):
91
91
 
92
92
  class Light_Emitting_Diode(TwoPinMixIn):
93
93
  ''' 发光二极管 '''
94
- def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None):
94
+ def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None) -> None:
95
95
  self.data: CircuitElementData = {
96
96
  "ModelID": "Light-Emitting Diode", "Identifier": Generate,
97
97
  "IsBroken": False, "IsLocked": False,
@@ -105,7 +105,7 @@ class Light_Emitting_Diode(TwoPinMixIn):
105
105
 
106
106
  class Ground_Component(CircuitBase):
107
107
  ''' 接地元件 '''
108
- def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None):
108
+ def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None) -> None:
109
109
  self.data: CircuitElementData = {
110
110
  "ModelID": "Ground Component", "Identifier": Generate,
111
111
  "IsBroken": False, "IsLocked": False, "Properties": {"锁定": 1.0},
@@ -120,7 +120,7 @@ class Ground_Component(CircuitBase):
120
120
 
121
121
  class Transformer(CircuitBase):
122
122
  ''' 理想变压器 '''
123
- def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None):
123
+ def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None) -> None:
124
124
  self.data: CircuitElementData = {
125
125
  "ModelID": "Transformer", "Identifier": Generate,
126
126
  "IsBroken": False, "IsLocked": False,
@@ -151,7 +151,7 @@ class Transformer(CircuitBase):
151
151
 
152
152
  class Tapped_Transformer(CircuitBase):
153
153
  ''' 中心抽头变压器 '''
154
- def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None):
154
+ def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None) -> None:
155
155
  self.data: CircuitElementData = {
156
156
  "ModelID": "Tapped Transformer", "Identifier": Generate,
157
157
  "IsBroken": False, "IsLocked": False,
@@ -184,7 +184,7 @@ class Tapped_Transformer(CircuitBase):
184
184
 
185
185
  class Mutual_Inductor(CircuitBase):
186
186
  ''' 理想互感 '''
187
- def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None):
187
+ def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None) -> None:
188
188
  self.data: CircuitElementData = {
189
189
  "ModelID": "Mutual Inductor", "Identifier": Generate,
190
190
  "IsBroken": False, "IsLocked": False,
@@ -213,7 +213,7 @@ class Mutual_Inductor(CircuitBase):
213
213
 
214
214
  class Rectifier(CircuitBase):
215
215
  ''' 全波整流器 '''
216
- def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None):
216
+ def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None) -> None:
217
217
  self.data: CircuitElementData = {
218
218
  "ModelID": "Rectifier", "Identifier": Generate,
219
219
  "IsBroken": False, "IsLocked": False,
@@ -241,7 +241,7 @@ class Rectifier(CircuitBase):
241
241
 
242
242
  class Transistor(CircuitBase):
243
243
  ''' 三极管 '''
244
- def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None):
244
+ def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None) -> None:
245
245
  self.data: CircuitElementData = {
246
246
  "ModelID": "Transistor", "Identifier": Generate,
247
247
  "IsBroken": False, "IsLocked": False,
@@ -265,7 +265,7 @@ class Transistor(CircuitBase):
265
265
 
266
266
  class Comparator(CircuitBase):
267
267
  ''' 比较器 '''
268
- def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None):
268
+ def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None) -> None:
269
269
  self.data: CircuitElementData = {
270
270
  "ModelID": "Comparator", "Identifier": Generate,
271
271
  "IsBroken": False, "IsLocked": False,
@@ -289,7 +289,7 @@ class Comparator(CircuitBase):
289
289
 
290
290
  class Operational_Amplifier(CircuitBase):
291
291
  ''' 运算放大器 '''
292
- def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None):
292
+ def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None) -> None:
293
293
  self.data: CircuitElementData = {
294
294
  "ModelID": "Operational Amplifier", "Identifier": Generate,
295
295
  "IsBroken": False, "IsLocked": False,
@@ -314,7 +314,7 @@ class Operational_Amplifier(CircuitBase):
314
314
 
315
315
  class Relay_Component(CircuitBase):
316
316
  ''' 继电器 '''
317
- def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None):
317
+ def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None) -> None:
318
318
  self.data: CircuitElementData = {
319
319
  "ModelID": "Relay Component", "Identifier": Generate,
320
320
  "IsBroken": False, "IsLocked": False,
@@ -348,7 +348,7 @@ class Relay_Component(CircuitBase):
348
348
 
349
349
  class N_MOSFET(CircuitBase):
350
350
  ''' N-MOSFET '''
351
- def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None):
351
+ def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None) -> None:
352
352
  self.data: CircuitElementData = {
353
353
  "ModelID": "N-MOSFET", "Identifier": Generate, "IsBroken": False,
354
354
  "IsLocked": False, "Properties": {"PNP": 1.0, "放大系数": 0.027,
@@ -396,7 +396,7 @@ class P_MOSFET(CircuitBase):
396
396
 
397
397
  class _source_electricity(TwoPinMixIn):
398
398
  """ 波形发生器基类 """
399
- def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None):
399
+ def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None) -> None:
400
400
  self.data: CircuitElementData = {
401
401
  "ModelID": Generate, "Identifier": Generate, "IsBroken": False, "IsLocked": False,
402
402
  "Properties": {"电压": 3.0, "内阻": 0.5, "频率": 20000.0, "偏移": 0.0,
@@ -407,30 +407,30 @@ class _source_electricity(TwoPinMixIn):
407
407
 
408
408
  class Sinewave_Source(_source_electricity):
409
409
  ''' 正弦波发生器 '''
410
- def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None):
410
+ def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None) -> None:
411
411
  super().__init__(x, y, z, elementXYZ)
412
412
  self.data["ModelID"] = "Sinewave Source"
413
413
 
414
414
  class Square_Source(_source_electricity):
415
415
  ''' 方波发生器 '''
416
- def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None):
416
+ def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None) -> None:
417
417
  super().__init__(x, y, z, elementXYZ)
418
418
  self.data["ModelID"] = "Square Source"
419
419
 
420
420
  class Triangle_Source(_source_electricity):
421
421
  ''' 三角波发生器 '''
422
- def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None):
422
+ def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None) -> None:
423
423
  super().__init__(x, y, z, elementXYZ)
424
424
  self.data["ModelID"] = "Triangle Source"
425
425
 
426
426
  class Sawtooth_Source(_source_electricity):
427
427
  ''' 锯齿波发生器 '''
428
- def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None):
428
+ def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None) -> None:
429
429
  super().__init__(x, y, z, elementXYZ)
430
430
  self.data["ModelID"] = "Sawtooth Source"
431
431
 
432
432
  class Pulse_Source(_source_electricity):
433
433
  ''' 尖峰波发生器 '''
434
- def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None):
434
+ def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None) -> None:
435
435
  super().__init__(x, y, z, elementXYZ)
436
436
  self.data["ModelID"] = "Pulse Source"
@@ -5,7 +5,7 @@ from physicsLab.typehint import Optional, numType, CircuitElementData, Self, Gen
5
5
 
6
6
  class _switch_Base(CircuitBase):
7
7
  ''' 开关基类 '''
8
- def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None):
8
+ def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None) -> None:
9
9
  self.data: CircuitElementData = {
10
10
  "ModelID": Generate, "Identifier": Generate, "IsBroken": False,
11
11
  "IsLocked": False, "Properties": {"开关": 0, "锁定": 1.0},
@@ -21,7 +21,7 @@ class _switch_Base(CircuitBase):
21
21
 
22
22
  class Simple_Switch(_switch_Base, TwoPinMixIn):
23
23
  ''' 简单开关 '''
24
- def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None):
24
+ def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None) -> None:
25
25
  super().__init__(x, y, z, elementXYZ)
26
26
  self.data["ModelID"] = "Simple Switch"
27
27
 
@@ -40,7 +40,7 @@ class Simple_Switch(_switch_Base, TwoPinMixIn):
40
40
 
41
41
  class SPDT_Switch(_switch_Base):
42
42
  ''' 单刀双掷开关 '''
43
- def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None):
43
+ def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None) -> None:
44
44
  super().__init__(x, y, z, elementXYZ)
45
45
  self.data["ModelID"] = "SPDT Switch"
46
46
 
@@ -78,7 +78,7 @@ class SPDT_Switch(_switch_Base):
78
78
 
79
79
  class DPDT_Switch(_switch_Base):
80
80
  ''' 双刀双掷开关 '''
81
- def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None):
81
+ def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None) -> None:
82
82
  super().__init__(x, y, z, elementXYZ)
83
83
  self.data["ModelID"] = "DPDT Switch"
84
84
 
@@ -128,7 +128,7 @@ class DPDT_Switch(_switch_Base):
128
128
 
129
129
  class Push_Switch(TwoPinMixIn):
130
130
  ''' 按钮开关 '''
131
- def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None):
131
+ def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None) -> None:
132
132
  self.data: CircuitElementData = {
133
133
  "ModelID": "Push Switch", "Identifier": Generate,
134
134
  "IsBroken": False, "IsLocked": False,
@@ -140,7 +140,7 @@ class Push_Switch(TwoPinMixIn):
140
140
 
141
141
  class Air_Switch(TwoPinMixIn):
142
142
  ''' 空气开关 '''
143
- def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None):
143
+ def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None) -> None:
144
144
  self.data: CircuitElementData = {
145
145
  "ModelID": "Air Switch", "Identifier": Generate,
146
146
  "IsBroken": False, "IsLocked": False,
@@ -170,7 +170,7 @@ class Air_Switch(TwoPinMixIn):
170
170
 
171
171
  class Incandescent_Lamp(TwoPinMixIn):
172
172
  ''' 白炽灯泡 '''
173
- def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None):
173
+ def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None) -> None:
174
174
  self.data: CircuitElementData = {
175
175
  "ModelID": "Incandescent Lamp", "Identifier": Generate,
176
176
  "IsBroken": False, "IsLocked": False,
@@ -185,7 +185,7 @@ class Incandescent_Lamp(TwoPinMixIn):
185
185
 
186
186
  class Battery_Source(TwoPinMixIn):
187
187
  ''' 一节电池 '''
188
- def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None):
188
+ def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None) -> None:
189
189
  self.data: CircuitElementData = {
190
190
  "ModelID": "Battery Source", "Identifier": Generate,
191
191
  "IsBroken": False, "IsLocked": False,
@@ -197,7 +197,7 @@ class Battery_Source(TwoPinMixIn):
197
197
 
198
198
  class Student_Source(CircuitBase):
199
199
  ''' 学生电源 '''
200
- def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None):
200
+ def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None) -> None:
201
201
  self.data: CircuitElementData = {
202
202
  "ModelID": "Student Source", "Identifier": Generate,
203
203
  "IsBroken": False, "IsLocked": False,
@@ -229,7 +229,7 @@ class Student_Source(CircuitBase):
229
229
 
230
230
  class Resistor(TwoPinMixIn):
231
231
  ''' 电阻 '''
232
- def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None):
232
+ def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None) -> None:
233
233
  self.data: CircuitElementData = {
234
234
  "ModelID": "Resistor", "Identifier": Generate,
235
235
  "IsBroken": False, "IsLocked": False,
@@ -250,7 +250,7 @@ class Resistor(TwoPinMixIn):
250
250
 
251
251
  class Fuse_Component(TwoPinMixIn):
252
252
  ''' 保险丝 '''
253
- def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None):
253
+ def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None) -> None:
254
254
  self.data: CircuitElementData = {
255
255
  "ModelID": "Fuse Component", "Identifier": Generate,
256
256
  "IsBroken": False, "IsLocked": False,
@@ -263,7 +263,7 @@ class Fuse_Component(TwoPinMixIn):
263
263
 
264
264
  class Slide_Rheostat(CircuitBase):
265
265
  ''' 滑动变阻器 '''
266
- def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None):
266
+ def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None) -> None:
267
267
  self.data: CircuitElementData = {
268
268
  "ModelID": "Slide Rheostat", "Identifier": Generate,
269
269
  "IsBroken": False, "IsLocked": False,
@@ -295,7 +295,7 @@ class Slide_Rheostat(CircuitBase):
295
295
 
296
296
  class Multimeter(TwoPinMixIn):
297
297
  ''' 多用电表 '''
298
- def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None):
298
+ def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None) -> None:
299
299
  self.data: CircuitElementData = {
300
300
  "ModelID": "Multimeter", "Identifier": Generate,
301
301
  "IsBroken": False, "IsLocked": False,
@@ -309,7 +309,7 @@ class Multimeter(TwoPinMixIn):
309
309
 
310
310
  class Galvanometer(CircuitBase):
311
311
  ''' 灵敏电流计 '''
312
- def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None):
312
+ def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None) -> None:
313
313
  self.data: CircuitElementData = {
314
314
  "ModelID": "Galvanometer", "Identifier": Generate,
315
315
  "IsBroken": False, "IsLocked": False,
@@ -334,7 +334,7 @@ class Galvanometer(CircuitBase):
334
334
 
335
335
  class Microammeter(CircuitBase):
336
336
  ''' 微安表 '''
337
- def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None):
337
+ def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None) -> None:
338
338
  self.data: CircuitElementData = {
339
339
  "ModelID": "Microammeter", "Identifier": Generate,
340
340
  "IsBroken": False, "IsLocked": False,
@@ -359,7 +359,7 @@ class Microammeter(CircuitBase):
359
359
 
360
360
  class Electricity_Meter(CircuitBase):
361
361
  ''' 电能表 '''
362
- def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None):
362
+ def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None) -> None:
363
363
  self.data: CircuitElementData = {
364
364
  "ModelID": "Electricity Meter", "Identifier": Generate,
365
365
  "IsBroken": False, "IsLocked": False,
@@ -388,7 +388,7 @@ class Electricity_Meter(CircuitBase):
388
388
 
389
389
  class Resistance_Box(CircuitBase):
390
390
  ''' 电阻箱 '''
391
- def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None):
391
+ def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None) -> None:
392
392
  self.data: CircuitElementData = {
393
393
  "ModelID": "Resistance Box", "Identifier": Generate,
394
394
  "IsBroken": False, "IsLocked": False,
@@ -420,7 +420,7 @@ class Resistance_Box(CircuitBase):
420
420
 
421
421
  class Simple_Ammeter(CircuitBase):
422
422
  ''' 直流安培表 '''
423
- def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None):
423
+ def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None) -> None:
424
424
  self.data: CircuitElementData = {
425
425
  "ModelID": "Simple Ammeter", "Identifier": Generate,
426
426
  "IsBroken": False, "IsLocked": False,
@@ -446,7 +446,7 @@ class Simple_Ammeter(CircuitBase):
446
446
 
447
447
  class Simple_Voltmeter(CircuitBase):
448
448
  ''' 直流电压表 '''
449
- def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None):
449
+ def __init__(self, x: numType, y: numType, z: numType, elementXYZ: Optional[bool] = None) -> None:
450
450
  self.data: CircuitElementData = {
451
451
  "ModelID": "Simple Voltmeter", "Identifier": Generate,
452
452
  "IsBroken": False, "IsLocked": False,