launchpy 0.4.5.post3__tar.gz → 0.4.5.post4__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.
- {launchpy-0.4.5.post3/launchpy.egg-info → launchpy-0.4.5.post4}/PKG-INFO +1 -1
- {launchpy-0.4.5.post3 → launchpy-0.4.5.post4}/docs/synchronizer.md +1 -0
- launchpy-0.4.5.post4/launchpy/__version__.py +1 -0
- {launchpy-0.4.5.post3 → launchpy-0.4.5.post4}/launchpy/synchronizer.py +57 -50
- {launchpy-0.4.5.post3 → launchpy-0.4.5.post4/launchpy.egg-info}/PKG-INFO +1 -1
- launchpy-0.4.5.post3/launchpy/__version__.py +0 -1
- {launchpy-0.4.5.post3 → launchpy-0.4.5.post4}/LICENSE +0 -0
- {launchpy-0.4.5.post3 → launchpy-0.4.5.post4}/README.md +0 -0
- {launchpy-0.4.5.post3 → launchpy-0.4.5.post4}/docs/admin.md +0 -0
- {launchpy-0.4.5.post3 → launchpy-0.4.5.post4}/docs/getstarted.md +0 -0
- {launchpy-0.4.5.post3 → launchpy-0.4.5.post4}/docs/library.md +0 -0
- {launchpy-0.4.5.post3 → launchpy-0.4.5.post4}/docs/main.md +0 -0
- {launchpy-0.4.5.post3 → launchpy-0.4.5.post4}/docs/property.md +0 -0
- {launchpy-0.4.5.post3 → launchpy-0.4.5.post4}/docs/releases.md +0 -0
- {launchpy-0.4.5.post3 → launchpy-0.4.5.post4}/docs/translator.md +0 -0
- {launchpy-0.4.5.post3 → launchpy-0.4.5.post4}/launchpy/__init__.py +0 -0
- {launchpy-0.4.5.post3 → launchpy-0.4.5.post4}/launchpy/admin.py +0 -0
- {launchpy-0.4.5.post3 → launchpy-0.4.5.post4}/launchpy/config.py +0 -0
- {launchpy-0.4.5.post3 → launchpy-0.4.5.post4}/launchpy/configs.py +0 -0
- {launchpy-0.4.5.post3 → launchpy-0.4.5.post4}/launchpy/connector.py +0 -0
- {launchpy-0.4.5.post3 → launchpy-0.4.5.post4}/launchpy/launchpy.py +0 -0
- {launchpy-0.4.5.post3 → launchpy-0.4.5.post4}/launchpy/library.py +0 -0
- {launchpy-0.4.5.post3 → launchpy-0.4.5.post4}/launchpy/property.py +0 -0
- {launchpy-0.4.5.post3 → launchpy-0.4.5.post4}/launchpy.egg-info/SOURCES.txt +0 -0
- {launchpy-0.4.5.post3 → launchpy-0.4.5.post4}/launchpy.egg-info/dependency_links.txt +0 -0
- {launchpy-0.4.5.post3 → launchpy-0.4.5.post4}/launchpy.egg-info/requires.txt +0 -0
- {launchpy-0.4.5.post3 → launchpy-0.4.5.post4}/launchpy.egg-info/top_level.txt +0 -0
- {launchpy-0.4.5.post3 → launchpy-0.4.5.post4}/pyproject.toml +0 -0
- {launchpy-0.4.5.post3 → launchpy-0.4.5.post4}/requirements.txt +0 -0
- {launchpy-0.4.5.post3 → launchpy-0.4.5.post4}/setup.cfg +0 -0
- {launchpy-0.4.5.post3 → launchpy-0.4.5.post4}/setup.py +0 -0
|
@@ -47,6 +47,7 @@ Arguments:
|
|
|
47
47
|
* componentName : The name of the component to sync between template and target properties
|
|
48
48
|
* componentId : The id of the component to sync
|
|
49
49
|
* publishedVersion : Set to `False` by default. If set to True, takes the latest published version of the component.
|
|
50
|
+
* forceCreation : Set to `True` by default. It will create the element sync if it does not exist in the target property. Set to `False`, it will prevent that behavior.
|
|
50
51
|
|
|
51
52
|
Either of these 2 can be used, but in the end, the name of the component is used to do the matching between properties.
|
|
52
53
|
A component is either a Data Element or a Rule.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.4.5-4"
|
|
@@ -178,7 +178,7 @@ class Synchronizer:
|
|
|
178
178
|
cmp_baseDict['copy'] = copySettings(publishedVersion)
|
|
179
179
|
return cmp_baseDict
|
|
180
180
|
|
|
181
|
-
def syncComponent(self,componentName:str=None,componentId:str=None,publishedVersion:bool=False,**kwargs)->None:
|
|
181
|
+
def syncComponent(self,componentName:str=None,componentId:str=None,publishedVersion:bool=False,forceCreation:bool=True,**kwargs)->None:
|
|
182
182
|
"""
|
|
183
183
|
Synchronize a component from the base property to the different target properties.
|
|
184
184
|
It will detect the component with the same name in target properties.
|
|
@@ -188,6 +188,7 @@ class Synchronizer:
|
|
|
188
188
|
componentName : REQUIRED : the name of the component to sync
|
|
189
189
|
componentID : REQUIRED : the id of the component to sync
|
|
190
190
|
publishedVersion : OPTIONAL : if you want to take the version that has been published
|
|
191
|
+
forceCreation : OPTIONAL : If the component does not exist in the target property, create it. Default: True
|
|
191
192
|
possible kwargs:
|
|
192
193
|
timeout : OPTIONAL : The timeout to be used for the rule component. If not provided, the existing timeout will be used.
|
|
193
194
|
"""
|
|
@@ -211,22 +212,23 @@ class Synchronizer:
|
|
|
211
212
|
translatedComponent = self.translator.translate(target,data_element=cmp_baseDict['copy'])
|
|
212
213
|
## if it does not exist
|
|
213
214
|
if cmp_baseDict['name'] not in [de.get('attributes',{}).get('name') for de in self.targets[target]['dataElements']]:
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
215
|
+
if forceCreation:
|
|
216
|
+
comp = self.targets[target]['api'].createDataElement(
|
|
217
|
+
name=cmp_baseDict['name'],
|
|
218
|
+
descriptor= translatedComponent['descriptor'],
|
|
219
|
+
settings=translatedComponent['settings'],
|
|
220
|
+
extension=translatedComponent['extension'],
|
|
221
|
+
storage_duration = translatedComponent["storage_duration"],
|
|
222
|
+
force_lower_case = translatedComponent["force_lower_case"],
|
|
223
|
+
clean_text = translatedComponent["clean_text"],
|
|
224
|
+
default_value= translatedComponent["default_value"]
|
|
225
|
+
)
|
|
226
|
+
if cmp_baseDict['component']['attributes']['enabled'] != comp['attributes']['enabled']:
|
|
227
|
+
updateDE = self.targets[target]['api'].updateDataElement(
|
|
228
|
+
dataElement_id=comp['id'],
|
|
229
|
+
attr_dict=translatedComponent)
|
|
230
|
+
self.targets[target]['libraryStack']['dataElements'].append(comp)
|
|
231
|
+
self.targets[target]['dataElements'].append(comp)
|
|
230
232
|
else:
|
|
231
233
|
index,old_component = [(index,de) for index,de in enumerate(self.targets[target]['dataElements']) if de.get('attributes',{}).get('name') == cmp_baseDict['name']][0]
|
|
232
234
|
attributes = {
|
|
@@ -257,6 +259,7 @@ class Synchronizer:
|
|
|
257
259
|
rc['rule_id'] = cmp_baseDict['id']
|
|
258
260
|
for target in list(self.targets.keys()):
|
|
259
261
|
flagAllowList = False
|
|
262
|
+
flagSkipCreation = False ## do not check for new rule config if rule has not been created
|
|
260
263
|
## check if the component is in the exclComponentList
|
|
261
264
|
if any([bool(re.search(key,cmp_baseDict['name'])) for key in self.target_configs.get(target,{}).get('exclComponents',[])]):
|
|
262
265
|
return {cmp_baseDict['name']:False}
|
|
@@ -268,34 +271,37 @@ class Synchronizer:
|
|
|
268
271
|
if len(self.target_configs.get(target,{}).get('inclComponents',[]))==0 or flagAllowList:
|
|
269
272
|
## if rule does not exist
|
|
270
273
|
if cmp_baseDict['name'] not in [rule['attributes']['name'] for rule in self.targets[target]['rules']]:
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
274
|
+
if forceCreation:## creating the rule
|
|
275
|
+
targetRule = self.targets[target]['api'].createRule(
|
|
276
|
+
name=cmp_baseDict['name']
|
|
277
|
+
)
|
|
278
|
+
targetRuleId = targetRule['id']
|
|
279
|
+
self.translator.extendTargetRules(ruleName=cmp_baseDict['name'],ruleId=targetRuleId,property_name=target)
|
|
280
|
+
self.targets[target]['rules'].append(targetRule)
|
|
281
|
+
index = len(self.targets[target]['rules'])-1
|
|
282
|
+
self.targets[target]['libraryStack']['rules'].append(targetRule)
|
|
283
|
+
for rc in template_ruleComponents:
|
|
284
|
+
try:
|
|
285
|
+
translatedComponent = self.translator.translate(target,rule_component=copySettings(rc))
|
|
286
|
+
except:
|
|
287
|
+
raise KeyError("Could not translate the component. Please check if your extensions are aligned in the properties.")
|
|
288
|
+
translatedComponent['rule_setting']['data'][0]['id'] = targetRuleId
|
|
289
|
+
if timeout is not None:
|
|
290
|
+
translatedComponent['timeout'] = timeout
|
|
291
|
+
targetRuleComponent = self.targets[target]['api'].createRuleComponent(
|
|
292
|
+
name=translatedComponent['name'],
|
|
293
|
+
settings = translatedComponent['settings'],
|
|
294
|
+
descriptor = translatedComponent['descriptor'],
|
|
295
|
+
extension_infos = translatedComponent['extension'],
|
|
296
|
+
rule_infos = translatedComponent['rule_setting'],
|
|
297
|
+
rule_order=translatedComponent['rule_order'],
|
|
298
|
+
order=translatedComponent['order'],
|
|
299
|
+
negate=translatedComponent['negate'],
|
|
300
|
+
delay_next=translatedComponent['delay_next'],
|
|
301
|
+
timeout=translatedComponent['timeout'],
|
|
302
|
+
)
|
|
303
|
+
else:
|
|
304
|
+
flagSkipCreation = True
|
|
299
305
|
else: ## if a rule exist with the same name
|
|
300
306
|
index, targetRule = [(index,rule) for index, rule in enumerate(self.targets[target]['rules']) if rule['attributes']['name'] == cmp_baseDict['name']][0]
|
|
301
307
|
self.targets[target]['libraryStack']['rules'].append(targetRule)
|
|
@@ -329,11 +335,12 @@ class Synchronizer:
|
|
|
329
335
|
timeout=translatedComponent['timeout'],
|
|
330
336
|
)
|
|
331
337
|
## updating rule attribute if difference between base and target
|
|
332
|
-
if
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
338
|
+
if not flagSkipCreation:
|
|
339
|
+
if cmp_baseDict['component']['attributes']['enabled'] != targetRule['attributes']['enabled']:
|
|
340
|
+
baseRuleAttr = copySettings(cmp_baseDict['component'])
|
|
341
|
+
targetRule = self.targets[target]['api'].updateRule(rule_id=targetRuleId,attr_dict=baseRuleAttr) ## keeping in a var for debug
|
|
342
|
+
del self.targets[target]['rules'][index]
|
|
343
|
+
self.targets[target]['rules'].append(targetRule)
|
|
337
344
|
|
|
338
345
|
def syncComponents(self,componentsName:list=None,componentsId:list=None,publishedVersion:bool=False)->None:
|
|
339
346
|
"""
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.4.5-3"
|
|
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
|
|
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
|