uranusjr commented on code in PR #27526:
URL: https://github.com/apache/airflow/pull/27526#discussion_r1015880123


##########
kubernetes_tests/test_kubernetes_pod_operator.py:
##########
@@ -51,7 +50,7 @@
 
 def create_context(task) -> Context:
     dag = DAG(dag_id="dag")
-    tzinfo = pendulum.timezone("Europe/Amsterdam")
+    tzinfo = pendulum.timezone("Europe/Amsterdam")  # type: ignore

Review Comment:
   It’s because Pendulum imports `timezone` in `__init__.py`, and then later 
overrides the name to a function:
   
   
https://github.com/sdispater/pendulum/blob/cc2db5d573f8936a475148bda3ff92057723fc48/pendulum/__init__.py
   
   It is not unlike how Mypy dislikes this:
   
   ```python
   a = 1
   a = "2"  # type: ignore
   
   def f(x: str) -> None:
       print(x)
   
   f(a)  # error: Argument 1 to "f" has incompatible type "int"; expected "str"
   ```
   
   Pendulum does not really care about strong typing, so everything’s fine from 
its perspective, but from Mypy’s perspective `pendulum.timezone` is still 
declared as a module (because that’s what appears first), not a function.



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