pycoze 0.1.268__tar.gz → 0.1.270__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. {pycoze-0.1.268 → pycoze-0.1.270}/PKG-INFO +1 -1
  2. pycoze-0.1.270/pycoze/api/lib/tab_cls.py +66 -0
  3. {pycoze-0.1.268 → pycoze-0.1.270}/pycoze.egg-info/PKG-INFO +1 -1
  4. {pycoze-0.1.268 → pycoze-0.1.270}/setup.py +1 -1
  5. pycoze-0.1.268/pycoze/api/lib/tab_cls.py +0 -96
  6. {pycoze-0.1.268 → pycoze-0.1.270}/LICENSE +0 -0
  7. {pycoze-0.1.268 → pycoze-0.1.270}/README.md +0 -0
  8. {pycoze-0.1.268 → pycoze-0.1.270}/pycoze/__init__.py +0 -0
  9. {pycoze-0.1.268 → pycoze-0.1.270}/pycoze/ai/__init__.py +0 -0
  10. {pycoze-0.1.268 → pycoze-0.1.270}/pycoze/ai/llm/__init__.py +0 -0
  11. {pycoze-0.1.268 → pycoze-0.1.270}/pycoze/ai/llm/chat.py +0 -0
  12. {pycoze-0.1.268 → pycoze-0.1.270}/pycoze/ai/llm/text_to_image_prompt.py +0 -0
  13. {pycoze-0.1.268 → pycoze-0.1.270}/pycoze/ai/llm/think.py +0 -0
  14. {pycoze-0.1.268 → pycoze-0.1.270}/pycoze/ai/vram_reserve.py +0 -0
  15. {pycoze-0.1.268 → pycoze-0.1.270}/pycoze/api/__init__.py +0 -0
  16. {pycoze-0.1.268 → pycoze-0.1.270}/pycoze/api/lib/__init__.py +0 -0
  17. {pycoze-0.1.268 → pycoze-0.1.270}/pycoze/api/lib/view.py +0 -0
  18. {pycoze-0.1.268 → pycoze-0.1.270}/pycoze/api/lib/window_cls.py +0 -0
  19. {pycoze-0.1.268 → pycoze-0.1.270}/pycoze/bot/__init__.py +0 -0
  20. {pycoze-0.1.268 → pycoze-0.1.270}/pycoze/bot/agent/__init__.py +0 -0
  21. {pycoze-0.1.268 → pycoze-0.1.270}/pycoze/bot/agent/agent.py +0 -0
  22. {pycoze-0.1.268 → pycoze-0.1.270}/pycoze/bot/agent/agent_types/__init__.py +0 -0
  23. {pycoze-0.1.268 → pycoze-0.1.270}/pycoze/bot/agent/agent_types/const.py +0 -0
  24. {pycoze-0.1.268 → pycoze-0.1.270}/pycoze/bot/agent/agent_types/openai_func_call_agent.py +0 -0
  25. {pycoze-0.1.268 → pycoze-0.1.270}/pycoze/bot/agent/assistant.py +0 -0
  26. {pycoze-0.1.268 → pycoze-0.1.270}/pycoze/bot/agent/chat.py +0 -0
  27. {pycoze-0.1.268 → pycoze-0.1.270}/pycoze/bot/agent_chat.py +0 -0
  28. {pycoze-0.1.268 → pycoze-0.1.270}/pycoze/bot/bot.py +0 -0
  29. {pycoze-0.1.268 → pycoze-0.1.270}/pycoze/reference/__init__.py +0 -0
  30. {pycoze-0.1.268 → pycoze-0.1.270}/pycoze/reference/bot.py +0 -0
  31. {pycoze-0.1.268 → pycoze-0.1.270}/pycoze/reference/lib.py +0 -0
  32. {pycoze-0.1.268 → pycoze-0.1.270}/pycoze/reference/tool.py +0 -0
  33. {pycoze-0.1.268 → pycoze-0.1.270}/pycoze/reference/workflow.py +0 -0
  34. {pycoze-0.1.268 → pycoze-0.1.270}/pycoze/ui/__init__.py +0 -0
  35. {pycoze-0.1.268 → pycoze-0.1.270}/pycoze/ui/base.py +0 -0
  36. {pycoze-0.1.268 → pycoze-0.1.270}/pycoze/ui/color.py +0 -0
  37. {pycoze-0.1.268 → pycoze-0.1.270}/pycoze/ui/typ.py +0 -0
  38. {pycoze-0.1.268 → pycoze-0.1.270}/pycoze/ui/ui_def.py +0 -0
  39. {pycoze-0.1.268 → pycoze-0.1.270}/pycoze/utils/__init__.py +0 -0
  40. {pycoze-0.1.268 → pycoze-0.1.270}/pycoze/utils/arg.py +0 -0
  41. {pycoze-0.1.268 → pycoze-0.1.270}/pycoze/utils/env.py +0 -0
  42. {pycoze-0.1.268 → pycoze-0.1.270}/pycoze/utils/socket.py +0 -0
  43. {pycoze-0.1.268 → pycoze-0.1.270}/pycoze/utils/text_or_file.py +0 -0
  44. {pycoze-0.1.268 → pycoze-0.1.270}/pycoze.egg-info/SOURCES.txt +0 -0
  45. {pycoze-0.1.268 → pycoze-0.1.270}/pycoze.egg-info/dependency_links.txt +0 -0
  46. {pycoze-0.1.268 → pycoze-0.1.270}/pycoze.egg-info/top_level.txt +0 -0
  47. {pycoze-0.1.268 → pycoze-0.1.270}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pycoze
3
- Version: 0.1.268
3
+ Version: 0.1.270
4
4
  Summary: Package for pycoze only!
5
5
  Author: Yuan Jie Xiong
6
6
  Author-email: aiqqqqqqq@qq.com
@@ -0,0 +1,66 @@
1
+ import os
2
+ from .view import ViewCls, WorkflowCls
3
+ import time
4
+ from pycoze import utils
5
+
6
+
7
+ socket = utils.socket
8
+ params = utils.params
9
+
10
+ class TabCls:
11
+
12
+ def open_workflow(self, workflow_id: str, wait_for_open) -> WorkflowCls:
13
+ item_path = os.path.join(params["workspacePath"], 'workflow', workflow_id)
14
+ if not os.path.isabs(item_path):
15
+ item_path = os.path.abspath(item_path)
16
+ location = ["FileOrDir", item_path]
17
+ socket.post("add-tab", {"location": location, "name": "todo"})
18
+ if wait_for_open:
19
+ self._wait_for_tab_open(location)
20
+ return WorkflowCls(location)
21
+
22
+ def get_active(self) -> ViewCls:
23
+ result = socket.post_and_recv_result("get-active-tab", {})
24
+ return self._result_to_view(result)
25
+
26
+ def _wait_for_tab_open(self, location: list[str] | ViewCls):
27
+ times = 0
28
+ while not self.is_tab_open(location):
29
+ time.sleep(0.01)
30
+ times += 1
31
+ if times > 1000:
32
+ raise Exception("Tab open timeout")
33
+
34
+ def get_all(self) -> list[ViewCls]:
35
+ results = socket.post_and_recv_result("get-all-tabs", {})
36
+ return [self._result_to_view(result) for result in results]
37
+
38
+ def close_tab(self, location: list[str] | ViewCls):
39
+ if isinstance(location, ViewCls):
40
+ location = location.location
41
+ self.wait_for_tab_open(location)
42
+ socket.post("close-tab", {"location": location})
43
+
44
+ def switch_tab(self, location: list[str] | ViewCls):
45
+ if isinstance(location, ViewCls):
46
+ location = location.location
47
+ self.wait_for_tab_open(location)
48
+ socket.post("switchTab", {"location": location})
49
+
50
+ def is_tab_open(self, location: list[str] | ViewCls):
51
+ if isinstance(location, ViewCls):
52
+ location = location.location
53
+ result = socket.post_and_recv_result("is-tab-open", {"location": location})
54
+ return result
55
+
56
+ def pin_tab(self, location: list[str] | ViewCls):
57
+ if isinstance(location, ViewCls):
58
+ location = location.location
59
+ self.wait_for_tab_open(location)
60
+ socket.post("pin-tab", {"location": location})
61
+
62
+ def unpin_tab(self, location: list[str] | ViewCls):
63
+ if isinstance(location, ViewCls):
64
+ location = location.location
65
+ self.wait_for_tab_open(location)
66
+ socket.post("unpin-tab", {"location": location})
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pycoze
3
- Version: 0.1.268
3
+ Version: 0.1.270
4
4
  Summary: Package for pycoze only!
5
5
  Author: Yuan Jie Xiong
6
6
  Author-email: aiqqqqqqq@qq.com
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="pycoze",
5
- version="0.1.268",
5
+ version="0.1.270",
6
6
  packages=find_packages(),
7
7
  install_requires=[],
8
8
  author="Yuan Jie Xiong",
@@ -1,96 +0,0 @@
1
- import os
2
- from uuid import uuid4
3
- from view import ViewCls, WebsiteViewCls, FileViewCls, DirectoryViewCls, WorkflowCls
4
- import time
5
- from typing import Union
6
- from pycoze import utils
7
-
8
-
9
- socket = utils.socket
10
-
11
- class TabCls:
12
-
13
- def open_path(self, item_path: str) -> FileViewCls | DirectoryViewCls:
14
- if not os.path.isabs(item_path):
15
- item_path = os.path.abspath(item_path)
16
- if os.path.isdir(item_path):
17
- return self.open_dir(item_path)
18
- else:
19
- return self.open_file(item_path)
20
-
21
- def open_file(self, item_path: str) -> Union[FileViewCls, WebsiteViewCls, WorkflowCls]:
22
- if not os.path.isabs(item_path):
23
- item_path = os.path.abspath(item_path)
24
- location = ["FileOrDir", item_path]
25
- socket.post("add-tab", {"location": location, "name": os.path.basename(item_path)})
26
- lower_suffix = item_path.lower().split(".")[-1]
27
- if lower_suffix == 'workflow':
28
- return WorkflowCls(location)
29
- if len(location) > 1 and (location[0] == "Website" or location[1].endswith(".website") or location[1].endswith(".html") or location[1].endswith(".ipynb")):
30
- return WebsiteViewCls(location)
31
- return FileViewCls(location)
32
-
33
- def open_dir(self, item_path: str) -> DirectoryViewCls:
34
- if not os.path.isabs(item_path):
35
- item_path = os.path.abspath(item_path)
36
- location = ["FileOrDir", item_path]
37
- socket.post("add-tab", {"location": location, "name": os.path.basename(item_path)})
38
- return DirectoryViewCls(location)
39
-
40
- def get_active(self) -> ViewCls:
41
- result = socket.post_and_recv_result("get-active-tab", {})
42
- return self._result_to_view(result)
43
-
44
- def _result_to_view(self, result: list[str]) -> ViewCls:
45
- if result[0] == "Website":
46
- return WebsiteViewCls(result)
47
- elif result[0] == "FileOrDir":
48
- if os.path.isdir(result[1]):
49
- return DirectoryViewCls(result)
50
- else:
51
- if result[1].lower().split(".")[-1] == 'workflow':
52
- return WorkflowCls(result)
53
- return FileViewCls(result)
54
- return ViewCls(result)
55
-
56
- def wait_for_tab_open(self, location: list[str] | ViewCls):
57
- times = 0
58
- while not self.is_tab_open(location):
59
- time.sleep(0.01)
60
- times += 1
61
- if times > 1000:
62
- raise Exception("Tab open timeout")
63
-
64
- def get_all(self) -> list[ViewCls]:
65
- results = socket.post_and_recv_result("get-all-tabs", {})
66
- return [self._result_to_view(result) for result in results]
67
-
68
- def close_tab(self, location: list[str] | ViewCls):
69
- if isinstance(location, ViewCls):
70
- location = location.location
71
- self.wait_for_tab_open(location)
72
- socket.post("close-tab", {"location": location})
73
-
74
- def switch_tab(self, location: list[str] | ViewCls):
75
- if isinstance(location, ViewCls):
76
- location = location.location
77
- self.wait_for_tab_open(location)
78
- socket.post("switchTab", {"location": location})
79
-
80
- def is_tab_open(self, location: list[str] | ViewCls):
81
- if isinstance(location, ViewCls):
82
- location = location.location
83
- result = socket.post_and_recv_result("is-tab-open", {"location": location})
84
- return result
85
-
86
- def pin_tab(self, location: list[str] | ViewCls):
87
- if isinstance(location, ViewCls):
88
- location = location.location
89
- self.wait_for_tab_open(location)
90
- socket.post("pin-tab", {"location": location})
91
-
92
- def unpin_tab(self, location: list[str] | ViewCls):
93
- if isinstance(location, ViewCls):
94
- location = location.location
95
- self.wait_for_tab_open(location)
96
- socket.post("unpin-tab", {"location": location})
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes