pbesa 3.1.3__tar.gz → 4.0.0__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 (193) hide show
  1. pbesa-4.0.0/.gitignore +15 -0
  2. pbesa-4.0.0/LICENSE +21 -0
  3. pbesa-4.0.0/LICENSE.txt +21 -0
  4. pbesa-4.0.0/MANIFEST +3 -0
  5. pbesa-4.0.0/PKG-INFO +10 -0
  6. pbesa-4.0.0/examples/django/helloworld/db.sqlite3 +0 -0
  7. pbesa-4.0.0/examples/django/helloworld/helloworld/__init__.py +2 -0
  8. pbesa-4.0.0/examples/django/helloworld/helloworld/__pycache__/__init__.cpython-36.pyc +0 -0
  9. pbesa-4.0.0/examples/django/helloworld/helloworld/__pycache__/pbesa.cpython-36.pyc +0 -0
  10. pbesa-4.0.0/examples/django/helloworld/helloworld/__pycache__/settings.cpython-36.pyc +0 -0
  11. pbesa-4.0.0/examples/django/helloworld/helloworld/__pycache__/urls.cpython-36.pyc +0 -0
  12. pbesa-4.0.0/examples/django/helloworld/helloworld/__pycache__/wsgi.cpython-36.pyc +0 -0
  13. pbesa-4.0.0/examples/django/helloworld/helloworld/asgi.py +16 -0
  14. pbesa-4.0.0/examples/django/helloworld/helloworld/pbesa.py +9 -0
  15. pbesa-4.0.0/examples/django/helloworld/helloworld/settings.py +121 -0
  16. pbesa-4.0.0/examples/django/helloworld/helloworld/urls.py +22 -0
  17. pbesa-4.0.0/examples/django/helloworld/helloworld/wsgi.py +16 -0
  18. pbesa-4.0.0/examples/django/helloworld/manage.py +21 -0
  19. pbesa-4.0.0/examples/django/helloworld/translate/__pycache__/__init__.cpython-36.pyc +0 -0
  20. pbesa-4.0.0/examples/django/helloworld/translate/__pycache__/admin.cpython-36.pyc +0 -0
  21. pbesa-4.0.0/examples/django/helloworld/translate/__pycache__/apps.cpython-36.pyc +0 -0
  22. pbesa-4.0.0/examples/django/helloworld/translate/__pycache__/models.cpython-36.pyc +0 -0
  23. pbesa-4.0.0/examples/django/helloworld/translate/__pycache__/urls.cpython-36.pyc +0 -0
  24. pbesa-4.0.0/examples/django/helloworld/translate/__pycache__/views.cpython-36.pyc +0 -0
  25. pbesa-4.0.0/examples/django/helloworld/translate/admin.py +3 -0
  26. pbesa-4.0.0/examples/django/helloworld/translate/apps.py +24 -0
  27. pbesa-4.0.0/examples/django/helloworld/translate/mas/controller/__pycache__/translatecontroller.cpython-36.pyc +0 -0
  28. pbesa-4.0.0/examples/django/helloworld/translate/mas/controller/__pycache__/translatedelegate.cpython-36.pyc +0 -0
  29. pbesa-4.0.0/examples/django/helloworld/translate/mas/controller/__pycache__/translateresponse.cpython-36.pyc +0 -0
  30. pbesa-4.0.0/examples/django/helloworld/translate/mas/controller/translatecontroller.py +20 -0
  31. pbesa-4.0.0/examples/django/helloworld/translate/mas/controller/translatedelegate.py +25 -0
  32. pbesa-4.0.0/examples/django/helloworld/translate/mas/controller/translateresponse.py +19 -0
  33. pbesa-4.0.0/examples/django/helloworld/translate/mas/worker/__pycache__/translatetask.cpython-36.pyc +0 -0
  34. pbesa-4.0.0/examples/django/helloworld/translate/mas/worker/__pycache__/workeragent.cpython-36.pyc +0 -0
  35. pbesa-4.0.0/examples/django/helloworld/translate/mas/worker/translatetask.py +21 -0
  36. pbesa-4.0.0/examples/django/helloworld/translate/mas/worker/workeragent.py +17 -0
  37. pbesa-4.0.0/examples/django/helloworld/translate/migrations/__pycache__/__init__.cpython-36.pyc +0 -0
  38. pbesa-4.0.0/examples/django/helloworld/translate/models.py +3 -0
  39. pbesa-4.0.0/examples/django/helloworld/translate/tests.py +3 -0
  40. pbesa-4.0.0/examples/django/helloworld/translate/urls.py +8 -0
  41. pbesa-4.0.0/examples/django/helloworld/translate/views.py +10 -0
  42. pbesa-4.0.0/examples/remote/mas/controller/__pycache__/countercontroller.cpython-36.pyc +0 -0
  43. pbesa-4.0.0/examples/remote/mas/controller/__pycache__/counterdelegate.cpython-36.pyc +0 -0
  44. pbesa-4.0.0/examples/remote/mas/controller/__pycache__/counterresponse.cpython-36.pyc +0 -0
  45. pbesa-4.0.0/examples/remote/mas/controller/__pycache__/translatecontroller.cpython-36.pyc +0 -0
  46. pbesa-4.0.0/examples/remote/mas/controller/__pycache__/translatedelegate.cpython-36.pyc +0 -0
  47. pbesa-4.0.0/examples/remote/mas/controller/__pycache__/translateresponse.cpython-36.pyc +0 -0
  48. pbesa-4.0.0/examples/remote/mas/controller/countercontroller.py +20 -0
  49. pbesa-4.0.0/examples/remote/mas/controller/counterdelegate.py +19 -0
  50. pbesa-4.0.0/examples/remote/mas/controller/counterresponse.py +21 -0
  51. pbesa-4.0.0/examples/remote/mas/worker/__pycache__/counteragent.cpython-36.pyc +0 -0
  52. pbesa-4.0.0/examples/remote/mas/worker/__pycache__/countertask.cpython-36.pyc +0 -0
  53. pbesa-4.0.0/examples/remote/mas/worker/__pycache__/translatetask.cpython-36.pyc +0 -0
  54. pbesa-4.0.0/examples/remote/mas/worker/__pycache__/workeragent.cpython-36.pyc +0 -0
  55. pbesa-4.0.0/examples/remote/mas/worker/counteragent.py +17 -0
  56. pbesa-4.0.0/examples/remote/mas/worker/countertask.py +22 -0
  57. pbesa-4.0.0/examples/remote/remote_a.py +68 -0
  58. pbesa-4.0.0/examples/remote/remote_b.py +55 -0
  59. pbesa-4.0.0/examples/remote/remote_c.py +55 -0
  60. pbesa-4.0.0/pbesa/__init__.py +5 -0
  61. pbesa-4.0.0/pbesa/cognitive.py +438 -0
  62. {pbesa-3.1.3 → pbesa-4.0.0}/pbesa/kernel/__init__.py +1 -3
  63. pbesa-4.0.0/pbesa/kernel/adapter.py +165 -0
  64. pbesa-4.0.0/pbesa/kernel/agent.py +558 -0
  65. pbesa-4.0.0/pbesa/kernel/io/__init__.py +2 -0
  66. pbesa-4.0.0/pbesa/kernel/io/system_file.py +38 -0
  67. pbesa-4.0.0/pbesa/kernel/io/tcp_server.py +23 -0
  68. pbesa-4.0.0/pbesa/kernel/res/__init__.py +0 -0
  69. pbesa-4.0.0/pbesa/kernel/res/__pycache__/__init__.cpython-36.pyc +0 -0
  70. pbesa-4.0.0/pbesa/kernel/res/__pycache__/__init__.cpython-37.pyc +0 -0
  71. pbesa-4.0.0/pbesa/kernel/res/__pycache__/__init__.cpython-38.pyc +0 -0
  72. pbesa-4.0.0/pbesa/kernel/res/__pycache__/__init__.cpython-39.pyc +0 -0
  73. pbesa-4.0.0/pbesa/kernel/res/conf.json +8 -0
  74. pbesa-4.0.0/pbesa/kernel/util.py +217 -0
  75. pbesa-4.0.0/pbesa/kernel/world.py +43 -0
  76. pbesa-3.1.3/pbesa/kernel/system/Adm.py → pbesa-4.0.0/pbesa/mas.py +232 -79
  77. pbesa-4.0.0/pbesa/models.py +151 -0
  78. pbesa-4.0.0/pbesa/remote/__init__.py +5 -0
  79. pbesa-4.0.0/pbesa/remote/adm_listener.py +44 -0
  80. pbesa-3.1.3/pbesa/middleware/remote/AdmListenerHandler.py → pbesa-4.0.0/pbesa/remote/adm_listener_handler.py +25 -8
  81. pbesa-3.1.3/pbesa/middleware/remote/RemoteAdm.py → pbesa-4.0.0/pbesa/remote/remote_adm.py +22 -3
  82. pbesa-3.1.3/pbesa/middleware/remote/RemoteAdmHandler.py → pbesa-4.0.0/pbesa/remote/remote_adm_handler.py +33 -16
  83. pbesa-4.0.0/pbesa/social/__init__.py +4 -0
  84. pbesa-4.0.0/pbesa/social/collaborative_team.py +299 -0
  85. pbesa-4.0.0/pbesa/social/delegator.py +81 -0
  86. pbesa-4.0.0/pbesa/social/delegator_team.py +334 -0
  87. pbesa-4.0.0/pbesa/social/dialog.py +153 -0
  88. pbesa-4.0.0/pbesa/social/dispatcher_team.py +319 -0
  89. pbesa-4.0.0/pbesa/social/templates.py +18 -0
  90. pbesa-4.0.0/pbesa/social/worker.py +188 -0
  91. pbesa-4.0.0/pbesa.egg-info/PKG-INFO +10 -0
  92. pbesa-4.0.0/pbesa.egg-info/SOURCES.txt +100 -0
  93. pbesa-4.0.0/pbesa.egg-info/requires.txt +5 -0
  94. pbesa-4.0.0/setup.py +16 -0
  95. pbesa-3.1.3/PKG-INFO +0 -148
  96. pbesa-3.1.3/pbesa/__init__.py +0 -5
  97. pbesa-3.1.3/pbesa/engine/__init__.py +0 -3
  98. pbesa-3.1.3/pbesa/engine/bdi/BDIAg.py +0 -42
  99. pbesa-3.1.3/pbesa/engine/bdi/BDILevel.py +0 -10
  100. pbesa-3.1.3/pbesa/engine/bdi/BDIMachine.py +0 -116
  101. pbesa-3.1.3/pbesa/engine/bdi/Goal.py +0 -28
  102. pbesa-3.1.3/pbesa/engine/bdi/GoalExe.py +0 -36
  103. pbesa-3.1.3/pbesa/engine/bdi/__init__.py +0 -5
  104. pbesa-3.1.3/pbesa/engine/ps/__init__.py +0 -5
  105. pbesa-3.1.3/pbesa/engine/ps/alpha_node.py +0 -77
  106. pbesa-3.1.3/pbesa/engine/ps/betha_node.py +0 -309
  107. pbesa-3.1.3/pbesa/engine/ps/exceptions.py +0 -18
  108. pbesa-3.1.3/pbesa/engine/ps/psagent/__init__.py +0 -19
  109. pbesa-3.1.3/pbesa/engine/ps/psagent/add_fact_agenda_action.py +0 -17
  110. pbesa-3.1.3/pbesa/engine/ps/psagent/assert_fact_action.py +0 -17
  111. pbesa-3.1.3/pbesa/engine/ps/psagent/fact.py +0 -25
  112. pbesa-3.1.3/pbesa/engine/ps/psagent/periodic_action.py +0 -42
  113. pbesa-3.1.3/pbesa/engine/ps/psagent/psagent.py +0 -80
  114. pbesa-3.1.3/pbesa/engine/ps/psagent/retract_fact_action.py +0 -17
  115. pbesa-3.1.3/pbesa/engine/ps/psagent/rule.py +0 -53
  116. pbesa-3.1.3/pbesa/engine/ps/psagent/run_agenda_action.py +0 -17
  117. pbesa-3.1.3/pbesa/engine/ps/psagent/sp_periodic_data.py +0 -12
  118. pbesa-3.1.3/pbesa/engine/ps/psagent/template.py +0 -20
  119. pbesa-3.1.3/pbesa/engine/ps/psagent/update_fact_action.py +0 -17
  120. pbesa-3.1.3/pbesa/engine/ps/rete.py +0 -84
  121. pbesa-3.1.3/pbesa/engine/rational/ActionExe.py +0 -35
  122. pbesa-3.1.3/pbesa/engine/rational/Brain.py +0 -10
  123. pbesa-3.1.3/pbesa/engine/rational/RationalAg.py +0 -43
  124. pbesa-3.1.3/pbesa/engine/rational/__init__.py +0 -3
  125. pbesa-3.1.3/pbesa/kernel/adapter/Adapter.py +0 -26
  126. pbesa-3.1.3/pbesa/kernel/adapter/FileAdapter.py +0 -23
  127. pbesa-3.1.3/pbesa/kernel/adapter/__init__.py +0 -2
  128. pbesa-3.1.3/pbesa/kernel/agent/Action.py +0 -42
  129. pbesa-3.1.3/pbesa/kernel/agent/Agent.py +0 -191
  130. pbesa-3.1.3/pbesa/kernel/agent/BehaviorExe.py +0 -61
  131. pbesa-3.1.3/pbesa/kernel/agent/Channel.py +0 -8
  132. pbesa-3.1.3/pbesa/kernel/agent/World.py +0 -14
  133. pbesa-3.1.3/pbesa/kernel/agent/__init__.py +0 -6
  134. pbesa-3.1.3/pbesa/kernel/agent/exceptions.py +0 -22
  135. pbesa-3.1.3/pbesa/kernel/io/SystemFile.py +0 -13
  136. pbesa-3.1.3/pbesa/kernel/io/TCPServer.py +0 -4
  137. pbesa-3.1.3/pbesa/kernel/io/__init__.py +0 -2
  138. pbesa-3.1.3/pbesa/kernel/system/Directory.py +0 -62
  139. pbesa-3.1.3/pbesa/kernel/system/__init__.py +0 -3
  140. pbesa-3.1.3/pbesa/kernel/system/exceptions.py +0 -19
  141. pbesa-3.1.3/pbesa/kernel/util/Queue.py +0 -231
  142. pbesa-3.1.3/pbesa/kernel/util/__init__.py +0 -1
  143. pbesa-3.1.3/pbesa/middleware/__init__.py +0 -3
  144. pbesa-3.1.3/pbesa/middleware/adapter/RESTAdapter.py +0 -52
  145. pbesa-3.1.3/pbesa/middleware/adapter/SubProcessAdapter.py +0 -30
  146. pbesa-3.1.3/pbesa/middleware/adapter/WSSAdapter.py +0 -83
  147. pbesa-3.1.3/pbesa/middleware/adapter/WSSNJAdapter.py +0 -51
  148. pbesa-3.1.3/pbesa/middleware/adapter/WSSNJHandler.py +0 -23
  149. pbesa-3.1.3/pbesa/middleware/adapter/__init__.py +0 -5
  150. pbesa-3.1.3/pbesa/middleware/remote/AdmListener.py +0 -17
  151. pbesa-3.1.3/pbesa/middleware/remote/__init__.py +0 -5
  152. pbesa-3.1.3/pbesa/middleware/web/WebAgTK.py +0 -15
  153. pbesa-3.1.3/pbesa/scrape/CrawlAction.py +0 -94
  154. pbesa-3.1.3/pbesa/scrape/CrawlData.py +0 -42
  155. pbesa-3.1.3/pbesa/scrape/SpiderAction.py +0 -110
  156. pbesa-3.1.3/pbesa/scrape/SpiderAgent.py +0 -30
  157. pbesa-3.1.3/pbesa/scrape/SpiderData.py +0 -15
  158. pbesa-3.1.3/pbesa/scrape/__init__.py +0 -7
  159. pbesa-3.1.3/pbesa/scrape/exceptions.py +0 -22
  160. pbesa-3.1.3/pbesa/social/__init__.py +0 -4
  161. pbesa-3.1.3/pbesa/social/delegator/__init__.py +0 -2
  162. pbesa-3.1.3/pbesa/social/delegator/delegator_agent.py +0 -38
  163. pbesa-3.1.3/pbesa/social/delegator/exceptions.py +0 -18
  164. pbesa-3.1.3/pbesa/social/linealcontroller/__init__.py +0 -5
  165. pbesa-3.1.3/pbesa/social/linealcontroller/delegateaction.py +0 -37
  166. pbesa-3.1.3/pbesa/social/linealcontroller/exceptions.py +0 -18
  167. pbesa-3.1.3/pbesa/social/linealcontroller/linealcontroller.py +0 -90
  168. pbesa-3.1.3/pbesa/social/linealcontroller/responseaction.py +0 -49
  169. pbesa-3.1.3/pbesa/social/linealcontroller/timeoutaction.py +0 -46
  170. pbesa-3.1.3/pbesa/social/poolcontroller/__init__.py +0 -7
  171. pbesa-3.1.3/pbesa/social/poolcontroller/delegate.py +0 -27
  172. pbesa-3.1.3/pbesa/social/poolcontroller/delegateaction.py +0 -33
  173. pbesa-3.1.3/pbesa/social/poolcontroller/exceptions.py +0 -18
  174. pbesa-3.1.3/pbesa/social/poolcontroller/notifyfreeaction.py +0 -22
  175. pbesa-3.1.3/pbesa/social/poolcontroller/poolcontroller.py +0 -75
  176. pbesa-3.1.3/pbesa/social/poolcontroller/pooltype.py +0 -4
  177. pbesa-3.1.3/pbesa/social/poolcontroller/responseaction.py +0 -34
  178. pbesa-3.1.3/pbesa/social/worker/__init__.py +0 -4
  179. pbesa-3.1.3/pbesa/social/worker/exceptions.py +0 -22
  180. pbesa-3.1.3/pbesa/social/worker/task.py +0 -51
  181. pbesa-3.1.3/pbesa/social/worker/timeoutaction.py +0 -37
  182. pbesa-3.1.3/pbesa/social/worker/worker.py +0 -50
  183. pbesa-3.1.3/pbesa.egg-info/PKG-INFO +0 -148
  184. pbesa-3.1.3/pbesa.egg-info/SOURCES.txt +0 -103
  185. pbesa-3.1.3/pbesa.egg-info/requires.txt +0 -3
  186. pbesa-3.1.3/setup.py +0 -49
  187. {pbesa-3.1.3 → pbesa-4.0.0}/README.md +0 -0
  188. {pbesa-3.1.3/pbesa/kernel/res → pbesa-4.0.0/examples/django/helloworld/translate}/__init__.py +0 -0
  189. {pbesa-3.1.3/pbesa/middleware/web → pbesa-4.0.0/examples/django/helloworld/translate/migrations}/__init__.py +0 -0
  190. {pbesa-3.1.3/pbesa/middleware → pbesa-4.0.0/pbesa}/remote/exceptions.py +0 -0
  191. {pbesa-3.1.3 → pbesa-4.0.0}/pbesa.egg-info/dependency_links.txt +0 -0
  192. {pbesa-3.1.3 → pbesa-4.0.0}/pbesa.egg-info/top_level.txt +0 -0
  193. {pbesa-3.1.3 → pbesa-4.0.0}/setup.cfg +0 -0
pbesa-4.0.0/.gitignore ADDED
@@ -0,0 +1,15 @@
1
+ /src/**/*.pyc
2
+ /src/**/*.class
3
+ /src/**/*.bak
4
+ /src/**/*.xlsx
5
+ /src/**/*.xls
6
+ /src/**/*.env
7
+ /src/**/*.log
8
+ /src/**/*.csv
9
+ /src/**/*.owl
10
+ /src/pbesa/middleware/adapter/node_modules
11
+ /src/**/*.joblib
12
+ __pycache__
13
+ .vscode
14
+ *.h5
15
+ .env
pbesa-4.0.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Aken
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 Joel Barmettler
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
pbesa-4.0.0/MANIFEST ADDED
@@ -0,0 +1,3 @@
1
+ # file GENERATED by distutils, do NOT edit
2
+ setup.cfg
3
+ setup.py
pbesa-4.0.0/PKG-INFO ADDED
@@ -0,0 +1,10 @@
1
+ Metadata-Version: 2.1
2
+ Name: pbesa
3
+ Version: 4.0.0
4
+ License-File: LICENSE
5
+ License-File: LICENSE.txt
6
+ Requires-Dist: pymongo==4.6.3
7
+ Requires-Dist: requests==2.32.3
8
+ Requires-Dist: azure-ai-projects==1.0.0b6
9
+ Requires-Dist: azure-ai-inference==1.0.0b9
10
+ Requires-Dist: azure-identity==1.20.0
@@ -0,0 +1,2 @@
1
+ from .pbesa import mas as mas_app
2
+ __all__ = ['mas_app']
@@ -0,0 +1,16 @@
1
+ """
2
+ ASGI config for helloworld project.
3
+
4
+ It exposes the ASGI callable as a module-level variable named ``application``.
5
+
6
+ For more information on this file, see
7
+ https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/
8
+ """
9
+
10
+ import os
11
+
12
+ from django.core.asgi import get_asgi_application
13
+
14
+ os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'helloworld.settings')
15
+
16
+ application = get_asgi_application()
@@ -0,0 +1,9 @@
1
+ # ----------------------------------------------------------
2
+ # Define ADM
3
+ # ----------------------------------------------------------
4
+ from pbesa.kernel.system.adm import Adm
5
+
6
+ #-----------------------------------------------------------
7
+ # Start MAS
8
+ mas = Adm()
9
+ mas.start()
@@ -0,0 +1,121 @@
1
+ """
2
+ Django settings for helloworld project.
3
+
4
+ Generated by 'django-admin startproject' using Django 3.0.3.
5
+
6
+ For more information on this file, see
7
+ https://docs.djangoproject.com/en/3.0/topics/settings/
8
+
9
+ For the full list of settings and their values, see
10
+ https://docs.djangoproject.com/en/3.0/ref/settings/
11
+ """
12
+
13
+ import os
14
+
15
+ # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
16
+ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
17
+
18
+
19
+ # Quick-start development settings - unsuitable for production
20
+ # See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/
21
+
22
+ # SECURITY WARNING: keep the secret key used in production secret!
23
+ SECRET_KEY = 'vr)v&1eyq%m5^5%e+ao8k7mxui=k@+*aqjg#x=hf6b9&ymeivq'
24
+
25
+ # SECURITY WARNING: don't run with debug turned on in production!
26
+ DEBUG = True
27
+
28
+ ALLOWED_HOSTS = ['*']
29
+
30
+
31
+ # Application definition
32
+
33
+ INSTALLED_APPS = [
34
+ 'django.contrib.admin',
35
+ 'django.contrib.auth',
36
+ 'django.contrib.contenttypes',
37
+ 'django.contrib.sessions',
38
+ 'django.contrib.messages',
39
+ 'django.contrib.staticfiles',
40
+ 'translate.apps.TranslateConfig'
41
+ ]
42
+
43
+ MIDDLEWARE = [
44
+ 'django.middleware.security.SecurityMiddleware',
45
+ 'django.contrib.sessions.middleware.SessionMiddleware',
46
+ 'django.middleware.common.CommonMiddleware',
47
+ 'django.middleware.csrf.CsrfViewMiddleware',
48
+ 'django.contrib.auth.middleware.AuthenticationMiddleware',
49
+ 'django.contrib.messages.middleware.MessageMiddleware',
50
+ 'django.middleware.clickjacking.XFrameOptionsMiddleware',
51
+ ]
52
+
53
+ ROOT_URLCONF = 'helloworld.urls'
54
+
55
+ TEMPLATES = [
56
+ {
57
+ 'BACKEND': 'django.template.backends.django.DjangoTemplates',
58
+ 'DIRS': [],
59
+ 'APP_DIRS': True,
60
+ 'OPTIONS': {
61
+ 'context_processors': [
62
+ 'django.template.context_processors.debug',
63
+ 'django.template.context_processors.request',
64
+ 'django.contrib.auth.context_processors.auth',
65
+ 'django.contrib.messages.context_processors.messages',
66
+ ],
67
+ },
68
+ },
69
+ ]
70
+
71
+ WSGI_APPLICATION = 'helloworld.wsgi.application'
72
+
73
+
74
+ # Database
75
+ # https://docs.djangoproject.com/en/3.0/ref/settings/#databases
76
+
77
+ DATABASES = {
78
+ 'default': {
79
+ 'ENGINE': 'django.db.backends.sqlite3',
80
+ 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
81
+ }
82
+ }
83
+
84
+
85
+ # Password validation
86
+ # https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators
87
+
88
+ AUTH_PASSWORD_VALIDATORS = [
89
+ {
90
+ 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
91
+ },
92
+ {
93
+ 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
94
+ },
95
+ {
96
+ 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
97
+ },
98
+ {
99
+ 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
100
+ },
101
+ ]
102
+
103
+
104
+ # Internationalization
105
+ # https://docs.djangoproject.com/en/3.0/topics/i18n/
106
+
107
+ LANGUAGE_CODE = 'en-us'
108
+
109
+ TIME_ZONE = 'UTC'
110
+
111
+ USE_I18N = True
112
+
113
+ USE_L10N = True
114
+
115
+ USE_TZ = True
116
+
117
+
118
+ # Static files (CSS, JavaScript, Images)
119
+ # https://docs.djangoproject.com/en/3.0/howto/static-files/
120
+
121
+ STATIC_URL = '/static/'
@@ -0,0 +1,22 @@
1
+ """helloworld URL Configuration
2
+
3
+ The `urlpatterns` list routes URLs to views. For more information please see:
4
+ https://docs.djangoproject.com/en/3.0/topics/http/urls/
5
+ Examples:
6
+ Function views
7
+ 1. Add an import: from my_app import views
8
+ 2. Add a URL to urlpatterns: path('', views.home, name='home')
9
+ Class-based views
10
+ 1. Add an import: from other_app.views import Home
11
+ 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
12
+ Including another URLconf
13
+ 1. Import the include() function: from django.urls import include, path
14
+ 2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
15
+ """
16
+ from django.contrib import admin
17
+ from django.urls import path, include
18
+
19
+ urlpatterns = [
20
+ path('admin/', admin.site.urls),
21
+ path('pbesa/', include('translate.urls'))
22
+ ]
@@ -0,0 +1,16 @@
1
+ """
2
+ WSGI config for helloworld project.
3
+
4
+ It exposes the WSGI callable as a module-level variable named ``application``.
5
+
6
+ For more information on this file, see
7
+ https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/
8
+ """
9
+
10
+ import os
11
+
12
+ from django.core.wsgi import get_wsgi_application
13
+
14
+ os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'helloworld.settings')
15
+
16
+ application = get_wsgi_application()
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env python
2
+ """Django's command-line utility for administrative tasks."""
3
+ import os
4
+ import sys
5
+
6
+
7
+ def main():
8
+ os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'helloworld.settings')
9
+ try:
10
+ from django.core.management import execute_from_command_line
11
+ except ImportError as exc:
12
+ raise ImportError(
13
+ "Couldn't import Django. Are you sure it's installed and "
14
+ "available on your PYTHONPATH environment variable? Did you "
15
+ "forget to activate a virtual environment?"
16
+ ) from exc
17
+ execute_from_command_line(sys.argv)
18
+
19
+
20
+ if __name__ == '__main__':
21
+ main()
@@ -0,0 +1,3 @@
1
+ from django.contrib import admin
2
+
3
+ # Register your models here.
@@ -0,0 +1,24 @@
1
+ from django.apps import AppConfig
2
+ from translate.mas.worker.workeragent import WorkerAgent
3
+ from translate.mas.controller.translatecontroller import TranslateController
4
+
5
+ class TranslateConfig(AppConfig):
6
+ name = 'translate'
7
+
8
+ def ready(self):
9
+ #-----------------------------------------------------
10
+ # Create the worker agents
11
+ w1ID = 'w1'
12
+ w1 = WorkerAgent(w1ID)
13
+ w1.start()
14
+ w2ID = 'w2'
15
+ w2 = WorkerAgent(w2ID)
16
+ w2.start()
17
+
18
+ #-----------------------------------------------------
19
+ # Create the controller agent
20
+ ctrID = 'Jarvis'
21
+ ag = TranslateController(ctrID)
22
+ ag.suscribe_agent(w1)
23
+ ag.suscribe_agent(w2)
24
+ ag.start()
@@ -0,0 +1,20 @@
1
+ from .translatedelegate import TranslateDelegate
2
+ from .translateresponse import TranslateResponse
3
+ from pbesa.social.secuencial_team.secuencial_team import SecuencialController
4
+
5
+ class TranslateController(SecuencialController):
6
+ """ Through a class the concept of agent is defined """
7
+
8
+ def build(self):
9
+ """
10
+ Method that allows defining the structure and
11
+ resources of the agent
12
+ """
13
+ # Assign an action to the behavior
14
+ self.bind_delegate_action(TranslateDelegate())
15
+ # Assign an action to the behavior
16
+ self.bind_response_action(TranslateResponse())
17
+
18
+ def shutdown(self):
19
+ """ Method to free up the resources taken by the agent """
20
+ pass
@@ -0,0 +1,25 @@
1
+ from pbesa.social.secuencial_team.delegate_action import DelegateAction
2
+
3
+ class TranslateDelegate(DelegateAction):
4
+ """ An action is a response to the occurrence of an event """
5
+
6
+ def delegate(self, data):
7
+ """
8
+ Catch the exception.
9
+ @param exception Response exception
10
+ """
11
+ tokens = None
12
+ if '_' in data:
13
+ tokens = data.split('_')
14
+ if ' ' in data:
15
+ tokens = data.split('_')
16
+ self.toAssign(tokens[0].lower())
17
+ self.toAssign(tokens[1].lower())
18
+ self.activeTimeout(3)
19
+
20
+ def catchException(self, exception):
21
+ """
22
+ Catch the exception.
23
+ @param exception Response exception
24
+ """
25
+ pass
@@ -0,0 +1,19 @@
1
+ from pbesa.social.secuencial_team.response_action import ResponseAction
2
+
3
+ class TranslateResponse(ResponseAction):
4
+ """ An action is a response to the occurrence of an event """
5
+
6
+ def end_of_process(self, resultDict, timeout):
7
+ """
8
+ Catch the exception.
9
+ @param exception Response exception
10
+ """
11
+ result = "%s %s" % (resultDict['w1'], resultDict['w2'])
12
+ self.send_response(result)
13
+
14
+ def catchException(self, exception):
15
+ """
16
+ Catch the exception.
17
+ @param exception Response exception
18
+ """
19
+ pass
@@ -0,0 +1,21 @@
1
+ from pbesa.social.worker.task import Task
2
+
3
+ class TranslateTask(Task):
4
+ """ An action is a response to the occurrence of an event """
5
+
6
+ def run(self, data):
7
+ """
8
+ Execute.
9
+ @param data Event data
10
+ """
11
+ if data == 'hello':
12
+ self.send_response('Hola')
13
+ if data == 'world':
14
+ self.send_response('Mundo')
15
+
16
+ def catchException(self, exception):
17
+ """
18
+ Catch the exception.
19
+ @param exception Response exception
20
+ """
21
+ pass
@@ -0,0 +1,17 @@
1
+ from .translatetask import TranslateTask
2
+ from pbesa.social.worker.worker import Worker
3
+
4
+ class WorkerAgent(Worker):
5
+ """ Through a class the concept of agent is defined """
6
+
7
+ def build(self):
8
+ """
9
+ Method that allows defining the structure and
10
+ resources of the agent
11
+ """
12
+ # Assign an action to the behavior
13
+ self.bind_task(TranslateTask())
14
+
15
+ def shutdown(self):
16
+ """ Method to free up the resources taken by the agent """
17
+ pass
@@ -0,0 +1,3 @@
1
+ from django.db import models
2
+
3
+ # Create your models here.
@@ -0,0 +1,3 @@
1
+ from django.test import TestCase
2
+
3
+ # Create your tests here.
@@ -0,0 +1,8 @@
1
+ from django.urls import path
2
+
3
+ from . import views
4
+ from django.conf.urls import url
5
+
6
+ urlpatterns = [
7
+ path('translate', views.index, name='index'),
8
+ ]
@@ -0,0 +1,10 @@
1
+ import json
2
+ from pbesa.kernel.system.adm import Adm
3
+ from django.http.response import HttpResponse
4
+
5
+ def index(request):
6
+ term = request.GET['data']
7
+ result = Adm().call_agent('Jarvis', term)
8
+ return HttpResponse(json.dumps({
9
+ 'text': result
10
+ }))
@@ -0,0 +1,20 @@
1
+ from .counterdelegate import CounterDelegate
2
+ from .counterresponse import CounterResponse
3
+ from pbesa.social.secuencial_team.secuencial_team import SecuencialController
4
+
5
+ class CounterController(SecuencialController):
6
+ """ Through a class the concept of agent is defined """
7
+
8
+ def build(self):
9
+ """
10
+ Method that allows defining the structure and
11
+ resources of the agent
12
+ """
13
+ # Assign an action to the behavior
14
+ self.bind_delegate_action(CounterDelegate())
15
+ # Assign an action to the behavior
16
+ self.bind_response_action(CounterResponse())
17
+
18
+ def shutdown(self):
19
+ """ Method to free up the resources taken by the agent """
20
+ pass
@@ -0,0 +1,19 @@
1
+ from pbesa.social.secuencial_team.delegate_action import DelegateAction
2
+
3
+ class CounterDelegate(DelegateAction):
4
+ """ An action is a response to the occurrence of an event """
5
+
6
+ def delegate(self, data):
7
+ """
8
+ Catch the exception.
9
+ @param exception Response exception
10
+ """
11
+ for it in range(1, 10):
12
+ self.toAssign(10)
13
+
14
+ def catchException(self, exception):
15
+ """
16
+ Catch the exception.
17
+ @param exception Response exception
18
+ """
19
+ print(exception)
@@ -0,0 +1,21 @@
1
+ from pbesa.social.secuencial_team.response_action import ResponseAction
2
+
3
+ class CounterResponse(ResponseAction):
4
+ """ An action is a response to the occurrence of an event """
5
+
6
+ def end_of_process(self, resultDict, timeout):
7
+ """
8
+ Catch the exception.
9
+ @param exception Response exception
10
+ """
11
+ result = 0
12
+ for res in resultDict.values():
13
+ result += res
14
+ self.send_response(result)
15
+
16
+ def catchException(self, exception):
17
+ """
18
+ Catch the exception.
19
+ @param exception Response exception
20
+ """
21
+ print(exception)
@@ -0,0 +1,17 @@
1
+ from .countertask import CounterTask
2
+ from pbesa.social.worker.worker import Worker
3
+
4
+ class CounterAgent(Worker):
5
+ """ Through a class the concept of agent is defined """
6
+
7
+ def build(self):
8
+ """
9
+ Method that allows defining the structure and
10
+ resources of the agent
11
+ """
12
+ # Assign an action to the behavior
13
+ self.bind_task(CounterTask())
14
+
15
+ def shutdown(self):
16
+ """ Method to free up the resources taken by the agent """
17
+ pass
@@ -0,0 +1,22 @@
1
+ import time
2
+ from pbesa.social.worker.task import Task
3
+
4
+ class CounterTask(Task):
5
+ """ An action is a response to the occurrence of an event """
6
+
7
+ def run(self, data):
8
+ """
9
+ Execute.
10
+ @param data Event data
11
+ """
12
+ for it in range(1, data + 1):
13
+ time.sleep(1)
14
+ print("AG: %s Count: %d" % (self.agent.id, it))
15
+ self.send_response(10)
16
+
17
+ def catchException(self, exception):
18
+ """
19
+ Catch the exception.
20
+ @param exception Response exception
21
+ """
22
+ print(exception)