This is an automated email from the ASF dual-hosted git repository.

shahar1 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 0135f75e6c1 Remove unused datetime to nanoseconds converter (#75781)
0135f75e6c1 is described below

commit 0135f75e6c1db10c6ae1c37aebb051979a5dbfe4
Author: Hussein Awala <[email protected]>
AuthorDate: Tue Oct 27 22:02:52 2026 +0100

    Remove unused datetime to nanoseconds converter (#75781)
    
    The datetime conversion helper has no callers, registrations, or documented 
public API contract. Its calendar dependency is exclusive to the unused 
implementation.
---
 airflow-core/src/airflow/utils/dates.py | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/airflow-core/src/airflow/utils/dates.py 
b/airflow-core/src/airflow/utils/dates.py
index c2fb08f388b..9c258bc941d 100644
--- a/airflow-core/src/airflow/utils/dates.py
+++ b/airflow-core/src/airflow/utils/dates.py
@@ -17,8 +17,6 @@
 # under the License.
 from __future__ import annotations
 
-import calendar
-
 # NOTE: Keep in sync with CRON_PRESETS in 
task-sdk/src/airflow/sdk/definitions/timetables/_cron.py
 # The SDK cannot import from core, so both dicts must be updated together.
 cron_presets: dict[str, str] = {
@@ -29,16 +27,3 @@ cron_presets: dict[str, str] = {
     "@quarterly": "0 0 1 */3 *",
     "@yearly": "0 0 1 1 *",
 }
-
-
-def datetime_to_nano(datetime) -> int | None:
-    """Convert datetime to nanoseconds."""
-    if datetime:
-        if datetime.tzinfo is None:
-            # There is no timezone info, handle it the same as UTC.
-            timestamp = calendar.timegm(datetime.timetuple()) + 
datetime.microsecond / 1e6
-        else:
-            # The datetime is timezone-aware. Use timestamp directly.
-            timestamp = datetime.timestamp()
-        return int(timestamp * 1e9)
-    return None

Reply via email to