tirkarthi commented on code in PR #50142:
URL: https://github.com/apache/airflow/pull/50142#discussion_r2075077969


##########
task-sdk/src/airflow/sdk/definitions/dag.py:
##########
@@ -185,7 +185,18 @@ def _convert_doc_md(doc_md: str | None) -> str | None:
                 return fh.read()
         except FileNotFoundError:
             return doc_md
+    return doc_md
+
 
+def _clean_doc_md(doc_md: str) -> str:
+    # alternative to using math.inf, the linter doesn't like inf being a float
+    strip_count = len(doc_md)
+
+    for line in doc_md.split("\n"):
+        if line != "":
+            strip_count = min(strip_count, len(line) - len(line.lstrip()))
+    if strip_count > 0:
+        doc_md = "\n".join([line[strip_count:] for line in doc_md.split("\n")])

Review Comment:
   I just checked in 2.10 and serialized_dag has the spaces preserved in doc_md 
and on the webserver in Airflow 2 `textwrap.dedent` is used to remove indents. 
I would prefer using stdlib function than custom implementation. 
   
   https://docs.python.org/3/library/inspect.html#inspect.cleandoc



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

Reply via email to