Atelier des rouesLab FR
Objects/Documentation

creneaux11.py

I provide this item to reproduce or inspect AT.T4.

Download ↓
"""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()

Read in context

Comments

Comments from both language editions appear here.

The discussion is open for reading. I’ll enable submissions once spam protection is configured.