madhushreeag commented on code in PR #43337:
URL: https://github.com/apache/superset/pull/43337#discussion_r3815509521
##########
superset/charts/schemas.py:
##########
@@ -972,21 +980,33 @@ class ChartDataGeodeticParseOptionsSchema(
class ChartDataPostProcessingOperationSchema(Schema):
+ _builtin_ops = [
+ name
+ for name, value in inspect.getmembers(pandas_postprocessing,
inspect.isfunction)
+ ]
+
operation = fields.String(
metadata={
"description": "Post processing operation type",
"example": "aggregate",
},
required=True,
- validate=validate.OneOf(
- choices=[
- name
- for name, value in inspect.getmembers(
- pandas_postprocessing, inspect.isfunction
- )
- ]
- ),
)
+
+ @validates("operation")
+ def validate_operation(self, value: str, **kwargs: object) -> None:
+ from flask import current_app
+
+ extra_op_names = [
+ fn.__name__
+ for fn in
current_app.config.get("EXTRA_PANDAS_POSTPROCESSING_OPS", [])
+ ]
Review Comment:
Use getattr(fn, "__name__", None) with a filter to skip callables without a
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]