LumAPI 1.1.2__tar.gz → 1.1.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.
@@ -0,0 +1,21 @@
1
+ # LumAPI/__init__.py
2
+
3
+ # 显式导入所有需要对外暴露的类和函数
4
+ from .lumapi import (
5
+ lumapi, lumerical, LumFuncBase,
6
+ FDTD, MODE, DEVICE, INTERCONNECT,
7
+ savemat, loadmat,
8
+ create_cmap, set_colorbar_range,
9
+ Estimate_focal, Kirchhoff,
10
+ RayleighSommerfeld_Scalar, RayleighSommerfeld_Vector, AngularSpectrum_Vector
11
+ )
12
+
13
+ # 定义 import * 时对外暴露的接口白名单(这是静态检查器识别 import * 的关键)
14
+ __all__ = [
15
+ 'lumapi', 'lumerical', 'LumFuncBase',
16
+ 'FDTD', 'MODE', 'DEVICE', 'INTERCONNECT',
17
+ 'savemat', 'loadmat',
18
+ 'create_cmap', 'set_colorbar_range',
19
+ 'Estimate_focal', 'Kirchhoff',
20
+ 'RayleighSommerfeld_Scalar', 'RayleighSommerfeld_Vector', 'AngularSpectrum_Vector'
21
+ ]
@@ -1081,6 +1081,10 @@ class lumerical:
1081
1081
  except Exception:
1082
1082
  self.lumapi = None
1083
1083
 
1084
+ def __bool__(self):
1085
+ """判断配置是否成功,允许直接使用 if lumapi: 来判断"""
1086
+ return self.lumapi is not None
1087
+
1084
1088
  def _check_config_and_prompt(self):
1085
1089
  """核心逻辑:检查配置状态,若无效则引导用户使用 LumAPI 命令"""
1086
1090
  if self.lumapi is None: