pycgraph 3.2__cp313-cp313-win_amd64.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.
Files changed (55) hide show
  1. pycgraph-3.2.dist-info/METADATA +40 -0
  2. pycgraph-3.2.dist-info/RECORD +55 -0
  3. pycgraph-3.2.dist-info/WHEEL +5 -0
  4. pycgraph-3.2.dist-info/top_level.txt +5 -0
  5. pycgraph.cp313-win_amd64.pyd +0 -0
  6. setup.py +77 -0
  7. tutorial/MyGAspect/MyConnApsect.py +27 -0
  8. tutorial/MyGAspect/MyTimerAspect.py +23 -0
  9. tutorial/MyGAspect/__init__.py +7 -0
  10. tutorial/MyGCondition/MyCondition.py +13 -0
  11. tutorial/MyGCondition/MyParamCondition.py +22 -0
  12. tutorial/MyGCondition/__init__.py +7 -0
  13. tutorial/MyGDaemon/MyMonitorDaemon.py +17 -0
  14. tutorial/MyGDaemon/__init__.py +7 -0
  15. tutorial/MyGEvent/MyPrintEvent.py +20 -0
  16. tutorial/MyGEvent/__init__.py +7 -0
  17. tutorial/MyGMutable/MyMutable.py +45 -0
  18. tutorial/MyGMutable/__init__.py +7 -0
  19. tutorial/MyGNode/HelloCGraphNode.py +14 -0
  20. tutorial/MyGNode/MyEventNode.py +18 -0
  21. tutorial/MyGNode/MyHoldNode.py +27 -0
  22. tutorial/MyGNode/MyMatchNode.py +31 -0
  23. tutorial/MyGNode/MyNode1.py +18 -0
  24. tutorial/MyGNode/MyNode2.py +26 -0
  25. tutorial/MyGNode/MyReadParamNode.py +20 -0
  26. tutorial/MyGNode/MyStageNode.py +27 -0
  27. tutorial/MyGNode/MyTemplateNode.py +20 -0
  28. tutorial/MyGNode/MyWriteParamNode.py +26 -0
  29. tutorial/MyGNode/__init__.py +7 -0
  30. tutorial/MyParams/MyParam.py +17 -0
  31. tutorial/MyParams/__init__.py +7 -0
  32. tutorial/T00-HelloCGraph.py +21 -0
  33. tutorial/T01-Simple.py +41 -0
  34. tutorial/T02-Cluster.py +31 -0
  35. tutorial/T03-Region.py +33 -0
  36. tutorial/T04-Complex.py +37 -0
  37. tutorial/T05-Param.py +37 -0
  38. tutorial/T06-Condition.py +43 -0
  39. tutorial/T07-MultiPipeline.py +56 -0
  40. tutorial/T08-Template.py +27 -0
  41. tutorial/T09-Aspect.py +31 -0
  42. tutorial/T10-AspectParam.py +31 -0
  43. tutorial/T12-Function.py +55 -0
  44. tutorial/T13-Daemon.py +30 -0
  45. tutorial/T14-Hold.py +26 -0
  46. tutorial/T18-Event.py +32 -0
  47. tutorial/T19-Cancel.py +45 -0
  48. tutorial/T20-Suspend.py +43 -0
  49. tutorial/T21-MultiCondition.py +31 -0
  50. tutorial/T22-Timeout.py +42 -0
  51. tutorial/T24-Fence.py +34 -0
  52. tutorial/T26-Mutable.py +30 -0
  53. tutorial/T27-Trim.py +33 -0
  54. tutorial/T28-Stage.py +32 -0
  55. tutorial/__init__.py +7 -0
@@ -0,0 +1,40 @@
1
+ Metadata-Version: 2.4
2
+ Name: pycgraph
3
+ Version: 3.2
4
+ Summary: CGraph with python api wrapper by pybind11
5
+ Home-page: https://github.com/ChunelFeng/CGraph
6
+ Author: Chunel
7
+ Author-email: chunel@foxmail.com
8
+ License: MIT
9
+ Keywords: pycgraph,CGraph,dag,parallel,airflow,taskflow,workflow,pybind11
10
+ Classifier: Development Status :: 5 - Production/Stable
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.8
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: C++
20
+ Classifier: Operating System :: Unix
21
+ Classifier: Operating System :: MacOS :: MacOS X
22
+ Classifier: Operating System :: Microsoft :: Windows
23
+ Classifier: License :: OSI Approved :: MIT License
24
+ Classifier: Natural Language :: Chinese (Simplified)
25
+ Classifier: Natural Language :: English
26
+ Requires-Python: >=3.8
27
+ Description-Content-Type: text/markdown
28
+ Requires-Dist: pybind11
29
+ Dynamic: author
30
+ Dynamic: author-email
31
+ Dynamic: classifier
32
+ Dynamic: description
33
+ Dynamic: description-content-type
34
+ Dynamic: home-page
35
+ Dynamic: keywords
36
+ Dynamic: license
37
+ Dynamic: requires-python
38
+ Dynamic: summary
39
+
40
+ You can get everything in CGraph github main page : [CGraph](https://github.com/ChunelFeng/CGraph)
@@ -0,0 +1,55 @@
1
+ pycgraph.cp313-win_amd64.pyd,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ setup.py,sha256=1k6BM6JIsN6XQfue-VaMdqFEi-pTwAJ8Z0jl74NiwhY,2665
3
+ tutorial/T00-HelloCGraph.py,sha256=09iZYnHnDes7zv6csu0M3M8JSaa-IH_hn-18cAy2LHs,400
4
+ tutorial/T01-Simple.py,sha256=YH_rBSaKPOmEbaPkHL6g4o5RvMDmbYKK6d7-Eq1VjJk,1165
5
+ tutorial/T02-Cluster.py,sha256=ErcDI6_z6QMlinWbYvX93pJT5ds1Y5LvJ2IloPobN_E,833
6
+ tutorial/T03-Region.py,sha256=rwkS-k8Ls2RhVgzCXYgl2rS_OXL5QW0VyZHvWeGQOt0,752
7
+ tutorial/T04-Complex.py,sha256=8hoq65dJ-xA4R4gj0NSdoMkRwZzhtaWC7GuK0mBB-90,1220
8
+ tutorial/T05-Param.py,sha256=xBp5fBDPwrlUv8nvofDOM7LG2RmHRCzWQrc7PXcicpk,1059
9
+ tutorial/T06-Condition.py,sha256=n8u6tHGwSxKAJ_oyRa0aoGenLEiYijt876_cAsa7SDQ,1370
10
+ tutorial/T07-MultiPipeline.py,sha256=fJCWuancVy2KwGLFtafCZrMMDa_TNmaPFm15lUoERkE,1433
11
+ tutorial/T08-Template.py,sha256=BBawOZbCOUgMPkP38VlNgMwQnGdmlStOkeg_RF3tJ-I,613
12
+ tutorial/T09-Aspect.py,sha256=0sPK9uiUaU671Mz-crPsKL9FjEwBNjlCrgndJ7kYQsA,775
13
+ tutorial/T10-AspectParam.py,sha256=BYpS_W4nzy6l2Kum72LU9WFcl7D0VmxRPGEWkR6ATDs,787
14
+ tutorial/T12-Function.py,sha256=ewTtO1VRe3JQjGjqCYJVI8G1H6ZPxSTn2IZvRop5Sbo,1573
15
+ tutorial/T13-Daemon.py,sha256=Izn0eIEyo0h5IF52D92ZncMC-lj4OXNQJkOGtFBR-JI,642
16
+ tutorial/T14-Hold.py,sha256=Cm9MgZUMmSmP7TyCLfAcdFqrq7gFVLLHb1EfA48EUF4,493
17
+ tutorial/T18-Event.py,sha256=wRWS4llBmDHpYKY-0kbB8rcn4Roz7iEjUGkHJ2vs29k,800
18
+ tutorial/T19-Cancel.py,sha256=aZs1zsKzZbRH5uMJ9nOLBM_mgUhZkoU8CmijsLlc_ug,1075
19
+ tutorial/T20-Suspend.py,sha256=3njl_tFd9i4VsW7fm3XtIiZpYaIs2N9Ru4-TAx2wVh8,998
20
+ tutorial/T21-MultiCondition.py,sha256=thS87aMkBfW946xdnWdMq6NgYF7_DQlxabqFHb4Li5g,995
21
+ tutorial/T22-Timeout.py,sha256=kFyD64BZBgVsvAdvl6U-y6nkTvGtzECjXrLDEelwjho,1203
22
+ tutorial/T24-Fence.py,sha256=5v1MbvnzMHb0PgDutxigWEIB35qFk7C3InrKDjO18Ec,933
23
+ tutorial/T26-Mutable.py,sha256=TPB5-hr0uvfGxZV0M_ohIEr1lK-vJVf6mZKV6RH4ki0,779
24
+ tutorial/T27-Trim.py,sha256=i5cuvOa1VN_lWDV0D2q7WmJWbRL_1rHlt7nnTbeZr4Q,728
25
+ tutorial/T28-Stage.py,sha256=Stw2PY5siV3rkTWPzk0OEdeXpckG0STG9yXc6REviag,785
26
+ tutorial/__init__.py,sha256=cH_cC6GOKFh3db3JqsndTjfDESTBOz9w6aOwiot_ttw,103
27
+ tutorial/MyGAspect/MyConnApsect.py,sha256=2jV4WRT_rG40ONYPG-I60ku5EHqwLzypDE1dasyqODo,807
28
+ tutorial/MyGAspect/MyTimerAspect.py,sha256=xOlpr0tn6bz65Dh6h2jOLZqjSBEuu8JUhGTXxjDl8H0,531
29
+ tutorial/MyGAspect/__init__.py,sha256=DlRqf8zVvHEL1k7dPryi_jGqoSqDMNxan3OKRJfX-3k,109
30
+ tutorial/MyGCondition/MyCondition.py,sha256=GcO5cn806Y0C-4Nkw0L1047NKPxgVpQ5-iOEwgncoFw,220
31
+ tutorial/MyGCondition/MyParamCondition.py,sha256=AEfNONGPmuDHjdGast7wPHJzmIPeHEaEz2nef5u3BxI,510
32
+ tutorial/MyGCondition/__init__.py,sha256=axQK3GBC7UuZ5raBUi0ESUHkCe_4MpernSpyNlsxjsA,110
33
+ tutorial/MyGDaemon/MyMonitorDaemon.py,sha256=sqyWEhQklxdgMcllkCWtdYbN0iZK8haGmHT1ibsHRds,451
34
+ tutorial/MyGDaemon/__init__.py,sha256=yKiffFNh4G9MFpQiZGI7FswQtqjSBmc3CxRouy4IUXc,110
35
+ tutorial/MyGEvent/MyPrintEvent.py,sha256=7bDpzuh9zMkhZUvsZmRGVBaxZlUP-YitNSy0Bja8Qy4,425
36
+ tutorial/MyGEvent/__init__.py,sha256=nliD92iCKxHm_sLes9ln80FwHFOMOiQPmre8CLvrHu0,110
37
+ tutorial/MyGMutable/MyMutable.py,sha256=Q4gw30i96M8DgfgnS1IEx1-XfEY-0LG8FjUO9ClLvv0,1603
38
+ tutorial/MyGMutable/__init__.py,sha256=HcnPQ9Lwsp7sOMuOMTOWyXENYi3mG3z0A--EEYXUoPk,109
39
+ tutorial/MyGNode/HelloCGraphNode.py,sha256=7i9n0ckZCZGJqJTcXpHva1fSfx1tl4-xZwy0przEg6U,269
40
+ tutorial/MyGNode/MyEventNode.py,sha256=5vd76gbZ0-2fTBdQaxdfpIXvdprcGoAEdHPT2h80fvw,492
41
+ tutorial/MyGNode/MyHoldNode.py,sha256=4VOuSAzLNruNuixSgYk5a3PbL86VQpEHYqbub3fdulY,703
42
+ tutorial/MyGNode/MyMatchNode.py,sha256=WCZyhNK8hkjRrcs3HxwwGUAhlOQMCDvK5zu7VHN0t48,755
43
+ tutorial/MyGNode/MyNode1.py,sha256=m06gvU3qOZNDJQGYcEKtXLfPDTq4jdQChIUXJ7hI0AY,405
44
+ tutorial/MyGNode/MyNode2.py,sha256=JPJ2e9Yjfa9j8h5GpzpXiDIdCyw4sPx5eppCDjUpZsY,682
45
+ tutorial/MyGNode/MyReadParamNode.py,sha256=G94YmDDSiTF6ihQA-khjriMMnKMz61XKYx0zQ0wfNEE,473
46
+ tutorial/MyGNode/MyStageNode.py,sha256=oKGwOmdJ8Jkw14l1rNoQOS0yzu5I1XEnNR3lFn4QjIc,758
47
+ tutorial/MyGNode/MyTemplateNode.py,sha256=YF1nG3JG3gBio4cFzD1suOkkl0yn-aE40w_uwmqGjus,497
48
+ tutorial/MyGNode/MyWriteParamNode.py,sha256=wIH5Bmu-ljp07aQYk1nykkscUYQDjEG03t7xUNDqMZQ,605
49
+ tutorial/MyGNode/__init__.py,sha256=avSBZ1mOnoDuU8rzpV3eg0qSz8_TENIbO44ZmrBVY1M,110
50
+ tutorial/MyParams/MyParam.py,sha256=LTiibJRAivG9jrZsGiHqoG0LzJF9jTjN44KzpTy9BIM,286
51
+ tutorial/MyParams/__init__.py,sha256=YEFEaZ5wflfE4JsuxHQmyxjemdJbfpotzmI4y_kLbcs,110
52
+ pycgraph-3.2.dist-info/METADATA,sha256=wHEfqNK2LM9OjCzskSrGps0bQRd4gri8xXViqe1Qm5g,1496
53
+ pycgraph-3.2.dist-info/WHEEL,sha256=qV0EIPljj1XC_vuSatRWjn02nZIz3N1t8jsZz7HBr2U,101
54
+ pycgraph-3.2.dist-info/top_level.txt,sha256=7N8qdft-4K2RHUBo7OXqg4ioeYlKuNgxdp8GShcGXRc,38
55
+ pycgraph-3.2.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: false
4
+ Tag: cp313-cp313-win_amd64
5
+
@@ -0,0 +1,5 @@
1
+ build
2
+ pycgraph
3
+ setup
4
+ tutorial
5
+ wrapper
File without changes
setup.py ADDED
@@ -0,0 +1,77 @@
1
+ """
2
+ @Author: Chunel
3
+ @Contact: chunel@foxmail.com
4
+ @File: setup
5
+ @Time: 2025/3/6 23:25
6
+ @Desc:
7
+ """
8
+
9
+ import glob
10
+ from setuptools import setup, Extension
11
+ import pybind11
12
+
13
+ __PYCGRAPH_NAME__ = "pycgraph"
14
+ __PYCGRAPH_VERSION__ = "3.2"
15
+ __PYCGRAPH_AUTHOR__ = "Chunel"
16
+ __PYCGRAPH_AUTHOR_EMAIL__ = "chunel@foxmail.com"
17
+ __PYCGRAPH_DESCRIPTION__ = "CGraph with python api wrapper by pybind11"
18
+ __PYCGRAPH_URL__ = "https://github.com/ChunelFeng/CGraph"
19
+ __PYCGRAPH_LICENSE__ = "MIT"
20
+ __PYCGRAPH_LONG_DESCRIPTION__ = 'You can get everything in CGraph github main page : [CGraph](https://github.com/ChunelFeng/CGraph)'
21
+ __PYCGRAPH_KEYWORDS__ = [__PYCGRAPH_NAME__,
22
+ "CGraph",
23
+ "dag",
24
+ "parallel",
25
+ "airflow",
26
+ "taskflow",
27
+ "workflow",
28
+ "pybind11"]
29
+
30
+ _sources = ['PyCGraph.cpp'] + glob.glob("../src/**/*.cpp", recursive=True)
31
+ _extra_compile_args = ["-pthread",
32
+ "-std=c++11",
33
+ "-fvisibility=hidden"]
34
+ _include_dirs = [pybind11.get_include(),
35
+ "../src"]
36
+ _ext_modules = [
37
+ Extension(
38
+ name=__PYCGRAPH_NAME__,
39
+ sources=_sources,
40
+ extra_compile_args=_extra_compile_args,
41
+ include_dirs=_include_dirs,
42
+ ),
43
+ ]
44
+
45
+ setup(
46
+ name=__PYCGRAPH_NAME__,
47
+ version=__PYCGRAPH_VERSION__,
48
+ author=__PYCGRAPH_AUTHOR__,
49
+ author_email=__PYCGRAPH_AUTHOR_EMAIL__,
50
+ description=__PYCGRAPH_DESCRIPTION__,
51
+ url=__PYCGRAPH_URL__,
52
+ license=__PYCGRAPH_LICENSE__,
53
+ ext_modules=_ext_modules,
54
+ zip_safe=False,
55
+ long_description=__PYCGRAPH_LONG_DESCRIPTION__,
56
+ long_description_content_type="text/markdown",
57
+ python_requires=">=3.8",
58
+ keywords=__PYCGRAPH_KEYWORDS__,
59
+ classifiers=[
60
+ "Development Status :: 5 - Production/Stable",
61
+ "Intended Audience :: Developers",
62
+ "Programming Language :: Python :: 3",
63
+ "Programming Language :: Python :: 3.8",
64
+ "Programming Language :: Python :: 3.9",
65
+ "Programming Language :: Python :: 3.10",
66
+ "Programming Language :: Python :: 3.11",
67
+ "Programming Language :: Python :: 3.12",
68
+ "Programming Language :: Python :: 3.13",
69
+ "Programming Language :: C++",
70
+ "Operating System :: Unix",
71
+ "Operating System :: MacOS :: MacOS X",
72
+ "Operating System :: Microsoft :: Windows",
73
+ "License :: OSI Approved :: MIT License",
74
+ "Natural Language :: Chinese (Simplified)",
75
+ "Natural Language :: English",
76
+ ]
77
+ )
@@ -0,0 +1,27 @@
1
+ """
2
+ @Author: Chunel
3
+ @Contact: chunel@foxmail.com
4
+ @File: MyConnApsect
5
+ @Time: 2025/3/30 21:13
6
+ @Desc:
7
+ """
8
+
9
+ from PyCGraph import GAspect, CStatus
10
+
11
+ class MyConnAspect(GAspect):
12
+ def __init__(self, ip: str, port: int):
13
+ super().__init__()
14
+ self.ip_ = ip
15
+ self.port_ = port
16
+
17
+ def beginRun(self):
18
+ print(' ----> [MyConnAspect] [{0} : {1}] has been connected...'.format(self.ip_, self.port_))
19
+ return CStatus()
20
+
21
+ def finishRun(self, curStatus: CStatus):
22
+ if curStatus.isOK():
23
+ print(' <---- [MyConnAspect] [{0} : {1}] has been connected...'.format(self.ip_, self.port_))
24
+ else:
25
+ print(' <---- [MyConnAspect] [{0} : {1}] is already been disconnected...'.format(self.ip_, self.port_))
26
+ return
27
+
@@ -0,0 +1,23 @@
1
+ """
2
+ @Author: Chunel
3
+ @Contact: chunel@foxmail.com
4
+ @File: MyTimerAspect
5
+ @Time: 2025/3/5 23:38
6
+ @Desc:
7
+ """
8
+
9
+ import time
10
+
11
+ from PyCGraph import GAspect, CStatus
12
+
13
+ class MyTimerAspect(GAspect):
14
+ _start_time = None
15
+
16
+ def beginRun(self):
17
+ self._start_time = time.time()
18
+ return CStatus()
19
+
20
+ def finishRun(self, curStatus: CStatus):
21
+ span = time.time() - self._start_time
22
+ print('----> [MyTimerAspect] {0} time cost is : {1}s'.format(self.getName(), round(span, 2)))
23
+ return
@@ -0,0 +1,7 @@
1
+ """
2
+ @Author: Chunel
3
+ @Contact: chunel@foxmail.com
4
+ @File: __init__.py
5
+ @Time: 2025/3/5 23:38
6
+ @Desc:
7
+ """
@@ -0,0 +1,13 @@
1
+ """
2
+ @Author: Chunel
3
+ @Contact: chunel@foxmail.com
4
+ @File: MyCondition
5
+ @Time: 2025/2/25 23:37
6
+ @Desc:
7
+ """
8
+
9
+ from PyCGraph import GCondition
10
+
11
+ class MyCondition(GCondition):
12
+ def choose(self):
13
+ return 1
@@ -0,0 +1,22 @@
1
+ """
2
+ @Author: Chunel
3
+ @Contact: chunel@foxmail.com
4
+ @File: MyParamCondition
5
+ @Time: 2025/3/2 13:49
6
+ @Desc:
7
+ """
8
+
9
+
10
+ from PyCGraph import GCondition, GElementRelation
11
+
12
+ from MyParams.MyParam import MyParam
13
+
14
+ class MyParamCondition(GCondition):
15
+ def choose(self):
16
+ param: MyParam = self.getGParamWithNoEmpty("param1")
17
+ param.lock()
18
+ cnt = param.count
19
+ param.unlock()
20
+
21
+ relation: GElementRelation = self.getRelation()
22
+ return cnt % len(relation.children)
@@ -0,0 +1,7 @@
1
+ """
2
+ @Author: Chunel
3
+ @Contact: chunel@foxmail.com
4
+ @File: __init__.py
5
+ @Time: 2025/2/25 23:36
6
+ @Desc:
7
+ """
@@ -0,0 +1,17 @@
1
+ """
2
+ @Author: Chunel
3
+ @Contact: chunel@foxmail.com
4
+ @File: MyMonitorDaemon
5
+ @Time: 2025/3/30 00:49
6
+ @Desc:
7
+ """
8
+
9
+ from PyCGraph import GDaemon
10
+
11
+ from MyParams.MyParam import MyParam
12
+
13
+ class MyMonitorGDaemon(GDaemon):
14
+ def daemonTask(self, _):
15
+ param: MyParam = self.getGParamWithNoEmpty('param1')
16
+ print("----> [MyMonitorDaemon] monitor span is [{0}] ms, count is [{1}]".format(
17
+ self.getInterval(), param.count))
@@ -0,0 +1,7 @@
1
+ """
2
+ @Author: Chunel
3
+ @Contact: chunel@foxmail.com
4
+ @File: __init__.py
5
+ @Time: 2025/3/30 00:48
6
+ @Desc:
7
+ """
@@ -0,0 +1,20 @@
1
+ """
2
+ @Author: Chunel
3
+ @Contact: chunel@foxmail.com
4
+ @File: MyPrintEvent
5
+ @Time: 2025/3/22 00:37
6
+ @Desc:
7
+ """
8
+
9
+ import time
10
+
11
+ from PyCGraph import GEvent
12
+
13
+ class MyPrintEvent(GEvent):
14
+ _times: int = 0
15
+
16
+ def trigger(self, _):
17
+ time.sleep(1)
18
+ p1 = self.getGParamWithNoEmpty('param1')
19
+ self._times += 1
20
+ print(' ----> trigger {0} times, val = {1}'.format( self._times, p1.value))
@@ -0,0 +1,7 @@
1
+ """
2
+ @Author: Chunel
3
+ @Contact: chunel@foxmail.com
4
+ @File: __init__.py
5
+ @Time: 2025/3/22 00:37
6
+ @Desc:
7
+ """
@@ -0,0 +1,45 @@
1
+ """
2
+ @Author: Chunel
3
+ @Contact: chunel@foxmail.com
4
+ @File: MyMutable
5
+ @Time: 2025/4/9 00:05
6
+ @Desc:
7
+ """
8
+
9
+ from typing import List
10
+
11
+ from PyCGraph import GMutable, CStatus, GElement
12
+
13
+ from MyParams.MyParam import MyParam
14
+
15
+ class MyMutable(GMutable):
16
+ def reshape(self, elements: List[GElement]) -> CStatus:
17
+ param: MyParam = self.getGParamWithNoEmpty('param1')
18
+ cnt = param.count % 4
19
+ if 0 == cnt:
20
+ print(" ---- run as a->[b,c]")
21
+ elements[1].addDependGElements({elements[0]})
22
+ elements[2].addDependGElements({elements[0]})
23
+ elements[0].setVisible(True) # must set all used elements visible
24
+ elements[1].setVisible(True)
25
+ elements[2].setVisible(True)
26
+ elif 1 == cnt:
27
+ print(" ---- run as c(*3)->b->a")
28
+ elements[0].addDependGElements({elements[1]})
29
+ elements[1].addDependGElements({elements[2]})
30
+ elements[0].setVisible(True)
31
+ elements[1].setVisible(True)
32
+ elements[2].setVisible(True)
33
+ elements[2].setLoop(3)
34
+ elif 2 == cnt:
35
+ print(" ---- run as a->c, do not run b")
36
+ elements[2].addDependGElements({elements[0]})
37
+ elements[0].setVisible(True)
38
+ elements[2].setVisible(True)
39
+ elif 3 == cnt:
40
+ print(" ---- run as [a,b(*2),c]")
41
+ elements[0].setVisible(True)
42
+ elements[1].setVisible(True)
43
+ elements[1].setLoop(2)
44
+ elements[2].setVisible(True)
45
+ return CStatus()
@@ -0,0 +1,7 @@
1
+ """
2
+ @Author: Chunel
3
+ @Contact: chunel@foxmail.com
4
+ @File: __init__.py
5
+ @Time: 2025/4/9 00:05
6
+ @Desc:
7
+ """
@@ -0,0 +1,14 @@
1
+ """
2
+ @Author: Chunel
3
+ @Contact: chunel@foxmail.com
4
+ @File: HelloCGraphPyNode
5
+ @Time: 2025/2/21 23:30
6
+ @Desc:
7
+ """
8
+
9
+ from PyCGraph import GNode, CStatus
10
+
11
+ class HelloCGraphNode(GNode):
12
+ def run(self):
13
+ print("Hello, PyCGraph.")
14
+ return CStatus()
@@ -0,0 +1,18 @@
1
+ """
2
+ @Author: Chunel
3
+ @Contact: chunel@foxmail.com
4
+ @File: MyEventNode
5
+ @Time: 2025/3/22 01:46
6
+ @Desc:
7
+ """
8
+
9
+ from datetime import datetime
10
+
11
+ from PyCGraph import GNode, CStatus, GEventType
12
+
13
+ class MyEventNode(GNode):
14
+ def run(self):
15
+ print('[{0}] before event notify, {1}'.format(datetime.now(), self.getName()))
16
+ self.notify('event1', GEventType.SYNC)
17
+ print('[{0}] after event notify, {1}'.format(datetime.now(), self.getName()))
18
+ return CStatus()
@@ -0,0 +1,27 @@
1
+ """
2
+ @Author: Chunel
3
+ @Contact: chunel@foxmail.com
4
+ @File: MyHoldNode
5
+ @Time: 2025/3/4 00:08
6
+ @Desc:
7
+ """
8
+
9
+ from PyCGraph import GNode, CStatus
10
+
11
+ from MyParams.MyParam import MyParam
12
+
13
+ class MyHoldNode(GNode):
14
+ _param_key = 'hold-param'
15
+ def init(self):
16
+ return self.createGParam(MyParam(), self._param_key)
17
+
18
+ def run(self):
19
+ param: MyParam = self.getGParam(self._param_key)
20
+ param.value += 1
21
+ print('current value is {0}'.format(param.value))
22
+ return CStatus()
23
+
24
+ def isHold(self):
25
+ param: MyParam = self.getGParam(self._param_key)
26
+ print('enter hold path, value is {0}'.format(param.value))
27
+ return param.value < 3
@@ -0,0 +1,31 @@
1
+ """
2
+ @Author: Chunel
3
+ @Contact: chunel@foxmail.com
4
+ @File: MyMatchNode
5
+ @Time: 2025/3/7 23:54
6
+ @Desc:
7
+ """
8
+
9
+ import time
10
+ from datetime import datetime
11
+
12
+ from PyCGraph import GNode, CStatus
13
+
14
+ from MyParams.MyParam import MyParam
15
+
16
+
17
+ class MyMatchNode(GNode):
18
+ def run(self):
19
+ time.sleep(1)
20
+ print("[{0}] run MyMatchNode: {1}".format(datetime.now(), self.getName()))
21
+
22
+ return CStatus()
23
+
24
+ def isMatch(self):
25
+ param: MyParam = self.getGParamWithNoEmpty('param1')
26
+ result = 0 != param.count % 2
27
+ if result:
28
+ print(' match, ready to run {0}'.format(self.getName()))
29
+ else:
30
+ print(' not match, will not run {0}'.format(self.getName()))
31
+ return result
@@ -0,0 +1,18 @@
1
+ """
2
+ @Author: Chunel
3
+ @Contact: chunel@foxmail.com
4
+ @File: MyNode1
5
+ @Time: 2025/2/21 23:47
6
+ @Desc:
7
+ """
8
+
9
+ from datetime import datetime
10
+ import time
11
+
12
+ from PyCGraph import GNode, CStatus
13
+
14
+ class MyNode1(GNode):
15
+ def run(self):
16
+ print("[{0}] {1}, enter MyNode1 run function. Sleep for 1 second ... ".format(datetime.now(), self.getName()))
17
+ time.sleep(1)
18
+ return CStatus()
@@ -0,0 +1,26 @@
1
+ """
2
+ @Author: Chunel
3
+ @Contact: chunel@foxmail.com
4
+ @File: MyPyNode2
5
+ @Time: 2025/2/21 23:48
6
+ @Desc:
7
+ """
8
+
9
+ from datetime import datetime
10
+ import time
11
+
12
+ from PyCGraph import GNode, CStatus
13
+
14
+ class MyNode2(GNode):
15
+ def init(self):
16
+ print("[INIT] [{0}], enter MyNode2 init function.".format(self.getName()))
17
+ return CStatus()
18
+
19
+ def run(self):
20
+ print("[{0}] {1}, enter MyNode2 run function. Sleep for 2 second ... ".format(datetime.now(), self.getName()))
21
+ time.sleep(2)
22
+ return CStatus()
23
+
24
+ def destroy(self):
25
+ print("[DESTROY] [{0}], enter MyNode2 destroy function.".format(self.getName()))
26
+ return CStatus()
@@ -0,0 +1,20 @@
1
+ """
2
+ @Author: Chunel
3
+ @Contact: chunel@foxmail.com
4
+ @File: MyReadParamNode
5
+ @Time: 2025/2/27 23:42
6
+ @Desc:
7
+ """
8
+
9
+ from PyCGraph import GNode, CStatus
10
+
11
+ from MyParams.MyParam import MyParam
12
+
13
+
14
+ class MyReadParamNode(GNode):
15
+ def run(self):
16
+ param = self.getGParamWithNoEmpty("param1")
17
+ param.lock()
18
+ print('[{0}] value is {1}, count is {2}'.format(self.getName(), param.value, param.count))
19
+ param.unlock()
20
+ return CStatus()
@@ -0,0 +1,27 @@
1
+ """
2
+ @Author: Chunel
3
+ @Contact: chunel@foxmail.com
4
+ @File: MyStageNode
5
+ @Time: 2025/4/4 01:16
6
+ @Desc:
7
+ """
8
+
9
+ import time
10
+ from datetime import datetime
11
+
12
+ from PyCGraph import GNode, CStatus
13
+
14
+ class MyStageNode(GNode):
15
+ def __init__(self, before: int, after: int):
16
+ super().__init__()
17
+ self._before = before
18
+ self._after = after
19
+
20
+ def run(self):
21
+ time.sleep(self._before)
22
+ print('[{0}] ----> {1} wait {2}s before enter stage'.format(datetime.now(), self.getName(), self._before))
23
+
24
+ status: CStatus = self.enterStage('stage1')
25
+ print('[{0}] <---- {1} wait {2}s after enter stage'.format(datetime.now(), self.getName(), self._after))
26
+ time.sleep(self._after)
27
+ return status
@@ -0,0 +1,20 @@
1
+ """
2
+ @Author: Chunel
3
+ @Contact: chunel@foxmail.com
4
+ @File: MyTemplateNode
5
+ @Time: 2025/4/2 00:02
6
+ @Desc:
7
+ """
8
+
9
+ from PyCGraph import GNode, CStatus
10
+
11
+
12
+ class MyTemplateNode(GNode):
13
+ def __init__(self, num: int, score: float):
14
+ super().__init__() # must call super init function
15
+ self._num = num
16
+ self._score = score
17
+
18
+ def run(self):
19
+ print('[{0}] num = [{1}], score = [{2}]'.format(self.getName(), self._num, self._score))
20
+ return CStatus()
@@ -0,0 +1,26 @@
1
+ """
2
+ @Author: Chunel
3
+ @Contact: chunel@foxmail.com
4
+ @File: MyWriteParamNode
5
+ @Time: 2025/2/27 23:42
6
+ @Desc:
7
+ """
8
+
9
+
10
+ from PyCGraph import GNode, CStatus
11
+
12
+ from MyParams.MyParam import MyParam
13
+
14
+ class MyWriteParamNode(GNode):
15
+ def init(self):
16
+ return self.createGParam(MyParam(), "param1")
17
+
18
+ def run(self):
19
+ param: MyParam = self.getGParam("param1")
20
+
21
+ param.lock()
22
+ param.count += 1
23
+ param.value += 1
24
+ print('[{0}] value is {1}, count is {2}'.format(self.getName(), param.value, param.count))
25
+ param.unlock()
26
+ return CStatus()
@@ -0,0 +1,7 @@
1
+ """
2
+ @Author: Chunel
3
+ @Contact: chunel@foxmail.com
4
+ @File: __init__.py
5
+ @Time: 2025/2/21 23:26
6
+ @Desc:
7
+ """