{ "info": { "author": "RocketBoots Pty Ltd", "author_email": "support@rocketboots.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "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 :: Software Development :: Libraries :: Python Modules" ], "description": "Timeswitch: Time Period Expression Language\n===========================================\n\nTimeswitch allows dates to be tested against a time range to see if they\nare contained within the time range. Time ranges are expressed using a\nsimple grammar that supports absolute dates and times, repeating\nperiods, greater, less than, between and exact match comparisons, and\ncombinations of brackets and infix notation logical operators.\n\nA time is made up of the following ordered components, with sensible\ndefaults for components when omitted:\n\n- *year:* range expression with values 1-9999\n- *month:* range expression with integer values 1-12 or case\n insensitive jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov,\n dec\n- *day:* range expression with either integer values 1-31 or case\n insensitive mon, tue, wed, thu, fri, sat, sun. When used with a month\n a weekday has an optional ordinal 1st, 2nd, 3rd, 4th or 5th prefix to\n indicate nth weekday in the month\n- *hour-minute:* range expression with two integer values separated by\n a colon 0-23:0-59\n- *compound:* range expression with all or partial non ambiguous\n sequences of year month day hour-minute values\n\nThe expected month, weekday and ordinal strings can be overriden if\nnecessary using the API.\n\nA time range expression is similar to Python array syntax:\n\n- ``-`` is any value\n- ``x`` is a value = x\n- ``x-y`` is a value x \u2264 value \u2264 y. Note that:\n\n - The expressions on either side of the ``-`` must specify the same\n rightmost elements, e.g ``2017 jan - feb`` not\n ``2017 jan - feb 12``\n - The repeat period of the right hand side must be the same as or\n more frequent thant the first e.g ``jan - 2017 feb`` is not valid\n - For weekday ranges, Monday is considered the start of the week\n\n- ``-x`` is a value less than or equal to x\n- ``x-`` is a value greater than or equal to x\n\nTime range expressions can be combined using ``and``, ``or``, ``not``\nand ``( )`` to form nested expressions.\n\nThe empty string is always off. A dash is always on:\n\n``-``\n\nAlways on from 1:30am on the 3rd of April 2017:\n\n``2017 apr 3 1:30 -``\n\nAlways on every Friday on or after the 3rd of April 2017 (year and month\ncan be omitted because 'fri' is unambiguously a weekday):\n\n``fri and 2017 apr 3 -``\n\nAlways on every 1st Friday of the month on or after the 3rd of April\n2017:\n\n``1st fri and 2017 apr 3 -``\n\nAlways on every 1st or 3rd Friday of the month on or after the 3rd of\nApril 2017:\n\n``(1st fri or 3rd fri) and 2017 apr 3 -``\n\nFirst Friday of the month between 6:30pm and 9:50pm:\n\n``1st fri 18:30-21:50``\n\nThanksgiving, Christmas, Boxing Day and New Year's Day:\n\n``nov 4th thu or dec 25 or dec 26 or jan 1``\n\nNormal operator precedence is ``not``, ``and``, ``or``. Parenthesis can\nbe used to change this:\n\n``not((jun or aug) and 2017)``\n\nUsage\n-----\n\nA command line interface for timeswitch is available:\n\n.. code:: bash\n\n $ timeswitch\n usage: timeswitch [-h] [-d] [-w] [-y] [-a] [-p] expression [date]\n timeswitch: error: too few arguments\n $ timeswitch \"2017 jan 20 -\"\n on\n $ echo $?\n 0\n $ timeswitch \"1972 dec 5 - 1975 nov 11\"\n off\n $ echo $?\n 1\n $\n\nThe ``--year``, ``--week``, and ``--day`` options provide helpful\nvisualisations when developing and debugging timeswitch expressions.\n\nTo use the library directly in Python:\n\n.. code:: python\n\n from timeswitch import timeswitch\n from datetime import datetime\n\n ts = timeswitch('2017 may 4 20:20 - 20:30')\n print ts(datetime(2017, 5, 4, 20, 21)) # True\n print ts(datetime(2017, 5, 4, 20, 31)) # False\n\n``timeswitch()`` accepts optional named ``months``, ``weekdays`` and\n``ordinal`` arguments. Each is an array of alternative literal strings\nused when parsing the corresponding date part, for example if you want\nto write 'first wed' instead of '1st wed':\n\n.. code:: python\n\n ts = timeswitch('first wed', ordinals='first second third fourth fifth'.split(' '))\n\nContributing\n------------\n\nYou may contribute to the project by logging issues through the project\nissue tracker or by submitting a pull request.\n\nDevelopment\n~~~~~~~~~~~\n\nA development environment may be setup like this:\n\n.. code:: bash\n\n git clone https://bitbucket.org/rocketboots/timeswitch.git\n cd timeswitch\n pip install -e .[test]\n python setup.py nosetests\n\nContributions should include passing unit tests.\n\nPyPI Registration\n~~~~~~~~~~~~~~~~~\n\nTo support reStructuredText as PyPI expects, this document is\nautomatically converted provided the `Pandoc `__\npackage is installed. On OS X,\n\n.. code:: bash\n\n brew install pandoc\n pip install pypandoc twine\n python setup.py sdist\n twine register dist/timeswitch-*.tar.gz", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://bitbucket.org/rocketboots/timeswitch/", "keywords": "date time range period expression language", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "timeswitch", "package_url": "https://pypi.org/project/timeswitch/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/timeswitch/", "project_urls": { "Homepage": "https://bitbucket.org/rocketboots/timeswitch/" }, "release_url": "https://pypi.org/project/timeswitch/1.0.1/", "requires_dist": [ "enum34 (~=1.0)", "pyparsing (~=2.1)", "coverage (~=4.0); extra == 'test'", "mock (~=1.3); extra == 'test'", "nose (~=1.3); extra == 'test'", "testfixtures (~=4.3); extra == 'test'" ], "requires_python": "", "summary": "Test date/time against a time period expressed in a simple grammar", "version": "1.0.1" }, "last_serial": 2818642, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "bdf17a00fe55f152ad1497b428def867", "sha256": "1eeb56b50de0871a37816ace3b21336fdffc9f5624aa951c7f5b9ed30bc55314" }, "downloads": -1, "filename": "timeswitch-1.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "bdf17a00fe55f152ad1497b428def867", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 14383, "upload_time": "2017-03-23T06:28:48", "url": "https://files.pythonhosted.org/packages/6d/09/ce9be3ac91080fe26f3a1e092272cc4670a89dfa0cdc4993b9c46c2edbfc/timeswitch-1.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "115f78bcd75b95e9232b74bb7a8aec94", "sha256": "519151ace4e9e06e0682bb0b0df96b85cde91278681e3ee7771530d2ecbeef86" }, "downloads": -1, "filename": "timeswitch-1.0.0.tar.gz", "has_sig": false, "md5_digest": "115f78bcd75b95e9232b74bb7a8aec94", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12784, "upload_time": "2017-03-23T06:28:50", "url": "https://files.pythonhosted.org/packages/7e/9c/34cfda54e8abb3ea8127ad7dcf996a14892b5877a24113ef491fee6fd9f1/timeswitch-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "86da3bf2331bda2fba5d5d7cc953b5e8", "sha256": "f74f8c98ebbdc90171ae3c128ca95d5fca3ad063943d455a3a1e3ff322670e1e" }, "downloads": -1, "filename": "timeswitch-1.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "86da3bf2331bda2fba5d5d7cc953b5e8", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 14688, "upload_time": "2017-04-21T05:04:39", "url": "https://files.pythonhosted.org/packages/3c/0c/e79131b2a2f0e7b0c9c25a16873b4e67290cc9fa5f0820af7628ceee2e06/timeswitch-1.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "389bd4b1e4e0b06b26621d33841703da", "sha256": "0ab3e2749f521cb38c7115dd957110ad1c22743b4fb72b5e8dbb58a59b87fb38" }, "downloads": -1, "filename": "timeswitch-1.0.1.tar.gz", "has_sig": false, "md5_digest": "389bd4b1e4e0b06b26621d33841703da", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11570, "upload_time": "2017-04-21T05:04:40", "url": "https://files.pythonhosted.org/packages/3f/98/2b30793ad928cedb4d20daa2d53934a6d7f235c84b6768f7d791c7f4fad3/timeswitch-1.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "86da3bf2331bda2fba5d5d7cc953b5e8", "sha256": "f74f8c98ebbdc90171ae3c128ca95d5fca3ad063943d455a3a1e3ff322670e1e" }, "downloads": -1, "filename": "timeswitch-1.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "86da3bf2331bda2fba5d5d7cc953b5e8", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 14688, "upload_time": "2017-04-21T05:04:39", "url": "https://files.pythonhosted.org/packages/3c/0c/e79131b2a2f0e7b0c9c25a16873b4e67290cc9fa5f0820af7628ceee2e06/timeswitch-1.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "389bd4b1e4e0b06b26621d33841703da", "sha256": "0ab3e2749f521cb38c7115dd957110ad1c22743b4fb72b5e8dbb58a59b87fb38" }, "downloads": -1, "filename": "timeswitch-1.0.1.tar.gz", "has_sig": false, "md5_digest": "389bd4b1e4e0b06b26621d33841703da", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11570, "upload_time": "2017-04-21T05:04:40", "url": "https://files.pythonhosted.org/packages/3f/98/2b30793ad928cedb4d20daa2d53934a6d7f235c84b6768f7d791c7f4fad3/timeswitch-1.0.1.tar.gz" } ] }