turbaszek commented on a change in pull request #14761:
URL: https://github.com/apache/airflow/pull/14761#discussion_r598262524
##########
File path: airflow/decorators/base.py
##########
@@ -29,7 +29,60 @@
from airflow.utils.task_group import TaskGroup, TaskGroupContext
-class BaseDecoratedOperator(BaseOperator):
+def validate_python_callable(python_callable):
+ """
+ Validate that python callable can be wrapped by operator.
+ Raises exception if invalid.
+
+ :param python_callable: Python object to be validated
+ :raises: TypeError, AirflowException
+ """
+ if not callable(python_callable):
+ raise TypeError('`python_callable` param must be callable')
+ if 'self' in signature(python_callable).parameters.keys():
+ raise AirflowException('@task does not support methods')
Review comment:
What about class methods?
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]