Загрузка данных


# utils.py
from typing import List, Optional
from store import Store

def select_store(stores: List[Store], current_hour: float) -> Optional[Store]:
    """Выбрать магазин с минимальным processing_time среди открытых."""
    open_stores = [s for s in stores if s.is_open(current_hour)]
    if not open_stores:
        return None
    return min(open_stores, key=lambda s: s.processing_time)

def calculate_payment(rating: int, is_express: bool) -> float:
    base = 200.0
    coeff = {1: 1.0, 2: 1.2, 3: 1.4, 4: 1.6, 5: 1.8}
    if rating not in coeff:
        raise ValueError("Оценка должна быть от 1 до 5")
    amount = base * coeff[rating]
    if is_express:
        amount *= 1.5
    return amount

def format_hours(hours: float) -> str:
    h = int(hours)
    m = int((hours - h) * 60)
    return f"{h}:{m:02d}"