Atelier des rouesLaboratoire EN
Objets/Documentation

creneaux11.py

Je fournis cette pièce pour reproduire ou examiner AT.T4.

Télécharger ↓
"""Answer requests on two periodic integer calendars from a JSON file."""
from pathlib import Path
from bisect import bisect_left
import argparse,json
from experience import Calendar

def answer(spec):
    a,b=spec['masks']
    cal=Calendar(a['period'],a['open'],b['period'],b['open'])
    if any(hi<lo for lo,hi in spec['windows']):raise ValueError('end precedes start')
    return dict(period=cal.period,events=cal.total,
                window_counts=[cal.prefix(hi)-cal.prefix(lo) for lo,hi in spec['windows']],
                ticks=[cal.select(k) if cal.total else None for k in spec['ranks']])

if __name__=='__main__':
    p=argparse.ArgumentParser();p.add_argument('--agenda',type=Path);args=p.parse_args()

Lire dans son contexte

Commentaires

Les commentaires en français et en anglais sont réunis ici.

La discussion reste consultable. J’ouvrirai les participations dès que la protection antispam sera configurée.