{ "info": { "author": "Andrew Pashkin", "author_email": "andrew.pashkin@gmx.co.uk", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: MacOS :: MacOS X", "Operating System :: Microsoft :: Windows", "Operating System :: POSIX", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Topic :: Database", "Topic :: Software Development :: Libraries", "Topic :: Utilities" ], "description": "=====\nTempo\n=====\n\n.. image:: https://travis-ci.org/AndrewPashkin/python-tempo.svg?branch=master\n :alt: Build Status\n :target: https://travis-ci.org/AndrewPashkin/python-tempo\n\n.. image:: https://coveralls.io/repos/AndrewPashkin/python-tempo/badge.svg?branch=master&service=github\n :alt: Coverage\n :target: https://coveralls.io/github/AndrewPashkin/python-tempo?branch=master\n\nThis project provides a generic way to compose and query schedules of\nrecurrent continuous events, such as working time of organizations, meetings,\nmovie shows, etc.\n\nIt contains a Python implementation and bindings for PostgreSQL,\nDjango and Django REST Framework.\n\nLinks\n=====\n:PyPI: https://pypi.python.org/pypi/python-tempo\n:Documentation: https://python-tempo.readthedocs.org/\n:Issues: https://github.com/AndrewPashkin/python-tempo/issues/\n:Code: https://github.com/AndrewPashkin/python-tempo/\n\nFeatures\n========\n- Flexible schedule model, that can express shcedules, that other libraries\n can't.\n- Queries: containment of a single timestamp, future occurences.\n- Bindings:\n\n * PostgreSQL\n\n + Domain type for storing schedules\n + Procedures for performing tests on them\n (timestamp containment, future occurences).\n\n * Django\n\n + Model field\n + Custom lookups\n (timestamp containment,\n intersection with interval between two timestamps,\n test if scheduled event occurs within given interval\n between two timestamps).\n\n * Django-REST-Framework\n\n + Serializer field for serializing and deserializing schedules.\n\nQuick example\n=============\nJust a short example, which shows, how to construct and query a schedule.\n::\n\n >>> import datetime as dt\n >>> from itertools import islice\n >>> from tempo.recurrenteventset import RecurrentEventSet\n >>> recurrenteventset = RecurrentEventSet.from_json(\n ... ('OR',\n ... ('AND', [1, 5, 'day', 'week'], [10, 19, 'hour', 'day']),\n ... ('AND', [5, 6, 'day', 'week'], [10, 16, 'hour', 'day']))\n ... ) # 10-19 from Monday to Thursday and 10-16 in Friday\n >>> d1 = dt.datetime(year=2000, month=10, day=5, hour=18)\n >>> d1.weekday() # Thursday\n 3\n >>> d1 in recurrenteventset\n True\n >>> d2 = dt.datetime(year=2000, month=10, day=6, hour=18)\n >>> d2.weekday() # Friday\n 4\n >>> d2 in recurrenteventset\n False\n >>> d = dt.datetime(year=2000, month=1, day=1)\n >>> list(islice(recurrenteventset.forward(start=d), 3))\n [(datetime.datetime(2000, 1, 3, 10, 0),\n datetime.datetime(2000, 1, 3, 19, 0)),\n (datetime.datetime(2000, 1, 4, 10, 0),\n datetime.datetime(2000, 1, 4, 19, 0)),\n (datetime.datetime(2000, 1, 5, 10, 0),\n datetime.datetime(2000, 1, 5, 19, 0))]\n\n.. _readme-schedule-model:\n\nSchedule model\n==============\n\nExample\n-------\n\nHere is an example of how Tempo represents schedules::\n\n ('OR',\n ('AND', [1, 5, 'day', 'week'], [10, 19, 'hour', 'day']),\n ('AND', [5, 6, 'day', 'week'], [10, 16, 'hour', 'day'])))\n\nIt means \"from monday to thursday between 10am and 7pm and\nin friday between 10am and 4pm\".\n\nInformal definition\n-------------------\n\nBasic building block of schedule is a recurrent event,\nwhich is defined is such way::\n\n [, ,