[Python-modules-commits] [parsedatetime] 01/06: New upstream version 2.3

Harlan Lieberman-Berg hlieberman at moszumanska.debian.org
Sat Mar 11 03:42:00 UTC 2017


This is an automated email from the git hooks/post-receive script.

hlieberman pushed a commit to branch master
in repository parsedatetime.

commit cfab5ddaafcf7aa1a9a18a7261812fcf57c520fc
Author: Harlan Lieberman-Berg <hlieberman at setec.io>
Date:   Fri Mar 10 22:24:11 2017 -0500

    New upstream version 2.3
---
 CHANGES.txt                           |   1 +
 Makefile                              |  51 +++++--
 PKG-INFO                              |  41 ++++--
 README.rst                            |  37 ++++-
 parsedatetime.egg-info/PKG-INFO       |  41 ++++--
 parsedatetime.egg-info/SOURCES.txt    |   4 +
 parsedatetime.egg-info/pbr.json       |   1 +
 parsedatetime.egg-info/requires.txt   |   1 +
 parsedatetime/__init__.py             |  65 +++++----
 parsedatetime/parsedatetime.py        |   2 +-
 parsedatetime/pdt_locales/__init__.py |   2 +-
 parsedatetime/pdt_locales/base.py     |   4 +-
 parsedatetime/pdt_locales/en_AU.py    |   4 +-
 parsedatetime/pdt_locales/fr_FR.py    | 248 ++++++++++++++++++++++++++++++++++
 requirements.testing.txt              |  12 ++
 setup.cfg                             |  23 ++--
 setup.py                              |   7 +-
 tests/TestAlternativeAbbreviations.py |   8 +-
 tests/TestAustralianLocale.py         |   8 +-
 tests/TestComplexDateTimes.py         |  16 ++-
 tests/TestContext.py                  |   7 +-
 tests/TestConvertUnitAsWords.py       |  12 +-
 tests/TestDelta.py                    |  19 ++-
 tests/TestErrors.py                   |   8 +-
 tests/TestFrenchLocale.py             | 193 +++++++++++---------------
 tests/TestGermanLocale.py             |   8 +-
 tests/TestInc.py                      |   7 +-
 tests/TestLocaleBase.py               |  29 +---
 tests/TestMultiple.py                 |   8 +-
 tests/TestNlp.py                      |   9 +-
 tests/TestPhrases.py                  |   8 +-
 tests/TestRanges.py                   |   8 +-
 tests/TestRussianLocale.py            |   8 +-
 tests/TestSimpleDateTimes.py          |  13 +-
 tests/TestSimpleOffsets.py            |  40 +++++-
 tests/TestSimpleOffsetsHours.py       |   7 +-
 tests/TestSimpleOffsetsNoon.py        |  31 ++++-
 tests/TestStartTimeFromSourceTime.py  |   7 +-
 tests/TestUnits.py                    |   7 +-
 tests/__init__.py                     |   5 +-
 violations.flake8.txt                 |   2 -
 41 files changed, 736 insertions(+), 276 deletions(-)

diff --git a/CHANGES.txt b/CHANGES.txt
index 6334ce5..7311c23 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,5 +1,6 @@
 02 Mar 2016 - bear
     v2.1 released
+    v2.2 bump
 
     Issue #156 parsedatetime 2.0 doesn't work on py26
 
diff --git a/Makefile b/Makefile
index a24d628..b0c9ee2 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,18 @@
 .PHONY: docs test
 
+UNAME_S := $(shell uname -s)
+ifeq ($(UNAME_S),Darwin)
+    BREWPATH = $(shell brew --prefix)
+    PYICU_LD = -L${BREWPATH}/opt/icu4c/lib
+    PYICU_CPP = -I${BREWPATH}/opt/icu4c/include
+else
+    PYICU_LD =
+    PYICU_CPP =
+endif
+
 help:
-	@echo "  env         create a development environment using virtualenv"
+	@echo "  env         install all production dependencies"
+	@echo "  dev         install all dev and production dependencies (virtualenv is assumed)"
 	@echo "  clean       remove unwanted stuff"
 	@echo "  lint        check style with flake8"
 	@echo "  test        run tests"
@@ -9,11 +20,23 @@ help:
 	@echo "  upload      generate source and wheel dist files and upload them"
 
 env:
-	sudo easy_install pip && \
-	pip install virtualenv && \
-	virtualenv env && \
-	. env/bin/activate && \
-	pip install .
+	pip install -Ur requirements.txt
+
+dev: env
+	pip install -Uqr requirements.testing.txt | tee
+	@echo "on OS X use homebrew to install icu4c"
+	LDFLAGS=${PYICU_LD} CPPFLAGS=${PYICU_CPP} \
+    pip install -U pyicu
+	pyenv install -s 2.7.11
+	pyenv install -s 3.5.2
+	pyenv install -s 2.6.9
+	pyenv install -s pypy-5.3
+	pyenv local 2.7.11 3.5.2 2.6.9 pypy-5.3
+
+info:
+	@python --version
+	@pyenv --version
+	@pip --version
 
 clean:
 	rm -fr build
@@ -28,10 +51,22 @@ docs:
 lint:
 	flake8 parsedatetime > violations.flake8.txt
 
-test:
-	nosetests
+test: lint
+	python setup.py test
+
+tox: clean
+	tox
+
+coverage: clean
+	@coverage run --source=parsedatetime setup.py test
+	@coverage html
+	@coverage report
+
+ci: tox coverage
+	CODECOV_TOKEN=`cat .codecov-token` codecov
 
 build: clean
+	python setup.py check
 	python setup.py sdist
 	python setup.py bdist_wheel
 
diff --git a/PKG-INFO b/PKG-INFO
index b49e75f..57dbd3e 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
-Metadata-Version: 1.0
+Metadata-Version: 1.1
 Name: parsedatetime
-Version: 2.1
+Version: 2.3
 Summary: Parse human-readable date/time text.
 Home-page: https://github.com/bear/parsedatetime
 Author: Mike Taylor
@@ -11,7 +11,9 @@ Description: parsedatetime
         
         Parse human-readable date/time strings.
         
-        Python 2.7 or greater is required for parsedatetime version 1.0 or greater.
+        Python 2.6 or greater is required for parsedatetime version 1.0 or greater.
+        
+        While we still test with Python 2.6 we cannot guarantee that future changes will not break under 2.6
         
         .. image:: https://img.shields.io/pypi/v/parsedatetime.svg
             :target: https://pypi.python.org/pypi/parsedatetime/
@@ -29,6 +31,10 @@ Description: parsedatetime
              :target: https://requires.io/github/bear/parsedatetime/requirements/?branch=master
              :alt: Requirements Status
         
+        .. image:: https://dependencyci.com/github/bear/parsedatetime/badge
+             :target: https://dependencyci.com/github/bear/parsedatetime
+             :alt: Dependency Status
+        
         ==========
         Installing
         ==========
@@ -45,14 +51,32 @@ Description: parsedatetime
         
             make test
         
-        To run tests on several python versions, type ``tox``::
+        To run tests on several python versions, type ``make tox``::
         
-          $ tox
+          $ make tox
           [... tox creates a virtualenv for every python version and runs tests inside of each]
           py27: commands succeeded
           py35: commands succeeded
         
-        This assumes that you have ``python2.7``, ``python3.5``, etc in ``PATH``.
+        This assumes that you have the versions you want to test under installed as part of your
+        PyEnv environment::
+        
+            pyenv install -s 2.6.9
+            pyenv install -s 2.7.11
+            pyenv install -s 3.5.2
+            pyenv install -s pypy-5.3
+            pyenv global 2.7.11 3.5.2 2.6.9 pypy-5.3
+        
+        The tests depend on PyICU being installed. PyICU depends on icu4c which on OS X requires homebrew::
+        
+            brew install icu4c
+        
+        *and* then will require that you pass in the ``LDFLAGS`` and ``CPPFLAGS`` that homebrew will display after the install::
+        
+            LDFLAGS:  -L/usr/local/opt/icu4c/lib
+            CPPFLAGS: -I/usr/local/opt/icu4c/include
+        
+        The Makefile contains the OS X default values for them so you may need to tweak them.
         
         ===================
         Using parsedatetime
@@ -69,10 +93,9 @@ Description: parsedatetime
         To get it to a Python ``datetime`` object::
         
             from datetime import datetime
-            from time import mktime
         
             time_struct, parse_status = cal.parse("tomorrow")
-            datetime.fromtimestamp(mktime(time_struct))
+            datetime(*time_struct[:6])
         
         Parse datetime with timezone support (using pytz package)::
         
@@ -111,7 +134,7 @@ Description: parsedatetime
         
         When I went to work for Open Source Applications Foundation and realized that the Chandler project could benefit from my experience with parsing of date/time text I decided to start from scratch and implement the code using Python and make it truly open.
         
-        After working on the initial concept and creating something that could be shown to the Chandler folks the code has now evolved to it's current state with the help the Chandler folks, most especially Darshana.
+        After working on the initial concept and creating something that could be shown to the Chandler folks, the code has now evolved to its current state with the help of the Chandler folks, most especially Darshana.
         
 Platform: Any
 Classifier: Development Status :: 5 - Production/Stable
diff --git a/README.rst b/README.rst
index a006717..226bbeb 100644
--- a/README.rst
+++ b/README.rst
@@ -2,7 +2,9 @@ parsedatetime
 
 Parse human-readable date/time strings.
 
-Python 2.7 or greater is required for parsedatetime version 1.0 or greater.
+Python 2.6 or greater is required for parsedatetime version 1.0 or greater.
+
+While we still test with Python 2.6 we cannot guarantee that future changes will not break under 2.6
 
 .. image:: https://img.shields.io/pypi/v/parsedatetime.svg
     :target: https://pypi.python.org/pypi/parsedatetime/
@@ -20,6 +22,10 @@ Python 2.7 or greater is required for parsedatetime version 1.0 or greater.
      :target: https://requires.io/github/bear/parsedatetime/requirements/?branch=master
      :alt: Requirements Status
 
+.. image:: https://dependencyci.com/github/bear/parsedatetime/badge
+     :target: https://dependencyci.com/github/bear/parsedatetime
+     :alt: Dependency Status
+
 ==========
 Installing
 ==========
@@ -36,14 +42,32 @@ From the source directory::
 
     make test
 
-To run tests on several python versions, type ``tox``::
+To run tests on several python versions, type ``make tox``::
 
-  $ tox
+  $ make tox
   [... tox creates a virtualenv for every python version and runs tests inside of each]
   py27: commands succeeded
   py35: commands succeeded
 
-This assumes that you have ``python2.7``, ``python3.5``, etc in ``PATH``.
+This assumes that you have the versions you want to test under installed as part of your
+PyEnv environment::
+
+    pyenv install -s 2.6.9
+    pyenv install -s 2.7.11
+    pyenv install -s 3.5.2
+    pyenv install -s pypy-5.3
+    pyenv global 2.7.11 3.5.2 2.6.9 pypy-5.3
+
+The tests depend on PyICU being installed. PyICU depends on icu4c which on OS X requires homebrew::
+
+    brew install icu4c
+
+*and* then will require that you pass in the ``LDFLAGS`` and ``CPPFLAGS`` that homebrew will display after the install::
+
+    LDFLAGS:  -L/usr/local/opt/icu4c/lib
+    CPPFLAGS: -I/usr/local/opt/icu4c/include
+
+The Makefile contains the OS X default values for them so you may need to tweak them.
 
 ===================
 Using parsedatetime
@@ -60,10 +84,9 @@ An example of how to use parsedatetime::
 To get it to a Python ``datetime`` object::
 
     from datetime import datetime
-    from time import mktime
 
     time_struct, parse_status = cal.parse("tomorrow")
-    datetime.fromtimestamp(mktime(time_struct))
+    datetime(*time_struct[:6])
 
 Parse datetime with timezone support (using pytz package)::
 
@@ -102,4 +125,4 @@ The code in parsedatetime has been implemented over the years in many different
 
 When I went to work for Open Source Applications Foundation and realized that the Chandler project could benefit from my experience with parsing of date/time text I decided to start from scratch and implement the code using Python and make it truly open.
 
-After working on the initial concept and creating something that could be shown to the Chandler folks the code has now evolved to it's current state with the help the Chandler folks, most especially Darshana.
+After working on the initial concept and creating something that could be shown to the Chandler folks, the code has now evolved to its current state with the help of the Chandler folks, most especially Darshana.
diff --git a/parsedatetime.egg-info/PKG-INFO b/parsedatetime.egg-info/PKG-INFO
index b49e75f..57dbd3e 100644
--- a/parsedatetime.egg-info/PKG-INFO
+++ b/parsedatetime.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
-Metadata-Version: 1.0
+Metadata-Version: 1.1
 Name: parsedatetime
-Version: 2.1
+Version: 2.3
 Summary: Parse human-readable date/time text.
 Home-page: https://github.com/bear/parsedatetime
 Author: Mike Taylor
@@ -11,7 +11,9 @@ Description: parsedatetime
         
         Parse human-readable date/time strings.
         
-        Python 2.7 or greater is required for parsedatetime version 1.0 or greater.
+        Python 2.6 or greater is required for parsedatetime version 1.0 or greater.
+        
+        While we still test with Python 2.6 we cannot guarantee that future changes will not break under 2.6
         
         .. image:: https://img.shields.io/pypi/v/parsedatetime.svg
             :target: https://pypi.python.org/pypi/parsedatetime/
@@ -29,6 +31,10 @@ Description: parsedatetime
              :target: https://requires.io/github/bear/parsedatetime/requirements/?branch=master
              :alt: Requirements Status
         
+        .. image:: https://dependencyci.com/github/bear/parsedatetime/badge
+             :target: https://dependencyci.com/github/bear/parsedatetime
+             :alt: Dependency Status
+        
         ==========
         Installing
         ==========
@@ -45,14 +51,32 @@ Description: parsedatetime
         
             make test
         
-        To run tests on several python versions, type ``tox``::
+        To run tests on several python versions, type ``make tox``::
         
-          $ tox
+          $ make tox
           [... tox creates a virtualenv for every python version and runs tests inside of each]
           py27: commands succeeded
           py35: commands succeeded
         
-        This assumes that you have ``python2.7``, ``python3.5``, etc in ``PATH``.
+        This assumes that you have the versions you want to test under installed as part of your
+        PyEnv environment::
+        
+            pyenv install -s 2.6.9
+            pyenv install -s 2.7.11
+            pyenv install -s 3.5.2
+            pyenv install -s pypy-5.3
+            pyenv global 2.7.11 3.5.2 2.6.9 pypy-5.3
+        
+        The tests depend on PyICU being installed. PyICU depends on icu4c which on OS X requires homebrew::
+        
+            brew install icu4c
+        
+        *and* then will require that you pass in the ``LDFLAGS`` and ``CPPFLAGS`` that homebrew will display after the install::
+        
+            LDFLAGS:  -L/usr/local/opt/icu4c/lib
+            CPPFLAGS: -I/usr/local/opt/icu4c/include
+        
+        The Makefile contains the OS X default values for them so you may need to tweak them.
         
         ===================
         Using parsedatetime
@@ -69,10 +93,9 @@ Description: parsedatetime
         To get it to a Python ``datetime`` object::
         
             from datetime import datetime
-            from time import mktime
         
             time_struct, parse_status = cal.parse("tomorrow")
-            datetime.fromtimestamp(mktime(time_struct))
+            datetime(*time_struct[:6])
         
         Parse datetime with timezone support (using pytz package)::
         
@@ -111,7 +134,7 @@ Description: parsedatetime
         
         When I went to work for Open Source Applications Foundation and realized that the Chandler project could benefit from my experience with parsing of date/time text I decided to start from scratch and implement the code using Python and make it truly open.
         
-        After working on the initial concept and creating something that could be shown to the Chandler folks the code has now evolved to it's current state with the help the Chandler folks, most especially Darshana.
+        After working on the initial concept and creating something that could be shown to the Chandler folks, the code has now evolved to its current state with the help of the Chandler folks, most especially Darshana.
         
 Platform: Any
 Classifier: Development Status :: 5 - Production/Stable
diff --git a/parsedatetime.egg-info/SOURCES.txt b/parsedatetime.egg-info/SOURCES.txt
index 5c1f872..e563b6d 100644
--- a/parsedatetime.egg-info/SOURCES.txt
+++ b/parsedatetime.egg-info/SOURCES.txt
@@ -4,6 +4,7 @@ LICENSE.txt
 MANIFEST.in
 Makefile
 README.rst
+requirements.testing.txt
 requirements.txt
 setup.cfg
 setup.py
@@ -18,6 +19,8 @@ parsedatetime/warns.py
 parsedatetime.egg-info/PKG-INFO
 parsedatetime.egg-info/SOURCES.txt
 parsedatetime.egg-info/dependency_links.txt
+parsedatetime.egg-info/pbr.json
+parsedatetime.egg-info/requires.txt
 parsedatetime.egg-info/top_level.txt
 parsedatetime/pdt_locales/__init__.py
 parsedatetime/pdt_locales/base.py
@@ -25,6 +28,7 @@ parsedatetime/pdt_locales/de_DE.py
 parsedatetime/pdt_locales/en_AU.py
 parsedatetime/pdt_locales/en_US.py
 parsedatetime/pdt_locales/es.py
+parsedatetime/pdt_locales/fr_FR.py
 parsedatetime/pdt_locales/icu.py
 parsedatetime/pdt_locales/nl_NL.py
 parsedatetime/pdt_locales/pt_BR.py
diff --git a/parsedatetime.egg-info/pbr.json b/parsedatetime.egg-info/pbr.json
new file mode 100644
index 0000000..1be2325
--- /dev/null
+++ b/parsedatetime.egg-info/pbr.json
@@ -0,0 +1 @@
+{"is_release": false, "git_version": "e3cf2a1"}
\ No newline at end of file
diff --git a/parsedatetime.egg-info/requires.txt b/parsedatetime.egg-info/requires.txt
new file mode 100644
index 0000000..2c6edea
--- /dev/null
+++ b/parsedatetime.egg-info/requires.txt
@@ -0,0 +1 @@
+future
diff --git a/parsedatetime/__init__.py b/parsedatetime/__init__.py
index 07be367..c724d76 100644
--- a/parsedatetime/__init__.py
+++ b/parsedatetime/__init__.py
@@ -44,7 +44,7 @@ __author__ = 'Mike Taylor'
 __email__ = 'bear at bear.im'
 __copyright__ = 'Copyright (c) 2016 Mike Taylor'
 __license__ = 'Apache License 2.0'
-__version__ = '2.1'
+__version__ = '2.3'
 __url__ = 'https://github.com/bear/parsedatetime'
 __download_url__ = 'https://pypi.python.org/pypi/parsedatetime'
 __description__ = 'Parse human-readable date/time text.'
@@ -915,7 +915,8 @@ class Calendar(object):
                 # day-of-week, we want to start with target as the day
                 # in the current week.
                 dowOffset = offset
-                if modifier not in ['next', 'last', 'prior', 'previous']:
+                relativeModifier = modifier not in ['this', 'next', 'last', 'prior', 'previous']
+                if relativeModifier:
                     dowOffset = 0
 
                 wkdy = self.ptc.WeekdayOffsets[wkdy]
@@ -926,7 +927,7 @@ class Calendar(object):
                                           startMinute, startSecond)
                 target = start + datetime.timedelta(days=diff)
 
-                if chunk1 != '':
+                if chunk1 != '' and relativeModifier:
                     # consider "one day before thursday": we need to parse chunk1 ("one day")
                     # and apply according to the offset ("before"), rather than allowing the
                     # remaining parse step to apply "one day" without the offset direction.
@@ -939,7 +940,7 @@ class Calendar(object):
                 sourceTime = target.timetuple()
             ctx.updateAccuracy(ctx.ACU_DAY)
 
-        elif self.ptc.CRE_TIME.match(unit):
+        elif chunk1 == '' and chunk2 == '' and self.ptc.CRE_TIME.match(unit):
             m = self.ptc.CRE_TIME.match(unit)
             debug and log.debug('CRE_TIME matched')
             (yr, mth, dy, hr, mn, sec, wd, yd, isdst), subctx = \
@@ -1576,6 +1577,9 @@ class Calendar(object):
         parseStr = None
         chunk1 = chunk2 = ''
 
+        ctx = self.currentContext
+        log.debug('eval %s with context - %s, %s', s, ctx.hasDate, ctx.hasTime)
+
         # Weekday
         m = self.ptc.CRE_WEEKDAY.search(s)
         if m is not None:
@@ -1592,7 +1596,7 @@ class Calendar(object):
                     parseStr = s
                     s = ''
 
-        if parseStr:
+        if parseStr and not ctx.hasDate:
             debug and log.debug(
                 'found (weekday) [%s][%s][%s]', parseStr, chunk1, chunk2)
             sourceTime = self._evalWeekday(parseStr, sourceTime)
@@ -2402,13 +2406,14 @@ class Constants(object):
                         adjusted.append(d)
                 return adjusted
 
+            def re_join(g):
+                return '|'.join(re.escape(i) for i in g)
+
             mths = _getLocaleDataAdjusted(self.locale.Months)
             smths = _getLocaleDataAdjusted(self.locale.shortMonths)
             swds = _getLocaleDataAdjusted(self.locale.shortWeekdays)
             wds = _getLocaleDataAdjusted(self.locale.Weekdays)
 
-            re_join = lambda g: '|'.join(re.escape(i) for i in g)
-
             # escape any regex special characters that may be found
             self.locale.re_values['months'] = re_join(mths)
             self.locale.re_values['shortmonths'] = re_join(smths)
@@ -2471,11 +2476,11 @@ class Constants(object):
                                         (?P<day>\d\d?)
                                         (?P<suffix>{daysuffix})?
                                         (,)?
-                                        (\s)?
+                                        (\s)*
                                     )
                                     (?P<mthname>
                                         \b({months}|{shortmonths})\b
-                                    )\s?
+                                    )\s*
                                     (?P<year>\d\d
                                         (\d\d)?
                                     )?
@@ -2491,17 +2496,17 @@ class Constants(object):
         # when the day is absent from the string
         self.RE_DATE3 = r'''(?P<date>
                                 (?:
-                                    (?:^|\s)
+                                    (?:^|\s+)
                                     (?P<mthname>
                                         {months}|{shortmonths}
                                     )\b
                                     |
-                                    (?:^|\s)
+                                    (?:^|\s+)
                                     (?P<day>[1-9]|[012]\d|3[01])
                                     (?P<suffix>{daysuffix}|)\b
                                     (?!\s*(?:{timecomponents}))
                                     |
-                                    ,?\s
+                                    ,?\s+
                                     (?P<year>\d\d(?:\d\d|))\b
                                     (?!\s*(?:{timecomponents}))
                                 ){{1,3}}
@@ -2510,18 +2515,18 @@ class Constants(object):
 
         # not being used in code, but kept in case others are manually
         # utilizing this regex for their own purposes
-        self.RE_MONTH = r'''(\s|^)
+        self.RE_MONTH = r'''(\s+|^)
                             (?P<month>
                                 (
                                     (?P<mthname>
                                         \b({months}|{shortmonths})\b
                                     )
-                                    (\s?
+                                    (\s*
                                         (?P<year>(\d{{4}}))
                                     )?
                                 )
                             )
-                            (?=\s|$|[^\w])'''.format(**self.locale.re_values)
+                            (?=\s+|$|[^\w])'''.format(**self.locale.re_values)
 
         self.RE_WEEKDAY = r'''\b
                               (?:
@@ -2546,7 +2551,7 @@ class Constants(object):
 
         self.RE_QUNITS = r'''\b(?P<qty>
                                  -?
-                                 (?:\d+(?:{decimal_mark}\d+|)|(?:{numbers})s)\s?
+                                 (?:\d+(?:{decimal_mark}\d+|)|(?:{numbers})\s+)\s*
                                  (?P<qunits>{qunits})
                              )\b'''.format(**self.locale.re_values)
 
@@ -2589,7 +2594,7 @@ class Constants(object):
                                  )'''
 
         if 'meridian' in self.locale.re_values:
-            self.RE_TIMEHMS2 += (r'\s?(?P<meridian>{meridian})\b'
+            self.RE_TIMEHMS2 += (r'\s*(?P<meridian>{meridian})\b'
                                  .format(**self.locale.re_values))
         else:
             self.RE_TIMEHMS2 += r'\b'
@@ -2629,20 +2634,20 @@ class Constants(object):
         self.RE_REMAINING = r'\s+'
 
         # Regex for date/time ranges
-        self.RE_RTIMEHMS = r'''(\s?|^)
+        self.RE_RTIMEHMS = r'''(\s*|^)
                                (\d\d?){timeseparator}
                                (\d\d)
                                ({timeseparator}(\d\d))?
-                               (\s?|$)'''.format(**self.locale.re_values)
+                               (\s*|$)'''.format(**self.locale.re_values)
 
-        self.RE_RTIMEHMS2 = (r'''(\s?|^)
+        self.RE_RTIMEHMS2 = (r'''(\s*|^)
                                  (\d\d?)
                                  ({timeseparator}(\d\d?))?
                                  ({timeseparator}(\d\d?))?'''
                              .format(**self.locale.re_values))
 
         if 'meridian' in self.locale.re_values:
-            self.RE_RTIMEHMS2 += (r'\s?({meridian})'
+            self.RE_RTIMEHMS2 += (r'\s*({meridian})'
                                   .format(**self.locale.re_values))
 
         self.RE_RDATE = r'(\d+([%s]\d+)+)' % dateSeps
@@ -2650,40 +2655,40 @@ class Constants(object):
                                 (
                                     (
                                         \b({months})\b
-                                    )\s?
+                                    )\s*
                                     (
                                         (\d\d?)
                                         (\s?|{daysuffix}|$)+
                                     )?
-                                    (,\s?\d{{4}})?
+                                    (,\s*\d{{4}})?
                                 )
                             )'''.format(**self.locale.re_values)
 
         # "06/07/06 - 08/09/06"
-        self.DATERNG1 = (r'{0}\s?{rangeseparator}\s?{0}'
+        self.DATERNG1 = (r'{0}\s*{rangeseparator}\s*{0}'
                          .format(self.RE_RDATE, **self.locale.re_values))
 
         # "march 31 - june 1st, 2006"
-        self.DATERNG2 = (r'{0}\s?{rangeseparator}\s?{0}'
+        self.DATERNG2 = (r'{0}\s*{rangeseparator}\s*{0}'
                          .format(self.RE_RDATE3, **self.locale.re_values))
 
         # "march 1rd -13th"
-        self.DATERNG3 = (r'{0}\s?{rangeseparator}\s?(\d\d?)\s?(rd|st|nd|th)?'
+        self.DATERNG3 = (r'{0}\s*{rangeseparator}\s*(\d\d?)\s*(rd|st|nd|th)?'
                          .format(self.RE_RDATE3, **self.locale.re_values))
 
         # "4:00:55 pm - 5:90:44 am", '4p-5p'
-        self.TIMERNG1 = (r'{0}\s?{rangeseparator}\s?{0}'
+        self.TIMERNG1 = (r'{0}\s*{rangeseparator}\s*{0}'
                          .format(self.RE_RTIMEHMS2, **self.locale.re_values))
 
-        self.TIMERNG2 = (r'{0}\s?{rangeseparator}\s?{0}'
+        self.TIMERNG2 = (r'{0}\s*{rangeseparator}\s*{0}'
                          .format(self.RE_RTIMEHMS, **self.locale.re_values))
 
         # "4-5pm "
-        self.TIMERNG3 = (r'\d\d?\s?{rangeseparator}\s?{0}'
+        self.TIMERNG3 = (r'\d\d?\s*{rangeseparator}\s*{0}'
                          .format(self.RE_RTIMEHMS2, **self.locale.re_values))
 
         # "4:30-5pm "
-        self.TIMERNG4 = (r'{0}\s?{rangeseparator}\s?{1}'
+        self.TIMERNG4 = (r'{0}\s*{rangeseparator}\s*{1}'
                          .format(self.RE_RTIMEHMS, self.RE_RTIMEHMS2,
                                  **self.locale.re_values))
 
diff --git a/parsedatetime/parsedatetime.py b/parsedatetime/parsedatetime.py
index 5a50a14..647eb06 100644
--- a/parsedatetime/parsedatetime.py
+++ b/parsedatetime/parsedatetime.py
@@ -1,2 +1,2 @@
 # Backward compatibility fix.
-from . import *
+from . import *         # noqa
diff --git a/parsedatetime/pdt_locales/__init__.py b/parsedatetime/pdt_locales/__init__.py
index b1edf2c..cb05718 100644
--- a/parsedatetime/pdt_locales/__init__.py
+++ b/parsedatetime/pdt_locales/__init__.py
@@ -9,7 +9,7 @@ All of the included locale classes shipped with pdt.
 from __future__ import absolute_import
 from .icu import get_icu
 
-locales = ['de_DE', 'en_AU', 'en_US', 'es', 'nl_NL', 'pt_BR', 'ru_RU']
+locales = ['de_DE', 'en_AU', 'en_US', 'es', 'nl_NL', 'pt_BR', 'ru_RU', 'fr_FR']
 
 __locale_caches = {}
 
diff --git a/parsedatetime/pdt_locales/base.py b/parsedatetime/pdt_locales/base.py
index 8a10dfe..0191629 100644
--- a/parsedatetime/pdt_locales/base.py
+++ b/parsedatetime/pdt_locales/base.py
@@ -102,9 +102,9 @@ re_values = {
     'timeseparator': ':',
     'rangeseparator': '-',
     'daysuffix': 'rd|st|nd|th',
-    'meridian': 'am|pm|a.m.|p.m.|a|p',
+    'meridian': r'am|pm|a\.m\.|p\.m\.|a|p',
     'qunits': 'h|m|s|d|w|y',
-    'now': ['now'],
+    'now': ['now', 'right now'],
 }
 
 # Used to adjust the returned date before/after the source
diff --git a/parsedatetime/pdt_locales/en_AU.py b/parsedatetime/pdt_locales/en_AU.py
index e4e4b54..bff3d3f 100644
--- a/parsedatetime/pdt_locales/en_AU.py
+++ b/parsedatetime/pdt_locales/en_AU.py
@@ -14,8 +14,6 @@ dateFormats = {
     'short': 'd/MM/yy',
 }
 
-timeFormats = {
-    'long': timeFormats['full'],
-}
+timeFormats['long'] = timeFormats['full']
 
 dp_order = ['d', 'm', 'y']
diff --git a/parsedatetime/pdt_locales/fr_FR.py b/parsedatetime/pdt_locales/fr_FR.py
new file mode 100644
index 0000000..0e5d3ef
--- /dev/null
+++ b/parsedatetime/pdt_locales/fr_FR.py
@@ -0,0 +1,248 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+from .base import *  # noqa
+
+# don't use an unicode string
+localeID = 'fr_FR'
+dateSep = ['\/']
+timeSep = [':', 'h']
+meridian = ['du matin', 'du soir']
+usesMeridian = True
+uses24 = True
+WeekdayOffsets = {}
+MonthOffsets = {}
+
+# always lowercase any lookup values - helper code expects that
+Weekdays = [
+    'lundi', 'mardi', 'mercredi', 'jeudi',
+    'vendredi', 'samedi', 'dimanche',
+]
+
+shortWeekdays = [
+    'lun', 'mar', 'mer', 'jeu', 'ven', 'sam', 'dim',
+]
+
+Months = [
+    'janvier', 'février|fevrier', 'mars', 'avril', 'mai', 'juin', 'juillet',
+    'août|aout', 'septembre', 'octobre', 'novembre', 'décembre|decembre',
+]
+
+# We do not list 'mar' as a short name for 'mars' as it conflicts with
+# the 'mar' of 'mardi'
+shortMonths = [
+    'jan', 'fév|fev', 'mars', 'avr', 'mai', 'jui',
+    'juil', 'aoû|aou', 'sep', 'oct', 'nov', 'déc|dec',
+]
+
+# use the same formats as ICU by default
+dateFormats = {
+    'full': 'EEEE d MMMM yyyy',
+    'long': 'd MMMM yyyy',
+    'medium': 'd MMM yyyy',
+    'short': 'd/M/yy'
+}
+
+timeFormats = {
+    'full': 'h:mm:ss a z',
+    'long': 'h:mm:ss a z',
+    'medium': 'h:mm:ss a',
+    'short': 'h:mm a',
+}
+
+dp_order = ['d', 'm', 'y']
+
+# Used to parse expressions like "in 5 hours"
+numbers = {
+    'zéro': 0,
+    'zero': 0,
+    'un': 1,
+    'une': 1,
+    'deux': 2,
+    'trois': 3,
+    'quatre': 4,
+    'cinq': 5,
+    'six': 6,
+    'sept': 7,
+    'huit': 8,
+    'neuf': 9,
+    'dix': 10,
+    'onze': 11,
+    'douze': 12,
+    'treize': 13,
+    'quatorze': 14,
+    'quinze': 15,
+    'seize': 16,
+    'dix-sept': 17,
+    'dix sept': 17,
+    'dix-huit': 18,
+    'dix huit': 18,
+    'dix-neuf': 19,
+    'dix neuf': 19,
+    'vingt': 20,
+    'vingt-et-un': 21,
+    'vingt et un': 21,
+    'vingt-deux': 22,
+    'vingt deux': 22,
+    'vingt-trois': 23,
+    'vingt trois': 23,
+    'vingt-quatre': 24,
+    'vingt quatre': 24,
+}
+
+decimal_mark = ','
+
+# this will be added to re_values later
+units = {
+    'seconds': ['seconde', 'secondes', 'sec', 's'],
+    'minutes': ['minute', 'minutes', 'min', 'mn'],
+    'hours': ['heure', 'heures', 'h'],
+    'days': ['jour', 'jours', 'journée', 'journee', 'journées', 'journees', 'j'],
+    'weeks': ['semaine', 'semaines', 'sem'],
+    'months': ['mois', 'm'],
+    'years': ['année', 'annee', 'an', 'années', 'annees', 'ans'],
+}
+
+# text constants to be used by later regular expressions
+re_values = {
+    'specials': 'à|a|le|la|du|de',
+    'timeseparator': '(?:\:|h|\s*heures?\s*)',
+    'rangeseparator': '-',
+    'daysuffix': 'ième|ieme|ème|eme|ère|ere|nde',
+    'meridian': None,
+    'qunits': 'h|m|s|j|sem|a',
+    'now': ['maintenant', 'tout de suite', 'immédiatement', 'immediatement', 'à l\'instant', 'a l\'instant'],
+}
+
+# Used to adjust the returned date before/after the source
+Modifiers = {
+    'avant': -1,
+    'il y a': -1,
+    'plus tot': -1,
+    'plus tôt': -1,
+    'y a': -1,
+    'antérieur': -1,
+    'anterieur': -1,
+    'dernier': -1,
+    'dernière': -1,
+    'derniere': -1,
+    'précédent': -1,
+    'précedent': -1,
+    'precédent': -1,
+    'precedent': -1,
+    'fin de': 0,
+    'fin du': 0,
+    'fin de la': 0,
+    'fin des': 0,
+    'fin d\'': 0,
+    'ce': 0,
+    'cette': 0,
+    'depuis': 1,
+    'dans': 1,
+    'à partir': 1,
+    'a partir': 1,
+    'après': 1,
+    'apres': 1,
+    'lendemain': 1,
+    'prochain': 1,
+    'prochaine': 1,
+    'suivant': 1,
+    'suivante': 1,
+    'plus tard': 1
+}
+
+dayOffsets = {
+    'après-demain': 2,
+    'apres-demain': 2,
+    'après demain': 2,
+    'apres demain': 2,
+    'demain': 1,
+    'aujourd\'hui': 0,
+    'hier': -1,
+    'avant-hier': -2,
+    'avant hier': -2
+}
+
+# special day and/or times, i.e. lunch, noon, evening
+# each element in the dictionary is a dictionary that is used
+# to fill in any value to be replace - the current date/time will
+# already have been populated by the method buildSources
+re_sources = {
+    'après-midi': {'hr': 13, 'mn': 0, 'sec': 0},
+    'apres-midi': {'hr': 13, 'mn': 0, 'sec': 0},
+    'après midi': {'hr': 13, 'mn': 0, 'sec': 0},
+    'apres midi': {'hr': 13, 'mn': 0, 'sec': 0},
+    'midi': {'hr': 12, 'mn': 0, 'sec': 0},
+    'déjeuner': {'hr': 12, 'mn': 0, 'sec': 0},
+    'dejeuner': {'hr': 12, 'mn': 0, 'sec': 0},
+    'matin': {'hr': 6, 'mn': 0, 'sec': 0},
+    'petit-déjeuner': {'hr': 8, 'mn': 0, 'sec': 0},
+    'petit-dejeuner': {'hr': 8, 'mn': 0, 'sec': 0},
+    'petit déjeuner': {'hr': 8, 'mn': 0, 'sec': 0},
+    'petit dejeuner': {'hr': 8, 'mn': 0, 'sec': 0},
+    'diner': {'hr': 19, 'mn': 0, 'sec': 0},
+    'dîner': {'hr': 19, 'mn': 0, 'sec': 0},
+    'soir': {'hr': 18, 'mn': 0, 'sec': 0},
+    'soirée': {'hr': 18, 'mn': 0, 'sec': 0},
+    'soiree': {'hr': 18, 'mn': 0, 'sec': 0},
+    'minuit': {'hr': 0, 'mn': 0, 'sec': 0},
+    'nuit': {'hr': 21, 'mn': 0, 'sec': 0},
+}
+
+small = {
+    'zéro': 0,
+    'zero': 0,
+    'un': 1,
+    'une': 1,
+    'deux': 2,
+    'trois': 3,
+    'quatre': 4,
+    'cinq': 5,
+    'six': 6,
+    'sept': 7,
+    'huit': 8,
+    'neuf': 9,
+    'dix': 10,
+    'onze': 11,
+    'douze': 12,
+    'treize': 13,
+    'quatorze': 14,
+    'quinze': 15,
+    'seize': 16,
+    'dix-sept': 17,
+    'dix sept': 17,
+    'dix-huit': 18,
+    'dix huit': 18,
+    'dix-neuf': 19,
+    'dix neuf': 19,
+    'vingt': 20,
+    'vingt-et-un': 21,
+    'vingt et un': 21,
+    'trente': 30,
+    'quarante': 40,
+    'cinquante': 50,
+    'soixante': 60,
+    'soixante-dix': 70,
+    'soixante dix': 70,
+    'quatre-vingt': 80,
+    'quatre vingt': 80,
+    'quatre-vingt-dix': 90,
+    'quatre vingt dix': 90
+}
+
+magnitude = {
+    'mille': 1000,
+    'millier': 1000,
+    'million': 1000000,
+    'milliard': 1000000000,
+    'trillion': 1000000000000,
+    'quadrillion': 1000000000000000,
+    'quintillion': 1000000000000000000,
+    'sextillion': 1000000000000000000000,
+    'septillion': 1000000000000000000000000,
+    'octillion': 1000000000000000000000000000,
+    'nonillion': 1000000000000000000000000000000,
+    'décillion': 1000000000000000000000000000000000,
+    'decillion': 1000000000000000000000000000000000,
+}
+
+ignore = ('et', ',')
diff --git a/requirements.testing.txt b/requirements.testing.txt
new file mode 100644
index 0000000..666b599
--- /dev/null
+++ b/requirements.testing.txt
@@ -0,0 +1,12 @@
+pytest
+pytest-cov
+pytest-runner
+mccabe
+flake8
+coverage
+coveralls
+codecov
+check-manifest
+unittest2
+tox
+tox-pyenv
\ No newline at end of file
diff --git a/setup.cfg b/setup.cfg
index 84cb5e6..c28269b 100644
--- a/setup.cfg
... 1066 lines suppressed ...

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/parsedatetime.git



More information about the Python-modules-commits mailing list