rusackas commented on code in PR #41502:
URL: https://github.com/apache/superset/pull/41502#discussion_r3564110012


##########
superset/commands/report/log_prune.py:
##########
@@ -41,7 +41,7 @@ def run(self) -> None:
 
         for report_schedule in db.session.query(ReportSchedule).all():
             if report_schedule.log_retention is not None:
-                from_date = datetime.utcnow() - timedelta(
+                from_date = datetime.now(timezone.utc).replace(tzinfo=None) - 
timedelta(
                     days=report_schedule.log_retention
                 )

Review Comment:
   Added the annotation on `from_date`.



##########
superset/daos/query.py:
##########
@@ -48,7 +48,9 @@ def save_metadata(query: Query, payload: dict[str, Any]) -> 
None:
     @staticmethod
     def get_queries_changed_after(last_updated_ms: Union[float, int]) -> 
list[Query]:
         # UTC date time, same that is stored in the DB.
-        last_updated_dt = datetime.utcfromtimestamp(last_updated_ms / 1000)
+        last_updated_dt = datetime.fromtimestamp(
+            last_updated_ms / 1000, timezone.utc
+        ).replace(tzinfo=None)

Review Comment:
   Added the annotation on `last_updated_dt`.



##########
superset/commands/report/execute.py:
##########
@@ -134,7 +134,7 @@ def __init__(
     ) -> None:
         self._report_schedule = report_schedule
         self._scheduled_dttm = scheduled_dttm
-        self._start_dttm = datetime.utcnow()
+        self._start_dttm = datetime.now(timezone.utc).replace(tzinfo=None)

Review Comment:
   Added the annotation on `self._start_dttm`.



##########
superset/commands/report/execute.py:
##########
@@ -511,7 +513,7 @@ def _get_screenshots(self) -> list[bytes]:
         Get chart or dashboard screenshots
         :raises: ReportScheduleScreenshotFailedError
         """
-        start_time = datetime.utcnow()
+        start_time = datetime.now(timezone.utc).replace(tzinfo=None)

Review Comment:
   Added the annotation on `start_time`.



##########
superset/commands/report/execute.py:
##########
@@ -699,7 +707,7 @@ def _post_chart_data(
         return content or None
 
     def _get_csv_data(self) -> bytes:
-        start_time = datetime.utcnow()
+        start_time = datetime.now(timezone.utc).replace(tzinfo=None)

Review Comment:
   Added the annotation here too.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to