How to use the diagrams.overview.Time function in diagrams

To help you get started, we’ve selected a few diagrams examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PyCon / pycon / diagrams / overview.py View on Github external
def main():
    if len(sys.argv) != 2:
        print >>sys.stderr, 'usage: overview.py destination_directory'
        sys.exit(2)
    with open('overview.tpl') as f:
        template_text = f.read()
    for day, end_time in zip(range(1, 6), [1730, 2030, 2045, 2045, 2045]):
        random.seed(day)
        scope = dict(
            day=day,
            t=Time((800 if day < 3 else 700), end_time, 2),
            )
        output = template(template_text, **scope)
        path = os.path.join(sys.argv[1], 'overview{}.svg'.format(day))
        with open(path, 'w') as f:
            f.write(output.encode('utf-8'))