[Git][debian-gis-team/trollsift][upstream] New upstream version 0.3.3

Antonio Valentino gitlab at salsa.debian.org
Fri Oct 11 07:01:35 BST 2019



Antonio Valentino pushed to branch upstream at Debian GIS Project / trollsift


Commits:
eadc560e by Antonio Valentino at 2019-10-11T05:54:37Z
New upstream version 0.3.3
- - - - -


8 changed files:

- .gitignore
- + .stickler.yml
- .travis.yml
- CHANGELOG.md
- appveyor.yml
- trollsift/parser.py
- trollsift/tests/unittests/test_parser.py
- trollsift/version.py


Changes:

=====================================
.gitignore
=====================================
@@ -1,64 +1,34 @@
-/testenv/*
-/build/*
-/dist/*
-/tests/unittests/__init__.pyc
-/tests/unittests/test_parser.pyc
-/tests/unittests/test_parser.py~
-/tests/integrationtests/__init__.pyc
-/tests/integrationtests/test_parser.pyc
-/tests/integrationtests/test_parser.py~
-/tests/__init__.pyc
-/tests/unittest/__init__.pyc
-/trollsift.egg-info/PKG-INFO
-/trollsift.egg-info/SOURCES.txt
-/trollsift.egg-info/dependency_links.txt
-/trollsift.egg-info/not-zip-safe
-/trollsift.egg-info/top_level.txt
-/trollsift/version.pyc
-/doc/source/api.rst~
-/doc/source/index.rst~
-/doc/source/installation.rst~
-/doc/source/usage.rst~
-/doc/build/doctrees/api.doctree
-/doc/build/doctrees/environment.pickle
-/doc/build/doctrees/index.doctree
-/doc/build/doctrees/installation.doctree
-/doc/build/doctrees/usage.doctree
-/doc/build/html/.buildinfo
-/doc/build/html/_sources/api.txt
-/doc/build/html/_sources/index.txt
-/doc/build/html/_sources/installation.txt
-/doc/build/html/_sources/usage.txt
-/doc/build/html/_static/ajax-loader.gif
-/doc/build/html/_static/basic.css
-/doc/build/html/_static/comment-bright.png
-/doc/build/html/_static/comment-close.png
-/doc/build/html/_static/comment.png
-/doc/build/html/_static/default.css
-/doc/build/html/_static/doctools.js
-/doc/build/html/_static/down-pressed.png
-/doc/build/html/_static/down.png
-/doc/build/html/_static/file.png
-/doc/build/html/_static/jquery.js
-/doc/build/html/_static/minus.png
-/doc/build/html/_static/plus.png
-/doc/build/html/_static/pygments.css
-/doc/build/html/_static/searchtools.js
-/doc/build/html/_static/sidebar.js
-/doc/build/html/_static/underscore.js
-/doc/build/html/_static/up-pressed.png
-/doc/build/html/_static/up.png
-/doc/build/html/_static/websupport.js
-/doc/build/html/api.html
-/doc/build/html/genindex.html
-/doc/build/html/index.html
-/doc/build/html/installation.html
-/doc/build/html/objects.inv
-/doc/build/html/py-modindex.html
-/doc/build/html/search.html
-/doc/build/html/searchindex.js
-/doc/build/html/usage.html
-/.coverage
-/tests/unittest/test_parser.pyc
-/trollsift/__init__.pyc
-/trollsift/parser.pyc
+# Byte-compiled / optimized / DLL files
+__pycache__/
+*.py[cod]
+*$py.class
+
+# C extensions
+*.so
+
+# Distribution / packaging
+.Python
+build/
+develop-eggs/
+dist/
+downloads/
+eggs/
+.eggs/
+lib/
+lib64/
+parts/
+sdist/
+var/
+wheels/
+pip-wheel-metadata/
+share/python-wheels/
+*.egg-info/
+.installed.cfg
+*.egg
+MANIFEST
+
+# Jupyter Notebook
+.ipynb_checkpoints
+
+doc/build/*
+.coverage


=====================================
.stickler.yml
=====================================
@@ -0,0 +1,5 @@
+linters:
+  flake8:
+    python: 3
+    config: setup.cfg
+


=====================================
.travis.yml
=====================================
@@ -23,7 +23,8 @@ matrix:
     os: osx
     language: generic
 install:
-- git clone --depth 1 git://github.com/astropy/ci-helpers.git
+#- git clone --depth 1 git://github.com/astropy/ci-helpers.git
+- git clone --depth 1 -b all-the-fixes git://github.com/djhoese/ci-helpers.git
 - source ci-helpers/travis/setup_conda.sh
 script:
 - coverage run --source=trollsift setup.py test


=====================================
CHANGELOG.md
=====================================
@@ -1,3 +1,18 @@
+## Version 0.3.3 (2019/10/09)
+
+### Pull Requests Merged
+
+#### Bugs fixed
+
+* [PR 15](https://github.com/pytroll/trollsift/pull/15) - Fix parse accepting strings with trailing characters
+
+#### Features added
+
+* [PR 14](https://github.com/pytroll/trollsift/pull/14) - Adding .stickler.yml configuration file
+
+In this release 2 pull requests were closed.
+
+
 ## Version 0.3.2 (2019/01/14)
 
 


=====================================
appveyor.yml
=====================================
@@ -19,10 +19,10 @@ environment:
       NUMPY_VERSION: "stable"
 
 install:
-    - "git clone --depth 1 git://github.com/astropy/ci-helpers.git"
+#    - "git clone --depth 1 git://github.com/astropy/ci-helpers.git"
+    - "git clone --depth 1 -b all-the-fixes git://github.com/djhoese/ci-helpers.git"
     - "powershell ci-helpers/appveyor/install-miniconda.ps1"
-    - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
-    - "activate test"
+    - "conda activate test"
 
 build: false  # Not a C# project, build stuff at the test step instead.
 


=====================================
trollsift/parser.py
=====================================
@@ -41,11 +41,11 @@ class Parser(object):
     def __str__(self):
         return self.fmt
 
-    def parse(self, stri):
+    def parse(self, stri, full_match=True):
         '''Parse keys and corresponding values from *stri* using format
         described in *fmt* string.
         '''
-        return parse(self.fmt, stri)
+        return parse(self.fmt, stri, full_match=full_match)
 
     def compose(self, keyvals):
         '''Return string composed according to *fmt* string and filled
@@ -295,8 +295,19 @@ class RegexFormatter(string.Formatter):
         field_name, value = value
         return self.regex_field(field_name, value, format_spec)
 
-    def extract_values(self, fmt, stri):
+    def extract_values(self, fmt, stri, full_match=True):
+        """Extract information from string matching format.
+
+        Args:
+            fmt (str): Python format string to match against
+            stri (str): String to extract information from
+            full_match (bool): Force the match of the whole string. Default
+                to ``True``.
+
+        """
         regex = self.format(fmt)
+        if full_match:
+            regex = '^' + regex + '$'
         match = re.match(regex, stri)
         if match is None:
             raise ValueError("String does not match pattern.")
@@ -307,9 +318,10 @@ regex_formatter = RegexFormatter()
 
 
 def _get_number_from_fmt(fmt):
-    """
-    Helper function for extract_values,
-    figures out string length from format string.
+    """Helper function for extract_values.
+
+    Figures out string length from format string.
+
     """
     if '%' in fmt:
         # its datetime
@@ -362,10 +374,18 @@ def get_convert_dict(fmt):
     return convdef
 
 
-def parse(fmt, stri):
-    """Parse keys and corresponding values from *stri* using format described in *fmt* string."""
+def parse(fmt, stri, full_match=True):
+    """Parse keys and corresponding values from *stri* using format described in *fmt* string.
+
+    Args:
+        fmt (str): Python format string to match against
+        stri (str): String to extract information from
+        full_match (bool): Force the match of the whole string. Default
+            True.
+
+    """
     convdef = get_convert_dict(fmt)
-    keyvals = regex_formatter.extract_values(fmt, stri)
+    keyvals = regex_formatter.extract_values(fmt, stri, full_match=full_match)
     for key in convdef.keys():
         keyvals[key] = _convert(convdef[key], keyvals[key])
 


=====================================
trollsift/tests/unittests/test_parser.py
=====================================
@@ -97,6 +97,15 @@ class TestParser(unittest.TestCase):
         fmt = '/somedir/{directory}/hrpt_{platform:4s}{platnum:2s}_{time:%Y%m%d_%H%M}_{orbit:4d}.l1b'
         self.assertRaises(ValueError, regex_formatter.extract_values, fmt, self.string)
 
+    def test_extract_values_full_match(self):
+        """Test that a string must completely match."""
+        fmt = '{orbit:05d}'
+        val = regex_formatter.extract_values(fmt, '12345')
+        self.assertEqual(val, {'orbit': '12345'})
+        self.assertRaises(ValueError, regex_formatter.extract_values, fmt, '12345abc')
+        val = regex_formatter.extract_values(fmt, '12345abc', full_match=False)
+        self.assertEqual(val, {'orbit': '12345'})
+
     def test_convert_digits(self):
         self.assertEqual(_convert('d', '69022'), 69022)
         self.assertRaises(ValueError, _convert, 'd', '69dsf')


=====================================
trollsift/version.py
=====================================
@@ -23,9 +23,9 @@ def get_keywords():
     # setup.py/versioneer.py will grep for the variable names, so they must
     # each be defined on a line of their own. _version.py will just call
     # get_keywords().
-    git_refnames = " (HEAD -> master, tag: v0.3.2)"
-    git_full = "d0e5b6006e248974d806d0dd8e20cc6641d778fb"
-    git_date = "2019-01-14 17:05:37 -0600"
+    git_refnames = " (HEAD -> master, tag: v0.3.3)"
+    git_full = "e0a82d62b317df5f62eb2532480ef110f2fe3b16"
+    git_date = "2019-10-09 08:55:57 -0500"
     keywords = {"refnames": git_refnames, "full": git_full, "date": git_date}
     return keywords
 



View it on GitLab: https://salsa.debian.org/debian-gis-team/trollsift/commit/eadc560ee05b3315280320eb36dd89faa701d2ec

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/trollsift/commit/eadc560ee05b3315280320eb36dd89faa701d2ec
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20191011/28988637/attachment-0001.html>


More information about the Pkg-grass-devel mailing list