Commit 1bcc7f6a authored by Jérome Perrin's avatar Jérome Perrin

py3: modernize -j20 --write -f dict_six **py ( manually adjusted )

adjusted to use ensure_list to not allocate a new list on py2
parent 269c886d
""" """
This script is called from ebulk client to get list of Data Streams for a Data set. This script is called from ebulk client to get list of Data Streams for a Data set.
""" """
from Products.ERP5Type.Utils import ensure_list
import json import json
from erp5.component.module.Log import log from erp5.component.module.Log import log
...@@ -40,5 +41,5 @@ for stream_brain in data_stream_list: ...@@ -40,5 +41,5 @@ for stream_brain in data_stream_list:
'large-hash': version, 'large-hash': version,
'full-size': size} 'full-size': size}
result_dict = { 'status_code': 0, 'result': data_stream_dict.values()} result_dict = { 'status_code': 0, 'result': ensure_list(data_stream_dict.values())}
return json.dumps(result_dict) return json.dumps(result_dict)
...@@ -5,6 +5,7 @@ from six.moves import range ...@@ -5,6 +5,7 @@ from six.moves import range
import transaction import transaction
from DateTime import DateTime from DateTime import DateTime
from wendelin.bigarray.array_zodb import ZBigArray from wendelin.bigarray.array_zodb import ZBigArray
import six
class ZBigArrayConverter(object): class ZBigArrayConverter(object):
...@@ -420,7 +421,7 @@ class InventoryDataFrameQuery(object): ...@@ -420,7 +421,7 @@ class InventoryDataFrameQuery(object):
def _filterCategoryParameters(self, **kw): def _filterCategoryParameters(self, **kw):
category_kw = {} category_kw = {}
keys_to_delete = [] keys_to_delete = []
for key, value in kw.iteritems(): for key, value in six.iteritems(kw):
for field in self.FIELDS_WITH_CATEGORY: for field in self.FIELDS_WITH_CATEGORY:
regex = re.compile(r'%s_.*_uid$' % field) regex = re.compile(r'%s_.*_uid$' % field)
if regex.match(key): if regex.match(key):
...@@ -547,7 +548,7 @@ class InventoryDataFrameQuery(object): ...@@ -547,7 +548,7 @@ class InventoryDataFrameQuery(object):
def _filterCategories(self): def _filterCategories(self):
partial_filter = self._true_array() partial_filter = self._true_array()
for field, value in self.category_kw.iteritems(): for field, value in six.iteritems(self.category_kw):
if self.duplicated_categories: if self.duplicated_categories:
partial_filter = (partial_filter) & (self.df[field] == value) partial_filter = (partial_filter) & (self.df[field] == value)
else: else:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment