adamdebreceni commented on code in PR #1770:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1770#discussion_r1601416310
##########
extensions/python/pythonprocessors/nifiapi/properties.py:
##########
@@ -281,3 +284,21 @@ def getProperty(self, descriptor) -> PythonPropertyValue:
expression_language_support = descriptor.expressionLanguageScope
!= ExpressionLanguageScope.NONE
property_value = self.cpp_context.getProperty(property_name)
return PythonPropertyValue(self.cpp_context, property_name,
property_value, expression_language_support)
+
+ def getStateManager(self) -> StateManager:
+ return self.cpp_context.getStateManager()
+
+ def getName(self) -> str:
+ return self.cpp_context.getName()
+
+ def getProperties(self) -> Dict[PropertyDescriptor, str]:
+ properties = dict()
+ cpp_properties = self.cpp_context.getProperties()
+
+ for property_name in cpp_properties:
+ for property_descriptor in self.processor.getPropertyDescriptors():
+ if property_descriptor.name == property_name:
+ properties[property_descriptor] =
cpp_properties[property_name]
+ break
Review Comment:
can't we just flip it and do, `cpp_properties` seems to be a wrapped python
dictionary, forwarding the `contains` call (which I think the following code
would do)
```suggestion
for property_descriptor in self.processor.getPropertyDescriptors():
if property_descriptor.name in cpp_properties:
properties[property_descriptor] =
cpp_properties[property_name]
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]