Hello community,

here is the log from the commit of package python-ordered-namespace for 
openSUSE:Factory checked in at 2019-06-06 18:16:07
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-ordered-namespace (Old)
 and      /work/SRC/openSUSE:Factory/.python-ordered-namespace.new.4811 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-ordered-namespace"

Thu Jun  6 18:16:07 2019 rev:4 rq:707144 version:2018.6.26

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-ordered-namespace/python-ordered-namespace.changes
        2018-12-24 11:40:35.629494608 +0100
+++ 
/work/SRC/openSUSE:Factory/.python-ordered-namespace.new.4811/python-ordered-namespace.changes
      2019-06-06 18:16:17.932704010 +0200
@@ -1,0 +2,6 @@
+Mon Jun  3 11:04:06 UTC 2019 - Tomáš Chvátal <[email protected]>
+
+- Update to 2018.6.26:
+  * no upstream changelog
+
+-------------------------------------------------------------------

Old:
----
  ordered_namespace-2017.11.25.tar.gz

New:
----
  LICENSE
  ordered_namespace-2018.6.26.tar.gz

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

Other differences:
------------------
++++++ python-ordered-namespace.spec ++++++
--- /var/tmp/diff_new_pack.7wxfUx/_old  2019-06-06 18:16:18.396703874 +0200
+++ /var/tmp/diff_new_pack.7wxfUx/_new  2019-06-06 18:16:18.400703873 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package python-ordered-namespace
 #
-# 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
@@ -18,18 +18,18 @@
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-ordered-namespace
-Version:        2017.11.25
+Version:        2018.6.26
 Release:        0
 Summary:        Python namespace class
 License:        MIT
 Group:          Development/Languages/Python
-Url:            https://github.com/who8mylunch/OrderedNamespace
-Source:         
https://files.pythonhosted.org/packages/source/o/ordered-namespace/ordered_namespace-%{version}.tar.gz
+URL:            https://github.com/who8mylunch/OrderedNamespace
+Source:         
https://files.pythonhosted.org/packages/source/o/ordered_namespace/ordered_namespace-%{version}.tar.gz
+Source99:       
https://raw.githubusercontent.com/Who8MyLunch/OrderedNamespace/master/LICENSE
 BuildRequires:  %{python_module setuptools}
 BuildRequires:  fdupes
 BuildRequires:  python-rpm-macros
 BuildArch:      noarch
-
 %python_subpackages
 
 %description
@@ -38,6 +38,7 @@
 
 %prep
 %setup -q -n ordered_namespace-%{version}
+cp %{SOURCE99} .
 
 %build
 %python_build
@@ -46,8 +47,13 @@
 %python_install
 %python_expand %fdupes %{buildroot}%{$python_sitelib}
 
+%check
+# tests have no way of being executed properly
+# on github there are no tags
+
 %files %{python_files}
 %doc README.md
+%license LICENSE
 %{python_sitelib}/*
 
 %changelog

++++++ LICENSE ++++++
MIT License

Copyright (c) 2017 Pierre V. Villeneuve

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
++++++ ordered_namespace-2017.11.25.tar.gz -> 
ordered_namespace-2018.6.26.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ordered_namespace-2017.11.25/PKG-INFO 
new/ordered_namespace-2018.6.26/PKG-INFO
--- old/ordered_namespace-2017.11.25/PKG-INFO   2017-11-25 23:26:25.000000000 
+0100
+++ new/ordered_namespace-2018.6.26/PKG-INFO    2018-06-27 01:54:24.000000000 
+0200
@@ -1,12 +1,11 @@
 Metadata-Version: 1.0
 Name: ordered_namespace
-Version: 2017.11.25
+Version: 2018.6.26
 Summary: An easy-to-use Python namespace class derived from OrderedDict, 
including tab-completion
 Home-page: https://github.com/who8mylunch/OrderedNamespace
 Author: Pierre V. Villeneuve
 Author-email: [email protected]
 License: MIT
-Description-Content-Type: UNKNOWN
 Description: UNKNOWN
 Keywords: namespace,ordereddict,structure
 Platform: UNKNOWN
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ordered_namespace-2017.11.25/ordered_namespace/core.py 
new/ordered_namespace-2018.6.26/ordered_namespace/core.py
--- old/ordered_namespace-2017.11.25/ordered_namespace/core.py  2017-11-25 
23:12:25.000000000 +0100
+++ new/ordered_namespace-2018.6.26/ordered_namespace/core.py   2018-06-27 
01:51:59.000000000 +0200
@@ -1,7 +1,30 @@
-from collections import OrderedDict
+from collections import OrderedDict, UserDict
 import re
 
 
+
+
+def convert_to_struct(value):
+    """Convert the following to Structs:
+       - dicts
+       - list elements that are dicts
+       - ???
+
+    This function is harmless to call on arbitrary variables.
+    """
+    direct_converts = [dict, OrderedDict, UserDict]
+    if type(value) in direct_converts:
+        # Convert dict-like things to Struct
+        value = Struct(value)
+    elif isinstance(value, list):
+        # Process list elements
+        value = [convert_to_struct(z) for z in value]
+
+    # Done
+    return value
+
+
+
 class Struct:
     """Ordered namespace class
     """
@@ -21,6 +44,8 @@
         self.update(*args, **kwargs)
 
     def update(self, *args, **kwargs):
+        """Update self with new content
+        """
         d = {}
         d.update(*args, **kwargs)
         for key, value in d.items():
@@ -36,7 +61,7 @@
         elif hasattr({}, key):
             return False
         elif key in self._special_names:
-            return True
+            return False
         else:
             return self._valid_key_pattern.match(key)
 
@@ -82,8 +107,16 @@
         if not self._valid_key(key):
             raise KeyError('Invalid attribute name: {}'.format(key))
 
-        if isinstance(value, dict) and key not in self._special_names:
-            value = Struct(value)
+        value = convert_to_struct(value)
+        # if isinstance(value, dict) and key not in self._special_names:
+        #     # Convert dict to Struct
+        #     value = Struct(value)
+        # elif isinstance(value, list):
+        #     # Find elements to convert from dict to Struct
+        #     change = []
+        #     for k, v in enumerate(value):
+        #         if isinstance(v, dict):
+        #             change.append(k)
 
         self._odict[key] = value
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ordered_namespace-2017.11.25/ordered_namespace.egg-info/PKG-INFO 
new/ordered_namespace-2018.6.26/ordered_namespace.egg-info/PKG-INFO
--- old/ordered_namespace-2017.11.25/ordered_namespace.egg-info/PKG-INFO        
2017-11-25 23:26:25.000000000 +0100
+++ new/ordered_namespace-2018.6.26/ordered_namespace.egg-info/PKG-INFO 
2018-06-27 01:54:24.000000000 +0200
@@ -1,12 +1,11 @@
 Metadata-Version: 1.0
 Name: ordered-namespace
-Version: 2017.11.25
+Version: 2018.6.26
 Summary: An easy-to-use Python namespace class derived from OrderedDict, 
including tab-completion
 Home-page: https://github.com/who8mylunch/OrderedNamespace
 Author: Pierre V. Villeneuve
 Author-email: [email protected]
 License: MIT
-Description-Content-Type: UNKNOWN
 Description: UNKNOWN
 Keywords: namespace,ordereddict,structure
 Platform: UNKNOWN
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ordered_namespace-2017.11.25/setup.py 
new/ordered_namespace-2018.6.26/setup.py
--- old/ordered_namespace-2017.11.25/setup.py   2017-11-25 23:25:29.000000000 
+0100
+++ new/ordered_namespace-2018.6.26/setup.py    2018-06-27 01:43:06.000000000 
+0200
@@ -1,7 +1,7 @@
 
 from setuptools import setup, find_packages
 
-version = '2017.11.25'
+version = '2018.6.26'
 
 setup(
     name='ordered_namespace',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ordered_namespace-2017.11.25/test/test.py 
new/ordered_namespace-2018.6.26/test/test.py
--- old/ordered_namespace-2017.11.25/test/test.py       2017-11-25 
23:24:37.000000000 +0100
+++ new/ordered_namespace-2018.6.26/test/test.py        2018-06-27 
01:42:15.000000000 +0200
@@ -73,6 +73,15 @@
 
         self.assertTrue(item == info.AA)
 
+    def test_special_keys(self):
+        info = ons.Struct()
+
+        item = [1, 2, 3]
+        def fn():
+            info['_odict'] = item
+
+        self.assertRaises(KeyError, fn)
+
     def test_order(self):
         keys = ['Z', 'z', 'a', 'B00', 'B1', 'B0']
         values = list(range(len(keys)))
@@ -103,6 +112,44 @@
         self.assertTrue(type(info.AA) == ons.Struct)
         self.assertTrue(type(info.AA.BB) == ons.Struct)
 
+    def test_nested_dict_update(self):
+        info = ons.Struct()
+
+        nuts = {'a': [1, 2], 'X': 'hello'}
+        corn = {'b': [6, 9], 'Y': 'bye', 'm': nuts}
+        yikes = {'c': [6, 9], 'Z': 'hello', 'n': corn}
+
+        info.CC = yikes
+
+        self.assertTrue(type(info.CC) == ons.Struct)
+        self.assertTrue(type(info.CC.n) == ons.Struct)
+        self.assertTrue(type(info.CC.n.m) == ons.Struct)
+
+    def test_nested_dict_define(self):
+
+        nuts = {'a': [1, 2], 'X': 'hello'}
+        corn = {'b': [6, 9], 'Y': 'bye', 'm': nuts}
+        yikes = {'c': [6, 9], 'Z': 'hello', 'n': corn}
+
+        info = ons.Struct(yikes)
+
+        # print(yikes.n.m)
+        # print(type(yikes.n.m))
+        self.assertTrue(type(info.n.m) == ons.Struct)
+
+    def test_nested_dict_list(self):
+
+        nuts = {'a': [1, 2], 'X': 'hello'}
+        corn = {'b': [6, 9], 'Y': 'bye'}
+        yikes = {'c': [6, 9], 'Z': 'hello'}
+
+        stuff = [nuts, corn, yikes]
+
+        info = ons.Struct()
+        info.S = stuff
+
+        self.assertTrue(type(info.S[0]) == ons.Struct)
+
     def test_as_dict(self):
         info = ons.Struct()
 
@@ -114,6 +161,7 @@
 
         info = info.asdict()
 
+        self.assertTrue(type(info) == dict)
         self.assertTrue(type(info['AA']) == dict)
         self.assertTrue(type(info['AA']['BB']) == dict)
 


Reply via email to