Taragolis commented on code in PR #36281:
URL: https://github.com/apache/airflow/pull/36281#discussion_r1436018174


##########
airflow/providers/cncf/kubernetes/pod_launcher_deprecated.py:
##########
@@ -148,13 +148,13 @@ def monitor_pod(self, pod: V1Pod, get_logs: bool) -> 
tuple[State, str | None]:
         """
         if get_logs:
             read_logs_since_sec = None
-            last_log_time = None
+            last_log_time: pendulum.DateTime | None = None
             while True:
                 logs = self.read_pod_logs(pod, timestamps=True, 
since_seconds=read_logs_since_sec)
                 for line in logs:
                     timestamp, message = 
self.parse_log_line(line.decode("utf-8"))
                     if timestamp:
-                        last_log_time = pendulum.parse(timestamp)
+                        last_log_time = cast(pendulum.DateTime, 
pendulum.parse(timestamp))

Review Comment:
   For formal pass type checking `¯\_(ツ)_/¯`.  
   
   `penulum.parse` might return any of `pendulum.datetime.DateTime`, 
`pendulum.date.Date`, `pendulum.time.Time`, `pendulum.time.Period` and in 
addition in pendulum 3 it could return `pendulum.interval.Interval` but it not 
listed in type annotation:
   
   - https://github.com/sdispater/pendulum/blob/3.0.0/src/pendulum/parser.py
   - https://github.com/sdispater/pendulum/blob/2.1.2/pendulum/parser.py
   
   Yeah, there is might be potential bug exists because `last_log_time` could 
be parsed in any type rather than `DateTime`. However I keep this code without 
any changes, rather than forced type checkers think that this actually 
`DateTime`.



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