Browse Source

[Python3.9] encodestring is deprecated in favour of encodebytes and decodestring is deprecated in favour of decodebytes (#3266)

* [Python39] encodestring is deprecated in favour of encodebytes

* fixing pylint issues
Ayush Goyal 2 years ago
parent
commit
1ac136a5d3

+ 1 - 1
desktop/core/ext-py3/boto-2.49.0/boto/sdb/item.py

@@ -62,7 +62,7 @@ class Item(dict):
     def decode_value(self, value):
         if self.encoding == 'base64':
             self.encoding = None
-            return base64.decodestring(value)
+            return base64.decodebytes(value)
         else:
             return value
 

+ 2 - 2
desktop/core/ext-py3/pysaml2-5.0.0/src/saml2/saml.py

@@ -87,8 +87,8 @@ XSD = "xs"
 NS_SOAP_ENC = "http://schemas.xmlsoap.org/soap/encoding/"
 
 
-_b64_decode_fn = getattr(base64, 'decodebytes', base64.decodestring)
-_b64_encode_fn = getattr(base64, 'encodebytes', base64.encodestring)
+_b64_decode_fn = getattr(base64, 'decodebytes', base64.decodebytes)
+_b64_encode_fn = getattr(base64, 'encodebytes', base64.encodebytes)
 
 
 class AttributeValueBase(SamlBase):

+ 3 - 1
desktop/libs/metadata/src/metadata/optimizer_api.py

@@ -40,8 +40,10 @@ from metadata.conf import OPTIMIZER
 
 if sys.version_info[0] > 2:
   from django.utils.translation import gettext as _
+  from base64 import decodebytes
 else:
   from django.utils.translation import ugettext as _
+  from base64 import decodestring as decodebytes
 
 LOG = logging.getLogger(__name__)
 
@@ -397,7 +399,7 @@ def _convert_queries(queries_data):
         if isinstance(guid, str):
           guid = guid.encode('utf-8')
         # unpack_guid uses '%016x:%016x' while optmizer api uses '%s:%s'.
-        original_query_id = '%s:%s' % struct.unpack(b"QQ", base64.decodestring(guid))
+        original_query_id = '%s:%s' % struct.unpack(b"QQ", decodebytes(guid))
         execution_time = snippet['result']['executionTime'] * 100 if snippet['status'] in ('available', 'expired') else -1
         statement = _clean_query(_get_statement(query_data))
         queries.append((original_query_id, execution_time, statement, snippet.get('database', 'default').strip()))