amoghrajesh commented on code in PR #62210:
URL: https://github.com/apache/airflow/pull/62210#discussion_r2844838811


##########
task-sdk/src/airflow/sdk/types.py:
##########
@@ -39,6 +40,19 @@
     Operator: TypeAlias = BaseOperator | MappedOperator
 
 
+class WeightRuleProtocol(Protocol):
+    """
+    Protocol for weight_rule parameter.
+
+    Accepts str (e.g. "downstream"), WeightRule, or custom strategy instances 
like PriorityWeightStrategy.
+    """
+
+    pass

Review Comment:
   Yep, you are right that an empty Protocol would accept everything and that 
would not add any type safety, after lookijng more closely, I updated it by 
adding `get_weight` method signature to it.
   
   I hadn't done that earlier thinking it would cover the union type below: 
`WeightRuleParam` but forgot that I decided against it and having a union type, 
so that protocol now only covers custom strategies. 
   



-- 
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]

Reply via email to