physicsLab 2.0.2__tar.gz → 2.0.3__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 (75) hide show
  1. {physicslab-2.0.2 → physicslab-2.0.3}/PKG-INFO +1 -1
  2. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/_colorUtils.py +8 -2
  3. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/_core.py +42 -22
  4. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/celestial/planets.py +216 -7
  5. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/circuit/_circuit_core.py +1 -1
  6. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/circuit/elements/artificialCircuit.py +122 -1
  7. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/circuit/elements/basicCircuit.py +100 -1
  8. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/circuit/elements/logicCircuit.py +139 -1
  9. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/circuit/elements/otherCircuit.py +67 -1
  10. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/circuit/elements/sensor.py +58 -1
  11. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/electromagnetism/elements.py +42 -3
  12. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/element.py +15 -10
  13. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/errors.py +15 -0
  14. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/lib/logic_circuit/logic.py +64 -0
  15. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/lib/logic_circuit/super_logic_gate.py +5 -5
  16. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/savTemplate.py +6 -7
  17. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/web/_api.py +2 -2
  18. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/web/webutils.py +2 -2
  19. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab.egg-info/PKG-INFO +1 -1
  20. {physicslab-2.0.2 → physicslab-2.0.3}/setup.py +1 -1
  21. {physicslab-2.0.2 → physicslab-2.0.3}/LICENSE +0 -0
  22. {physicslab-2.0.2 → physicslab-2.0.3}/README.md +0 -0
  23. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/__init__.py +0 -0
  24. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/_tools.py +0 -0
  25. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/_typing.py +0 -0
  26. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/celestial/__init__.py +0 -0
  27. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/celestial/_planetbase.py +0 -0
  28. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/chart.py +0 -0
  29. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/circuit/__init__.py +0 -0
  30. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/circuit/elements/__init__.py +0 -0
  31. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/electromagnetism/__init__.py +0 -0
  32. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/electromagnetism/_electromagnetismBase.py +0 -0
  33. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/enums.py +0 -0
  34. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/lib/__init__.py +0 -0
  35. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/lib/analog_circuit/__init__.py +0 -0
  36. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/lib/analog_circuit/analog.py +0 -0
  37. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/lib/logic_circuit/__init__.py +0 -0
  38. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/lib/logic_circuit/edge_trigger.py +0 -0
  39. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/lib/logic_circuit/wires.py +0 -0
  40. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/music/__init__.py +0 -0
  41. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/music/mido/__init__.py +0 -0
  42. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/music/mido/frozen.py +0 -0
  43. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/music/mido/messages/__init__.py +0 -0
  44. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/music/mido/messages/checks.py +0 -0
  45. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/music/mido/messages/decode.py +0 -0
  46. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/music/mido/messages/encode.py +0 -0
  47. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/music/mido/messages/messages.py +0 -0
  48. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/music/mido/messages/specs.py +0 -0
  49. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/music/mido/messages/strings.py +0 -0
  50. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/music/mido/midifiles/__init__.py +0 -0
  51. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/music/mido/midifiles/meta.py +0 -0
  52. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/music/mido/midifiles/midifiles.py +0 -0
  53. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/music/mido/midifiles/tracks.py +0 -0
  54. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/music/mido/midifiles/units.py +0 -0
  55. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/music/mido/parser.py +0 -0
  56. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/music/mido/ports.py +0 -0
  57. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/music/mido/scripts/__init__.py +0 -0
  58. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/music/mido/scripts/mido_connect.py +0 -0
  59. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/music/mido/scripts/mido_play.py +0 -0
  60. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/music/mido/scripts/mido_ports.py +0 -0
  61. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/music/mido/scripts/mido_serve.py +0 -0
  62. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/music/mido/sockets.py +0 -0
  63. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/music/mido/syx.py +0 -0
  64. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/music/mido/tokenizer.py +0 -0
  65. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/music/music.py +0 -0
  66. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/plAR.py +0 -0
  67. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/utils.py +0 -0
  68. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/web/__init__.py +0 -0
  69. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/web/_threadpool.py +0 -0
  70. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab/web/api.py +0 -0
  71. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab.egg-info/SOURCES.txt +0 -0
  72. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab.egg-info/dependency_links.txt +0 -0
  73. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab.egg-info/requires.txt +0 -0
  74. {physicslab-2.0.2 → physicslab-2.0.3}/physicsLab.egg-info/top_level.txt +0 -0
  75. {physicslab-2.0.2 → physicslab-2.0.3}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: physicsLab
3
- Version: 2.0.2
3
+ Version: 2.0.3
4
4
  Summary: Python API for Quantum-Physics App
5
5
  Home-page: https://github.com/GoodenoughPhysicsLab/physicsLab
6
6
  Author: Arendelle
@@ -3,7 +3,13 @@
3
3
  from enum import Enum, unique
4
4
 
5
5
  import colorama
6
- colorama.init(autoreset=True)
6
+
7
+ # 设置终端的编码为UTF-8
8
+ import io
9
+ import sys
10
+ sys.stdin = io.TextIOWrapper(sys.stdin.buffer, encoding='utf-8')
11
+ sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
12
+ sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8')
7
13
 
8
14
  @unique
9
15
  class COLOR(Enum):
@@ -25,7 +31,7 @@ def color_print(msg: str, color: COLOR, end='\n') -> None:
25
31
  global _ColorSupport
26
32
 
27
33
  if _ColorSupport:
28
- print(color.value + msg, end=end)
34
+ print(color.value + msg + colorama.Fore.RESET, end=end)
29
35
  else:
30
36
  print(msg, end=end)
31
37
 
@@ -1,11 +1,13 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  ''' `physicsLab` 操作存档的核心文件
3
- 该文件提供操作存档的核心: `class _Experiment` 与所有元件的基类: class `_ElementBase`
3
+ 该文件提供操作存档的核心: `class _Experiment` 与所有元件的基类: class `ElementBase`
4
4
  为了避免在physicsLab内出现大量的cyclic import
5
5
  该文件仅会对存档进行文件读写方面的操作, 将元件的的信息进一步导入由`class Experiment`负责
6
6
  `class Experiment`也提供了对用户更加友好的接口
7
7
  '''
8
8
  import os
9
+ import sys
10
+ import abc
9
11
  import json
10
12
  import copy
11
13
  import time
@@ -29,7 +31,7 @@ class _ExperimentStack:
29
31
 
30
32
  @classmethod
31
33
  def inside(cls, item: "_Experiment") -> bool:
32
- assert isinstance(item, _Experiment)
34
+ errors.assert_true(isinstance(item, _Experiment))
33
35
 
34
36
  for a_expe in cls.data:
35
37
  if a_expe.SAV_PATH == item.SAV_PATH:
@@ -98,6 +100,13 @@ class _Experiment:
98
100
  def __init__(*args, **kwargs) -> NoReturn:
99
101
  raise NotImplementedError
100
102
 
103
+ @property
104
+ def is_anonymous_sav(self) -> bool:
105
+ ''' 是否为匿名存档
106
+ 若为匿名存档则返回True, 否则返回False
107
+ '''
108
+ return "InternalName" not in self.PlSav
109
+
101
110
  @property
102
111
  @_check_not_closed
103
112
  def is_elementXYZ(self) -> bool:
@@ -163,7 +172,7 @@ class _Experiment:
163
172
  if can_break:
164
173
  break
165
174
  else:
166
- assert False
175
+ errors.unreachable()
167
176
 
168
177
  assert identifier in self._id2element.keys()
169
178
  del self._id2element[identifier]
@@ -253,7 +262,7 @@ class _Experiment:
253
262
  "Elements": [a_element.data for a_element in self.Elements],
254
263
  }
255
264
  else:
256
- assert False
265
+ errors.unreachable()
257
266
 
258
267
  self.PlSav["Experiment"]["CreationDate"] = int(time.time() * 1000)
259
268
  self.PlSav["Summary"]["CreationDate"] = int(time.time() * 1000)
@@ -283,38 +292,43 @@ class _Experiment:
283
292
  else:
284
293
  target_path = os.path.abspath(target_path)
285
294
 
286
- if self.open_mode in (OpenMode.load_by_sav_name, OpenMode.load_by_filepath, OpenMode.load_by_plar_app):
287
- status: str = "update"
288
- elif self.open_mode == OpenMode.crt:
289
- status: str = "create"
290
- else:
291
- assert False
292
-
293
295
  self.__write()
294
296
 
295
- context: str = json.dumps(self.PlSav, indent=2, ensure_ascii=False, separators=(',', ':'))
297
+ try:
298
+ context: str = json.dumps(self.PlSav, indent=2, ensure_ascii=False, separators=(',', ':'))
299
+ except TypeError as e:
300
+ # 通常由序列化出现 <Generate>导致
301
+ print("TypeError: ", e, file=sys.stderr)
302
+ errors.unreachable()
296
303
 
297
304
  with open(target_path, "w", encoding="utf-8") as f:
298
305
  f.write(context)
299
306
 
300
307
  if not no_print_info:
308
+ _colorUtils.color_print("Successfully save experiment ", color=_colorUtils.COLOR.GREEN, end='')
309
+ if self.is_anonymous_sav:
310
+ # 对匿名实验的特殊处理
311
+ _colorUtils.color_print(f"<anonymous>", color=_colorUtils.COLOR.CYAN, end='')
312
+ else:
313
+ _colorUtils.color_print(
314
+ f"\"{self.PlSav['InternalName']}\"",
315
+ color=_colorUtils.COLOR.GREEN,
316
+ end='',
317
+ )
318
+ _colorUtils.color_print(f" at \"{target_path}\"! ", _colorUtils.COLOR.GREEN, end='')
301
319
  if self.experiment_type == ExperimentType.Circuit:
302
320
  _colorUtils.color_print(
303
- f"Successfully {status} experiment \"{self.PlSav['InternalName']}\""
304
- f"(\"{target_path}\")! "
305
321
  f"{self.get_elements_count()} elements, {self.get_wires_count()} wires.",
306
322
  color=_colorUtils.COLOR.GREEN
307
323
  )
308
324
  elif self.experiment_type == ExperimentType.Celestial \
309
325
  or self.experiment_type == ExperimentType.Electromagnetism:
310
326
  _colorUtils.color_print(
311
- f"Successfully {status} experiment \"{self.PlSav['InternalName']}\""
312
- f"(\"{target_path}\")! "
313
327
  f"{self.get_elements_count()} elements.",
314
328
  color=_colorUtils.COLOR.GREEN
315
329
  )
316
330
  else:
317
- assert False
331
+ errors.unreachable()
318
332
 
319
333
  return self
320
334
 
@@ -326,10 +340,12 @@ class _Experiment:
326
340
  if delete:
327
341
  if os.path.exists(self.SAV_PATH): # 之所以判断路径是否存在是因为一个实验可能被创建但还未被写入就调用了delete
328
342
  os.remove(self.SAV_PATH)
329
- _colorUtils.color_print(
330
- f"Successfully delete experiment \"{self.PlSav['InternalName']}\"(\"{self.SAV_PATH}\")",
331
- _colorUtils.COLOR.BLUE
332
- )
343
+ _colorUtils.color_print("Successfully delete experiment ", _colorUtils.COLOR.BLUE, end='')
344
+ if self.is_anonymous_sav:
345
+ _colorUtils.color_print("<anonymous>", color=_colorUtils.COLOR.CYAN, end='')
346
+ else:
347
+ _colorUtils.color_print(f"\"{self.PlSav['InternalName']}\"", _colorUtils.COLOR.BLUE, end='')
348
+ _colorUtils.color_print(f"at \"{self.SAV_PATH}\"!", _colorUtils.COLOR.BLUE)
333
349
  if os.path.exists(self.SAV_PATH.replace(".sav", ".jpg")): # 用存档生成的实验无图片
334
350
  os.remove(self.SAV_PATH.replace(".sav", ".jpg"))
335
351
 
@@ -646,7 +662,7 @@ class _Experiment:
646
662
  if self is other:
647
663
  raise errors.ExperimentError("can not merge to itself") # TODO 换一个更好的异常类型?
648
664
 
649
- assert self.SAV_PATH is not None and other.SAV_PATH is not None
665
+ errors.assert_true(self.SAV_PATH is not None and other.SAV_PATH is not None)
650
666
 
651
667
  if self is other:
652
668
  return self
@@ -690,6 +706,10 @@ class ElementBase:
690
706
  def __init__(self) -> None:
691
707
  raise NotImplementedError
692
708
 
709
+ @abc.abstractmethod
710
+ def zh_name(self):
711
+ raise NotImplementedError
712
+
693
713
  def set_position(self, x: num_type, y: num_type, z: num_type) -> Self:
694
714
  ''' 设置元件的位置 '''
695
715
  if not isinstance(x, (int, float)) \
@@ -1,7 +1,12 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  from physicsLab.savTemplate import Generate
3
3
  from ._planetbase import PlanetBase
4
- from physicsLab._typing import num_type, Optional
4
+ from physicsLab._typing import (
5
+ num_type,
6
+ Optional,
7
+ LiteralString,
8
+ final,
9
+ )
5
10
 
6
11
  class Mercury(PlanetBase):
7
12
  def __init__(self, x: num_type, y: num_type, z: num_type, /, *, identifier: Optional[str] = None) -> None:
@@ -21,6 +26,11 @@ class Mercury(PlanetBase):
21
26
  "Aphelion": 10.0, "LeavingKepler": False
22
27
  }
23
28
 
29
+ @final
30
+ @staticmethod
31
+ def zh_name() -> LiteralString:
32
+ return "水星"
33
+
24
34
  class Venus(PlanetBase):
25
35
  def __init__(self, x: num_type, y: num_type, z: num_type, /, *, identifier: Optional[str] = None) -> None:
26
36
  self.data = {
@@ -40,6 +50,11 @@ class Venus(PlanetBase):
40
50
  "Aphelion": 10.0, "LeavingKepler": False
41
51
  }
42
52
 
53
+ @final
54
+ @staticmethod
55
+ def zh_name() -> LiteralString:
56
+ return "金星"
57
+
43
58
  class Earth(PlanetBase):
44
59
  def __init__(self, x: num_type, y: num_type, z: num_type, /, *, identifier: Optional[str] = None) -> None:
45
60
  self.data = {
@@ -58,6 +73,12 @@ class Earth(PlanetBase):
58
73
  "AxisSemi": 10.0, "Perihelion": 10.0, "Aphelion": 10.0,
59
74
  "LeavingKepler": False
60
75
  }
76
+
77
+ @final
78
+ @staticmethod
79
+ def zh_name() -> LiteralString:
80
+ return "地球"
81
+
61
82
  class Mars(PlanetBase):
62
83
  def __init__(self, x: num_type, y: num_type, z: num_type, /, *, identifier: Optional[str] = None) -> None:
63
84
  self.data = {
@@ -75,6 +96,11 @@ class Mars(PlanetBase):
75
96
  "Perihelion": 10.0, "Aphelion": 10.0, "LeavingKepler": False
76
97
  }
77
98
 
99
+ @final
100
+ @staticmethod
101
+ def zh_name() -> LiteralString:
102
+ return "火星"
103
+
78
104
  class Jupiter(PlanetBase):
79
105
  def __init__(self, x: num_type, y: num_type, z: num_type, /, *, identifier: Optional[str] = None) -> None:
80
106
  self.data = {
@@ -92,6 +118,11 @@ class Jupiter(PlanetBase):
92
118
  "Perihelion": 10.0, "Aphelion": 10.0, "LeavingKepler": False
93
119
  }
94
120
 
121
+ @final
122
+ @staticmethod
123
+ def zh_name() -> LiteralString:
124
+ return "木星"
125
+
95
126
  class Saturn(PlanetBase):
96
127
  def __init__(self, x: num_type, y: num_type, z: num_type, /, *, identifier: Optional[str] = None) -> None:
97
128
  self.data = {
@@ -109,6 +140,11 @@ class Saturn(PlanetBase):
109
140
  "Perihelion": 10.0, "Aphelion": 10.0, "LeavingKepler": False
110
141
  }
111
142
 
143
+ @final
144
+ @staticmethod
145
+ def zh_name() -> LiteralString:
146
+ return "土星"
147
+
112
148
  class Uranus(PlanetBase):
113
149
  def __init__(self, x: num_type, y: num_type, z: num_type, /, *, identifier: Optional[str] = None) -> None:
114
150
  self.data = {
@@ -126,6 +162,11 @@ class Uranus(PlanetBase):
126
162
  "Perihelion": 10.0, "Aphelion": 10.0, "LeavingKepler": False
127
163
  }
128
164
 
165
+ @final
166
+ @staticmethod
167
+ def zh_name() -> LiteralString:
168
+ return "天王星"
169
+
129
170
  class Neptune(PlanetBase):
130
171
  def __init__(self, x: num_type, y: num_type, z: num_type, /, *, identifier: Optional[str] = None) -> None:
131
172
  self.data = {
@@ -142,6 +183,11 @@ class Neptune(PlanetBase):
142
183
  "Perihelion": 10.0, "Aphelion": 10.0, "LeavingKepler": False
143
184
  }
144
185
 
186
+ @final
187
+ @staticmethod
188
+ def zh_name() -> LiteralString:
189
+ return "海王星"
190
+
145
191
  class Pluto(PlanetBase):
146
192
  def __init__(self, x: num_type, y: num_type, z: num_type, /, *, identifier: Optional[str] = None) -> None:
147
193
  self.data = {
@@ -159,6 +205,11 @@ class Pluto(PlanetBase):
159
205
  "Perihelion": 10.0, "Aphelion": 10.0, "LeavingKepler": False
160
206
  }
161
207
 
208
+ @final
209
+ @staticmethod
210
+ def zh_name() -> LiteralString:
211
+ return "冥王星"
212
+
162
213
  class Sun(PlanetBase):
163
214
  def __init__(self, x: num_type, y: num_type, z: num_type, /, *, identifier: Optional[str] = None) -> None:
164
215
  self.data = {
@@ -176,6 +227,11 @@ class Sun(PlanetBase):
176
227
  "Perihelion": 10.0, "Aphelion": 10.0, "LeavingKepler": False
177
228
  }
178
229
 
230
+ @final
231
+ @staticmethod
232
+ def zh_name() -> LiteralString:
233
+ return "太阳"
234
+
179
235
  class Blue_Giant(PlanetBase):
180
236
  def __init__(self, x: num_type, y: num_type, z: num_type, /, *, identifier: Optional[str] = None) -> None:
181
237
  self.data = {
@@ -193,6 +249,11 @@ class Blue_Giant(PlanetBase):
193
249
  "Perihelion": 10.0, "Aphelion": 10.0, "LeavingKepler": False
194
250
  }
195
251
 
252
+ @final
253
+ @staticmethod
254
+ def zh_name() -> LiteralString:
255
+ return "蓝巨星"
256
+
196
257
  class Red_Giant(PlanetBase):
197
258
  def __init__(self, x: num_type, y: num_type, z: num_type, /, *, identifier: Optional[str] = None) -> None:
198
259
  self.data = {
@@ -210,6 +271,11 @@ class Red_Giant(PlanetBase):
210
271
  "Perihelion": 10.0, "Aphelion": 10.0, "LeavingKepler": False
211
272
  }
212
273
 
274
+ @final
275
+ @staticmethod
276
+ def zh_name() -> LiteralString:
277
+ return "红巨星"
278
+
213
279
  class Red_Dwarf(PlanetBase):
214
280
  def __init__(self, x: num_type, y: num_type, z: num_type, /, *, identifier: Optional[str] = None) -> None:
215
281
  self.data = {
@@ -227,6 +293,11 @@ class Red_Dwarf(PlanetBase):
227
293
  "Perihelion": "NaN", "Aphelion": "NaN", "LeavingKepler": False
228
294
  }
229
295
 
296
+ @final
297
+ @staticmethod
298
+ def zh_name() -> LiteralString:
299
+ return "红矮星"
300
+
230
301
  class White_Dwarf(PlanetBase):
231
302
  def __init__(self, x: num_type, y: num_type, z: num_type, /, *, identifier: Optional[str] = None) -> None:
232
303
  self.data = {
@@ -244,6 +315,11 @@ class White_Dwarf(PlanetBase):
244
315
  "Perihelion": 10.0, "Aphelion": 10.0, "LeavingKepler": False
245
316
  }
246
317
 
318
+ @final
319
+ @staticmethod
320
+ def zh_name() -> LiteralString:
321
+ return "白矮星"
322
+
247
323
  class Blackhole(PlanetBase):
248
324
  def __init__(self, x: num_type, y: num_type, z: num_type, /, *, identifier: Optional[str] = None) -> None:
249
325
  self.data = {
@@ -261,6 +337,11 @@ class Blackhole(PlanetBase):
261
337
  "Perihelion": 10.0, "Aphelion": 10.0, "LeavingKepler": False
262
338
  }
263
339
 
340
+ @final
341
+ @staticmethod
342
+ def zh_name() -> LiteralString:
343
+ return "黑洞"
344
+
264
345
  class Fantasy_Star(PlanetBase):
265
346
  def __init__(self, x: num_type, y: num_type, z: num_type, /, *, identifier: Optional[str] = None) -> None:
266
347
  self.data = {
@@ -278,6 +359,11 @@ class Fantasy_Star(PlanetBase):
278
359
  "Perihelion": "NaN", "Aphelion": "NaN", "LeavingKepler": False
279
360
  }
280
361
 
362
+ @final
363
+ @staticmethod
364
+ def zh_name() -> LiteralString:
365
+ return "幻想恒星"
366
+
281
367
  class Moon(PlanetBase):
282
368
  def __init__(self, x: num_type, y: num_type, z: num_type, /, *, identifier: Optional[str] = None) -> None:
283
369
  self.data = {
@@ -295,6 +381,11 @@ class Moon(PlanetBase):
295
381
  "Aphelion": "NaN", "LeavingKepler": False
296
382
  }
297
383
 
384
+ @final
385
+ @staticmethod
386
+ def zh_name() -> LiteralString:
387
+ return "月球"
388
+
298
389
  class Chocolate_Ball(PlanetBase):
299
390
  def __init__(self, x: num_type, y: num_type, z: num_type, /, *, identifier: Optional[str] = None) -> None:
300
391
  self.data = {
@@ -311,6 +402,11 @@ class Chocolate_Ball(PlanetBase):
311
402
  "Aphelion": "NaN", "LeavingKepler": False
312
403
  }
313
404
 
405
+ @final
406
+ @staticmethod
407
+ def zh_name() -> LiteralString:
408
+ return "巧克力球"
409
+
314
410
  class Continential(PlanetBase):
315
411
  def __init__(self, x: num_type, y: num_type, z: num_type, /, *, identifier: Optional[str] = None) -> None:
316
412
  self.data = {
@@ -328,6 +424,11 @@ class Continential(PlanetBase):
328
424
  "Aphelion": 10.0, "LeavingKepler": False
329
425
  }
330
426
 
427
+ @final
428
+ @staticmethod
429
+ def zh_name() -> LiteralString:
430
+ return "大陆行星"
431
+
331
432
  class Arctic(PlanetBase):
332
433
  def __init__(self, x: num_type, y: num_type, z: num_type, /, *, identifier: Optional[str] = None) -> None:
333
434
  self.data = {
@@ -345,6 +446,11 @@ class Arctic(PlanetBase):
345
446
  "Aphelion": "NaN", "LeavingKepler": False
346
447
  }
347
448
 
449
+ @final
450
+ @staticmethod
451
+ def zh_name() -> LiteralString:
452
+ return "封冻行星"
453
+
348
454
  class Arid(PlanetBase):
349
455
  def __init__(self, x: num_type, y: num_type, z: num_type, /, *, identifier: Optional[str] = None) -> None:
350
456
  self.data = {
@@ -363,32 +469,135 @@ class Arid(PlanetBase):
363
469
  "Aphelion": "NaN", "LeavingKepler": False
364
470
  }
365
471
 
472
+ @final
473
+ @staticmethod
474
+ def zh_name() -> LiteralString:
475
+ return "干旱行星"
476
+
366
477
  class Barren(PlanetBase):
367
478
  def __init__(self, x: num_type, y: num_type, z: num_type, /, *, identifier: Optional[str] = None) -> None:
368
479
  self.data = {
369
- "Identifier": Generate, "Model": "Barren", "Override": None, "Name": "贫瘠行星", "Parent": None, "Type": 1, "Changed": False, "Extras": {}, "Radius": 4541.27246, "RadiusVisible": 0.030356545, "RotationPeriod": 1.0, "RotationPhase": 0.0, "AxialTilt": 0.0, "Mass": 2.03722143, "OrbitType": 0, "OrbitEstimation": 3, "Density": 5.192983592302659, "Gravity": 6.5928702184257375, "Luminosity": 0.0, "Temperature": 0.0, "Albedo": 0.10571566044065506, "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}
480
+ "Identifier": Generate, "Model": "Barren", "Override": None, "Name": "贫瘠行星",
481
+ "Parent": None, "Type": 1, "Changed": False, "Extras": {}, "Radius": 4541.27246,
482
+ "RadiusVisible": 0.030356545, "RotationPeriod": 1.0, "RotationPhase": 0.0,
483
+ "AxialTilt": 0.0, "Mass": 2.03722143, "OrbitType": 0, "OrbitEstimation": 3,
484
+ "Density": 5.192983592302659, "Gravity": 6.5928702184257375,
485
+ "Luminosity": 0.0, "Temperature": 0.0, "Albedo": 0.10571566044065506,
486
+ "PowerAbsorbtion": 0.0, "PlanetariumBalance": 0.0,
487
+ "Position": Generate, "Velocity": Generate, "Acceleration": Generate,
488
+ "Period": 0.0, "Eccentricity": "NaN", "OmegaUC": 0.0, "OmegaLC": "NaN",
489
+ "Inclination": "NaN", "Phase": 0.0, "PhaseCurrent": "NaN", "AxisSemi": "NaN",
490
+ "Perihelion": "NaN", "Aphelion": "NaN", "LeavingKepler": False}
491
+
492
+ @final
493
+ @staticmethod
494
+ def zh_name() -> LiteralString:
495
+ return "贫瘠行星"
370
496
 
371
497
  class Desert(PlanetBase):
372
498
  def __init__(self, x: num_type, y: num_type, z: num_type, /, *, identifier: Optional[str] = None) -> None:
373
499
  self.data = {
374
- "Identifier": Generate, "Model": "Desert", "Override": None, "Name": "沙漠行星", "Parent": None, "Type": 1, "Changed": False, "Extras": {}, "Radius": 4934.40771, "RadiusVisible": 0.03298449, "RotationPeriod": 1.0, "RotationPhase": 0.0, "AxialTilt": 0.0, "Mass": 2.710787, "OrbitType": 0, "OrbitEstimation": 3, "Density": 5.386438443611148, "Gravity": 7.430477946170987, "Luminosity": 0.0, "Temperature": 0.0, "Albedo": 0.21723898875306347, "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}
500
+ "Identifier": Generate, "Model": "Desert", "Override": None,
501
+ "Name": "沙漠行星", "Parent": None, "Type": 1, "Changed": False,
502
+ "Extras": {}, "Radius": 4934.40771, "RadiusVisible": 0.03298449,
503
+ "RotationPeriod": 1.0, "RotationPhase": 0.0, "AxialTilt": 0.0,
504
+ "Mass": 2.710787, "OrbitType": 0, "OrbitEstimation": 3,
505
+ "Density": 5.386438443611148, "Gravity": 7.430477946170987,
506
+ "Luminosity": 0.0, "Temperature": 0.0, "Albedo": 0.21723898875306347,
507
+ "PowerAbsorbtion": 0.0, "PlanetariumBalance": 0.0,
508
+ "Position": Generate, "Velocity": Generate, "Acceleration": Generate,
509
+ "Period": 0.0, "Eccentricity": "NaN", "OmegaUC": 0.0, "OmegaLC": "NaN",
510
+ "Inclination": "NaN", "Phase": 0.0, "PhaseCurrent": "NaN",
511
+ "AxisSemi": "NaN", "Perihelion": "NaN",
512
+ "Aphelion": "NaN", "LeavingKepler": False}
513
+
514
+ @final
515
+ @staticmethod
516
+ def zh_name() -> LiteralString:
517
+ return "沙漠行星"
375
518
 
376
519
  class Jungle(PlanetBase):
377
520
  def __init__(self, x: num_type, y: num_type, z: num_type, /, *, identifier: Optional[str] = None) -> None:
378
521
  self.data = {
379
- "Identifier": Generate, "Model": "Jungle", "Override": None, "Name": "丛林行星", "Parent": None, "Type": 1, "Changed": False, "Extras": {}, "Radius": 2861.00879, "RadiusVisible": 0.0191246718, "RotationPeriod": 1.0, "RotationPhase": 0.0, "AxialTilt": 0.0, "Mass": 0.5192027, "OrbitType": 0, "OrbitEstimation": 3, "Density": 5.2928643631051635, "Gravity": 4.233406517765326, "Luminosity": 0.0, "Temperature": 0.0, "Albedo": 0.10596970288294205, "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}
522
+ "Identifier": Generate, "Model": "Jungle", "Override": None,
523
+ "Name": "丛林行星", "Parent": None, "Type": 1, "Changed": False,
524
+ "Extras": {}, "Radius": 2861.00879, "RadiusVisible": 0.0191246718,
525
+ "RotationPeriod": 1.0, "RotationPhase": 0.0, "AxialTilt": 0.0,
526
+ "Mass": 0.5192027, "OrbitType": 0, "OrbitEstimation": 3,
527
+ "Density": 5.2928643631051635, "Gravity": 4.233406517765326,
528
+ "Luminosity": 0.0, "Temperature": 0.0, "Albedo": 0.10596970288294205,
529
+ "PowerAbsorbtion": 0.0, "PlanetariumBalance": 0.0,
530
+ "Position": Generate, "Velocity": Generate, "Acceleration": Generate,
531
+ "Period": 0.0, "Eccentricity": "NaN", "OmegaUC": 0.0, "OmegaLC": "NaN",
532
+ "Inclination": "NaN", "Phase": 0.0, "PhaseCurrent": "NaN",
533
+ "AxisSemi": "NaN", "Perihelion": "NaN",
534
+ "Aphelion": "NaN", "LeavingKepler": False}
535
+
536
+ @final
537
+ @staticmethod
538
+ def zh_name() -> LiteralString:
539
+ return "丛林行星"
380
540
 
381
541
  class Toxic(PlanetBase):
382
542
  def __init__(self, x: num_type, y: num_type, z: num_type, /, *, identifier: Optional[str] = None) -> None:
383
543
  self.data = {
384
- "Identifier": Generate, "Model": "Toxic", "Override": None, "Name": "剧毒行星", "Parent": None, "Type": 1, "Changed": False, "Extras": {}, "Radius": 9783.194, "RadiusVisible": 0.0653966442, "RotationPeriod": 1.0, "RotationPhase": 0.0, "AxialTilt": 0.0, "Mass": 20.55713, "OrbitType": 0, "OrbitEstimation": 3, "Density": 5.241213470473673, "Gravity": 14.334829985641749, "Luminosity": 0.0, "Temperature": 0.0, "Albedo": 0.11500446600565795, "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}
544
+ "Identifier": Generate, "Model": "Toxic", "Override": None,
545
+ "Name": "剧毒行星", "Parent": None, "Type": 1, "Changed": False,
546
+ "Extras": {}, "Radius": 9783.194, "RadiusVisible": 0.0653966442,
547
+ "RotationPeriod": 1.0, "RotationPhase": 0.0, "AxialTilt": 0.0,
548
+ "Mass": 20.55713, "OrbitType": 0, "OrbitEstimation": 3,
549
+ "Density": 5.241213470473673, "Gravity": 14.334829985641749, "Luminosity": 0.0,
550
+ "Temperature": 0.0, "Albedo": 0.11500446600565795, "PowerAbsorbtion": 0.0,
551
+ "PlanetariumBalance": 0.0, "Position": Generate, "Velocity": Generate,
552
+ "Acceleration": Generate, "Period": 0.0, "Eccentricity": "NaN",
553
+ "OmegaUC": 0.0, "OmegaLC": "NaN", "Inclination": "NaN", "Phase": 0.0,
554
+ "PhaseCurrent": "NaN", "AxisSemi": "NaN", "Perihelion": "NaN",
555
+ "Aphelion": "NaN", "LeavingKepler": False}
556
+
557
+ @final
558
+ @staticmethod
559
+ def zh_name() -> LiteralString:
560
+ return "剧毒行星"
385
561
 
386
562
  class Lava(PlanetBase):
387
563
  def __init__(self, x: num_type, y: num_type, z: num_type, /, *, identifier: Optional[str] = None) -> None:
388
564
  self.data = {
389
- "Identifier": Generate, "Model": "Lava", "Override": None, "Name": "熔岩行星", "Parent": None, "Type": 1, "Changed": False, "Extras": {}, "Radius": 5447.97, "RadiusVisible": 0.036417447, "RotationPeriod": 1.0, "RotationPhase": 0.0, "AxialTilt": 0.0, "Mass": 3.63040853, "OrbitType": 0, "OrbitEstimation": 3, "Density": 5.3599744007793495, "Gravity": 8.163519931681726, "Luminosity": 0.0, "Temperature": 0.0, "Albedo": 0.2376526732503912, "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}
565
+ "Identifier": Generate, "Model": "Lava", "Override": None,
566
+ "Name": "熔岩行星", "Parent": None, "Type": 1, "Changed": False,
567
+ "Extras": {}, "Radius": 5447.97, "RadiusVisible": 0.036417447,
568
+ "RotationPeriod": 1.0, "RotationPhase": 0.0, "AxialTilt": 0.0,
569
+ "Mass": 3.63040853, "OrbitType": 0, "OrbitEstimation": 3,
570
+ "Density": 5.3599744007793495, "Gravity": 8.163519931681726,
571
+ "Luminosity": 0.0, "Temperature": 0.0, "Albedo": 0.2376526732503912,
572
+ "PowerAbsorbtion": 0.0, "PlanetariumBalance": 0.0, "Position": Generate,
573
+ "Velocity": Generate, "Acceleration": Generate, "Period": 0.0,
574
+ "Eccentricity": "NaN", "OmegaUC": 0.0, "OmegaLC": "NaN", "Inclination": "NaN",
575
+ "Phase": 0.0, "PhaseCurrent": "NaN", "AxisSemi": "NaN",
576
+ "Perihelion": "NaN", "Aphelion": "NaN", "LeavingKepler": False}
577
+
578
+ @final
579
+ @staticmethod
580
+ def zh_name() -> LiteralString:
581
+ return "熔岩行星"
390
582
 
391
583
  class Ocean(PlanetBase):
392
584
  def __init__(self, x: num_type, y: num_type, z: num_type, /, *, identifier: Optional[str] = None) -> None:
393
585
  self.data = {
394
- "Identifier": Generate, "Model": "Ocean", "Override": None, "Name": "海洋行星", "Parent": None, "Type": 1, "Changed": False, "Extras": {}, "Radius": 6777.314, "RadiusVisible": 0.0453035645, "RotationPeriod": 1.0, "RotationPhase": 0.0, "AxialTilt": 0.0, "Mass": 7.10958433, "OrbitType": 0, "OrbitEstimation": 3, "Density": 5.452338182781527, "Gravity": 10.330477777335007, "Luminosity": 0.0, "Temperature": 0.0, "Albedo": 0.2213094047766173, "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}
586
+ "Identifier": Generate, "Model": "Ocean", "Override": None,
587
+ "Name": "海洋行星", "Parent": None, "Type": 1, "Changed": False,
588
+ "Extras": {}, "Radius": 6777.314, "RadiusVisible": 0.0453035645,
589
+ "RotationPeriod": 1.0, "RotationPhase": 0.0, "AxialTilt": 0.0,
590
+ "Mass": 7.10958433, "OrbitType": 0, "OrbitEstimation": 3,
591
+ "Density": 5.452338182781527, "Gravity": 10.330477777335007,
592
+ "Luminosity": 0.0, "Temperature": 0.0, "Albedo": 0.2213094047766173,
593
+ "PowerAbsorbtion": 0.0, "PlanetariumBalance": 0.0, "Position": Generate,
594
+ "Velocity": Generate, "Acceleration": Generate, "Period": 0.0, "Eccentricity": "NaN",
595
+ "OmegaUC": 0.0, "OmegaLC": "NaN", "Inclination": "NaN", "Phase": 0.0,
596
+ "PhaseCurrent": "NaN", "AxisSemi": "NaN", "Perihelion": "NaN",
597
+ "Aphelion": "NaN", "LeavingKepler": False}
598
+
599
+ @final
600
+ @staticmethod
601
+ def zh_name() -> LiteralString:
602
+ return "海洋行星"
603
+
@@ -45,7 +45,7 @@ class Pin(metaclass=_PinMeta):
45
45
  for name, a_pin in self.element_self.get_all_pins_property():
46
46
  if a_pin.fget(self.element_self) == self:
47
47
  return name
48
- assert False
48
+ errors.unreachable()
49
49
 
50
50
  def get_wires(self) -> List["Wire"]:
51
51
  ''' 获取该引脚上连接的所有导线