oocana 0.16.3__py3-none-any.whl → 0.16.5__py3-none-any.whl

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.
oocana/context.py CHANGED
@@ -42,9 +42,10 @@ class Context:
42
42
  __tmp_dir: str
43
43
  __package_name: str | None = None
44
44
  _logger: Optional[logging.Logger] = None
45
+ __pkg_dir: str
45
46
 
46
47
  def __init__(
47
- self, inputs: Dict[str, Any], blockInfo: BlockInfo, mainframe: Mainframe, store, outputs, session_dir: str, tmp_dir: str, package_name: str
48
+ self, inputs: Dict[str, Any], blockInfo: BlockInfo, mainframe: Mainframe, store, outputs, session_dir: str, tmp_dir: str, package_name: str, pkg_dir: str
48
49
  ) -> None:
49
50
 
50
51
  self.__block_info = blockInfo
@@ -61,6 +62,7 @@ class Context:
61
62
  self.__session_dir = session_dir
62
63
  self.__tmp_dir = tmp_dir
63
64
  self.__package_name = package_name
65
+ self.__pkg_dir = pkg_dir
64
66
 
65
67
  @property
66
68
  def logger(self) -> logging.Logger:
@@ -90,6 +92,12 @@ class Context:
90
92
  """
91
93
  return os.path.join(self.__tmp_dir, self.__package_name) if self.__package_name else self.__tmp_dir
92
94
 
95
+ @property
96
+ def pkg_dir(self) -> str:
97
+ """a directory for the current package, all blocks in the this package will share the same directory. this directory will be cleaned if this session finish successfully, otherwise it will be kept for debugging or other purpose.
98
+ """
99
+ return self.__pkg_dir
100
+
93
101
  @property
94
102
  def keepAlive(self):
95
103
  return self.__keep_alive
oocana/data.py CHANGED
@@ -29,17 +29,10 @@ class JobDict(TypedDict):
29
29
  job_id: str
30
30
 
31
31
  class BlockDict(TypedDict):
32
-
33
- try:
34
- # NotRequired, Required was added in version 3.11
35
- from typing import NotRequired, Required, TypedDict # type: ignore
36
- except ImportError:
37
- from typing_extensions import NotRequired, Required, TypedDict
38
-
39
32
  session_id: str
40
33
  job_id: str
41
34
  stacks: list
42
- block_path: NotRequired[str]
35
+ block_path: str | None # better to use NotRequired here, but it is not supported in python 3.10 and type_extensions requires high version, For compatibility, use None instead of NotRequired.
43
36
 
44
37
  # dataclass 默认字段必须一一匹配
45
38
  # 如果多一个或者少一个字段,就会报错。
@@ -84,7 +77,7 @@ class BlockInfo:
84
77
  "session_id": self.session_id,
85
78
  "job_id": self.job_id,
86
79
  "stacks": self.stacks,
87
- }
80
+ } # type: ignore[return-value]
88
81
 
89
82
  return {
90
83
  "session_id": self.session_id,
@@ -1,10 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: oocana
3
- Version: 0.16.3
3
+ Version: 0.16.5
4
4
  Summary: python implement of oocana to give a context for oocana block
5
5
  License: MIT
6
6
  Requires-Python: >=3.9
7
7
  Requires-Dist: paho-mqtt>=2
8
8
  Requires-Dist: simplejson>=3.19.2
9
- Requires-Dist: typing-extensions>=4.12.2; python_version < "3.11"
10
9
 
@@ -1,13 +1,13 @@
1
- oocana-0.16.3.dist-info/METADATA,sha256=20SZh3gMN4GZ_Jop-Im8xcLXutV2f_TRltqr5EJ8lZo,287
2
- oocana-0.16.3.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
3
- oocana-0.16.3.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
1
+ oocana-0.16.5.dist-info/METADATA,sha256=YHY9ozLT5p_kcR2WKJnZLX908HaWBUje-xGUyoBZCfw,221
2
+ oocana-0.16.5.dist-info/WHEEL,sha256=tSfRZzRHthuv7vxpI4aehrdN9scLjk-dCJkPLzkHxGg,90
3
+ oocana-0.16.5.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
4
4
  oocana/__init__.py,sha256=zMrQ1asZoRE91-BShf1v2ibdThaMc07YtZt5iNbbxsg,281
5
- oocana/context.py,sha256=vdWg7oJOCPv7qFdMNBtYZ4y79il58gFUuighdSlbymA,12762
6
- oocana/data.py,sha256=ex042cqPHxqyRI8nuQBCguL1aLKX-7GGDughc-EAPqY,2939
5
+ oocana/context.py,sha256=9hVS9jSpetgwVgg-hBWlYRL8qpSr-uN5kSBvTV8KTNw,13151
6
+ oocana/data.py,sha256=0KpJyckz_X5JbrncBRFbOaU00CxcDx2UYHk6xuH1Poc,2890
7
7
  oocana/handle_data.py,sha256=p0iEvdsVV3BqcelM8rvq0a_VPI52SeahaGCszfhZ0TI,1927
8
8
  oocana/mainframe.py,sha256=Jixk9PjvJh7PnYwPGqOR5viwcOHWfaPhEiQFNHxHCxw,5219
9
9
  oocana/preview.py,sha256=sAKcVUFmOMvrzYLrvqAxd26SppSvK1qJqRTHdAS-KDc,1959
10
10
  oocana/schema.py,sha256=8LwMaW4eXa3EmKxR4kzyTOpZiClMRMMsMA6f9CXodW4,4332
11
11
  oocana/service.py,sha256=dPCcScQfMBlEjIodFnKU17-HlbBzrQbQK6CNRw7SmOE,2442
12
12
  oocana/throtter.py,sha256=xTldm2OZ5uYPiyC6Aatug4FJAoMylPjtXftxHvSr_50,1104
13
- oocana-0.16.3.dist-info/RECORD,,
13
+ oocana-0.16.5.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: pdm-backend (2.4.3)
2
+ Generator: pdm-backend (2.4.4)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any