Hello community, here is the log from the commit of package python-arrow for openSUSE:Factory checked in at 2020-08-01 12:30:48 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-arrow (Old) and /work/SRC/openSUSE:Factory/.python-arrow.new.3592 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "python-arrow" Sat Aug 1 12:30:48 2020 rev:16 rq:822788 version:0.15.8 Changes: -------- --- /work/SRC/openSUSE:Factory/python-arrow/python-arrow.changes 2020-07-15 12:13:16.892674018 +0200 +++ /work/SRC/openSUSE:Factory/.python-arrow.new.3592/python-arrow.changes 2020-08-01 12:30:52.306439607 +0200 @@ -1,0 +2,19 @@ +Sat Jul 25 15:25:36 UTC 2020 - Arun Persaud <arun@gmx.de> + +- specfile: + * updated url + +- update to version 0.15.8: + * [WARN] arrow will drop support for Python 2.7 and 3.5 in the 1.0.0 + release in late September. The 0.15.x and 0.16.x releases are the + last to support Python 2.7 and 3.5. + * [NEW] Added humanize week granularity translation for Czech. + * [FIX] arrow.get will now pick sane defaults when weekdays are + passed with particular token combinations, see #446. + * [INTERNAL] Moved arrow to an organization. The repo can now be + found here. + * [INTERNAL] Started issuing deprecation warnings for Python 2.7 and + 3.5. + * [INTERNAL] Added Python 3.9 to CI pipeline. + +------------------------------------------------------------------- Old: ---- arrow-0.15.7.tar.gz New: ---- arrow-0.15.8.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-arrow.spec ++++++ --- /var/tmp/diff_new_pack.gYDCQA/_old 2020-08-01 12:30:53.098440349 +0200 +++ /var/tmp/diff_new_pack.gYDCQA/_new 2020-08-01 12:30:53.102440353 +0200 @@ -26,11 +26,11 @@ %endif %bcond_without python2 Name: python-arrow%{?psuffix} -Version: 0.15.7 +Version: 0.15.8 Release: 0 Summary: Better dates and times for Python License: Apache-2.0 -URL: https://github.com/crsmithdev/arrow +URL: https://github.com/arrow-py/arrow Source: https://files.pythonhosted.org/packages/source/a/arrow/arrow-%{version}.tar.gz BuildRequires: %{python_module setuptools} BuildRequires: fdupes ++++++ arrow-0.15.7.tar.gz -> arrow-0.15.8.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/arrow-0.15.7/CHANGELOG.rst new/arrow-0.15.8/CHANGELOG.rst --- old/arrow-0.15.7/CHANGELOG.rst 2020-06-19 19:35:25.000000000 +0200 +++ new/arrow-0.15.8/CHANGELOG.rst 2020-07-24 04:50:10.000000000 +0200 @@ -1,6 +1,16 @@ Changelog ========= +0.15.8 (2020-07-23) +------------------- + +- [WARN] arrow will **drop support** for Python 2.7 and 3.5 in the 1.0.0 release in late September. The 0.15.x and 0.16.x releases are the last to support Python 2.7 and 3.5. +- [NEW] Added ``humanize`` week granularity translation for Czech. +- [FIX] ``arrow.get`` will now pick sane defaults when weekdays are passed with particular token combinations, see `#446 <https://github.com/arrow-py/arrow/issues/446>`_. +- [INTERNAL] Moved arrow to an organization. The repo can now be found `here <https://github.com/arrow-py/arrow>`_. +- [INTERNAL] Started issuing deprecation warnings for Python 2.7 and 3.5. +- [INTERNAL] Added Python 3.9 to CI pipeline. + 0.15.7 (2020-06-19) ------------------- @@ -63,7 +73,7 @@ 0.15.5 (2020-01-03) ------------------- -- [WARN] Python 2 reached EOL on 2020-01-01. arrow will **drop support** for Python 2 in a future release to be decided (see `#739 <https://github.com/crsmithdev/arrow/issues/739>`_). +- [WARN] Python 2 reached EOL on 2020-01-01. arrow will **drop support** for Python 2 in a future release to be decided (see `#739 <https://github.com/arrow-py/arrow/issues/739>`_). - [NEW] Added bounds parameter to ``span_range``, ``interval`` and ``span`` methods. This allows you to include or exclude the start and end values. - [NEW] ``arrow.get()`` can now create arrow objects from a timestamp with a timezone, for example: @@ -116,7 +126,7 @@ - [NEW] Added ``humanize`` week granularity translations for Chinese, Spanish and Vietnamese. - [CHANGE] Added ``ParserError`` to module exports. -- [FIX] Added support for midnight at end of day. See `#703 <https://github.com/crsmithdev/arrow/issues/703>`_ for details. +- [FIX] Added support for midnight at end of day. See `#703 <https://github.com/arrow-py/arrow/issues/703>`_ for details. - [INTERNAL] Created Travis build for macOS. - [INTERNAL] Test parsing and formatting against full timezone database. @@ -125,7 +135,7 @@ - [NEW] Added ``humanize`` week granularity translations for Portuguese and Brazilian Portuguese. - [NEW] Embedded changelog within docs and added release dates to versions. -- [FIX] Fixed a bug that caused test failures on Windows only, see `#668 <https://github.com/crsmithdev/arrow/issues/668>`_ for details. +- [FIX] Fixed a bug that caused test failures on Windows only, see `#668 <https://github.com/arrow-py/arrow/issues/668>`_ for details. 0.15.1 (2019-09-10) ------------------- @@ -140,7 +150,7 @@ - [NEW] Added support for DDD and DDDD ordinal date tokens. The following functionality is now possible: ``arrow.get("1998-045")``, ``arrow.get("1998-45", "YYYY-DDD")``, ``arrow.get("1998-045", "YYYY-DDDD")``. - [NEW] ISO 8601 basic format for dates and times is now supported (e.g. ``YYYYMMDDTHHmmssZ``). - [NEW] Added ``humanize`` week granularity translations for French, Russian and Swiss German locales. -- [CHANGE] Timestamps of type ``str`` are no longer supported **without a format string** in the ``arrow.get()`` method. This change was made to support the ISO 8601 basic format and to address bugs such as `#447 <https://github.com/crsmithdev/arrow/issues/447>`_. +- [CHANGE] Timestamps of type ``str`` are no longer supported **without a format string** in the ``arrow.get()`` method. This change was made to support the ISO 8601 basic format and to address bugs such as `#447 <https://github.com/arrow-py/arrow/issues/447>`_. The following will NOT work in v0.15.0: @@ -160,9 +170,9 @@ - [CHANGE] When a meridian token (a|A) is passed and no meridians are available for the specified locale (e.g. unsupported or untranslated) a ``ParserError`` is raised. - [CHANGE] The timestamp token (``X``) will now match float timestamps of type ``str``: ``arrow.get(“1565358758.123415”, “X”)``. -- [CHANGE] Strings with leading and/or trailing whitespace will no longer be parsed without a format string. Please see `the docs <https://arrow.readthedocs.io/en/latest/#regular-expressions>`_ for ways to handle this. +- [CHANGE] Strings with leading and/or trailing whitespace will no longer be parsed without a format string. Please see `the docs <https://arrow.readthedocs.io/#regular-expressions>`_ for ways to handle this. - [FIX] The timestamp token (``X``) will now only match on strings that **strictly contain integers and floats**, preventing incorrect matches. -- [FIX] Most instances of ``arrow.get()`` returning an incorrect ``Arrow`` object from a partial parsing match have been eliminated. The following issue have been addressed: `#91 <https://github.com/crsmithdev/arrow/issues/91>`_, `#196 <https://github.com/crsmithdev/arrow/issues/196>`_, `#396 <https://github.com/crsmithdev/arrow/issues/396>`_, `#434 <https://github.com/crsmithdev/arrow/issues/434>`_, `#447 <https://github.com/crsmithdev/arrow/issues/447>`_, `#456 <https://github.com/crsmithdev/arrow/issues/456>`_, `#519 <https://github.com/crsmithdev/arrow/issues/519>`_, `#538 <https://github.com/crsmithdev/arrow/issues/538>`_, `#560 <https://github.com/crsmithdev/arrow/issues/560>`_. +- [FIX] Most instances of ``arrow.get()`` returning an incorrect ``Arrow`` object from a partial parsing match have been eliminated. The following issue have been addressed: `#91 <https://github.com/arrow-py/arrow/issues/91>`_, `#196 <https://github.com/arrow-py/arrow/issues/196>`_, `#396 <https://github.com/arrow-py/arrow/issues/396>`_, `#434 <https://github.com/arrow-py/arrow/issues/434>`_, `#447 <https://github.com/arrow-py/arrow/issues/447>`_, `#456 <https://github.com/arrow-py/arrow/issues/456>`_, `#519 <https://github.com/arrow-py/arrow/issues/519>`_, `#538 <https://github.com/arrow-py/arrow/issues/538>`_, `#560 <https://github.com/arrow-py/arrow/issues/560>`_. 0.14.7 (2019-09-04) ------------------- @@ -190,13 +200,13 @@ ------------------- - [FIX] Fixed a regression in 0.14.3 that prevented a tzinfo argument of type string to be passed to the ``get()`` function. Functionality such as ``arrow.get("2019072807", "YYYYMMDDHH", tzinfo="UTC")`` should work as normal again. -- [CHANGE] Moved ``backports.functools_lru_cache`` dependency from ``extra_requires`` to ``install_requires`` for ``Python 2.7`` installs to fix `#495 <https://github.com/crsmithdev/arrow/issues/495>`_. +- [CHANGE] Moved ``backports.functools_lru_cache`` dependency from ``extra_requires`` to ``install_requires`` for ``Python 2.7`` installs to fix `#495 <https://github.com/arrow-py/arrow/issues/495>`_. 0.14.3 (2019-07-28) ------------------- - [NEW] Added full support for Python 3.8. -- [CHANGE] Added warnings for upcoming factory.get() parsing changes in 0.15.0. Please see `#612 <https://github.com/crsmithdev/arrow/issues/612>`_ for full details. +- [CHANGE] Added warnings for upcoming factory.get() parsing changes in 0.15.0. Please see `#612 <https://github.com/arrow-py/arrow/issues/612>`_ for full details. - [FIX] Extensive refactor and update of documentation. - [FIX] factory.get() can now construct from kwargs. - [FIX] Added meridians to Spanish Locale. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/arrow-0.15.7/Makefile new/arrow-0.15.8/Makefile --- old/arrow-0.15.7/Makefile 2020-06-09 22:27:16.000000000 +0200 +++ new/arrow-0.15.8/Makefile 2020-07-20 06:56:36.000000000 +0200 @@ -16,7 +16,7 @@ pre-commit install test: - rm -f .coverage + rm -f .coverage coverage.xml . venv/bin/activate; pytest lint: @@ -28,7 +28,7 @@ clean: clean-dist rm -rf venv .pytest_cache ./**/__pycache__ - rm -f .coverage ./**/*.pyc + rm -f .coverage coverage.xml ./**/*.pyc clean-dist: rm -rf dist build .egg .eggs arrow.egg-info diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/arrow-0.15.7/PKG-INFO new/arrow-0.15.8/PKG-INFO --- old/arrow-0.15.7/PKG-INFO 2020-06-19 19:42:24.000000000 +0200 +++ new/arrow-0.15.8/PKG-INFO 2020-07-24 04:55:26.461238000 +0200 @@ -1,26 +1,26 @@ Metadata-Version: 2.1 Name: arrow -Version: 0.15.7 +Version: 0.15.8 Summary: Better dates & times for Python Home-page: https://arrow.readthedocs.io Author: Chris Smith Author-email: crsmithdev@gmail.com License: Apache 2.0 -Project-URL: Repository, https://github.com/crsmithdev/arrow -Project-URL: Bug Reports, https://github.com/crsmithdev/arrow/issues +Project-URL: Repository, https://github.com/arrow-py/arrow +Project-URL: Bug Reports, https://github.com/arrow-py/arrow/issues Project-URL: Documentation, https://arrow.readthedocs.io Description: Arrow: Better dates & times for Python ====================================== .. start-inclusion-marker-do-not-remove - .. image:: https://github.com/crsmithdev/arrow/workflows/tests/badge.svg?branch=master + .. image:: https://github.com/arrow-py/arrow/workflows/tests/badge.svg?branch=master :alt: Build Status - :target: https://github.com/crsmithdev/arrow/actions?query=workflow%3Atests+branch%3A... + :target: https://github.com/arrow-py/arrow/actions?query=workflow%3Atests+branch%3Ama... - .. image:: https://codecov.io/github/crsmithdev/arrow/coverage.svg?branch=master - :alt: Codecov - :target: https://codecov.io/github/crsmithdev/arrow + .. image:: https://codecov.io/gh/arrow-py/arrow/branch/master/graph/badge.svg + :alt: Coverage + :target: https://codecov.io/gh/arrow-py/arrow .. image:: https://img.shields.io/pypi/v/arrow.svg :alt: PyPI Version @@ -76,7 +76,7 @@ Installation ~~~~~~~~~~~~ - To install Arrow, use `pip <https://pip.pypa.io/en/stable/quickstart/>`_ or `pipenv <https://docs.pipenv.org/en/latest/>`_: + To install Arrow, use `pip <https://pip.pypa.io/en/stable/quickstart/>`_ or `pipenv <https://docs.pipenv.org>`_: .. code-block:: console @@ -123,20 +123,20 @@ Documentation ------------- - For full documentation, please visit `arrow.readthedocs.io <https://arrow.readthedocs.io/en/latest/>`_. + For full documentation, please visit `arrow.readthedocs.io <https://arrow.readthedocs.io>`_. Contributing ------------ Contributions are welcome for both code and localizations (adding and updating locales). Begin by gaining familiarity with the Arrow library and its features. Then, jump into contributing: - #. Find an issue or feature to tackle on the `issue tracker <https://github.com/crsmithdev/arrow/issues>`_. Issues marked with the `"good first issue" label <https://github.com/crsmithdev/arrow/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22>`_ may be a great place to start! - #. Fork `this repository <https://github.com/crsmithdev/arrow>`_ on GitHub and begin making changes in a branch. + #. Find an issue or feature to tackle on the `issue tracker <https://github.com/arrow-py/arrow/issues>`_. Issues marked with the `"good first issue" label <https://github.com/arrow-py/arrow/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22>`_ may be a great place to start! + #. Fork `this repository <https://github.com/arrow-py/arrow>`_ on GitHub and begin making changes in a branch. #. Add a few tests to ensure that the bug was fixed or the feature works as expected. - #. Run the entire test suite and linting checks by running one of the following commands: :code:`tox` (if you have `tox <https://tox.readthedocs.io/en/latest/>`_ installed) **OR** :code:`make build38 && make test && make lint` (if you do not have Python 3.8 installed, replace :code:`build38` with the latest Python version on your system). + #. Run the entire test suite and linting checks by running one of the following commands: :code:`tox` (if you have `tox <https://tox.readthedocs.io>`_ installed) **OR** :code:`make build38 && make test && make lint` (if you do not have Python 3.8 installed, replace :code:`build38` with the latest Python version on your system). #. Submit a pull request and await feedback 😃. - If you have any questions along the way, feel free to ask them `here <https://github.com/crsmithdev/arrow/issues/new?labels=question>`_. + If you have any questions along the way, feel free to ask them `here <https://github.com/arrow-py/arrow/issues/new?labels=question>`_. Support Arrow ------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/arrow-0.15.7/README.rst new/arrow-0.15.8/README.rst --- old/arrow-0.15.7/README.rst 2020-06-09 22:27:16.000000000 +0200 +++ new/arrow-0.15.8/README.rst 2020-07-24 04:50:10.000000000 +0200 @@ -3,13 +3,13 @@ .. start-inclusion-marker-do-not-remove -.. image:: https://github.com/crsmithdev/arrow/workflows/tests/badge.svg?branch=master +.. image:: https://github.com/arrow-py/arrow/workflows/tests/badge.svg?branch=master :alt: Build Status - :target: https://github.com/crsmithdev/arrow/actions?query=workflow%3Atests+branch%3A... + :target: https://github.com/arrow-py/arrow/actions?query=workflow%3Atests+branch%3Ama... -.. image:: https://codecov.io/github/crsmithdev/arrow/coverage.svg?branch=master - :alt: Codecov - :target: https://codecov.io/github/crsmithdev/arrow +.. image:: https://codecov.io/gh/arrow-py/arrow/branch/master/graph/badge.svg + :alt: Coverage + :target: https://codecov.io/gh/arrow-py/arrow .. image:: https://img.shields.io/pypi/v/arrow.svg :alt: PyPI Version @@ -65,7 +65,7 @@ Installation ~~~~~~~~~~~~ -To install Arrow, use `pip <https://pip.pypa.io/en/stable/quickstart/>`_ or `pipenv <https://docs.pipenv.org/en/latest/>`_: +To install Arrow, use `pip <https://pip.pypa.io/en/stable/quickstart/>`_ or `pipenv <https://docs.pipenv.org>`_: .. code-block:: console @@ -112,20 +112,20 @@ Documentation ------------- -For full documentation, please visit `arrow.readthedocs.io <https://arrow.readthedocs.io/en/latest/>`_. +For full documentation, please visit `arrow.readthedocs.io <https://arrow.readthedocs.io>`_. Contributing ------------ Contributions are welcome for both code and localizations (adding and updating locales). Begin by gaining familiarity with the Arrow library and its features. Then, jump into contributing: -#. Find an issue or feature to tackle on the `issue tracker <https://github.com/crsmithdev/arrow/issues>`_. Issues marked with the `"good first issue" label <https://github.com/crsmithdev/arrow/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22>`_ may be a great place to start! -#. Fork `this repository <https://github.com/crsmithdev/arrow>`_ on GitHub and begin making changes in a branch. +#. Find an issue or feature to tackle on the `issue tracker <https://github.com/arrow-py/arrow/issues>`_. Issues marked with the `"good first issue" label <https://github.com/arrow-py/arrow/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22>`_ may be a great place to start! +#. Fork `this repository <https://github.com/arrow-py/arrow>`_ on GitHub and begin making changes in a branch. #. Add a few tests to ensure that the bug was fixed or the feature works as expected. -#. Run the entire test suite and linting checks by running one of the following commands: :code:`tox` (if you have `tox <https://tox.readthedocs.io/en/latest/>`_ installed) **OR** :code:`make build38 && make test && make lint` (if you do not have Python 3.8 installed, replace :code:`build38` with the latest Python version on your system). +#. Run the entire test suite and linting checks by running one of the following commands: :code:`tox` (if you have `tox <https://tox.readthedocs.io>`_ installed) **OR** :code:`make build38 && make test && make lint` (if you do not have Python 3.8 installed, replace :code:`build38` with the latest Python version on your system). #. Submit a pull request and await feedback 😃. -If you have any questions along the way, feel free to ask them `here <https://github.com/crsmithdev/arrow/issues/new?labels=question>`_. +If you have any questions along the way, feel free to ask them `here <https://github.com/arrow-py/arrow/issues/new?labels=question>`_. Support Arrow ------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/arrow-0.15.7/arrow/_version.py new/arrow-0.15.8/arrow/_version.py --- old/arrow-0.15.7/arrow/_version.py 2020-06-19 19:35:25.000000000 +0200 +++ new/arrow-0.15.8/arrow/_version.py 2020-07-24 04:50:10.000000000 +0200 @@ -1 +1 @@ -__version__ = "0.15.7" +__version__ = "0.15.8" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/arrow-0.15.7/arrow/arrow.py new/arrow-0.15.8/arrow/arrow.py --- old/arrow-0.15.7/arrow/arrow.py 2020-06-16 00:06:45.000000000 +0200 +++ new/arrow-0.15.8/arrow/arrow.py 2020-07-24 04:50:10.000000000 +0200 @@ -9,6 +9,7 @@ import calendar import sys +import warnings from datetime import datetime, timedelta from datetime import tzinfo as dt_tzinfo from math import trunc @@ -18,6 +19,15 @@ from arrow import formatter, locales, parser, util +if sys.version_info[:2] < (3, 6): # pragma: no cover + with warnings.catch_warnings(): + warnings.simplefilter("default", DeprecationWarning) + warnings.warn( + "Arrow will drop support for Python 2.7 and 3.5 in the upcoming v1.0.0 release. Please upgrade to " + "Python 3.6+ to continue receiving updates for Arrow.", + DeprecationWarning, + ) + class Arrow(object): """An :class:`Arrow <arrow.arrow.Arrow>` object. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/arrow-0.15.7/arrow/locales.py new/arrow-0.15.8/arrow/locales.py --- old/arrow-0.15.7/arrow/locales.py 2020-06-16 21:42:45.000000000 +0200 +++ new/arrow-0.15.8/arrow/locales.py 2020-07-20 06:56:36.000000000 +0200 @@ -2867,6 +2867,8 @@ "hours": {"past": "{0} hodinami", "future": ["{0} hodiny", "{0} hodin"]}, "day": {"past": "dnem", "future": "den", "zero": "{0} dnů"}, "days": {"past": "{0} dny", "future": ["{0} dny", "{0} dnů"]}, + "week": {"past": "týdnem", "future": "týden", "zero": "{0} týdnů"}, + "weeks": {"past": "{0} týdny", "future": ["{0} týdny", "{0} týdnů"]}, "month": {"past": "měsícem", "future": "měsíc", "zero": "{0} měsíců"}, "months": {"past": "{0} měsíci", "future": ["{0} měsíce", "{0} měsíců"]}, "year": {"past": "rokem", "future": "rok", "zero": "{0} let"}, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/arrow-0.15.7/arrow/parser.py new/arrow-0.15.8/arrow/parser.py --- old/arrow-0.15.7/arrow/parser.py 2020-06-16 00:06:45.000000000 +0200 +++ new/arrow-0.15.8/arrow/parser.py 2020-07-20 06:56:36.000000000 +0200 @@ -7,7 +7,7 @@ from dateutil import tz from arrow import locales -from arrow.util import iso_to_gregorian, normalize_timestamp +from arrow.util import iso_to_gregorian, next_weekday, normalize_timestamp try: from functools import lru_cache @@ -338,9 +338,15 @@ elif token in ["DD", "D"]: parts["day"] = int(value) - elif token in ["Do"]: + elif token == "Do": parts["day"] = int(value) + elif token == "dddd": + parts["day_of_week"] = self.locale.day_names.index(value) - 1 + + elif token == "ddd": + parts["day_of_week"] = self.locale.day_abbreviations.index(value) - 1 + elif token.upper() in ["HH", "H"]: parts["hour"] = int(value) @@ -444,6 +450,24 @@ parts["month"] = dt.month parts["day"] = dt.day + day_of_week = parts.get("day_of_week") + day = parts.get("day") + + # If day is passed, ignore day of week + if day_of_week is not None and day is None: + year = parts.get("year", 1970) + month = parts.get("month", 1) + day = 1 + + # dddd => first day of week after epoch + # dddd YYYY => first day of week in specified year + # dddd MM YYYY => first day of week in specified year and month + # dddd MM => first day after epoch in specified month + next_weekday_dt = next_weekday(datetime(year, month, day), day_of_week) + parts["year"] = next_weekday_dt.year + parts["month"] = next_weekday_dt.month + parts["day"] = next_weekday_dt.day + am_pm = parts.get("am_pm") hour = parts.get("hour", 0) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/arrow-0.15.7/arrow/util.py new/arrow-0.15.8/arrow/util.py --- old/arrow-0.15.7/arrow/util.py 2020-06-16 00:06:45.000000000 +0200 +++ new/arrow-0.15.8/arrow/util.py 2020-07-20 06:56:36.000000000 +0200 @@ -4,9 +4,37 @@ import datetime import numbers +from dateutil.rrule import WEEKLY, rrule + from arrow.constants import MAX_TIMESTAMP, MAX_TIMESTAMP_MS, MAX_TIMESTAMP_US +def next_weekday(start_date, weekday): + """Get next weekday from the specified start date. + + :param start_date: Datetime object representing the start date. + :param weekday: Next weekday to obtain. Can be a value between 0 (Monday) and 6 (Sunday). + :return: Datetime object corresponding to the next weekday after start_date. + + Usage:: + + # Get first Monday after epoch + >>> next_weekday(datetime(1970, 1, 1), 0) + 1970-01-05 00:00:00 + + # Get first Thursday after epoch + >>> next_weekday(datetime(1970, 1, 1), 3) + 1970-01-01 00:00:00 + + # Get first Sunday after epoch + >>> next_weekday(datetime(1970, 1, 1), 6) + 1970-01-04 00:00:00 + """ + if weekday < 0 or weekday > 6: + raise ValueError("Weekday must be between 0 (Monday) and 6 (Sunday).") + return rrule(freq=WEEKLY, dtstart=start_date, byweekday=weekday, count=1)[0] + + def total_seconds(td): """Get total seconds for timedelta.""" return td.total_seconds() @@ -77,4 +105,4 @@ return isinstance(s, str) -__all__ = ["total_seconds", "is_timestamp", "isstr", "iso_to_gregorian"] +__all__ = ["next_weekday", "total_seconds", "is_timestamp", "isstr", "iso_to_gregorian"] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/arrow-0.15.7/arrow.egg-info/PKG-INFO new/arrow-0.15.8/arrow.egg-info/PKG-INFO --- old/arrow-0.15.7/arrow.egg-info/PKG-INFO 2020-06-19 19:42:23.000000000 +0200 +++ new/arrow-0.15.8/arrow.egg-info/PKG-INFO 2020-07-24 04:55:26.000000000 +0200 @@ -1,26 +1,26 @@ Metadata-Version: 2.1 Name: arrow -Version: 0.15.7 +Version: 0.15.8 Summary: Better dates & times for Python Home-page: https://arrow.readthedocs.io Author: Chris Smith Author-email: crsmithdev@gmail.com License: Apache 2.0 -Project-URL: Repository, https://github.com/crsmithdev/arrow -Project-URL: Bug Reports, https://github.com/crsmithdev/arrow/issues +Project-URL: Repository, https://github.com/arrow-py/arrow +Project-URL: Bug Reports, https://github.com/arrow-py/arrow/issues Project-URL: Documentation, https://arrow.readthedocs.io Description: Arrow: Better dates & times for Python ====================================== .. start-inclusion-marker-do-not-remove - .. image:: https://github.com/crsmithdev/arrow/workflows/tests/badge.svg?branch=master + .. image:: https://github.com/arrow-py/arrow/workflows/tests/badge.svg?branch=master :alt: Build Status - :target: https://github.com/crsmithdev/arrow/actions?query=workflow%3Atests+branch%3A... + :target: https://github.com/arrow-py/arrow/actions?query=workflow%3Atests+branch%3Ama... - .. image:: https://codecov.io/github/crsmithdev/arrow/coverage.svg?branch=master - :alt: Codecov - :target: https://codecov.io/github/crsmithdev/arrow + .. image:: https://codecov.io/gh/arrow-py/arrow/branch/master/graph/badge.svg + :alt: Coverage + :target: https://codecov.io/gh/arrow-py/arrow .. image:: https://img.shields.io/pypi/v/arrow.svg :alt: PyPI Version @@ -76,7 +76,7 @@ Installation ~~~~~~~~~~~~ - To install Arrow, use `pip <https://pip.pypa.io/en/stable/quickstart/>`_ or `pipenv <https://docs.pipenv.org/en/latest/>`_: + To install Arrow, use `pip <https://pip.pypa.io/en/stable/quickstart/>`_ or `pipenv <https://docs.pipenv.org>`_: .. code-block:: console @@ -123,20 +123,20 @@ Documentation ------------- - For full documentation, please visit `arrow.readthedocs.io <https://arrow.readthedocs.io/en/latest/>`_. + For full documentation, please visit `arrow.readthedocs.io <https://arrow.readthedocs.io>`_. Contributing ------------ Contributions are welcome for both code and localizations (adding and updating locales). Begin by gaining familiarity with the Arrow library and its features. Then, jump into contributing: - #. Find an issue or feature to tackle on the `issue tracker <https://github.com/crsmithdev/arrow/issues>`_. Issues marked with the `"good first issue" label <https://github.com/crsmithdev/arrow/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22>`_ may be a great place to start! - #. Fork `this repository <https://github.com/crsmithdev/arrow>`_ on GitHub and begin making changes in a branch. + #. Find an issue or feature to tackle on the `issue tracker <https://github.com/arrow-py/arrow/issues>`_. Issues marked with the `"good first issue" label <https://github.com/arrow-py/arrow/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22>`_ may be a great place to start! + #. Fork `this repository <https://github.com/arrow-py/arrow>`_ on GitHub and begin making changes in a branch. #. Add a few tests to ensure that the bug was fixed or the feature works as expected. - #. Run the entire test suite and linting checks by running one of the following commands: :code:`tox` (if you have `tox <https://tox.readthedocs.io/en/latest/>`_ installed) **OR** :code:`make build38 && make test && make lint` (if you do not have Python 3.8 installed, replace :code:`build38` with the latest Python version on your system). + #. Run the entire test suite and linting checks by running one of the following commands: :code:`tox` (if you have `tox <https://tox.readthedocs.io>`_ installed) **OR** :code:`make build38 && make test && make lint` (if you do not have Python 3.8 installed, replace :code:`build38` with the latest Python version on your system). #. Submit a pull request and await feedback 😃. - If you have any questions along the way, feel free to ask them `here <https://github.com/crsmithdev/arrow/issues/new?labels=question>`_. + If you have any questions along the way, feel free to ask them `here <https://github.com/arrow-py/arrow/issues/new?labels=question>`_. Support Arrow ------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/arrow-0.15.7/docs/conf.py new/arrow-0.15.8/docs/conf.py --- old/arrow-0.15.7/docs/conf.py 2020-03-26 18:27:13.000000000 +0100 +++ new/arrow-0.15.8/docs/conf.py 2020-07-24 04:50:10.000000000 +0200 @@ -47,7 +47,7 @@ # https://alabaster.readthedocs.io/en/latest/customization.html html_theme_options = { "description": "Arrow is a sensible and human-friendly approach to dates, times and timestamps.", - "github_user": "crsmithdev", + "github_user": "arrow-py", "github_repo": "arrow", "github_banner": True, "show_related": False, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/arrow-0.15.7/requirements.txt new/arrow-0.15.8/requirements.txt --- old/arrow-0.15.7/requirements.txt 2020-06-06 15:35:17.000000000 +0200 +++ new/arrow-0.15.8/requirements.txt 2020-07-20 06:56:36.000000000 +0200 @@ -1,14 +1,14 @@ backports.functools_lru_cache==1.6.1; python_version == "2.7" dateparser==0.7.* -pre-commit==1.20.*; python_version <= "3.5" -pre-commit==2.3.*; python_version >= "3.6" +pre-commit==1.21.*; python_version <= "3.5" +pre-commit==2.6.*; python_version >= "3.6" pytest==4.6.*; python_version == "2.7" pytest==5.4.*; python_version >= "3.5" -pytest-cov==2.8.* +pytest-cov==2.10.* pytest-mock==2.0.*; python_version == "2.7" -pytest-mock==3.1.*; python_version >= "3.5" +pytest-mock==3.2.*; python_version >= "3.5" python-dateutil==2.8.* pytz==2019.* simplejson==3.17.* sphinx==1.8.*; python_version == "2.7" -sphinx==3.0.*; python_version >= "3.5" +sphinx==3.1.*; python_version >= "3.5" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/arrow-0.15.7/setup.py new/arrow-0.15.8/setup.py --- old/arrow-0.15.7/setup.py 2020-06-16 00:06:33.000000000 +0200 +++ new/arrow-0.15.8/setup.py 2020-07-24 04:50:10.000000000 +0200 @@ -43,8 +43,8 @@ ], keywords="arrow date time datetime timestamp timezone humanize", project_urls={ - "Repository": "https://github.com/crsmithdev/arrow", - "Bug Reports": "https://github.com/crsmithdev/arrow/issues", + "Repository": "https://github.com/arrow-py/arrow", + "Bug Reports": "https://github.com/arrow-py/arrow/issues", "Documentation": "https://arrow.readthedocs.io", }, ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/arrow-0.15.7/tests/test_formatter.py new/arrow-0.15.8/tests/test_formatter.py --- old/arrow-0.15.7/tests/test_formatter.py 2020-06-16 00:06:33.000000000 +0200 +++ new/arrow-0.15.8/tests/test_formatter.py 2020-07-20 06:56:36.000000000 +0200 @@ -22,7 +22,7 @@ @pytest.mark.usefixtures("arrow_formatter") -class TestDateTimeFormatterFormatToken: +class TestFormatterFormatToken: def test_format(self): dt = datetime(2013, 2, 5, 12, 32, 51) @@ -220,7 +220,7 @@ @pytest.mark.usefixtures("arrow_formatter", "time_1975_12_25") -class TestDateTimeFormatterBuiltinFormats: +class TestFormatterBuiltinFormats: def test_atom(self): assert ( self.formatter.format(self.datetime, FORMAT_ATOM) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/arrow-0.15.7/tests/test_locales.py new/arrow-0.15.8/tests/test_locales.py --- old/arrow-0.15.7/tests/test_locales.py 2020-06-16 21:42:45.000000000 +0200 +++ new/arrow-0.15.8/tests/test_locales.py 2020-07-20 06:56:36.000000000 +0200 @@ -361,6 +361,12 @@ assert self.locale._format_timeframe("hours", -5) == "5 hodinami" assert self.locale._format_timeframe("now", 0) == "Teď" + assert self.locale._format_timeframe("weeks", 2) == "2 týdny" + assert self.locale._format_timeframe("weeks", 5) == "5 týdnů" + assert self.locale._format_timeframe("week", 0) == "0 týdnů" + assert self.locale._format_timeframe("weeks", -2) == "2 týdny" + assert self.locale._format_timeframe("weeks", -5) == "5 týdny" + def test_format_relative_now(self): result = self.locale._format_relative("Teď", "now", 0) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/arrow-0.15.7/tests/test_parser.py new/arrow-0.15.8/tests/test_parser.py --- old/arrow-0.15.7/tests/test_parser.py 2020-06-09 20:21:32.000000000 +0200 +++ new/arrow-0.15.8/tests/test_parser.py 2020-07-20 06:56:36.000000000 +0200 @@ -10,7 +10,7 @@ from dateutil import tz import arrow -from arrow import parser +from arrow import formatter, parser from arrow.constants import MAX_TIMESTAMP_US from arrow.parser import DateTimeParser, ParserError, ParserMatchError @@ -580,6 +580,96 @@ with pytest.raises(ParserError): self.parser.parse("145", "DDDD") + def test_parse_ddd_and_dddd(self): + fr_parser = parser.DateTimeParser("fr") + + # Day of week should be ignored when a day is passed + # 2019-10-17 is a Thursday, so we know day of week + # is ignored if the same date is outputted + expected = datetime(2019, 10, 17) + assert self.parser.parse("Tue 2019-10-17", "ddd YYYY-MM-DD") == expected + assert fr_parser.parse("mar 2019-10-17", "ddd YYYY-MM-DD") == expected + assert self.parser.parse("Tuesday 2019-10-17", "dddd YYYY-MM-DD") == expected + assert fr_parser.parse("mardi 2019-10-17", "dddd YYYY-MM-DD") == expected + + # Get first Tuesday after epoch + expected = datetime(1970, 1, 6) + assert self.parser.parse("Tue", "ddd") == expected + assert fr_parser.parse("mar", "ddd") == expected + assert self.parser.parse("Tuesday", "dddd") == expected + assert fr_parser.parse("mardi", "dddd") == expected + + # Get first Tuesday in 2020 + expected = datetime(2020, 1, 7) + assert self.parser.parse("Tue 2020", "ddd YYYY") == expected + assert fr_parser.parse("mar 2020", "ddd YYYY") == expected + assert self.parser.parse("Tuesday 2020", "dddd YYYY") == expected + assert fr_parser.parse("mardi 2020", "dddd YYYY") == expected + + # Get first Tuesday in February 2020 + expected = datetime(2020, 2, 4) + assert self.parser.parse("Tue 02 2020", "ddd MM YYYY") == expected + assert fr_parser.parse("mar 02 2020", "ddd MM YYYY") == expected + assert self.parser.parse("Tuesday 02 2020", "dddd MM YYYY") == expected + assert fr_parser.parse("mardi 02 2020", "dddd MM YYYY") == expected + + # Get first Tuesday in February after epoch + expected = datetime(1970, 2, 3) + assert self.parser.parse("Tue 02", "ddd MM") == expected + assert fr_parser.parse("mar 02", "ddd MM") == expected + assert self.parser.parse("Tuesday 02", "dddd MM") == expected + assert fr_parser.parse("mardi 02", "dddd MM") == expected + + # Times remain intact + expected = datetime(2020, 2, 4, 10, 25, 54, 123456, tz.tzoffset(None, -3600)) + assert ( + self.parser.parse( + "Tue 02 2020 10:25:54.123456-01:00", "ddd MM YYYY HH:mm:ss.SZZ" + ) + == expected + ) + assert ( + fr_parser.parse( + "mar 02 2020 10:25:54.123456-01:00", "ddd MM YYYY HH:mm:ss.SZZ" + ) + == expected + ) + assert ( + self.parser.parse( + "Tuesday 02 2020 10:25:54.123456-01:00", "dddd MM YYYY HH:mm:ss.SZZ" + ) + == expected + ) + assert ( + fr_parser.parse( + "mardi 02 2020 10:25:54.123456-01:00", "dddd MM YYYY HH:mm:ss.SZZ" + ) + == expected + ) + + # Regression test for issue #446 + arw_formatter = formatter.DateTimeFormatter() + arw_formatter.format(self.parser.parse("Mon", "ddd"), "ddd") == "Mon" + arw_formatter.format(self.parser.parse("Monday", "dddd"), "dddd") == "Monday" + arw_formatter.format(self.parser.parse("Tue", "ddd"), "ddd") == "Tue" + arw_formatter.format(self.parser.parse("Tuesday", "dddd"), "dddd") == "Tuesday" + arw_formatter.format(self.parser.parse("Wed", "ddd"), "ddd") == "Wed" + arw_formatter.format( + self.parser.parse("Wednesday", "dddd"), "dddd" + ) == "Wednesday" + arw_formatter.format(self.parser.parse("Thu", "ddd"), "ddd") == "Thu" + arw_formatter.format( + self.parser.parse("Thursday", "dddd"), "dddd" + ) == "Thursday" + arw_formatter.format(self.parser.parse("Fri", "ddd"), "ddd") == "Fri" + arw_formatter.format(self.parser.parse("Friday", "dddd"), "dddd") == "Friday" + arw_formatter.format(self.parser.parse("Sat", "ddd"), "ddd") == "Sat" + arw_formatter.format( + self.parser.parse("Saturday", "dddd"), "dddd" + ) == "Saturday" + arw_formatter.format(self.parser.parse("Sun", "ddd"), "ddd") == "Sun" + arw_formatter.format(self.parser.parse("Sunday", "dddd"), "dddd") == "Sunday" + def test_parse_HH_24(self): assert self.parser.parse( "2019-10-30T24:00:00", "YYYY-MM-DDTHH:mm:ss" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/arrow-0.15.7/tests/test_util.py new/arrow-0.15.8/tests/test_util.py --- old/arrow-0.15.7/tests/test_util.py 2020-06-16 00:06:45.000000000 +0200 +++ new/arrow-0.15.8/tests/test_util.py 2020-07-20 06:56:36.000000000 +0200 @@ -8,6 +8,35 @@ class TestUtil: + def test_next_weekday(self): + # Get first Monday after epoch + assert util.next_weekday(datetime(1970, 1, 1), 0) == datetime(1970, 1, 5) + + # Get first Tuesday after epoch + assert util.next_weekday(datetime(1970, 1, 1), 1) == datetime(1970, 1, 6) + + # Get first Wednesday after epoch + assert util.next_weekday(datetime(1970, 1, 1), 2) == datetime(1970, 1, 7) + + # Get first Thursday after epoch + assert util.next_weekday(datetime(1970, 1, 1), 3) == datetime(1970, 1, 1) + + # Get first Friday after epoch + assert util.next_weekday(datetime(1970, 1, 1), 4) == datetime(1970, 1, 2) + + # Get first Saturday after epoch + assert util.next_weekday(datetime(1970, 1, 1), 5) == datetime(1970, 1, 3) + + # Get first Sunday after epoch + assert util.next_weekday(datetime(1970, 1, 1), 6) == datetime(1970, 1, 4) + + # Weekdays are 0-indexed + with pytest.raises(ValueError): + util.next_weekday(datetime(1970, 1, 1), 7) + + with pytest.raises(ValueError): + util.next_weekday(datetime(1970, 1, 1), -1) + def test_total_seconds(self): td = datetime(2019, 1, 1) - datetime(2018, 1, 1) assert util.total_seconds(td) == td.total_seconds() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/arrow-0.15.7/tox.ini new/arrow-0.15.8/tox.ini --- old/arrow-0.15.7/tox.ini 2020-06-09 22:27:16.000000000 +0200 +++ new/arrow-0.15.8/tox.ini 2020-07-20 06:56:36.000000000 +0200 @@ -43,7 +43,7 @@ # Configure settings for pytest, isort, and flake8 [pytest] -addopts = -v --cov-branch --cov=arrow tests --cov-fail-under=100 --cov-report=term-missing +addopts = -v --cov-branch --cov=arrow tests --cov-fail-under=100 --cov-report=term-missing --cov-report=xml [isort] line_length = 88
participants (1)
-
root