utkarsharma2 commented on code in PR #38465: URL: https://github.com/apache/airflow/pull/38465#discussion_r1607944404
########## airflow/providers/cohere/hooks/cohere.py: ########## @@ -46,23 +59,34 @@ def __init__( conn_id: str = default_conn_name, timeout: int | None = None, max_retries: int | None = None, + request_options: dict | None = None, ) -> None: super().__init__() self.conn_id = conn_id self.timeout = timeout self.max_retries = max_retries + self.request_options = request_options + if self.max_retries: + warnings.warn( + "Argument `max_retries` is deprecated. Please use `request_options` dict for function-specific request configuration instead.", + AirflowProviderDeprecationWarning, + stacklevel=2, + ) + self.request_options = ( + {"max_retries": self.max_retries} + if self.request_options is None + else self.request_options.update({"max_retries": self.max_retries}) Review Comment: nit: we generally use if/else in this manner to conditionally assign values, which is the intent of `if` clause here but in `else` you are updating the `self.request_options` dict. Which to me seems out of place. It would be much better to have a simplified version of the code here. -- 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: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org