Hello community,

here is the log from the commit of package python-padaos for openSUSE:Factory 
checked in at 2019-02-04 14:24:59
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-padaos (Old)
 and      /work/SRC/openSUSE:Factory/.python-padaos.new.28833 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-padaos"

Mon Feb  4 14:24:59 2019 rev:5 rq:670888 version:0.1.9

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-padaos/python-padaos.changes      
2018-12-24 11:40:40.405490372 +0100
+++ /work/SRC/openSUSE:Factory/.python-padaos.new.28833/python-padaos.changes   
2019-02-04 14:24:59.977065487 +0100
@@ -1,0 +2,12 @@
+Sat Feb  2 22:46:55 UTC 2019 - Antonio Larrosa <[email protected]>
+
+- Update to padaos 0.1.9
+  * Lock while running compile. Adding and removing intents or entities
+    while compiling may cause a RuntimeError, this lock _should_ handle
+    that issue
+
+- Update to padaos 0.1.8
+  * Lines resulting in invalid regexes are now ignored but the failing
+    line logged.
+
+-------------------------------------------------------------------

Old:
----
  padaos-0.1.7.tar.gz

New:
----
  padaos-0.1.9.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-padaos.spec ++++++
--- /var/tmp/diff_new_pack.xddtSS/_old  2019-02-04 14:25:00.433065271 +0100
+++ /var/tmp/diff_new_pack.xddtSS/_new  2019-02-04 14:25:00.437065269 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package python-padaos
 #
-# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -20,7 +20,7 @@
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-padaos
-Version:        0.1.7
+Version:        0.1.9
 Release:        0
 Summary:        An intent parser
 License:        MIT
@@ -52,6 +52,8 @@
 
 %files %{python_files}
 %doc README.md
-%{python_sitelib}/*
+%{python_sitelib}/padaos.*
+%{python_sitelib}/__pycache__/padaos.*
+%{python_sitelib}/padaos-%{version}-py%{python_version}.egg-info
 
 %changelog

++++++ padaos-0.1.7.tar.gz -> padaos-0.1.9.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/padaos-0.1.7/PKG-INFO new/padaos-0.1.9/PKG-INFO
--- old/padaos-0.1.7/PKG-INFO   2018-09-12 01:52:05.000000000 +0200
+++ new/padaos-0.1.9/PKG-INFO   2019-01-30 17:44:25.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.0
 Name: padaos
-Version: 0.1.7
+Version: 0.1.9
 Summary: A rigid, lightweight, dead-simple intent parser
 Home-page: http://github.com/MatthewScholefield/padaos
 Author: Matthew Scholefield
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/padaos-0.1.7/padaos.egg-info/PKG-INFO 
new/padaos-0.1.9/padaos.egg-info/PKG-INFO
--- old/padaos-0.1.7/padaos.egg-info/PKG-INFO   2018-09-12 01:52:05.000000000 
+0200
+++ new/padaos-0.1.9/padaos.egg-info/PKG-INFO   2019-01-30 17:44:25.000000000 
+0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.0
 Name: padaos
-Version: 0.1.7
+Version: 0.1.9
 Summary: A rigid, lightweight, dead-simple intent parser
 Home-page: http://github.com/MatthewScholefield/padaos
 Author: Matthew Scholefield
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/padaos-0.1.7/padaos.py new/padaos-0.1.9/padaos.py
--- old/padaos-0.1.7/padaos.py  2018-09-12 01:51:49.000000000 +0200
+++ new/padaos-0.1.9/padaos.py  2019-01-30 17:43:54.000000000 +0100
@@ -1,30 +1,40 @@
 import re
+import sre_constants
+import logging
+from threading import Lock
 
 
+LOG = logging.getLogger('padaos')
+
 class IntentContainer:
     def __init__(self):
         self.intent_lines, self.entity_lines = {}, {}
         self.intents, self.entities = {}, {}
         self.must_compile = True
         self.i = 0
+        self.compile_lock = Lock()
 
     def add_intent(self, name, lines):
-        self.must_compile = True
-        self.intent_lines[name] = lines
+        with self.compile_lock:
+            self.must_compile = True
+            self.intent_lines[name] = lines
 
     def remove_intent(self, name):
-        self.must_compile = True
-        if name in self.intent_lines:
-            del self.intent_lines[name]
+        with self.compile_lock:
+            self.must_compile = True
+            if name in self.intent_lines:
+                del self.intent_lines[name]
 
     def add_entity(self, name, lines):
-        self.must_compile = True
-        self.entity_lines[name] = lines
+        with self.compile_lock:
+            self.must_compile = True
+            self.entity_lines[name] = lines
 
     def remove_entity(self, name):
-        self.must_compile = True
-        if name in self.entity_lines:
-            del self.entity_lines[name]
+        with self.compile_lock:
+            self.must_compile = True
+            if name in self.entity_lines:
+                del self.entity_lines[name]
 
     def _create_pattern(self, line):
         for pat, rep in (
@@ -91,14 +101,28 @@
             self.i += 1
         return '^{}$'.format(line)
 
+    def _create_regex(self, line, intent_name):
+        """ Create regex and return. If error occurs returns None. """
+        try:
+            return re.compile(self._create_intent_pattern(line, intent_name),
+                              re.IGNORECASE)
+        except sre_constants.error as e:
+            LOG.warning('Failed to parse the line "{}" '
+                        'for {}'.format(line, intent_name))
+            return None
+            
     def create_regexes(self, lines, intent_name):
-        return [
-            re.compile(self._create_intent_pattern(line, intent_name), 
re.IGNORECASE)
-            for line in sorted(lines, key=len, reverse=True)
-            if line.strip()
-        ]
+        regexes = [self._create_regex(line, intent_name)
+                  for line in sorted(lines, key=len, reverse=True)
+                  if line.strip()]
+        # Filter out all regexes that fails
+        return [r for r in regexes if r is not None]
 
     def compile(self):
+        with self.compile_lock:
+            self._compile()
+
+    def _compile(self):
         self.entities = {
             ent_name: r'({})'.format('|'.join(
                 self._create_pattern(line) for line in lines if line.strip()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/padaos-0.1.7/setup.py new/padaos-0.1.9/setup.py
--- old/padaos-0.1.7/setup.py   2018-09-12 01:51:49.000000000 +0200
+++ new/padaos-0.1.9/setup.py   2019-01-30 17:43:54.000000000 +0100
@@ -4,7 +4,7 @@
 
 setup(
     name='padaos',
-    version='0.1.7',
+    version='0.1.9',
     description='A rigid, lightweight, dead-simple intent parser',
     url='http://github.com/MatthewScholefield/padaos',
     author='Matthew Scholefield',


Reply via email to