Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-msrest for openSUSE:Factory checked in at 2021-04-12 15:49:32 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-msrest (Old) and /work/SRC/openSUSE:Factory/.python-msrest.new.2401 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-msrest" Mon Apr 12 15:49:32 2021 rev:14 rq:881989 version:0.6.21 Changes: -------- --- /work/SRC/openSUSE:Factory/python-msrest/python-msrest.changes 2020-12-09 22:21:27.599677729 +0100 +++ /work/SRC/openSUSE:Factory/.python-msrest.new.2401/python-msrest.changes 2021-04-12 15:49:44.305262965 +0200 @@ -1,0 +2,8 @@ +Mon Mar 29 10:48:08 UTC 2021 - John Paul Adrian Glaubitz <[email protected]> + +- New upstream release + + Version 0.6.21 + + For detailed information about changes see the + README.rst file provided with this package + +------------------------------------------------------------------- Old: ---- msrest-0.6.19.tar.gz New: ---- msrest-0.6.21.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-msrest.spec ++++++ --- /var/tmp/diff_new_pack.oBgw6b/_old 2021-04-12 15:49:44.889263672 +0200 +++ /var/tmp/diff_new_pack.oBgw6b/_new 2021-04-12 15:49:44.889263672 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-msrest # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -21,7 +21,7 @@ %define skip_python2 1 %endif Name: python-msrest -Version: 0.6.19 +Version: 0.6.21 Release: 0 Summary: AutoRest swagger generator Python client runtime License: MIT ++++++ msrest-0.6.19.tar.gz -> msrest-0.6.21.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msrest-0.6.19/PKG-INFO new/msrest-0.6.21/PKG-INFO --- old/msrest-0.6.19/PKG-INFO 2020-09-08 18:13:01.000000000 +0200 +++ new/msrest-0.6.21/PKG-INFO 2021-01-27 03:11:31.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: msrest -Version: 0.6.19 +Version: 0.6.21 Summary: AutoRest swagger generator Python client runtime. Home-page: https://github.com/Azure/msrest-for-python Author: Microsoft Corporation @@ -27,6 +27,21 @@ Release History --------------- + 2021-01-26 Version 0.6.21 + +++++++++++++++++++++++++ + + **Bug Fixes** + + - Fixes `failsafe_deserialize` introduced in `0.6.20` #232 + + 2021-01-25 Version 0.6.20 + +++++++++++++++++++++++++ + + **Features** + + - Add `failsafe_deserialize` method to the `Deserializer` object. #232 + - Serialize `datetime`, `date`, `time`, `timedelta` and `Decimal` correctly when serializing `object` . #224 + 2020-09-08 Version 0.6.19 +++++++++++++++++++++++++ @@ -749,6 +764,7 @@ Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 Classifier: License :: OSI Approved :: MIT License Classifier: Topic :: Software Development Provides-Extra: async diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msrest-0.6.19/README.rst new/msrest-0.6.21/README.rst --- old/msrest-0.6.19/README.rst 2020-09-08 18:12:14.000000000 +0200 +++ new/msrest-0.6.21/README.rst 2021-01-27 03:10:40.000000000 +0100 @@ -20,6 +20,21 @@ Release History --------------- +2021-01-26 Version 0.6.21 ++++++++++++++++++++++++++ + +**Bug Fixes** + +- Fixes `failsafe_deserialize` introduced in `0.6.20` #232 + +2021-01-25 Version 0.6.20 ++++++++++++++++++++++++++ + +**Features** + +- Add `failsafe_deserialize` method to the `Deserializer` object. #232 +- Serialize `datetime`, `date`, `time`, `timedelta` and `Decimal` correctly when serializing `object` . #224 + 2020-09-08 Version 0.6.19 +++++++++++++++++++++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msrest-0.6.19/msrest/serialization.py new/msrest-0.6.21/msrest/serialization.py --- old/msrest-0.6.19/msrest/serialization.py 2020-09-08 18:12:14.000000000 +0200 +++ new/msrest-0.6.21/msrest/serialization.py 2021-01-27 03:10:40.000000000 +0100 @@ -953,6 +953,16 @@ return self.serialize_long(attr) if obj_type is unicode_str: return self.serialize_unicode(attr) + if obj_type is datetime.datetime: + return self.serialize_iso(attr) + if obj_type is datetime.date: + return self.serialize_date(attr) + if obj_type is datetime.time: + return self.serialize_time(attr) + if obj_type is datetime.timedelta: + return self.serialize_duration(attr) + if obj_type is decimal.Decimal: + return self.serialize_decimal(attr) # If it's a model or I know this dependency, serialize as a Model elif obj_type in self.dependencies.values() or isinstance(attr, Model): @@ -1476,6 +1486,26 @@ pass # Target is not a Model, no classify return target, target.__class__.__name__ + def failsafe_deserialize(self, target_obj, data, content_type=None): + """Ignores any errors encountered in deserialization, + and falls back to not deserializing the object. Recommended + for use in error deserialization, as we want to return the + HttpResponseError to users, and not have them deal with + a deserialization error. + + :param str target_obj: The target object type to deserialize to. + :param str/dict data: The response data to deseralize. + :param str content_type: Swagger "produces" if available. + """ + try: + return self(target_obj, data, content_type=content_type) + except: + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", + exc_info=True + ) + return None + @staticmethod def _unpack_content(raw_data, content_type=None): """Extract the correct structure for deserialization. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msrest-0.6.19/msrest/universal_http/__init__.py new/msrest-0.6.21/msrest/universal_http/__init__.py --- old/msrest-0.6.19/msrest/universal_http/__init__.py 2020-09-08 18:12:14.000000000 +0200 +++ new/msrest-0.6.21/msrest/universal_http/__init__.py 2021-01-27 03:10:40.000000000 +0100 @@ -40,7 +40,7 @@ from urllib.parse import urlparse import xml.etree.ElementTree as ET -from typing import TYPE_CHECKING, Generic, TypeVar, cast, IO, List, Union, Any, Mapping, Dict, Optional, Tuple, Callable, Iterator # pylint: disable=unused-import +from typing import TYPE_CHECKING, Generic, TypeVar, cast, IO, List, Union, Any, Mapping, Dict, Optional, Tuple, Callable, Iterator, MutableMapping # pylint: disable=unused-import HTTPResponseType = TypeVar("HTTPResponseType", bound='HTTPClientResponse') @@ -325,7 +325,7 @@ self.request = request self.internal_response = internal_response self.status_code = None # type: Optional[int] - self.headers = {} # type: Dict[str, str] + self.headers = {} # type: MutableMapping[str, str] self.reason = None # type: Optional[str] def body(self): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msrest-0.6.19/msrest/universal_http/aiohttp.py new/msrest-0.6.21/msrest/universal_http/aiohttp.py --- old/msrest-0.6.19/msrest/universal_http/aiohttp.py 2020-09-08 18:12:14.000000000 +0200 +++ new/msrest-0.6.21/msrest/universal_http/aiohttp.py 2021-01-27 03:10:40.000000000 +0100 @@ -26,6 +26,7 @@ from typing import Any, Callable, AsyncIterator, Optional import aiohttp +from multidict import CIMultiDict from . import AsyncHTTPSender, ClientRequest, AsyncClientResponse @@ -69,7 +70,7 @@ super(AioHttpClientResponse, self).__init__(request, aiohttp_response) # https://aiohttp.readthedocs.io/en/stable/client_reference.html#aiohttp.ClientResponse self.status_code = aiohttp_response.status - self.headers = aiohttp_response.headers + self.headers = CIMultiDict(aiohttp_response.headers) self.reason = aiohttp_response.reason self._body = None diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msrest-0.6.19/msrest/version.py new/msrest-0.6.21/msrest/version.py --- old/msrest-0.6.19/msrest/version.py 2020-09-08 18:12:14.000000000 +0200 +++ new/msrest-0.6.21/msrest/version.py 2021-01-27 03:10:40.000000000 +0100 @@ -25,4 +25,4 @@ # -------------------------------------------------------------------------- #: version of this package. Use msrest.__version__ instead -msrest_version = "0.6.19" +msrest_version = "0.6.21" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msrest-0.6.19/msrest.egg-info/PKG-INFO new/msrest-0.6.21/msrest.egg-info/PKG-INFO --- old/msrest-0.6.19/msrest.egg-info/PKG-INFO 2020-09-08 18:13:01.000000000 +0200 +++ new/msrest-0.6.21/msrest.egg-info/PKG-INFO 2021-01-27 03:11:31.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: msrest -Version: 0.6.19 +Version: 0.6.21 Summary: AutoRest swagger generator Python client runtime. Home-page: https://github.com/Azure/msrest-for-python Author: Microsoft Corporation @@ -27,6 +27,21 @@ Release History --------------- + 2021-01-26 Version 0.6.21 + +++++++++++++++++++++++++ + + **Bug Fixes** + + - Fixes `failsafe_deserialize` introduced in `0.6.20` #232 + + 2021-01-25 Version 0.6.20 + +++++++++++++++++++++++++ + + **Features** + + - Add `failsafe_deserialize` method to the `Deserializer` object. #232 + - Serialize `datetime`, `date`, `time`, `timedelta` and `Decimal` correctly when serializing `object` . #224 + 2020-09-08 Version 0.6.19 +++++++++++++++++++++++++ @@ -749,6 +764,7 @@ Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 Classifier: License :: OSI Approved :: MIT License Classifier: Topic :: Software Development Provides-Extra: async diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msrest-0.6.19/setup.py new/msrest-0.6.21/setup.py --- old/msrest-0.6.19/setup.py 2020-09-08 18:12:14.000000000 +0200 +++ new/msrest-0.6.21/setup.py 2021-01-27 03:10:40.000000000 +0100 @@ -28,7 +28,7 @@ setup( name='msrest', - version='0.6.19', + version='0.6.21', author='Microsoft Corporation', packages=find_packages(exclude=["tests", "tests.*"]), url=("https://github.com/Azure/msrest-for-python"), @@ -45,6 +45,7 @@ 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', 'License :: OSI Approved :: MIT License', 'Topic :: Software Development'], install_requires=[ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msrest-0.6.19/tests/test_serialization.py new/msrest-0.6.21/tests/test_serialization.py --- old/msrest-0.6.19/tests/test_serialization.py 2020-09-08 18:12:14.000000000 +0200 +++ new/msrest-0.6.21/tests/test_serialization.py 2021-01-27 03:10:40.000000000 +0100 @@ -25,6 +25,7 @@ # #-------------------------------------------------------------------------- +from decimal import Decimal import sys import json import isodate @@ -1395,6 +1396,42 @@ 'data': {'id': u"\ua015"} } + def test_datetime_types_as_type_object(self): + """https://github.com/Azure/msrest-for-python/issues/223 + """ + + class TestModel(Model): + _attribute_map = {'data': {'key': 'data', 'type': 'object'}} + + m = TestModel(data = { + 'datetime': isodate.parse_datetime('2012-02-24T00:53:52.780Z'), + 'date': date(2019,5,1), + 'time': time(11,12,13), + 'timedelta': timedelta(56) + }) + serialized = m.serialize() + assert serialized['data'] == { + 'datetime': '2012-02-24T00:53:52.780Z', + 'date': '2019-05-01', + 'time': '11:12:13', + 'timedelta': 'P56D' + } + + def test_decimal_types_as_type_object(self): + """https://github.com/Azure/msrest-for-python/issues/223 + """ + + class TestModel(Model): + _attribute_map = {'data': {'key': 'data', 'type': 'object'}} + + m = TestModel(data = { + 'decimal': Decimal('1.1'), + }) + serialized = m.serialize() + assert serialized['data'] == { + 'decimal': 1.1 + } + def test_json_with_xml_map(self): basic_json = {'age': 37, 'country': 'france'} @@ -2496,6 +2533,33 @@ m = TestModel.deserialize({'data': {'id': long_type(1)}}) assert m.data['id'] == long_type(1) + def test_failsafe_deserialization(self): + class Error(Model): + + _attribute_map = { + "status": {"key": "status", "type": "int"}, + "message": {"key": "message", "type": "str"}, + } + + def __init__(self, **kwargs): + super(Error, self).__init__(**kwargs) + self.status = kwargs.get("status", None) + self.message = kwargs.get("message", None) + + + with pytest.raises(DeserializationError): + self.d(Error, json.dumps(''), 'text/html') + + # should fail + deserialized = self.d.failsafe_deserialize(Error, json.dumps(''), 'text/html') + assert deserialized is None + + # should not fail + error = {"status": 400, "message": "should deserialize"} + deserialized = self.d.failsafe_deserialize(Error, json.dumps(error), 'application/json') + assert deserialized.status == 400 + assert deserialized.message == "should deserialize" + class TestModelInstanceEquality(unittest.TestCase): def test_model_instance_equality(self):
