Hello community,

here is the log from the commit of package python-pynetbox for openSUSE:Factory 
checked in at 2019-12-11 12:13:52
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-pynetbox (Old)
 and      /work/SRC/openSUSE:Factory/.python-pynetbox.new.4691 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-pynetbox"

Wed Dec 11 12:13:52 2019 rev:8 rq:755726 version:4.2.2

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-pynetbox/python-pynetbox.changes  
2019-12-02 11:30:59.362569896 +0100
+++ 
/work/SRC/openSUSE:Factory/.python-pynetbox.new.4691/python-pynetbox.changes    
    2019-12-11 12:14:12.092527117 +0100
@@ -1,0 +2,8 @@
+Tue Dec 10 18:37:10 UTC 2019 - Martin Hauke <[email protected]>
+
+- Update to version 4.2.2
+  * Fixes issues with hashing Record objects by adding name
+    attribute to Endpoint and __eq__ method to Record objects to
+    facilitate comparison.
+
+-------------------------------------------------------------------

Old:
----
  pynetbox-4.2.1.tar.gz

New:
----
  pynetbox-4.2.2.tar.gz

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

Other differences:
------------------
++++++ python-pynetbox.spec ++++++
--- /var/tmp/diff_new_pack.sw0rur/_old  2019-12-11 12:14:13.268526786 +0100
+++ /var/tmp/diff_new_pack.sw0rur/_new  2019-12-11 12:14:13.272526785 +0100
@@ -18,7 +18,7 @@
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-pynetbox
-Version:        4.2.1
+Version:        4.2.2
 Release:        0
 Summary:        NetBox API client library
 License:        Apache-2.0

++++++ pynetbox-4.2.1.tar.gz -> pynetbox-4.2.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pynetbox-4.2.1/PKG-INFO new/pynetbox-4.2.2/PKG-INFO
--- old/pynetbox-4.2.1/PKG-INFO 2019-11-27 00:27:00.000000000 +0100
+++ new/pynetbox-4.2.2/PKG-INFO 2019-12-10 17:27:54.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: pynetbox
-Version: 4.2.1
+Version: 4.2.2
 Summary: NetBox API client library
 Home-page: https://github.com/digitalocean/pynetbox
 Author: Zach Moody
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pynetbox-4.2.1/pynetbox/core/endpoint.py 
new/pynetbox-4.2.2/pynetbox/core/endpoint.py
--- old/pynetbox-4.2.1/pynetbox/core/endpoint.py        2019-11-27 
00:26:42.000000000 +0100
+++ new/pynetbox-4.2.2/pynetbox/core/endpoint.py        2019-12-10 
17:27:36.000000000 +0100
@@ -42,6 +42,7 @@
 
     def __init__(self, api, app, name, model=None):
         self.return_obj = self._lookup_ret_obj(name, model)
+        self.name = name.replace("_", "-")
         self.api = api
         self.base_url = api.base_url
         self.token = api.token
@@ -50,7 +51,7 @@
         self.url = "{base_url}/{app}/{endpoint}".format(
             base_url=self.base_url,
             app=app.name,
-            endpoint=name.replace("_", "-"),
+            endpoint=self.name,
         )
         self._choices = None
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pynetbox-4.2.1/pynetbox/core/response.py 
new/pynetbox-4.2.2/pynetbox/core/response.py
--- old/pynetbox-4.2.1/pynetbox/core/response.py        2019-11-27 
00:26:42.000000000 +0100
+++ new/pynetbox-4.2.2/pynetbox/core/response.py        2019-12-10 
17:27:36.000000000 +0100
@@ -213,11 +213,19 @@
     def __setstate__(self, d):
         self.__dict__.update(d)
 
-    def __hash__(self):
+    def __key__(self):
         if hasattr(self, "id"):
-            return hash((self.endpoint.name, self.id))
+            return (self.endpoint.name, self.id)
         else:
-            return hash(self.endpoint.name)
+            return (self.endpoint.name)
+
+    def __hash__(self):
+        return hash(self.__key__())
+
+    def __eq__(self, other):
+        if isinstance(other, Record):
+            return self.__key__() == other.__key__()
+        return NotImplemented
 
     def _add_cache(self, item):
         key, value = item
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pynetbox-4.2.1/pynetbox.egg-info/PKG-INFO 
new/pynetbox-4.2.2/pynetbox.egg-info/PKG-INFO
--- old/pynetbox-4.2.1/pynetbox.egg-info/PKG-INFO       2019-11-27 
00:26:59.000000000 +0100
+++ new/pynetbox-4.2.2/pynetbox.egg-info/PKG-INFO       2019-12-10 
17:27:53.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: pynetbox
-Version: 4.2.1
+Version: 4.2.2
 Summary: NetBox API client library
 Home-page: https://github.com/digitalocean/pynetbox
 Author: Zach Moody
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pynetbox-4.2.1/tests/unit/test_response.py 
new/pynetbox-4.2.2/tests/unit/test_response.py
--- old/pynetbox-4.2.1/tests/unit/test_response.py      2019-11-27 
00:26:42.000000000 +0100
+++ new/pynetbox-4.2.2/tests/unit/test_response.py      2019-12-10 
17:27:36.000000000 +0100
@@ -128,3 +128,14 @@
         test2 = Record({}, None, endpoint2)
         test2.id = 2
         self.assertNotEqual(hash(test1), hash(test2))
+
+    def test_compare(self):
+        endpoint1 = Mock()
+        endpoint1.name = "test-endpoint"
+        endpoint2 = Mock()
+        endpoint2.name = "test-endpoint"
+        test1 = Record({}, None, endpoint1)
+        test1.id = 1
+        test2 = Record({}, None, endpoint2)
+        test2.id = 1
+        self.assertEqual(test1, test2)


Reply via email to