INNER CODE UNIT · Python

at

MichielMe/fastscheduler · src/fastscheduler/main.py:212

    def at(self, target_time: Union[datetime, str]) -> OnceScheduler:
        """Schedule a task at a specific datetime."""
        if isinstance(target_time, str):
            target_time = datetime.strptime(target_time, "%Y-%m-%d %H:%M:%S")

        delay = (target_time - datetime.now()).total_seconds()
        if delay < 0:
            raise ValueError("Target time is in the past")

        scheduler = OnceScheduler(self, delay)
        scheduler._decorator_mode = True
        return scheduler

    # ==================== Internal Methods ====================

    def _register_function(self, func: Callable):
        """Register a function for persistence."""
        self.job_registry[f"{func.__module__}.{func.__name__}"] = func

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…