[Python-modules-commits] [guessit] 04/07: merge patched into master
Etienne Millon
emillon-guest at moszumanska.debian.org
Sun Nov 13 19:32:32 UTC 2016
This is an automated email from the git hooks/post-receive script.
emillon-guest pushed a commit to branch master
in repository guessit.
commit caca135fad35bbb8b28c5d7393f071daf4a564f2
Merge: 970cd9b 74976ec
Author: Etienne Millon <me at emillon.org>
Date: Mon Nov 7 22:38:05 2016 +0100
merge patched into master
debian/.git-dpm | 4 +-
debian/patches/0002-Update-dateutil-patch.patch | 94 +++++++++++++++++++++++++
debian/patches/series | 1 +
guessit/date.py | 54 +++++++++++++-
4 files changed, 149 insertions(+), 4 deletions(-)
diff --cc debian/.git-dpm
index 7be6dff,0000000..13ee05f
mode 100644,000000..100644
--- a/debian/.git-dpm
+++ b/debian/.git-dpm
@@@ -1,11 -1,0 +1,11 @@@
+# see git-dpm(1) from git-dpm package
- dce2eb4b966def3b5a8e8ea50c82cad7334b171f
- dce2eb4b966def3b5a8e8ea50c82cad7334b171f
++74976ece23da7d7e627aa8287a2c32861bf11e78
++74976ece23da7d7e627aa8287a2c32861bf11e78
+5533c0e4beff88d470afc9dd6f15a54a97c2b98d
+5533c0e4beff88d470afc9dd6f15a54a97c2b98d
+guessit_0.11.0.orig.tar.gz
+de8e46cab4a9faa33c91244e8c200fecca7c1845
+148248
+debianTag="debian/%e%v"
+patchedTag="patched/%e%v"
+upstreamTag="upstream/%e%u"
diff --cc debian/patches/0002-Update-dateutil-patch.patch
index 0000000,0000000..0a40680
new file mode 100644
--- /dev/null
+++ b/debian/patches/0002-Update-dateutil-patch.patch
@@@ -1,0 -1,0 +1,94 @@@
++From 74976ece23da7d7e627aa8287a2c32861bf11e78 Mon Sep 17 00:00:00 2001
++From: Etienne Millon <me at emillon.org>
++Date: Mon, 7 Nov 2016 22:18:14 +0100
++Subject: Update dateutil patch
++
++---
++ guessit/date.py | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++--
++ 1 file changed, 52 insertions(+), 2 deletions(-)
++
++diff --git a/guessit/date.py b/guessit/date.py
++index 385c508..a24034f 100644
++--- a/guessit/date.py
+++++ b/guessit/date.py
++@@ -71,7 +71,48 @@ def search_year(string):
++ return None, None
++
++
++-def search_date(string, year_first=None, day_first=True):
+++def _is_int(string):
+++ """
+++ Check if the input string is an integer
+++
+++ :param string:
+++ :type string:
+++ :return:
+++ :rtype:
+++ """
+++ try:
+++ int(string)
+++ return True
+++ except ValueError:
+++ return False
+++
+++
+++def _guess_day_first_parameter(groups):
+++ """
+++ If day_first is not defined, use some heuristic to fix it.
+++ It helps to solve issues with python dateutils 2.5.3 parser changes.
+++
+++ :param groups: match groups found for the date
+++ :type groups: list of match objects
+++ :return: day_first option guessed value
+++ :rtype: bool
+++ """
+++
+++ # If match starts with a long year, then day_first is force to false.
+++ if _is_int(groups[0]) and valid_year(int(groups[0][:4])):
+++ return False
+++ # If match ends with a long year, the day_first is forced to true.
+++ elif _is_int(groups[-1]) and valid_year(int(groups[-1][-4:])):
+++ return True
+++ # If match starts with a short year, then day_first is force to false.
+++ elif _is_int(groups[0]) and int(groups[0][:2]) > 31:
+++ return False
+++ # If match ends with a short year, then day_first is force to true.
+++ elif _is_int(groups[-1]) and int(groups[-1][-2:]) > 31:
+++ return True
+++
+++
+++def search_date(string, year_first=None, day_first=None):
++ """Looks for date patterns, and if found return the date and group span.
++
++ Assumes there are sentinels at the beginning and end of the string that
++@@ -91,20 +132,29 @@ def search_date(string, year_first=None, day_first=True):
++ """
++ start, end = None, None
++ match = None
+++ groups = None
++ for date_re in date_regexps:
++ s = date_re.search(string)
++ if s and (match is None or s.end() - s.start() > len(match)):
++ start, end = s.start(), s.end()
++ if date_re.groups:
++- match = '-'.join(s.groups())
+++ groups = s.groups()
+++ match = '-'.join(groups)
++ else:
++ match = s.group()
+++ groups = [match]
++
++ if match is None:
++ return None, None
++
++ today = datetime.date.today()
++
+++ if year_first and day_first is None:
+++ day_first = False
+++
+++ if day_first is None:
+++ day_first = _guess_day_first_parameter(groups)
+++
++ # If day_first/year_first is undefined, parse is made using both possible values.
++ yearfirst_opts = [False, True]
++ if year_first is not None:
diff --cc debian/patches/series
index 56d2af1,0000000..7e14f8c
mode 100644,000000..100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@@ -1,1 -1,0 +1,2 @@@
+test_hash.patch
++0002-Update-dateutil-patch.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/guessit.git
More information about the Python-modules-commits
mailing list