Commit 888ec97e authored by Jérome Perrin's avatar Jérome Perrin

py3: modernize -j20 --write -f print **py

parent 037c5ac5
...@@ -14,8 +14,8 @@ ...@@ -14,8 +14,8 @@
import os.path import os.path
data = str(context.file_system_checksum).strip() data = str(context.file_system_checksum).strip()
lines = data.split("\n") lines = data.split("\n")
print "Total files = ", len(lines) print("Total files = ", len(lines))
print print()
check_result = True check_result = True
for line in lines[:]: for line in lines[:]:
md5_checksum = line[:32].strip() md5_checksum = line[:32].strip()
...@@ -27,16 +27,16 @@ for line in lines[:]: ...@@ -27,16 +27,16 @@ for line in lines[:]:
"reference": reference} "reference": reference}
data_stream = context.portal_catalog.getResultValue(**catalog_kw) data_stream = context.portal_catalog.getResultValue(**catalog_kw)
if data_stream is None: if data_stream is None:
print "[NOT FOUND]", reference print("[NOT FOUND]", reference)
check_result = False check_result = False
else: else:
is_upload_ok = (data_stream.getVersion()==md5_checksum) is_upload_ok = (data_stream.getVersion()==md5_checksum)
print md5_checksum, filename, data_stream is not None, is_upload_ok print(md5_checksum, filename, data_stream is not None, is_upload_ok)
if not is_upload_ok: if not is_upload_ok:
check_result = False check_result = False
print print()
if check_result: if check_result:
print "[OK] Data set correctly uploaded" print("[OK] Data set correctly uploaded")
else: else:
print "[ERROR] Data set was not correctly uploaded" print("[ERROR] Data set was not correctly uploaded")
return printed return printed
...@@ -7,14 +7,14 @@ from DateTime import DateTime ...@@ -7,14 +7,14 @@ from DateTime import DateTime
old_date = DateTime(2019, 12, 31) old_date = DateTime(2019, 12, 31)
catalog_kw = {'modification_date': {'query': old_date, 'range': '<='}} catalog_kw = {'modification_date': {'query': old_date, 'range': '<='}}
print "Following Dataset were invalidated:" print("Following Dataset were invalidated:")
for data_set in portal_catalog(portal_type="Data Set", **catalog_kw): for data_set in portal_catalog(portal_type="Data Set", **catalog_kw):
print print()
print "DATASET: " + data_set.getReference() print("DATASET: " + data_set.getReference())
print "state: " + data_set.getValidationState() print("state: " + data_set.getValidationState())
print "date: " + str(data_set.getModificationDate()) print("date: " + str(data_set.getModificationDate()))
print "len of datastream list: " + str(len(data_set.DataSet_getDataStreamList())) print("len of datastream list: " + str(len(data_set.DataSet_getDataStreamList())))
for data_stream in data_set.DataSet_getDataStreamList(): for data_stream in data_set.DataSet_getDataStreamList():
if data_stream is not None: if data_stream is not None:
portal.ERP5Site_invalidateIngestionObjects(data_stream.getReference()) portal.ERP5Site_invalidateIngestionObjects(data_stream.getReference())
......
for i in context.keras_vgg16_predict(context.image_module[image_document_id]): for i in context.keras_vgg16_predict(context.image_module[image_document_id]):
print i print(i)
return printed return printed
...@@ -266,11 +266,11 @@ class CategoryProcessor(object): ...@@ -266,11 +266,11 @@ class CategoryProcessor(object):
field_category_name = field+'_category' field_category_name = field+'_category'
field_name = field+'_uid' field_name = field+'_uid'
if verbose: if verbose:
print 'Processing %s' % field_name print('Processing %s' % field_name)
uids = [str(row[0]) for row in array[:][[field_name]]] uids = [str(row[0]) for row in array[:][[field_name]]]
objects = self.context.portal_catalog(uid=uids) objects = self.context.portal_catalog(uid=uids)
if verbose: if verbose:
print 'Found %s %s' % (len(objects), field) print('Found %s %s' % (len(objects), field))
for resource in objects: for resource in objects:
categories = resource.getCategoryList() categories = resource.getCategoryList()
...@@ -280,8 +280,8 @@ class CategoryProcessor(object): ...@@ -280,8 +280,8 @@ class CategoryProcessor(object):
category_uids.append(str(categories_df.ix[category]['uid'])) category_uids.append(str(categories_df.ix[category]['uid']))
except KeyError: except KeyError:
if verbose: if verbose:
print 'Category %s not found from %s' % (category, field_category_name) print('Category %s not found from %s' % (category, field_category_name))
print '...adding to the DataFrame.' print('...adding to the DataFrame.')
categories_df.loc[category] = self.context.portal_categories.resolveCategory(category).getUid() categories_df.loc[category] = self.context.portal_categories.resolveCategory(category).getUid()
fields_objects_categories[field][int(resource.getUid())] = ','.join(category_uids) fields_objects_categories[field][int(resource.getUid())] = ','.join(category_uids)
...@@ -314,7 +314,7 @@ class CategoryProcessor(object): ...@@ -314,7 +314,7 @@ class CategoryProcessor(object):
row[field_category_name] = categories row[field_category_name] = categories
transaction.commit() transaction.commit()
if duplicate_category: if duplicate_category:
print 'Duplication added to the array: %s' % total_duplication print('Duplication added to the array: %s' % total_duplication)
return return
def _getCategoriesDf(self): def _getCategoriesDf(self):
......
...@@ -67,5 +67,5 @@ configuration_save.addConfigurationItem("Portal Type Roles Spreadsheet Configura ...@@ -67,5 +67,5 @@ configuration_save.addConfigurationItem("Portal Type Roles Spreadsheet Configura
# Create ERP5Site_getSecurityCategoryMapping # Create ERP5Site_getSecurityCategoryMapping
configuration_save.addConfigurationItem("Security Category Mapping Configurator Item") configuration_save.addConfigurationItem("Security Category Mapping Configurator Item")
print "Created." print("Created.")
return printed return printed
...@@ -11,4 +11,4 @@ bme280.setup() ...@@ -11,4 +11,4 @@ bme280.setup()
data = bme280.read_all() data = bme280.read_all()
print("{}\t{}\t{}".format(data.pressure, data.humidity, data.temperature)) print(("{}\t{}\t{}".format(data.pressure, data.humidity, data.temperature)))
...@@ -25,4 +25,4 @@ r = requests.post(ingestion_policy_url, ...@@ -25,4 +25,4 @@ r = requests.post(ingestion_policy_url,
headers=headers) headers=headers)
if r.status_code >= 200 and r.status_code<=204: if r.status_code >= 200 and r.status_code<=204:
print "Successfully uploaded %s bytes to Wendelin." %len(payload) print("Successfully uploaded %s bytes to Wendelin." %len(payload))
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