sirio 0.1.1__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.
- sirio-0.1.1/PKG-INFO +23 -0
- sirio-0.1.1/README.md +0 -0
- sirio-0.1.1/setup.cfg +4 -0
- sirio-0.1.1/setup.py +31 -0
- sirio-0.1.1/sirio/__init__.py +5 -0
- sirio-0.1.1/sirio/business_object.py +82 -0
- sirio-0.1.1/sirio/event.py +34 -0
- sirio-0.1.1/sirio.egg-info/PKG-INFO +23 -0
- sirio-0.1.1/sirio.egg-info/SOURCES.txt +12 -0
- sirio-0.1.1/sirio.egg-info/dependency_links.txt +1 -0
- sirio-0.1.1/sirio.egg-info/requires.txt +1 -0
- sirio-0.1.1/sirio.egg-info/top_level.txt +2 -0
- sirio-0.1.1/tests/__init__.py +1 -0
- sirio-0.1.1/tests/test_sirio.py +21 -0
sirio-0.1.1/PKG-INFO
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: sirio
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Sirio
|
|
5
|
+
Home-page: https://github.com/pask-xx/sirio.git
|
|
6
|
+
Author: Pasquale Rombolà
|
|
7
|
+
Author-email: pasquale.rombola@cerved.com
|
|
8
|
+
License: BSD
|
|
9
|
+
Keywords: sirio,template,package
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Natural Language :: English
|
|
14
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
15
|
+
Classifier: Programming Language :: Python
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
21
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
22
|
+
Classifier: Topic :: Software Development
|
|
23
|
+
Requires-Python: >=3.8
|
sirio-0.1.1/README.md
ADDED
|
Binary file
|
sirio-0.1.1/setup.cfg
ADDED
sirio-0.1.1/setup.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
|
|
3
|
+
from distutils.core import setup
|
|
4
|
+
setup(
|
|
5
|
+
name='sirio',
|
|
6
|
+
packages=find_packages(),
|
|
7
|
+
version='0.1.1',
|
|
8
|
+
description='Sirio',
|
|
9
|
+
author='Pasquale Rombolà',
|
|
10
|
+
license='BSD',
|
|
11
|
+
author_email='pasquale.rombola@cerved.com',
|
|
12
|
+
url='https://github.com/pask-xx/sirio.git',
|
|
13
|
+
keywords=['sirio', 'template', 'package', ],
|
|
14
|
+
python_requires='>=3.8',
|
|
15
|
+
classifiers=[
|
|
16
|
+
'Development Status :: 4 - Beta',
|
|
17
|
+
'Environment :: Console',
|
|
18
|
+
'Intended Audience :: Developers',
|
|
19
|
+
'Natural Language :: English',
|
|
20
|
+
'License :: OSI Approved :: BSD License',
|
|
21
|
+
'Programming Language :: Python',
|
|
22
|
+
'Programming Language :: Python :: 3',
|
|
23
|
+
'Programming Language :: Python :: 3.10',
|
|
24
|
+
'Programming Language :: Python :: 3.11',
|
|
25
|
+
'Programming Language :: Python :: 3.12',
|
|
26
|
+
'Programming Language :: Python :: Implementation :: CPython',
|
|
27
|
+
'Programming Language :: Python :: Implementation :: PyPy',
|
|
28
|
+
'Topic :: Software Development',
|
|
29
|
+
],
|
|
30
|
+
install_requires=['requests'],
|
|
31
|
+
)
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
from enum import Enum
|
|
3
|
+
|
|
4
|
+
class TypeValue(Enum):
|
|
5
|
+
string = 1
|
|
6
|
+
date = 2
|
|
7
|
+
numeric = 3
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class ObjBusiness:
|
|
11
|
+
jsonComplete = {}
|
|
12
|
+
businessObject = {}
|
|
13
|
+
businessKey = ""
|
|
14
|
+
subject = ""
|
|
15
|
+
description = ""
|
|
16
|
+
urlGetBO = ""
|
|
17
|
+
urlComplete = ""
|
|
18
|
+
def __init__(self, businessKey: str, urlGetBO: str, urlComplete: str):
|
|
19
|
+
self.jsonComplete = {"businessKey": businessKey}
|
|
20
|
+
self.objects = []
|
|
21
|
+
self.data = {}
|
|
22
|
+
self.urlGetBO = urlGetBO
|
|
23
|
+
self.urlComplete = urlComplete
|
|
24
|
+
response = requests.get(urlGetBO.replace('{businessKey}', businessKey))
|
|
25
|
+
if response.status_code == 200:
|
|
26
|
+
self.businessObject = response.json()
|
|
27
|
+
self.description = self.businessObject['description']
|
|
28
|
+
self.subject = self.businessObject['subject']
|
|
29
|
+
else:
|
|
30
|
+
self = None
|
|
31
|
+
|
|
32
|
+
def getValue(self, bind:str, id:str):
|
|
33
|
+
valReturn = None
|
|
34
|
+
try:
|
|
35
|
+
if self.businessObject['data'] != None and self.businessObject['data'][bind] != None and self.businessObject['data'][bind][id] != None:
|
|
36
|
+
valReturn = self.businessObject['data'][bind][id]['value']['value']
|
|
37
|
+
except Exception as ex:
|
|
38
|
+
print("Eccezione su getValue [{}][{}] - {}".format(bind, id, ex))
|
|
39
|
+
return valReturn
|
|
40
|
+
|
|
41
|
+
def setValue(self, bind: str, id: str, value, typeValue=TypeValue.string):
|
|
42
|
+
if 'data' not in self.jsonComplete:
|
|
43
|
+
self.jsonComplete['data'] = {}
|
|
44
|
+
if bind not in self.jsonComplete['data']:
|
|
45
|
+
self.jsonComplete['data'][bind] = {}
|
|
46
|
+
if id not in self.jsonComplete['data'][bind]:
|
|
47
|
+
self.jsonComplete['data'][bind][id] = {"dataType": typeValue.name, "description": "string", "value": {"value": value }, "extendedValue": [] }
|
|
48
|
+
elif self.jsonComplete['data'][bind][id]['value']['value'] != value:
|
|
49
|
+
self.jsonComplete['data'][bind][id]['value']['value'] = value
|
|
50
|
+
|
|
51
|
+
if 'data' not in self.businessObject:
|
|
52
|
+
self.businessObject['data'] = {}
|
|
53
|
+
if bind not in self.businessObject['data']:
|
|
54
|
+
self.businessObject['data'][bind] = {}
|
|
55
|
+
if id not in self.businessObject['data'][bind]:
|
|
56
|
+
self.businessObject['data'][bind][id] = {"dataType": typeValue.name, "description": "string", "value": {"value": value }, "extendedValue": [] }
|
|
57
|
+
elif self.businessObject['data'][bind][id]['value']['value'] != value:
|
|
58
|
+
self.businessObject['data'][bind][id]['value']['value'] = value
|
|
59
|
+
|
|
60
|
+
def getObject(self, key: str):
|
|
61
|
+
object = None
|
|
62
|
+
try:
|
|
63
|
+
objList = self.businessObject['objects']
|
|
64
|
+
if objList is not None:
|
|
65
|
+
objects = list(objList)
|
|
66
|
+
if objects is not None:
|
|
67
|
+
for obj in objects:
|
|
68
|
+
if obj['key'] == key:
|
|
69
|
+
object = obj
|
|
70
|
+
break
|
|
71
|
+
except Exception as ex:
|
|
72
|
+
print("Eccezione su getObject - {}".format(ex))
|
|
73
|
+
return object
|
|
74
|
+
|
|
75
|
+
def setObject(self, object):
|
|
76
|
+
if 'objects' not in self.jsonComplete:
|
|
77
|
+
self.jsonComplete['objects'] = []
|
|
78
|
+
self.jsonComplete['objects'].append(object)
|
|
79
|
+
|
|
80
|
+
def complete(self, domain, taskId, priority=None, owner=None):
|
|
81
|
+
responseComplete = requests.post(self.urlComplete.replace('{domain}', domain).replace('{taskId}', taskId), json=self.jsonComplete)
|
|
82
|
+
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import json
|
|
2
|
+
from typing import List
|
|
3
|
+
|
|
4
|
+
class ObjEvent:
|
|
5
|
+
taskId = ''
|
|
6
|
+
taskPriority = ''
|
|
7
|
+
taskName = ''
|
|
8
|
+
processId = ''
|
|
9
|
+
domain = ''
|
|
10
|
+
businessKey = ''
|
|
11
|
+
owner = ''
|
|
12
|
+
internalBusinessKey = ''
|
|
13
|
+
def __init__(self):
|
|
14
|
+
self.files = []
|
|
15
|
+
|
|
16
|
+
def getObjEvent(event) -> List[ObjEvent]:
|
|
17
|
+
objReturn = []
|
|
18
|
+
myList = list(event['Records'])
|
|
19
|
+
for elem in myList:
|
|
20
|
+
objEvent = ObjEvent()
|
|
21
|
+
objMsg = json.loads(elem["body"])
|
|
22
|
+
|
|
23
|
+
objEvent.taskId = objMsg["taskId"]
|
|
24
|
+
objEvent.taskPriority = objMsg["taskPriority"]
|
|
25
|
+
objEvent.taskName = objMsg["taskName"]
|
|
26
|
+
objEvent.processId = objMsg["processId"]
|
|
27
|
+
objEvent.domain = objMsg["domain"]
|
|
28
|
+
objEvent.businessKey = objMsg["businessKey"]
|
|
29
|
+
processVariables = objMsg["processVariables"]
|
|
30
|
+
#objEvent.owner = processVariables["owner"]
|
|
31
|
+
objEvent.internalBusinessKey = processVariables["internalBusinessKey"]
|
|
32
|
+
objReturn.append(objEvent)
|
|
33
|
+
|
|
34
|
+
return objReturn
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: sirio
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Sirio
|
|
5
|
+
Home-page: https://github.com/pask-xx/sirio.git
|
|
6
|
+
Author: Pasquale Rombolà
|
|
7
|
+
Author-email: pasquale.rombola@cerved.com
|
|
8
|
+
License: BSD
|
|
9
|
+
Keywords: sirio,template,package
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Natural Language :: English
|
|
14
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
15
|
+
Classifier: Programming Language :: Python
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
21
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
22
|
+
Classifier: Topic :: Software Development
|
|
23
|
+
Requires-Python: >=3.8
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
setup.py
|
|
3
|
+
sirio/__init__.py
|
|
4
|
+
sirio/business_object.py
|
|
5
|
+
sirio/event.py
|
|
6
|
+
sirio.egg-info/PKG-INFO
|
|
7
|
+
sirio.egg-info/SOURCES.txt
|
|
8
|
+
sirio.egg-info/dependency_links.txt
|
|
9
|
+
sirio.egg-info/requires.txt
|
|
10
|
+
sirio.egg-info/top_level.txt
|
|
11
|
+
tests/__init__.py
|
|
12
|
+
tests/test_sirio.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
requests
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Unit test package for sirio."""
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
|
|
3
|
+
"""Tests for `sirio` package."""
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
import unittest
|
|
7
|
+
|
|
8
|
+
from sirio import event
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class TestSirio(unittest.TestCase):
|
|
12
|
+
"""Tests for `sirio` package."""
|
|
13
|
+
|
|
14
|
+
def setUp(self):
|
|
15
|
+
"""Set up test fixtures, if any."""
|
|
16
|
+
|
|
17
|
+
def tearDown(self):
|
|
18
|
+
"""Tear down test fixtures, if any."""
|
|
19
|
+
|
|
20
|
+
def test_000_something(self):
|
|
21
|
+
"""Test something."""
|