You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/12/22 19:13:00 UTC

[GitHub] [airflow] josh-fell commented on a change in pull request #20470: Fix Mypy errors in airflow/dag_processing

josh-fell commented on a change in pull request #20470:
URL: https://github.com/apache/airflow/pull/20470#discussion_r774109751



##########
File path: airflow/dag_processing/processor.py
##########
@@ -149,8 +149,8 @@ def _run_file_processor(
 
         try:
             # redirect stdout/stderr to log
-            with redirect_stdout(StreamLogWriter(log, logging.INFO)), redirect_stderr(
-                StreamLogWriter(log, logging.WARN)
+            with redirect_stdout(StreamLogWriter(log, logging.INFO)), (  # type: ignore[type-var]
+                redirect_stderr(StreamLogWriter(log, logging.WARN))  # type: ignore[type-var]

Review comment:
       Errors here:
   ```
   airflow/dag_processing/processor.py:152: error: Value of type variable "_T_io"
   of "redirect_stdout" cannot be "StreamLogWriter"
                   with redirect_stdout(StreamLogWriter(log, logging.INFO)), ...
                        ^
   airflow/dag_processing/processor.py:152: error: Value of type variable "_T_io"
   of "redirect_stderr" cannot be "StreamLogWriter"
   ```
   
   Typing for args of both `redirect_stdout()` and `redirect_stderr()` is handled in an external
   contextlib stub file and defined as `ContextManager[TypeVar("_T_io", bound=Optional[IO[str]])]`
   so ignoring the Mypy errors here. But any feedback on a proper handling of this is welcomed of course.




-- 
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-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org