Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-adapt-parser for
openSUSE:Factory checked in at 2021-11-27 00:51:38
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-adapt-parser (Old)
and /work/SRC/openSUSE:Factory/.python-adapt-parser.new.1895 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-adapt-parser"
Sat Nov 27 00:51:38 2021 rev:6 rq:934030 version:1.0.0
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-adapt-parser/python-adapt-parser.changes
2021-10-16 22:47:48.428700358 +0200
+++
/work/SRC/openSUSE:Factory/.python-adapt-parser.new.1895/python-adapt-parser.changes
2021-11-27 00:52:30.842555610 +0100
@@ -1,0 +2,10 @@
+Tue Nov 2 10:26:21 UTC 2021 - [email protected]
+
+- version update to 1.0.0
+ * Safe defaults #147
+ * Updated docstrings
+ * Fix is_prefix() implementation in Trie #148
+ * Python2 is officially supported
+ * Removed requirement of pyee
+
+-------------------------------------------------------------------
Old:
----
v0.6.1.tar.gz
New:
----
v1.0.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-adapt-parser.spec ++++++
--- /var/tmp/diff_new_pack.mWzMYK/_old 2021-11-27 00:52:31.266554147 +0100
+++ /var/tmp/diff_new_pack.mWzMYK/_new 2021-11-27 00:52:31.266554147 +0100
@@ -18,7 +18,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-adapt-parser
-Version: 0.6.1
+Version: 1.0.0
Release: 0
Summary: A text-to-intent parsing framework
License: Apache-2.0
@@ -53,7 +53,7 @@
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
-%python_exec setup.py test
+%pyunittest test/*.py
%files %{python_files}
%license LICENSE.md
++++++ v0.6.1.tar.gz -> v1.0.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/adapt-release-v0.6.1/.github/workflows/push.yml
new/adapt-release-v1.0.0/.github/workflows/push.yml
--- old/adapt-release-v0.6.1/.github/workflows/push.yml 2021-09-13
16:55:44.000000000 +0200
+++ new/adapt-release-v1.0.0/.github/workflows/push.yml 2021-09-29
04:25:34.000000000 +0200
@@ -39,9 +39,12 @@
tag-release-if-needed:
runs-on: ubuntu-latest
+ outputs:
+ version: ${{ steps.tag.outputs.version }}
steps:
- uses: actions/checkout@v2
- - name: Tag release
+ - id: tag
+ name: Tag release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TWINE_USERNAME: __token__
@@ -51,9 +54,63 @@
VERSION=$(python setup.py --version)
git tag -f release/v$VERSION || exit 0
if git push tag_target --tags; then
- echo "New tag published on github, push to pypi as well."
+ echo "New tag published on github, push to PyPI as well."
pip install twine wheel
python setup.py sdist bdist_wheel
twine check dist/*
twine upload dist/*
+ echo "Package pushed to PyPI. Prepare for mycroft-core PR."
+ echo "::set-output name=version::$VERSION"
fi
+
+ publish:
+ runs-on: ubuntu-latest
+ if: contains(github.ref, '/tags/release')
+ needs: build
+ steps:
+ - uses: actions/checkout@v2
+ - name: Push to pypi
+ env:
+ TWINE_USERNAME: __token__
+ TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
+ run: |
+ pip install twine wheel
+ python setup.py sdist bdist_wheel
+ twine check dist/*
+ twine upload dist/*
+
+ update-mycroft-core:
+ runs-on: ubuntu-latest
+ needs: [publish, tag-release-if-needed]
+ steps:
+ - uses: actions/checkout@v2
+ with:
+ repository: MycroftAI/mycroft-core
+
+ - name: Update mycroft-core
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ run: |
+ VERSION=${{needs.tag-release-if-needed.outputs.version}}
+ if [[ $VERSION != *"."* ]]; then
+ echo "Not a valid version number."
+ exit 1
+ elif [[ $VERSION == *"-"* ]]; then
+ echo "Pre-release suffix detected. Not pushing to mycroft-core."
+ else
+ sed -E
"s/adapt-parser==[0-9]+\.[0-9]+\.[0-9]+/adapt-parser==$VERSION/"
requirements/requirements.txt > tmp-requirements.txt
+ mv tmp-requirements.txt requirements/requirements.txt
+ echo "ADAPT_VERSION=$VERSION" >> $GITHUB_ENV
+ fi
+
+ - name: Create Pull Request
+ if: ${{ env.ADAPT_VERSION }}
+ uses: peter-evans/create-pull-request@v3
+ with:
+ token: ${{ secrets.BOT_TOKEN }}
+ push-to-fork: mycroft-adapt-bot/mycroft-core
+ commit-message: Update Adapt to v${{ env.ADAPT_VERSION }}
+ branch: feature/update-adapt
+ delete-branch: true
+ title: Update Adapt to v${{ env.ADAPT_VERSION }}
+ body: Automated update from mycroftai/adapt.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/adapt-release-v0.6.1/adapt/context.py
new/adapt-release-v1.0.0/adapt/context.py
--- old/adapt-release-v0.6.1/adapt/context.py 2021-09-13 16:55:44.000000000
+0200
+++ new/adapt-release-v1.0.0/adapt/context.py 2021-09-29 04:25:34.000000000
+0200
@@ -14,11 +14,7 @@
#
"""
-This is to Manage Context of a Conversation
-
-Notes:
- Comments are subject to evaluation and may not reflect intent.
- Comments should be updated as code is clearly understood.
+Context Management code for Adapt (where context ~= persistent session state).
"""
from six.moves import xrange
@@ -34,7 +30,7 @@
entities(list): Entities that belong to ContextManagerFrame
metadata(object): metadata to describe context belonging to
ContextManagerFrame
"""
- def __init__(self, entities=[], metadata={}):
+ def __init__(self, entities=None, metadata=None):
"""
Initialize ContextManagerFrame
@@ -42,17 +38,15 @@
entities(list): List of Entities...
metadata(object): metadata to describe context?
"""
- self.entities = entities
- self.metadata = metadata
+ self.entities = entities or []
+ self.metadata = metadata or {}
- def metadata_matches(self, query={}):
+ def metadata_matches(self, query=None):
"""
Returns key matches to metadata
- This will check every key in query for a matching key in metadata
- returning true if every key is in metadata. query without keys
- return false.
-
+ Asserts that the contents of query exist within (logical subset of)
+ metadata in this frame.
Args:
query(object): metadata for matching
@@ -64,6 +58,7 @@
found in self.metadata
"""
+ query = query or {}
result = len(query.keys()) > 0
for key in query.keys():
result = result and query[key] == self.metadata.get(key)
@@ -96,8 +91,11 @@
def __init__(self):
self.frame_stack = []
- def inject_context(self, entity, metadata={}):
+ def inject_context(self, entity, metadata=None):
"""
+ Add an entity to the current context.
+ If metadata matches the top of the context frame stack, merge.
+ Else, create a new frame and push it on top of the stack.
Args:
entity(object):
format {'data': 'Entity tag as <str>',
@@ -106,6 +104,7 @@
}
metadata(object): dict, arbitrary metadata about the entity being
added
"""
+ metadata = metadata or {}
top_frame = self.frame_stack[0] if len(self.frame_stack) > 0 else None
if top_frame and top_frame.metadata_matches(metadata):
top_frame.merge_context(entity, metadata)
@@ -113,9 +112,9 @@
frame = ContextManagerFrame(entities=[entity],
metadata=metadata.copy())
self.frame_stack.insert(0, frame)
- def get_context(self, max_frames=None, missing_entities=[]):
+ def get_context(self, max_frames=None, missing_entities=None):
"""
- Constructs a list of entities from the context.
+ Returns context, including decaying weights based on depth in stack.
Args:
max_frames(int): maximum number of frames to look back
@@ -124,6 +123,7 @@
Returns:
list: a list of entities
"""
+ missing_entities = missing_entities or []
if not max_frames or max_frames > len(self.frame_stack):
max_frames = len(self.frame_stack)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/adapt-release-v0.6.1/adapt/engine.py
new/adapt-release-v1.0.0/adapt/engine.py
--- old/adapt-release-v0.6.1/adapt/engine.py 2021-09-13 16:55:44.000000000
+0200
+++ new/adapt-release-v1.0.0/adapt/engine.py 2021-09-29 04:25:34.000000000
+0200
@@ -52,7 +52,8 @@
def __best_intent(self, parse_result, context=[]):
"""
- Decide the best intent
+ For the specified parse_result, find the intent parser with the
+ highest confidence match.
Args:
parse_result(list): results used to match the best intent.
@@ -278,11 +279,6 @@
def __init__(self):
"""
Initialize DomainIntentDeterminationEngine.
-
- Args:
- tokenizer(tokenizer): The tokenizer you wish to use.
- trie(Trie): the Trie() you wish to use.
- domain(str): a string representing the domain you wish to add
"""
self.domains = {}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/adapt-release-v0.6.1/adapt/tools/debug/__init__.py
new/adapt-release-v1.0.0/adapt/tools/debug/__init__.py
--- old/adapt-release-v0.6.1/adapt/tools/debug/__init__.py 2021-09-13
16:55:44.000000000 +0200
+++ new/adapt-release-v1.0.0/adapt/tools/debug/__init__.py 2021-09-29
04:25:34.000000000 +0200
@@ -3,6 +3,24 @@
from adapt.engine import DomainIntentDeterminationEngine, \
IntentDeterminationEngine
+"""
+Pickling is not inherently secure, and the documentation for pickle
+recommends never unpickling data from an untrusted source. This makes
+using it for debug reports a little dicey, but fortunately there are
+some things we can leverage to make things safer.
+
+First, we expect the deserialized object to be an instance of
+IntentDeterminationEngine or DomainIntentDeterminationEngine as a basic
+sanity check. We also leverage a custom `pickle.Unpickler` implementation
+that only allows specific imports from the adapt namespace, and displays
+a helpful error message if this assumption is validated.
+
+This is a bit of security theater; folks investigating issues have to know to
+specifically use this library to hydrate any submissions, otherwise it's all
+for naught.
+"""
+
+
EXPECTED_ENGINES = set([
IntentDeterminationEngine,
DomainIntentDeterminationEngine,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/adapt-release-v0.6.1/adapt/tools/text/tokenizer.py
new/adapt-release-v1.0.0/adapt/tools/text/tokenizer.py
--- old/adapt-release-v0.6.1/adapt/tools/text/tokenizer.py 2021-09-13
16:55:44.000000000 +0200
+++ new/adapt-release-v1.0.0/adapt/tools/text/tokenizer.py 2021-09-29
04:25:34.000000000 +0200
@@ -36,7 +36,7 @@
pass
def tokenize(self, string):
- """Used to parce a string into tokens
+ """Used to parse a string into tokens
This function is to take in a string and return a list of tokens
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/adapt-release-v0.6.1/adapt/tools/text/trie.py
new/adapt-release-v1.0.0/adapt/tools/text/trie.py
--- old/adapt-release-v0.6.1/adapt/tools/text/trie.py 2021-09-13
16:55:44.000000000 +0200
+++ new/adapt-release-v1.0.0/adapt/tools/text/trie.py 2021-09-29
04:25:34.000000000 +0200
@@ -121,7 +121,9 @@
self.children[iterable[index]].insert(iterable, index + 1, data)
def is_prefix(self, iterable, index=0):
- if iterable[index] in self.children:
+ if index == len(iterable):
+ return True
+ elif iterable[index] in self.children:
return self.children[iterable[index]].is_prefix(iterable, index +
1)
else:
return False
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/adapt-release-v0.6.1/setup.py
new/adapt-release-v1.0.0/setup.py
--- old/adapt-release-v0.6.1/setup.py 2021-09-13 16:55:44.000000000 +0200
+++ new/adapt-release-v1.0.0/setup.py 2021-09-29 04:25:34.000000000 +0200
@@ -32,7 +32,7 @@
setup(
name="adapt-parser",
- version="0.6.1",
+ version="1.0.0",
author="Sean Fitzgerald",
author_email="[email protected]",
description=("A text-to-intent parsing framework."),
@@ -43,7 +43,7 @@
url="https://github.com/MycroftAI/adapt",
packages=["adapt", "adapt.tools", "adapt.tools.text", "adapt.tools.debug"],
classifiers=[
- 'Development Status :: 4 - Beta',
+ 'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Topic :: Text Processing :: Linguistic',
'License :: OSI Approved :: Apache Software License',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/adapt-release-v0.6.1/test/TrieTest.py
new/adapt-release-v1.0.0/test/TrieTest.py
--- old/adapt-release-v0.6.1/test/TrieTest.py 2021-09-13 16:55:44.000000000
+0200
+++ new/adapt-release-v1.0.0/test/TrieTest.py 2021-09-29 04:25:34.000000000
+0200
@@ -179,5 +179,16 @@
assert "Gonzo" in muppet_names
assert "Rowlf" in muppet_names
+ def test_is_prefix(self):
+ trie = Trie()
+ trie.insert("play", "PlayVerb")
+ trie.insert("the big bang theory", "Television Show")
+ trie.insert("the big", "Not a Thing")
+ trie.insert("barenaked ladies", "Radio Station")
+
+ assert trie.root.is_prefix("the")
+ assert trie.root.is_prefix("play")
+ assert not trie.root.is_prefix("Kermit")
+
def tearDown(self):
pass