Github user ran-z commented on a diff in the pull request:
https://github.com/apache/incubator-ariatosca/pull/72#discussion_r104515579
--- Diff: aria/modeling/utils.py ---
@@ -120,27 +102,52 @@ def dump_dict_values(context, the_dict, name):
dump_list_values(context, the_dict.itervalues(), name)
-def dump_parameters(context, parameters, name='Properties'):
- if not parameters:
- return
- puts('%s:' % name)
- with context.style.indent:
- for parameter_name, parameter in parameters.iteritems():
- if parameter.type_name is not None:
- puts('%s = %s (%s)' %
(context.style.property(parameter_name),
-
context.style.literal(parameter.value),
-
context.style.type(parameter.type_name)))
- else:
- puts('%s = %s' % (context.style.property(parameter_name),
- context.style.literal(parameter.value)))
- if parameter.description:
- puts(context.style.meta(parameter.description))
-
-
def dump_interfaces(context, interfaces, name='Interfaces'):
if not interfaces:
return
puts('%s:' % name)
with context.style.indent:
for interface in interfaces.itervalues():
interface.dump(context)
+
+
+
+
+def deepcopy_with_locators(value):
+ """
+ Like :code:`deepcopy`, but also copies over locators.
+ """
+
+ res = deepcopy(value)
+ copy_locators(res, value)
+ return res
+
+
+def copy_locators(target, source):
+ """
+ Copies over :code:`_locator` for all elements, recursively.
+
+ Assumes that target and source have exactly the same list/dict
structure.
+ """
+
+ locator = getattr(source, '_locator', None)
--- End diff --
_locator shouldn't be handled in this part of the code
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---