From 2c445a6b755cf6d24e4603b0c59444decfb2df0d Mon Sep 17 00:00:00 2001 From: Python3pkg Date: Thu, 18 May 2017 05:59:48 -0700 Subject: [PATCH] Convert to python3 --- docs/conf.py | 18 +++---- .../AGOLMapServices/tileserviceproperties.py | 6 +-- samples/AGS/agsserverObjectExample.py | 12 ++--- samples/AGS/serverDetails.py | 10 ++-- .../addDomainToHostedFeatureService.py | 6 +-- .../addFieldToHostedFeatureService.py | 6 +-- .../listLayersInHostedFeatureService.py | 2 +- .../create_replica_all_assignments.py | 4 +- samples/Workforce/load_assignments_csv.py | 8 +-- samples/Workforce/load_assignments_lookup.py | 6 +-- samples/Workforce/query_completed_work.py | 4 +- .../Workforce/query_delete_completed_work.py | 4 +- samples/Workforce/update_status_assignment.py | 4 +- samples/addItem_kml_sample.py | 2 +- samples/add_field_layer.py | 2 +- samples/add_file_geodatabase.py | 4 +- samples/add_item.py | 10 ++-- samples/add_user_group.py | 4 +- samples/add_users.py | 10 ++-- samples/additem_webmap_sample.py | 2 +- samples/adds_rows_to_ags_service.py | 4 +- samples/adds_rows_to_service.py | 22 ++++---- samples/append_fc_to_service.py | 14 +++--- samples/assign_credits_users.py | 2 +- samples/change_folder.py | 2 +- samples/copy_feature_service_deforgorg.py | 14 +++--- samples/copy_item.py | 8 +-- samples/create_groups_from_csv.py | 10 ++-- samples/create_replica_fs.py | 2 +- samples/create_replica_portal_item.py | 24 ++++----- samples/delete_rows_from_service.py | 24 ++++----- samples/disable_sync_service_item.py | 2 +- samples/enableEsriAccess.py | 18 +++---- samples/loop_users_items.py | 2 +- samples/publish_sd_to_service.py | 2 +- samples/publishingGeoJSON.py | 2 +- samples/query_agol_layer.py | 2 +- .../query_agol_layer_using_ArcMap_Creds.py | 4 +- samples/query_agol_service.py | 2 +- samples/query_rows_from_service.py | 24 ++++----- samples/query_save_features_incremental.py | 2 +- samples/remove_adds_rows_to_service.py | 24 ++++----- samples/remove_all_content_groups_allusers.py | 2 +- samples/report_content_in_groups.py | 6 +-- samples/toggleEditing.py | 4 +- samples/update_features.py | 4 +- samples/update_item.py | 10 ++-- samples/update_largethumbnail.py | 22 ++++---- samples/update_rows_to_service_from_dict.py | 4 +- samples/update_thumbnail_csv.py | 32 ++++++------ samples/update_user_password.py | 2 +- src/arcrest/__init__.py | 2 +- src/arcrest/_abstract/__init__.py | 2 +- src/arcrest/_abstract/abstract.py | 6 +-- src/arcrest/agol/__init__.py | 2 +- src/arcrest/agol/_uploads.py | 4 +- src/arcrest/agol/helperservices/__init__.py | 2 +- src/arcrest/agol/helperservices/analysis.py | 2 +- src/arcrest/agol/helperservices/elevation.py | 2 +- src/arcrest/agol/helperservices/geocoder.py | 2 +- src/arcrest/agol/helperservices/hydrology.py | 2 +- src/arcrest/agol/services.py | 26 +++++----- src/arcrest/ags/__init__.py | 2 +- src/arcrest/ags/_geocodeservice.py | 8 +-- src/arcrest/ags/_geodataservice.py | 16 +++--- src/arcrest/ags/_geoprocessing.py | 14 +++--- src/arcrest/ags/_globeservice.py | 10 ++-- src/arcrest/ags/_gpobjects.py | 4 +- src/arcrest/ags/_imageservice.py | 10 ++-- src/arcrest/ags/_mobileservice.py | 12 ++--- src/arcrest/ags/_networkservice.py | 16 +++--- src/arcrest/ags/_schematicsservice.py | 8 +-- src/arcrest/ags/_streamservice.py | 8 +-- src/arcrest/ags/_uploads.py | 6 +-- src/arcrest/ags/_vectortile.py | 6 +-- src/arcrest/ags/featureservice.py | 8 +-- src/arcrest/ags/layer.py | 14 +++--- src/arcrest/ags/mapservice.py | 12 ++--- src/arcrest/ags/server.py | 10 ++-- src/arcrest/ags/services.py | 8 +-- src/arcrest/cmp/__init__.py | 2 +- src/arcrest/cmp/community.py | 8 +-- src/arcrest/common/__init__.py | 2 +- src/arcrest/common/domain.py | 8 +-- src/arcrest/common/errorhandlers.py | 4 +- src/arcrest/common/filters.py | 4 +- src/arcrest/common/find.py | 4 +- src/arcrest/common/general.py | 16 +++--- src/arcrest/common/geometry.py | 16 +++--- src/arcrest/common/renderer.py | 4 +- src/arcrest/common/servicedef.py | 4 +- src/arcrest/common/spatial.py | 8 +-- src/arcrest/common/symbology.py | 16 +++--- src/arcrest/enrichment/__init__.py | 2 +- src/arcrest/enrichment/_geoenrichment.py | 4 +- src/arcrest/geometryservice/__init__.py | 2 +- .../geometryservice/geometryservice.py | 8 +-- src/arcrest/hostedservice/__init__.py | 2 +- src/arcrest/hostedservice/service.py | 30 +++++------ src/arcrest/manageags/__init__.py | 2 +- src/arcrest/manageags/_clusters.py | 8 +-- src/arcrest/manageags/_data.py | 4 +- src/arcrest/manageags/_info.py | 6 +-- src/arcrest/manageags/_kml.py | 6 +-- src/arcrest/manageags/_logs.py | 10 ++-- src/arcrest/manageags/_machines.py | 8 +-- src/arcrest/manageags/_mode.py | 6 +-- src/arcrest/manageags/_security.py | 6 +-- src/arcrest/manageags/_services.py | 12 ++--- src/arcrest/manageags/_system.py | 14 +++--- src/arcrest/manageags/_uploads.py | 6 +-- src/arcrest/manageags/_usagereports.py | 8 +-- src/arcrest/manageags/administration.py | 6 +-- src/arcrest/manageorg/__init__.py | 2 +- src/arcrest/manageorg/_community.py | 40 +++++++-------- src/arcrest/manageorg/_content.py | 32 ++++++------ src/arcrest/manageorg/_content_constants.py | 4 +- src/arcrest/manageorg/_marketplace.py | 3 +- src/arcrest/manageorg/_oauth2.py | 4 +- src/arcrest/manageorg/_parameters.py | 6 +-- src/arcrest/manageorg/_portals.py | 24 ++++----- src/arcrest/manageorg/administration.py | 8 +-- src/arcrest/manageportal/__init__.py | 2 +- src/arcrest/manageportal/administration.py | 16 +++--- src/arcrest/opendata/__init__.py | 2 +- src/arcrest/opendata/_web.py | 16 +++--- src/arcrest/opendata/opendata.py | 6 +-- src/arcrest/packages/__init__.py | 2 +- .../packages/ntlm3/HTTPNtlmAuthHandler.py | 4 +- src/arcrest/packages/ntlm3/U32.py | 4 +- src/arcrest/packages/ntlm3/compat.py | 2 +- src/arcrest/packages/six.py | 40 +++++++-------- src/arcrest/security/__init__.py | 2 +- src/arcrest/security/security.py | 4 +- src/arcrest/web/__init__.py | 2 +- src/arcrest/web/_base.py | 23 +++++---- src/arcrest/webmap/__init__.py | 2 +- src/arcrest/webmap/domain.py | 4 +- src/arcrest/webmap/operationallayers.py | 4 +- src/arcrest/webmap/renderer.py | 4 +- src/arcrest/webmap/symbols.py | 8 +-- src/arcresthelper/__init__.py | 2 +- src/arcresthelper/common.py | 10 ++-- src/arcresthelper/featureservicetools.py | 4 +- src/arcresthelper/orgtools.py | 4 +- src/arcresthelper/packages/__init__.py | 2 +- src/arcresthelper/packages/six.py | 40 +++++++-------- src/arcresthelper/portalautomation.py | 4 +- src/arcresthelper/publishingtools.py | 6 +-- src/arcresthelper/resettools.py | 4 +- src/arcresthelper/securityhandlerhelper.py | 4 +- tests/enrichment_tests.py | 50 +++++++++---------- tools/src/addItem.py | 4 +- tools/src/addUser.py | 8 +-- tools/src/addUserToGroup.py | 4 +- tools/src/append_fc_to_fs.py | 6 +-- tools/src/append_groupLayer_fs.py | 8 +-- tools/src/createGroup.py | 4 +- tools/src/deleteGroup.py | 6 +-- tools/src/deleteItem.py | 4 +- tools/src/deleteUser.py | 6 +-- tools/src/deleteUserContent.py | 6 +-- tools/src/delete_rows_from_fs.py | 2 +- .../post_layer_to_workforce_assignments.py | 4 +- 164 files changed, 674 insertions(+), 678 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index dd81dba..20be761 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -49,18 +49,18 @@ master_doc = 'index' # General information about the project. -project = u'src' -copyright = u'2016, Author' -author = u'Author' +project = 'src' +copyright = '2016, Author' +author = 'Author' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. -version = u'' +version = '' # The full version, including alpha/beta/rc tags. -release = u'' +release = '' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -225,8 +225,8 @@ # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - (master_doc, 'src.tex', u'src Documentation', - u'Author', 'manual'), + (master_doc, 'src.tex', 'src Documentation', + 'Author', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of @@ -255,7 +255,7 @@ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ - (master_doc, 'src', u'src Documentation', + (master_doc, 'src', 'src Documentation', [author], 1) ] @@ -269,7 +269,7 @@ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - (master_doc, 'src', u'src Documentation', + (master_doc, 'src', 'src Documentation', author, 'src', 'One line description of project.', 'Miscellaneous'), ] diff --git a/samples/AGOLMapServices/tileserviceproperties.py b/samples/AGOLMapServices/tileserviceproperties.py index 19b9791..2acb27c 100644 --- a/samples/AGOLMapServices/tileserviceproperties.py +++ b/samples/AGOLMapServices/tileserviceproperties.py @@ -13,6 +13,6 @@ agolServices = arcrest.hostedservice.Services(url, securityHandler=sh) for service in agolServices.services: if isinstance(service, arcrest.hostedservice.AdminMapService): - print service.id - print service.urlService - print service.name \ No newline at end of file + print(service.id) + print(service.urlService) + print(service.name) \ No newline at end of file diff --git a/samples/AGS/agsserverObjectExample.py b/samples/AGS/agsserverObjectExample.py index 89aa04d..4e70f4f 100644 --- a/samples/AGS/agsserverObjectExample.py +++ b/samples/AGS/agsserverObjectExample.py @@ -11,15 +11,15 @@ # Access the AGSAdminstration Class # adminAGS = server.admin -print adminAGS.currentVersion -print adminAGS.clusters +print(adminAGS.currentVersion) +print(adminAGS.clusters) # Walk all the folders and # print out the raw JSON response # for each service and the url for folder in server.folders: server.currentFolder = folder for service in server.services: - print '----------------------' - print service.url - print str(service) - print '----------------------' \ No newline at end of file + print('----------------------') + print(service.url) + print(str(service)) + print('----------------------') \ No newline at end of file diff --git a/samples/AGS/serverDetails.py b/samples/AGS/serverDetails.py index 9a8ae06..f306639 100644 --- a/samples/AGS/serverDetails.py +++ b/samples/AGS/serverDetails.py @@ -30,15 +30,15 @@ def trace(): token_url=None, proxy_url=None, proxy_port=None) - print sh.token + print(sh.token) ags = AGSAdministration(url=url, securityHandler=sh, proxy_url=None, proxy_port=None) - print ags.data + print(ags.data) except: line, filename, synerror = trace() - print "error on line: %s" % line - print "error in file name: %s" % filename - print "with error message: %s" % synerror \ No newline at end of file + print("error on line: %s" % line) + print("error in file name: %s" % filename) + print("with error message: %s" % synerror) \ No newline at end of file diff --git a/samples/HostedFeatureServiceAdmin/addDomainToHostedFeatureService.py b/samples/HostedFeatureServiceAdmin/addDomainToHostedFeatureService.py index a07316f..3c4fdb1 100644 --- a/samples/HostedFeatureServiceAdmin/addDomainToHostedFeatureService.py +++ b/samples/HostedFeatureServiceAdmin/addDomainToHostedFeatureService.py @@ -39,10 +39,10 @@ agolServices = arcrest.hostedservice.Services(url, securityHandler=sh) for service in agolServices.services: if not service.layers is None: - print service.url + print(service.url) for lyr in service.layers: - print lyr.name + print(lyr.name) if lyr.name.lower() in featureLayerNames: - print lyr.updateDefinition(definition) + print(lyr.updateDefinition(definition)) # Output: {'success': True} \ No newline at end of file diff --git a/samples/HostedFeatureServiceAdmin/addFieldToHostedFeatureService.py b/samples/HostedFeatureServiceAdmin/addFieldToHostedFeatureService.py index 98bd9ec..8483396 100644 --- a/samples/HostedFeatureServiceAdmin/addFieldToHostedFeatureService.py +++ b/samples/HostedFeatureServiceAdmin/addFieldToHostedFeatureService.py @@ -27,10 +27,10 @@ agolServices = arcrest.hostedservice.Services(url, securityHandler=sh) for service in agolServices.services: if not service.layers is None: - print service.url + print(service.url) for lyr in service.layers: - print lyr.name + print(lyr.name) if lyr.name.lower() in featureLayerNames: - print lyr.addToDefinition(fieldToAdd) + print(lyr.addToDefinition(fieldToAdd)) # Output: {'success': True} \ No newline at end of file diff --git a/samples/HostedFeatureServiceAdmin/listLayersInHostedFeatureService.py b/samples/HostedFeatureServiceAdmin/listLayersInHostedFeatureService.py index 133db28..c2fb4f9 100644 --- a/samples/HostedFeatureServiceAdmin/listLayersInHostedFeatureService.py +++ b/samples/HostedFeatureServiceAdmin/listLayersInHostedFeatureService.py @@ -13,4 +13,4 @@ agolServices = arcrest.hostedservice.Services(url, securityHandler=sh) for service in agolServices.services: for lyr in service.layers: - print lyr.name, lyr._url \ No newline at end of file + print(lyr.name, lyr._url) \ No newline at end of file diff --git a/samples/Workforce/create_replica_all_assignments.py b/samples/Workforce/create_replica_all_assignments.py index f6059b5..d2ace08 100644 --- a/samples/Workforce/create_replica_all_assignments.py +++ b/samples/Workforce/create_replica_all_assignments.py @@ -4,7 +4,7 @@ ArcREST 3.5 """ -from __future__ import print_function + import arcrest from arcresthelper import securityhandlerhelper from arcresthelper import common @@ -77,7 +77,7 @@ def trace(): print (exportItem.userItem.deleteItem()) print (itemDataPath) - except (common.ArcRestHelperError),e: + except (common.ArcRestHelperError) as e: print ("error in function: %s" % e[0]['function']) print ("error on line: %s" % e[0]['line']) print ("error in file name: %s" % e[0]['filename']) diff --git a/samples/Workforce/load_assignments_csv.py b/samples/Workforce/load_assignments_csv.py index ea7ed27..78a8da3 100644 --- a/samples/Workforce/load_assignments_csv.py +++ b/samples/Workforce/load_assignments_csv.py @@ -4,7 +4,7 @@ ArcREST 3.5 """ -from __future__ import print_function + import arcrest from arcrest.common.general import Feature from arcresthelper import featureservicetools @@ -18,11 +18,11 @@ def UnicodeDictReader(utf8_data, **kwargs): if six.PY3 == True: csv_reader = csv.DictReader(utf8_data, **kwargs) for row in csv_reader: - yield {key: value for key, value in row.items()} + yield {key: value for key, value in list(row.items())} else: csv_reader = csv.DictReader(utf8_data, **kwargs) for row in csv_reader: - yield {unicode(key, 'utf-8-sig'): unicode(value, 'utf-8-sig') for key, value in row.items()} + yield {str(key, 'utf-8-sig'): str(value, 'utf-8-sig') for key, value in list(row.items())} def trace(): """ trace finds the line, the filename @@ -164,7 +164,7 @@ def main(): else: print ("0 features added to %s /n result info %s" % (fl.name,str(results))) - except (common.ArcRestHelperError),e: + except (common.ArcRestHelperError) as e: print ("error in function: %s" % e[0]['function']) print ("error on line: %s" % e[0]['line']) print ("error in file name: %s" % e[0]['filename']) diff --git a/samples/Workforce/load_assignments_lookup.py b/samples/Workforce/load_assignments_lookup.py index 7eb725e..8f8156c 100644 --- a/samples/Workforce/load_assignments_lookup.py +++ b/samples/Workforce/load_assignments_lookup.py @@ -7,7 +7,7 @@ ArcREST 3.5 """ -from __future__ import print_function + import arcrest from arcrest.common.general import Feature from arcresthelper import featureservicetools @@ -21,11 +21,11 @@ def UnicodeDictReader(utf8_data, **kwargs): if six.PY3 == True: csv_reader = csv.DictReader(utf8_data, **kwargs) for row in csv_reader: - yield {key: value for key, value in row.items()} + yield {key: value for key, value in list(row.items())} else: csv_reader = csv.DictReader(utf8_data, **kwargs) for row in csv_reader: - yield {unicode(key, 'utf-8-sig'): unicode(value, 'utf-8-sig') for key, value in row.items()} + yield {str(key, 'utf-8-sig'): str(value, 'utf-8-sig') for key, value in list(row.items())} def trace(): """ trace finds the line, the filename diff --git a/samples/Workforce/query_completed_work.py b/samples/Workforce/query_completed_work.py index ebc1191..3729134 100644 --- a/samples/Workforce/query_completed_work.py +++ b/samples/Workforce/query_completed_work.py @@ -4,7 +4,7 @@ Python 2.x/3.x ArcREST 3.5 """ -from __future__ import print_function + import arcrest from arcresthelper import featureservicetools from arcresthelper import common @@ -68,7 +68,7 @@ def main(): outName=outName) print (res) - except (common.ArcRestHelperError),e: + except (common.ArcRestHelperError) as e: print ("error in function: %s" % e[0]['function']) print ("error on line: %s" % e[0]['line']) print ("error in file name: %s" % e[0]['filename']) diff --git a/samples/Workforce/query_delete_completed_work.py b/samples/Workforce/query_delete_completed_work.py index 053aac3..4ace30b 100644 --- a/samples/Workforce/query_delete_completed_work.py +++ b/samples/Workforce/query_delete_completed_work.py @@ -6,7 +6,7 @@ Python 2.x/3.x ArcREST 3.5 """ -from __future__ import print_function + import arcrest from arcresthelper import featureservicetools from arcresthelper import common @@ -73,7 +73,7 @@ def main(): res = fst.DeleteFeaturesFromFeatureLayer(url=fl.url, sql=sql) print (res) - except (common.ArcRestHelperError),e: + except (common.ArcRestHelperError) as e: print ("error in function: %s" % e[0]['function']) print ("error on line: %s" % e[0]['line']) print ("error in file name: %s" % e[0]['filename']) diff --git a/samples/Workforce/update_status_assignment.py b/samples/Workforce/update_status_assignment.py index 6b8f129..225fe4b 100644 --- a/samples/Workforce/update_status_assignment.py +++ b/samples/Workforce/update_status_assignment.py @@ -4,7 +4,7 @@ ArcREST 3.5 """ -from __future__ import print_function + import arcrest from arcrest.common.general import Feature from arcresthelper import featureservicetools @@ -97,7 +97,7 @@ def main(): else: print ("0 features updated in %s /n result info %s" % (fl.name,str(results))) - except (common.ArcRestHelperError),e: + except (common.ArcRestHelperError) as e: print ("error in function: %s" % e[0]['function']) print ("error on line: %s" % e[0]['line']) print ("error in file name: %s" % e[0]['filename']) diff --git a/samples/addItem_kml_sample.py b/samples/addItem_kml_sample.py index c0adce1..77a9e77 100644 --- a/samples/addItem_kml_sample.py +++ b/samples/addItem_kml_sample.py @@ -4,7 +4,7 @@ ArcREST version 3.5.x Python 2/3 """ -from __future__ import print_function + import arcrest if __name__ == "__main__": diff --git a/samples/add_field_layer.py b/samples/add_field_layer.py index 294e74b..b146f66 100644 --- a/samples/add_field_layer.py +++ b/samples/add_field_layer.py @@ -6,7 +6,7 @@ Python 2/3 """ -from __future__ import print_function + from arcrest.security import AGOLTokenSecurityHandler from arcrest.agol import FeatureLayer diff --git a/samples/add_file_geodatabase.py b/samples/add_file_geodatabase.py index 07d9838..f7dcd32 100644 --- a/samples/add_file_geodatabase.py +++ b/samples/add_file_geodatabase.py @@ -1,5 +1,5 @@ -from __future__ import print_function -from __future__ import absolute_import + + import arcrest if __name__ == "__main__": diff --git a/samples/add_item.py b/samples/add_item.py index eb6f0c7..d025d39 100644 --- a/samples/add_item.py +++ b/samples/add_item.py @@ -45,7 +45,7 @@ def main(): shh = securityhandlerhelper.securityhandlerhelper(securityinfo) if shh.valid == False: - print shh.message + print(shh.message) else: admin = arcrest.manageorg.Administration(securityHandler=shh.securityhandler) content = admin.content @@ -92,13 +92,13 @@ def main(): destinationItemId=None, serviceProxyParams=None, metadata=None) - print item.title + " created" + print(item.title + " created") except: line, filename, synerror = trace() - print "error on line: %s" % line - print "error in file name: %s" % filename - print "with error message: %s" % synerror + print("error on line: %s" % line) + print("error in file name: %s" % filename) + print("with error message: %s" % synerror) if __name__ == "__main__": main() diff --git a/samples/add_user_group.py b/samples/add_user_group.py index 00a8c22..ac7c790 100644 --- a/samples/add_user_group.py +++ b/samples/add_user_group.py @@ -3,7 +3,7 @@ Python 2/3 ArcREST 3.5.1 """ -from __future__ import print_function + import arcrest from arcresthelper import securityhandlerhelper from arcresthelper import common @@ -66,7 +66,7 @@ def main(): res = group.addUsersToGroups(users=username) print (res) - except (common.ArcRestHelperError),e: + except (common.ArcRestHelperError) as e: print ("error in function: %s" % e[0]['function']) print ("error on line: %s" % e[0]['line']) print ("error in file name: %s" % e[0]['filename']) diff --git a/samples/add_users.py b/samples/add_users.py index 7ddbbe9..86d441a 100644 --- a/samples/add_users.py +++ b/samples/add_users.py @@ -46,7 +46,7 @@ def main(): shh = securityhandlerhelper.securityhandlerhelper(securityinfo) if shh.valid == False: - print shh.message + print(shh.message) else: admin = arcrest.manageorg.Administration(securityHandler=shh.securityhandler) portal = admin.portals.portalSelf @@ -57,14 +57,14 @@ def main(): email="test@test.com", role="account_user") res = portal.addUser(invitationList=invList, subject="test", html="test") - print res + print(res) except: line, filename, synerror = trace() - print "error on line: %s" % line - print "error in file name: %s" % filename - print "with error message: %s" % synerror + print("error on line: %s" % line) + print("error in file name: %s" % filename) + print("with error message: %s" % synerror) if __name__ == "__main__": main() \ No newline at end of file diff --git a/samples/additem_webmap_sample.py b/samples/additem_webmap_sample.py index 9dad42b..129aa80 100644 --- a/samples/additem_webmap_sample.py +++ b/samples/additem_webmap_sample.py @@ -4,7 +4,7 @@ version 3.5.x Python 2/3 """ -from __future__ import print_function + import arcrest import json if __name__ == "__main__": diff --git a/samples/adds_rows_to_ags_service.py b/samples/adds_rows_to_ags_service.py index b5215ca..4f5fb12 100644 --- a/samples/adds_rows_to_ags_service.py +++ b/samples/adds_rows_to_ags_service.py @@ -3,8 +3,8 @@ version 3.5.4 Python 2 """ -from __future__ import print_function -from __future__ import absolute_import + + import arcrest from arcresthelper import featureservicetools from arcresthelper import common diff --git a/samples/adds_rows_to_service.py b/samples/adds_rows_to_service.py index f49fadf..36d50ac 100644 --- a/samples/adds_rows_to_service.py +++ b/samples/adds_rows_to_service.py @@ -51,7 +51,7 @@ def main(): fst = featureservicetools.featureservicetools(securityinfo) if fst.valid == False: - print fst.message + print(fst.message) else: fs = fst.GetFeatureService(itemId=itemId,returnURLOnly=False) @@ -62,20 +62,20 @@ def main(): results = fst.AddFeaturesToFeatureLayer(url=fs_url, pathToFeatureClass=pathToFeatureClass, chunksize=2000) if 'addResults' in results: - print "%s features processed" % len(results['addResults']) - except (common.ArcRestHelperError),e: - print "error in function: %s" % e[0]['function'] - print "error on line: %s" % e[0]['line'] - print "error in file name: %s" % e[0]['filename'] - print "with error message: %s" % e[0]['synerror'] + print("%s features processed" % len(results['addResults'])) + except (common.ArcRestHelperError) as e: + print("error in function: %s" % e[0]['function']) + print("error on line: %s" % e[0]['line']) + print("error in file name: %s" % e[0]['filename']) + print("with error message: %s" % e[0]['synerror']) if 'arcpyError' in e[0]: - print "with arcpy message: %s" % e[0]['arcpyError'] + print("with arcpy message: %s" % e[0]['arcpyError']) except: line, filename, synerror = trace() - print "error on line: %s" % line - print "error in file name: %s" % filename - print "with error message: %s" % synerror + print("error on line: %s" % line) + print("error in file name: %s" % filename) + print("with error message: %s" % synerror) if __name__ == "__main__": main() \ No newline at end of file diff --git a/samples/append_fc_to_service.py b/samples/append_fc_to_service.py index 851608b..66773a9 100644 --- a/samples/append_fc_to_service.py +++ b/samples/append_fc_to_service.py @@ -51,7 +51,7 @@ def trace(): try: fst = featureservicetools.featureservicetools(securityinfo) if fst.valid == False: - print fst.message + print(fst.message) else: fs = fst.GetFeatureService(itemId=itemId,returnURLOnly=False) @@ -60,14 +60,14 @@ def trace(): fl = fst.GetLayerFromFeatureService(fs=fs,layerName=layerName,returnURLOnly=False) if not fl is None: results = fl.addFeatures(fc=fc,attachmentTable=atTable) - print json.dumps(results) + print(json.dumps(results)) else: - print "Layer %s was not found, please check your credentials and layer name" % layerName + print("Layer %s was not found, please check your credentials and layer name" % layerName) else: - print "Feature Service with id %s was not found" % fsId + print("Feature Service with id %s was not found" % fsId) except: line, filename, synerror = trace() - print "error on line: %s" % line - print "error in file name: %s" % filename - print "with error message: %s" % synerror \ No newline at end of file + print("error on line: %s" % line) + print("error in file name: %s" % filename) + print("with error message: %s" % synerror) \ No newline at end of file diff --git a/samples/assign_credits_users.py b/samples/assign_credits_users.py index a4192eb..5c8d69b 100644 --- a/samples/assign_credits_users.py +++ b/samples/assign_credits_users.py @@ -3,7 +3,7 @@ of users """ -from __future__ import print_function + import arcrest def main(): diff --git a/samples/change_folder.py b/samples/change_folder.py index 9815c7d..2be842d 100644 --- a/samples/change_folder.py +++ b/samples/change_folder.py @@ -6,7 +6,7 @@ Python 2/3 ArcREST version 3.5.x """ -from __future__ import print_function + from arcrest.security import AGOLTokenSecurityHandler import arcrest diff --git a/samples/copy_feature_service_deforgorg.py b/samples/copy_feature_service_deforgorg.py index c21f6b3..d4b7cce 100644 --- a/samples/copy_feature_service_deforgorg.py +++ b/samples/copy_feature_service_deforgorg.py @@ -67,7 +67,7 @@ def main(): shhSource = securityhandlerhelper.securityhandlerhelper(securityinfoSource) shhTarget = securityhandlerhelper.securityhandlerhelper(securityinfoTarget) if shhSource.valid == False or shhTarget.valid == False: - print shhSource.message + " " + shhTarget.message + print(shhSource.message + " " + shhTarget.message) else: adminSource = arcrest.manageorg.Administration(securityHandler=shhSource.securityhandler) @@ -78,10 +78,10 @@ def main(): serviceType='Feature Service') if 'available' in res: if res['available'] == False: - print "Pick a new name" + print("Pick a new name") return else: - print "Pick a new name" + print("Pick a new name") return itemSource = adminSource.content.getItem(itemId) @@ -196,7 +196,7 @@ def main(): print(updateItemResults) if itemSource.protected: - print(item.protect()) + print((item.protect())) adminNewFS = arcrest.hostedservice.AdminFeatureService(url=newServiceResult.url, securityHandler=shhTarget.securityhandler) adminExistFS = fs.administration @@ -238,9 +238,9 @@ def main(): except: line, filename, synerror = trace() - print("error on line: %s" % line) - print("error in file name: %s" % filename) - print("with error message: %s" % synerror) + print(("error on line: %s" % line)) + print(("error in file name: %s" % filename)) + print(("with error message: %s" % synerror)) if __name__ == "__main__": main() \ No newline at end of file diff --git a/samples/copy_item.py b/samples/copy_item.py index a752247..c12b03c 100644 --- a/samples/copy_item.py +++ b/samples/copy_item.py @@ -87,13 +87,13 @@ def main(): destinationItemId=None, serviceProxyParams=None, metadata=None) - print res + print(res) except: line, filename, synerror = trace() - print "error on line: %s" % line - print "error in file name: %s" % filename - print "with error message: %s" % synerror + print("error on line: %s" % line) + print("error in file name: %s" % filename) + print("with error message: %s" % synerror) if __name__ == "__main__": main() \ No newline at end of file diff --git a/samples/create_groups_from_csv.py b/samples/create_groups_from_csv.py index 7e68021..dd785e2 100644 --- a/samples/create_groups_from_csv.py +++ b/samples/create_groups_from_csv.py @@ -50,7 +50,7 @@ def trace(): orgt = orgtools.orgtools(securityinfo=securityinfo) if orgt.valid == False: - print orgt.message + print(orgt.message) else: if os.path.isfile(csvgroups): @@ -78,9 +78,9 @@ def trace(): if result is None: pass else: - print "Group created: " + result.title + print("Group created: " + result.title) except: line, filename, synerror = trace() - print "error on line: %s" % line - print "error in file name: %s" % filename - print "with error message: %s" % synerror \ No newline at end of file + print("error on line: %s" % line) + print("error in file name: %s" % filename) + print("with error message: %s" % synerror) \ No newline at end of file diff --git a/samples/create_replica_fs.py b/samples/create_replica_fs.py index fa81c60..7f438de 100644 --- a/samples/create_replica_fs.py +++ b/samples/create_replica_fs.py @@ -5,7 +5,7 @@ Python 2/3 """ -from __future__ import print_function + from arcrest.security import AGOLTokenSecurityHandler from arcrest.agol import FeatureService from arcrest.common.filters import LayerDefinitionFilter diff --git a/samples/create_replica_portal_item.py b/samples/create_replica_portal_item.py index e3aaee2..fc77a7a 100644 --- a/samples/create_replica_portal_item.py +++ b/samples/create_replica_portal_item.py @@ -52,7 +52,7 @@ def trace(): try: shh = securityhandlerhelper.securityhandlerhelper(securityinfo=securityinfo) if shh.valid == False: - print shh.message + print(shh.message) else: admin = arcrest.manageorg.Administration(securityHandler=shh.securityhandler) @@ -73,19 +73,19 @@ def trace(): exportItemId = res.id exportItem = admin.content.getItem(exportItemId) itemDataPath = exportItem.itemData(f=None, savePath=savePath) - print exportItem.userItem.deleteItem() + print(exportItem.userItem.deleteItem()) - print itemDataPath - except (common.ArcRestHelperError),e: - print "error in function: %s" % e[0]['function'] - print "error on line: %s" % e[0]['line'] - print "error in file name: %s" % e[0]['filename'] - print "with error message: %s" % e[0]['synerror'] + print(itemDataPath) + except (common.ArcRestHelperError) as e: + print("error in function: %s" % e[0]['function']) + print("error on line: %s" % e[0]['line']) + print("error in file name: %s" % e[0]['filename']) + print("with error message: %s" % e[0]['synerror']) if 'arcpyError' in e[0]: - print "with arcpy message: %s" % e[0]['arcpyError'] + print("with arcpy message: %s" % e[0]['arcpyError']) except: line, filename, synerror = trace() - print "error on line: %s" % line - print "error in file name: %s" % filename - print "with error message: %s" % synerror + print("error on line: %s" % line) + print("error in file name: %s" % filename) + print("with error message: %s" % synerror) diff --git a/samples/delete_rows_from_service.py b/samples/delete_rows_from_service.py index 8ca90a6..fd9e34c 100644 --- a/samples/delete_rows_from_service.py +++ b/samples/delete_rows_from_service.py @@ -50,7 +50,7 @@ def main(): fst = featureservicetools.featureservicetools(securityinfo) if fst.valid == False: - print fst.message + print(fst.message) else: fs = fst.GetFeatureService(itemId=itemId,returnURLOnly=False) @@ -59,21 +59,21 @@ def main(): for layerName in layerNames.split(','): fs_url = fst.GetLayerFromFeatureService(fs=fs,layerName=layerName,returnURLOnly=True) if not fs_url is None: - print fst.DeleteFeaturesFromFeatureLayer(url=fs_url, sql=sql, - chunksize=2000) - except (common.ArcRestHelperError),e: - print "error in function: %s" % e[0]['function'] - print "error on line: %s" % e[0]['line'] - print "error in file name: %s" % e[0]['filename'] - print "with error message: %s" % e[0]['synerror'] + print(fst.DeleteFeaturesFromFeatureLayer(url=fs_url, sql=sql, + chunksize=2000)) + except (common.ArcRestHelperError) as e: + print("error in function: %s" % e[0]['function']) + print("error on line: %s" % e[0]['line']) + print("error in file name: %s" % e[0]['filename']) + print("with error message: %s" % e[0]['synerror']) if 'arcpyError' in e[0]: - print "with arcpy message: %s" % e[0]['arcpyError'] + print("with arcpy message: %s" % e[0]['arcpyError']) except: line, filename, synerror = trace() - print "error on line: %s" % line - print "error in file name: %s" % filename - print "with error message: %s" % synerror + print("error on line: %s" % line) + print("error in file name: %s" % filename) + print("with error message: %s" % synerror) if __name__ == "__main__": main() \ No newline at end of file diff --git a/samples/disable_sync_service_item.py b/samples/disable_sync_service_item.py index 5f5add9..2c65623 100644 --- a/samples/disable_sync_service_item.py +++ b/samples/disable_sync_service_item.py @@ -7,7 +7,7 @@ """ -from __future__ import print_function + import arcrest from arcrest.security import AGOLTokenSecurityHandler from arcrest.security import PortalTokenSecurityHandler diff --git a/samples/enableEsriAccess.py b/samples/enableEsriAccess.py index 292e74e..80de968 100644 --- a/samples/enableEsriAccess.py +++ b/samples/enableEsriAccess.py @@ -26,7 +26,7 @@ shh = securityhandlerhelper.securityhandlerhelper(securityinfo=securityinfo) if shh.valid == False: - print (shh.message) + print((shh.message)) else: admin = arcrest.manageorg.Administration(securityHandler=shh.securityhandler, initialize=True) portal = admin.portals.portalSelf @@ -38,20 +38,20 @@ for commUser in commUsers: if not commUser.username.lower() in usersToSkip: user = admin.community.users.user(commUser.username) - print commUser.username + ": " + commUser.userType + " {" + commUser.provider + ")" + print(commUser.username + ": " + commUser.userType + " {" + commUser.provider + ")") if (enableAccess == True): if commUser.userType == 'arcgisonly': - print (user.update(userType='both')) - print (commUser.username + ": enabling Esri Access") + print((user.update(userType='both'))) + print((commUser.username + ": enabling Esri Access")) else: - print (commUser.username + ": Esri Access already enabled") + print((commUser.username + ": Esri Access already enabled")) else: if commUser.userType == 'both': - print (user.update(userType='arcgisonly')) - print (commUser.username + ": disabling Esri Access") + print((user.update(userType='arcgisonly'))) + print((commUser.username + ": disabling Esri Access")) else: - print (commUser.username + ": Esri Access already disabled") + print((commUser.username + ": Esri Access already disabled")) else: - print (commUser.username + ": skipped") + print((commUser.username + ": skipped")) diff --git a/samples/loop_users_items.py b/samples/loop_users_items.py index d98388c..798c43e 100644 --- a/samples/loop_users_items.py +++ b/samples/loop_users_items.py @@ -5,7 +5,7 @@ Python 2/3 ArcREST version 3.5.x """ -from __future__ import print_function + import arcrest from arcrest.security import AGOLTokenSecurityHandler from datetime import datetime as dt diff --git a/samples/publish_sd_to_service.py b/samples/publish_sd_to_service.py index 8e019ad..ff7b2c3 100644 --- a/samples/publish_sd_to_service.py +++ b/samples/publish_sd_to_service.py @@ -8,7 +8,7 @@ ArcREST 3.5.0 """ -from __future__ import print_function + import arcrest if __name__ == "__main__": diff --git a/samples/publishingGeoJSON.py b/samples/publishingGeoJSON.py index 1750e7a..e7e3432 100644 --- a/samples/publishingGeoJSON.py +++ b/samples/publishingGeoJSON.py @@ -4,7 +4,7 @@ Python 2/3 ArcREST version 3.5.0 """ -from __future__ import print_function + import arcrest if __name__ == "__main__": diff --git a/samples/query_agol_layer.py b/samples/query_agol_layer.py index 7c813bb..7b72dc9 100644 --- a/samples/query_agol_layer.py +++ b/samples/query_agol_layer.py @@ -1,4 +1,4 @@ -from __future__ import print_function + from arcrest.security import AGOLTokenSecurityHandler from arcrest.agol import FeatureLayer diff --git a/samples/query_agol_layer_using_ArcMap_Creds.py b/samples/query_agol_layer_using_ArcMap_Creds.py index 935af91..1879248 100644 --- a/samples/query_agol_layer_using_ArcMap_Creds.py +++ b/samples/query_agol_layer_using_ArcMap_Creds.py @@ -63,7 +63,7 @@ def main(*argv): arcpy.AddError("error in file name: %s" % filename) arcpy.AddError("with error message: %s" % synerror) arcpy.AddError("ArcPy Error Message: %s" % arcpy.GetMessages(2)) - except FunctionError, f_e: + except FunctionError as f_e: messages = f_e.args[0] arcpy.AddError("error in function: %s" % messages["function"]) arcpy.AddError("error on line: %s" % messages["line"]) @@ -79,5 +79,5 @@ def main(*argv): if __name__ == "__main__": env.overwriteOutput = True argv = tuple(arcpy.GetParameterAsText(i) - for i in xrange(arcpy.GetArgumentCount())) + for i in range(arcpy.GetArgumentCount())) main(*argv) \ No newline at end of file diff --git a/samples/query_agol_service.py b/samples/query_agol_service.py index a73be2e..71fb8c2 100644 --- a/samples/query_agol_service.py +++ b/samples/query_agol_service.py @@ -4,7 +4,7 @@ ArcREST 3.0.1 """ -from __future__ import print_function + from arcresthelper import securityhandlerhelper from arcrest.agol import FeatureService from arcrest.common.filters import LayerDefinitionFilter diff --git a/samples/query_rows_from_service.py b/samples/query_rows_from_service.py index 1645f3f..9dec5ca 100644 --- a/samples/query_rows_from_service.py +++ b/samples/query_rows_from_service.py @@ -52,7 +52,7 @@ def main(): fst = featureservicetools.featureservicetools(securityinfo) if fst.valid == False: - print fst.message + print(fst.message) else: fs = fst.GetFeatureService(itemId=itemId,returnURLOnly=False) @@ -61,24 +61,24 @@ def main(): for layerName in layerNames.split(','): fs_url = fst.GetLayerFromFeatureService(fs=fs,layerName=layerName,returnURLOnly=True) if not fs_url is None: - print fst.QueryAllFeatures(url=fs_url, + print(fst.QueryAllFeatures(url=fs_url, sql=sql, chunksize=300, saveLocation=r"c:\temp", - outName="test.shp") - except (common.ArcRestHelperError),e: - print "error in function: %s" % e[0]['function'] - print "error on line: %s" % e[0]['line'] - print "error in file name: %s" % e[0]['filename'] - print "with error message: %s" % e[0]['synerror'] + outName="test.shp")) + except (common.ArcRestHelperError) as e: + print("error in function: %s" % e[0]['function']) + print("error on line: %s" % e[0]['line']) + print("error in file name: %s" % e[0]['filename']) + print("with error message: %s" % e[0]['synerror']) if 'arcpyError' in e[0]: - print "with arcpy message: %s" % e[0]['arcpyError'] + print("with arcpy message: %s" % e[0]['arcpyError']) except: line, filename, synerror = trace() - print "error on line: %s" % line - print "error in file name: %s" % filename - print "with error message: %s" % synerror + print("error on line: %s" % line) + print("error in file name: %s" % filename) + print("with error message: %s" % synerror) if __name__ == "__main__": main() \ No newline at end of file diff --git a/samples/query_save_features_incremental.py b/samples/query_save_features_incremental.py index c284797..c6777a5 100644 --- a/samples/query_save_features_incremental.py +++ b/samples/query_save_features_incremental.py @@ -11,7 +11,7 @@ Python 2.x/3.x ArcREST 3.5.4 """ -from __future__ import print_function + import arcrest import csv diff --git a/samples/remove_adds_rows_to_service.py b/samples/remove_adds_rows_to_service.py index 62920e2..10c6189 100644 --- a/samples/remove_adds_rows_to_service.py +++ b/samples/remove_adds_rows_to_service.py @@ -53,11 +53,11 @@ def main(): pathToFeatureClass = r""#Path to FC try: startTime = datetime.datetime.now() - print "Starting process at %s" % (configFile,startTime.strftime(dateTimeFormat)) + print("Starting process at %s" % (configFile,startTime.strftime(dateTimeFormat))) fst = featureservicetools.featureservicetools(securityinfo) if fst.valid == False: - print fst.message + print(fst.message) else: fs = fst.GetFeatureService(itemId=itemId,returnURLOnly=False) @@ -70,20 +70,20 @@ def main(): id_field=id_field, chunksize=50) - print "process completed in %s" % (configFile, str(datetime.datetime.now() - startTime)) - except (common.ArcRestHelperError),e: - print "error in function: %s" % e[0]['function'] - print "error on line: %s" % e[0]['line'] - print "error in file name: %s" % e[0]['filename'] - print "with error message: %s" % e[0]['synerror'] + print("process completed in %s" % (configFile, str(datetime.datetime.now() - startTime))) + except (common.ArcRestHelperError) as e: + print("error in function: %s" % e[0]['function']) + print("error on line: %s" % e[0]['line']) + print("error in file name: %s" % e[0]['filename']) + print("with error message: %s" % e[0]['synerror']) if 'arcpyError' in e[0]: - print "with arcpy message: %s" % e[0]['arcpyError'] + print("with arcpy message: %s" % e[0]['arcpyError']) except: line, filename, synerror = trace() - print "error on line: %s" % line - print "error in file name: %s" % filename - print "with error message: %s" % synerror + print("error on line: %s" % line) + print("error in file name: %s" % filename) + print("with error message: %s" % synerror) if __name__ == "__main__": main() \ No newline at end of file diff --git a/samples/remove_all_content_groups_allusers.py b/samples/remove_all_content_groups_allusers.py index 67cb306..29d797d 100644 --- a/samples/remove_all_content_groups_allusers.py +++ b/samples/remove_all_content_groups_allusers.py @@ -5,7 +5,7 @@ Python 2.x ArcREST 3.5 """ -from __future__ import print_function + import arcrest from arcresthelper import resettools from arcresthelper import common diff --git a/samples/report_content_in_groups.py b/samples/report_content_in_groups.py index 3889a44..7340eac 100644 --- a/samples/report_content_in_groups.py +++ b/samples/report_content_in_groups.py @@ -5,8 +5,8 @@ Python 2.x/3.x ArcREST 3.5,6 """ -from __future__ import print_function -from __future__ import absolute_import + + import arcrest import os @@ -35,7 +35,7 @@ def trace(): def _unicode_convert(obj): """ converts unicode to anscii """ if isinstance(obj, dict): - return {_unicode_convert(key): _unicode_convert(value) for key, value in obj.items()} + return {_unicode_convert(key): _unicode_convert(value) for key, value in list(obj.items())} elif isinstance(obj, list): return [_unicode_convert(element) for element in obj] elif isinstance(obj, str): diff --git a/samples/toggleEditing.py b/samples/toggleEditing.py index e6e72b3..7a29b5d 100644 --- a/samples/toggleEditing.py +++ b/samples/toggleEditing.py @@ -22,8 +22,8 @@ serviceUrl = ''#URL to service, make sure to not include a layer shh = securityhandlerhelper.securityhandlerhelper(securityinfo=securityinfo) if shh.valid == False: - print shh.message + print(shh.message) else: fst = featureservicetools.featureservicetools(securityinfo=securityinfo) if fst.valid: - print fst.EnableEditingOnService(url=serviceUrl) \ No newline at end of file + print(fst.EnableEditingOnService(url=serviceUrl)) \ No newline at end of file diff --git a/samples/update_features.py b/samples/update_features.py index a46a510..87b881e 100644 --- a/samples/update_features.py +++ b/samples/update_features.py @@ -43,7 +43,7 @@ shh = securityhandlerhelper.securityhandlerhelper(securityinfo=securityinfo) if shh.valid == False: - print shh.message + print(shh.message) else: fl= FeatureLayer( url=url, @@ -63,4 +63,4 @@ for fld in fieldInfo: feat.set_value(fld["FieldName"],fld['ValueToSet']) - print fl.updateFeature(features=resFeats) \ No newline at end of file + print(fl.updateFeature(features=resFeats)) \ No newline at end of file diff --git a/samples/update_item.py b/samples/update_item.py index 2bca376..e9a74e5 100644 --- a/samples/update_item.py +++ b/samples/update_item.py @@ -48,7 +48,7 @@ def main(): shh = securityhandlerhelper.securityhandlerhelper(securityinfo) if shh.valid == False: - print shh.message + print(shh.message) else: portalAdmin = arcrest.manageorg.Administration(securityHandler=shh.securityhandler) item = portalAdmin.content.getItem(itemId=itemId).userItem @@ -63,13 +63,13 @@ def main(): text=None ) - print res + print(res) except: line, filename, synerror = trace() - print "error on line: %s" % line - print "error in file name: %s" % filename - print "with error message: %s" % synerror + print("error on line: %s" % line) + print("error in file name: %s" % filename) + print("with error message: %s" % synerror) if __name__ == "__main__": main() diff --git a/samples/update_largethumbnail.py b/samples/update_largethumbnail.py index c3d712e..9bc9b0f 100644 --- a/samples/update_largethumbnail.py +++ b/samples/update_largethumbnail.py @@ -48,7 +48,7 @@ def main(): try: shh = securityhandlerhelper.securityhandlerhelper(securityinfo=securityinfo) if shh.valid == False: - print shh.message + print(shh.message) else: admin = arcrest.manageorg.Administration(securityHandler=shh.securityhandler) content = admin.content @@ -58,20 +58,20 @@ def main(): itemParams.largeThumbnail = pathToImage - print item.userItem.updateItem(itemParameters=itemParams) - except (common.ArcRestHelperError),e: - print "error in function: %s" % e[0]['function'] - print "error on line: %s" % e[0]['line'] - print "error in file name: %s" % e[0]['filename'] - print "with error message: %s" % e[0]['synerror'] + print(item.userItem.updateItem(itemParameters=itemParams)) + except (common.ArcRestHelperError) as e: + print("error in function: %s" % e[0]['function']) + print("error on line: %s" % e[0]['line']) + print("error in file name: %s" % e[0]['filename']) + print("with error message: %s" % e[0]['synerror']) if 'arcpyError' in e[0]: - print "with arcpy message: %s" % e[0]['arcpyError'] + print("with arcpy message: %s" % e[0]['arcpyError']) except: line, filename, synerror = trace() - print "error on line: %s" % line - print "error in file name: %s" % filename - print "with error message: %s" % synerror + print("error on line: %s" % line) + print("error in file name: %s" % filename) + print("with error message: %s" % synerror) if __name__ == "__main__": main() \ No newline at end of file diff --git a/samples/update_rows_to_service_from_dict.py b/samples/update_rows_to_service_from_dict.py index dc73d9b..81dfcd7 100644 --- a/samples/update_rows_to_service_from_dict.py +++ b/samples/update_rows_to_service_from_dict.py @@ -31,7 +31,7 @@ shh = securityhandlerhelper.securityhandlerhelper(securityinfo=securityinfo) if shh.valid == False: - print shh.message + print(shh.message) else: fl= FeatureLayer( url=url, @@ -54,4 +54,4 @@ features.append(Feature(json_string=json_string)) - print fl.updateFeature(features=features) \ No newline at end of file + print(fl.updateFeature(features=features)) \ No newline at end of file diff --git a/samples/update_thumbnail_csv.py b/samples/update_thumbnail_csv.py index d1f4455..caf10c5 100644 --- a/samples/update_thumbnail_csv.py +++ b/samples/update_thumbnail_csv.py @@ -54,24 +54,24 @@ def main(): sciptPath = os.getcwd() try: - print "###############Script Started#################" - print datetime.datetime.now().strftime(dateTimeFormat) + print("###############Script Started#################") + print(datetime.datetime.now().strftime(dateTimeFormat)) if os.path.exists(imageFolder) == False: imageFolder = os.path.join(sciptPath,imageFolder) elif os.path.isabs(imageFolder) == False: imageFolder = os.path.join(sciptPath,imageFolder) if os.path.exists(imageFolder) == False: - print "Image folder %s could not be located" % imageFolderName + print("Image folder %s could not be located" % imageFolderName) return if os.path.isfile(configFiles) == False: - print "csv file %s could not be located" % configFiles + print("csv file %s could not be located" % configFiles) return agolSH = AGOLTokenSecurityHandler(username=username, password=password,org_url=url) - print "Login with token: %s" % agolSH.token + print("Login with token: %s" % agolSH.token) portalAdmin = arcrest.manageorg.Administration(securityHandler=agolSH) content = portalAdmin.content @@ -80,7 +80,7 @@ def main(): for row in csv.DictReader(csvfile,dialect='excel'): if not 'itemid' in row: - print "itemID could not be found if table" + print("itemID could not be found if table") return itemid = row['itemid'] @@ -88,32 +88,32 @@ def main(): itemParams = arcrest.manageorg.ItemParameter() if 'thumbnail' in row: - print "%s to be applied to thumbnail of %s" % (row['thumbnail'],itemid ) + print("%s to be applied to thumbnail of %s" % (row['thumbnail'],itemid )) image = os.path.join(imageFolder,row['thumbnail']) if os.path.isfile(image): itemParams.thumbnail = image else: - print "image %s could not be located" % row['thumbnail'] + print("image %s could not be located" % row['thumbnail']) if 'largethumbnail' in row: - print "%s to be applied to largethumbnail of %s" % (row['largethumbnail'],itemid ) + print("%s to be applied to largethumbnail of %s" % (row['largethumbnail'],itemid )) largeimage = os.path.join(imageFolder,row['largethumbnail']) if os.path.isfile(largeimage): itemParams.largeThumbnail = largeimage else: - print "image %s could not be located" % row['largethumbnail'] + print("image %s could not be located" % row['largethumbnail']) - print(item.userItem.updateItem(itemParameters=itemParams)) + print((item.userItem.updateItem(itemParameters=itemParams))) except: line, filename, synerror = trace() - print "error on line: %s" % line - print "error in file name: %s" % filename - print "with error message: %s" % synerror + print("error on line: %s" % line) + print("error in file name: %s" % filename) + print("with error message: %s" % synerror) finally: - print datetime.datetime.now().strftime(dateTimeFormat) - print "###############Script Completed#################" + print(datetime.datetime.now().strftime(dateTimeFormat)) + print("###############Script Completed#################") if __name__ == "__main__": main() \ No newline at end of file diff --git a/samples/update_user_password.py b/samples/update_user_password.py index 361b2d7..8bd46d8 100644 --- a/samples/update_user_password.py +++ b/samples/update_user_password.py @@ -4,7 +4,7 @@ version 3.5.x Python 2/3 """ -from __future__ import print_function + from arcresthelper import securityhandlerhelper import arcrest diff --git a/src/arcrest/__init__.py b/src/arcrest/__init__.py index e1641d6..1a8baa2 100644 --- a/src/arcrest/__init__.py +++ b/src/arcrest/__init__.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from .constants import * from . import agol from . import ags diff --git a/src/arcrest/_abstract/__init__.py b/src/arcrest/_abstract/__init__.py index b071175..e834102 100644 --- a/src/arcrest/_abstract/__init__.py +++ b/src/arcrest/_abstract/__init__.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from . import abstract __version__ = "3.5.9" \ No newline at end of file diff --git a/src/arcrest/_abstract/abstract.py b/src/arcrest/_abstract/abstract.py index 5e4a522..1643475 100644 --- a/src/arcrest/_abstract/abstract.py +++ b/src/arcrest/_abstract/abstract.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + import zipfile import datetime import calendar @@ -145,7 +145,7 @@ def _tostr(self,obj): def _unicode_convert(self, obj): """ converts unicode to anscii """ if isinstance(obj, dict): - return {self._unicode_convert(key): self._unicode_convert(value) for key, value in obj.items()} + return {self._unicode_convert(key): self._unicode_convert(value) for key, value in list(obj.items())} elif isinstance(obj, list): return [self._unicode_convert(element) for element in obj] elif isinstance(obj, str): @@ -269,7 +269,7 @@ def _tostr(self,obj): def _unicode_convert(self, obj): """ converts unicode to anscii """ if isinstance(obj, dict): - return {self._unicode_convert(key): self._unicode_convert(value) for key, value in obj.items()} + return {self._unicode_convert(key): self._unicode_convert(value) for key, value in list(obj.items())} elif isinstance(obj, list): return [self._unicode_convert(element) for element in obj] elif isinstance(obj, str): diff --git a/src/arcrest/agol/__init__.py b/src/arcrest/agol/__init__.py index 02b11ce..2b2c145 100644 --- a/src/arcrest/agol/__init__.py +++ b/src/arcrest/agol/__init__.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from .services import FeatureService, FeatureLayer, TableLayer, TiledService from . import helperservices from ._uploads import Uploads diff --git a/src/arcrest/agol/_uploads.py b/src/arcrest/agol/_uploads.py index 5f5eebf..a9cf6fa 100644 --- a/src/arcrest/agol/_uploads.py +++ b/src/arcrest/agol/_uploads.py @@ -1,8 +1,8 @@ """ handles the upload functions for all viable services """ -from __future__ import absolute_import -from __future__ import division + + import os import mmap import json diff --git a/src/arcrest/agol/helperservices/__init__.py b/src/arcrest/agol/helperservices/__init__.py index cae6a90..f4a170d 100644 --- a/src/arcrest/agol/helperservices/__init__.py +++ b/src/arcrest/agol/helperservices/__init__.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from .analysis import * from .elevation import * from .hydrology import * diff --git a/src/arcrest/agol/helperservices/analysis.py b/src/arcrest/agol/helperservices/analysis.py index 4eec230..8af5204 100644 --- a/src/arcrest/agol/helperservices/analysis.py +++ b/src/arcrest/agol/helperservices/analysis.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from ...ags._geoprocessing import * from ..._abstract import abstract ######################################################################## diff --git a/src/arcrest/agol/helperservices/elevation.py b/src/arcrest/agol/helperservices/elevation.py index 42d3196..f7774bd 100644 --- a/src/arcrest/agol/helperservices/elevation.py +++ b/src/arcrest/agol/helperservices/elevation.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from ...ags._geoprocessing import * from ...common.geometry import Polygon, Polyline, Point, SpatialReference, Envelope from ..._abstract import abstract diff --git a/src/arcrest/agol/helperservices/geocoder.py b/src/arcrest/agol/helperservices/geocoder.py index 15633f2..38a4751 100644 --- a/src/arcrest/agol/helperservices/geocoder.py +++ b/src/arcrest/agol/helperservices/geocoder.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from ...ags._geocodeservice import GeocodeService class geocode(GeocodeService): diff --git a/src/arcrest/agol/helperservices/hydrology.py b/src/arcrest/agol/helperservices/hydrology.py index 031d159..2b72374 100644 --- a/src/arcrest/agol/helperservices/hydrology.py +++ b/src/arcrest/agol/helperservices/hydrology.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from ...ags._geoprocessing import * from ...common.geometry import Polygon, Polyline, Point, SpatialReference, Envelope from ..._abstract import abstract diff --git a/src/arcrest/agol/services.py b/src/arcrest/agol/services.py index e1335ed..31adf25 100644 --- a/src/arcrest/agol/services.py +++ b/src/arcrest/agol/services.py @@ -8,9 +8,9 @@ .. moduleauthor:: Esri """ -from __future__ import absolute_import -from __future__ import print_function -from __future__ import division + + + import os import uuid import json @@ -115,7 +115,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k == 'layers': self._getLayers() elif k == 'tables': @@ -953,7 +953,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, json_dict[k]) else: @@ -1803,21 +1803,21 @@ def query(self, params['units'] = units if timeFilter and \ isinstance(timeFilter, TimeFilter): - for k,v in timeFilter.filter.items(): + for k,v in list(timeFilter.filter.items()): params[k] = v elif isinstance(timeFilter, dict): - for k,v in timeFilter.items(): + for k,v in list(timeFilter.items()): params[k] = v if geomtryFilter and \ isinstance(geomtryFilter, GeometryFilter): - for k,v in geomtryFilter.filter.items(): + for k,v in list(geomtryFilter.filter.items()): params[k] = v elif geomtryFilter and \ isinstance(geomtryFilter, dict): - for k,v in geomtryFilter.items(): + for k,v in list(geomtryFilter.items()): params[k] = v if len(kwargs) > 0: - for k,v in kwargs.items(): + for k,v in list(kwargs.items()): params[k] = v del k,v @@ -1972,7 +1972,7 @@ def _chunks(self, l, n): """ l.sort() newn = int(1.0 * len(l) / n + 0.5) - for i in xrange(0, n-1): + for i in range(0, n-1): yield l[i*newn:i*newn+newn] yield l[n*newn-newn:] #---------------------------------------------------------------------- @@ -2318,7 +2318,7 @@ def addFeatures(self, fc, attachmentTable=None, js = js['features'] if lowerCaseFieldNames == True: for feat in js: - feat['attributes'] = dict((k.lower(), v) for k,v in feat['attributes'].items()) + feat['attributes'] = dict((k.lower(), v) for k,v in list(feat['attributes'].items())) if len(js) == 0: return {'addResults':None} if len(js) <= max_chunk: @@ -2513,7 +2513,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, json_dict[k]) else: diff --git a/src/arcrest/ags/__init__.py b/src/arcrest/ags/__init__.py index c8482b7..3a4b5ee 100644 --- a/src/arcrest/ags/__init__.py +++ b/src/arcrest/ags/__init__.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from .featureservice import * from .mapservice import * from .layer import * diff --git a/src/arcrest/ags/_geocodeservice.py b/src/arcrest/ags/_geocodeservice.py index ccdd2d7..ab36207 100644 --- a/src/arcrest/ags/_geocodeservice.py +++ b/src/arcrest/ags/_geocodeservice.py @@ -1,5 +1,5 @@ -from __future__ import absolute_import -from __future__ import print_function + + from .._abstract.abstract import BaseAGSServer from ..security import AGOLTokenSecurityHandler, OAuthSecurityHandler from ..common.geometry import Point @@ -62,7 +62,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, v) else: @@ -77,7 +77,7 @@ def __str__(self): def __iter__(self): """returns key/value pair""" attributes = json.loads(str(self)) - for att in attributes.keys(): + for att in list(attributes.keys()): yield [att, getattr(self, att)] #---------------------------------------------------------------------- @property diff --git a/src/arcrest/ags/_geodataservice.py b/src/arcrest/ags/_geodataservice.py index afc0a32..33b703b 100644 --- a/src/arcrest/ags/_geodataservice.py +++ b/src/arcrest/ags/_geodataservice.py @@ -1,5 +1,5 @@ -from __future__ import absolute_import -from __future__ import print_function + + from .._abstract.abstract import BaseAGSServer import json ######################################################################## @@ -47,7 +47,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: if k == "versions" and json_dict[k]: self._versions = [] @@ -83,7 +83,7 @@ def __iter__(self): returns key/value pair """ attributes = json.loads(str(self)) - for att in attributes.keys(): + for att in list(attributes.keys()): yield [att, getattr(self, att)] #---------------------------------------------------------------------- @property @@ -195,7 +195,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, json_dict[k]) else: @@ -214,7 +214,7 @@ def __iter__(self): returns key/value pair """ attributes = json.loads(str(self)) - for att in attributes.keys(): + for att in list(attributes.keys()): yield [att, getattr(self, att)] #---------------------------------------------------------------------- @@ -323,7 +323,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, json_dict[k]) else: @@ -342,7 +342,7 @@ def __iter__(self): returns key/value pair """ attributes = json.loads(str(self)) - for att in attributes.keys(): + for att in list(attributes.keys()): yield [att, getattr(self, att)] #---------------------------------------------------------------------- diff --git a/src/arcrest/ags/_geoprocessing.py b/src/arcrest/ags/_geoprocessing.py index 827d5f9..79e6f7f 100644 --- a/src/arcrest/ags/_geoprocessing.py +++ b/src/arcrest/ags/_geoprocessing.py @@ -1,5 +1,5 @@ -from __future__ import absolute_import -from __future__ import print_function + + import json from ._gpobjects import * from .._abstract.abstract import BaseAGSServer, BaseGPObject @@ -85,7 +85,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: if k == "tasks": self._tasks = [] @@ -112,7 +112,7 @@ def __iter__(self): """returns the JSON response in key/value pairs""" if self._json_dict is None: self.__init() - for k,v in self._json_dict.items(): + for k,v in list(self._json_dict.items()): yield [k,v] #---------------------------------------------------------------------- @property @@ -195,7 +195,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, json_dict[k]) else: @@ -424,7 +424,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, json_dict[k]) else: @@ -467,7 +467,7 @@ def _get_json(self, urlpart): def results(self): """ returns the results """ self.__init() - for k,v in self._results.items(): + for k,v in list(self._results.items()): param = self._get_json(v['paramUrl']) if param['dataType'] == "GPFeatureRecordSetLayer": self._results[k] = GPFeatureRecordSetLayer.fromJSON(json.dumps(param)) diff --git a/src/arcrest/ags/_globeservice.py b/src/arcrest/ags/_globeservice.py index ed27e23..d7df20a 100644 --- a/src/arcrest/ags/_globeservice.py +++ b/src/arcrest/ags/_globeservice.py @@ -1,5 +1,5 @@ -from __future__ import absolute_import -from __future__ import print_function + + from .._abstract.abstract import BaseAGSServer import json ######################################################################## @@ -62,7 +62,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, v) else: @@ -80,7 +80,7 @@ def __iter__(self): returns key/value pair """ attributes = json.loads(str(self)) - for att in attributes.items(): + for att in list(attributes.items()): yield (att, getattr(self, att)) #---------------------------------------------------------------------- @property @@ -261,7 +261,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, v) else: diff --git a/src/arcrest/ags/_gpobjects.py b/src/arcrest/ags/_gpobjects.py index 1fe0d6d..fe7ada1 100644 --- a/src/arcrest/ags/_gpobjects.py +++ b/src/arcrest/ags/_gpobjects.py @@ -1,8 +1,8 @@ """ Contains all the geoprocessing objects. """ -from __future__ import absolute_import -from __future__ import print_function + + import json from ..common.general import local_time_to_online from .._abstract.abstract import BaseGPObject diff --git a/src/arcrest/ags/_imageservice.py b/src/arcrest/ags/_imageservice.py index dc7235d..6fba604 100644 --- a/src/arcrest/ags/_imageservice.py +++ b/src/arcrest/ags/_imageservice.py @@ -1,9 +1,9 @@ -from __future__ import absolute_import -from __future__ import print_function + + from .._abstract.abstract import BaseSecurityHandler, BaseAGSServer from ..security import AGSTokenSecurityHandler, PortalServerSecurityHandler from ..common.general import MosaicRuleObject, local_time_to_online -import datetime, urllib +import datetime, urllib.request, urllib.parse, urllib.error import json from ..common import filters ######################################################################## @@ -107,7 +107,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, v) else: @@ -123,7 +123,7 @@ def __iter__(self): """returns the JSON response in key/value pairs""" if self._json_dict is None: self.__init() - for k,v in self._json_dict.items(): + for k,v in list(self._json_dict.items()): yield [k,v] #---------------------------------------------------------------------- @property diff --git a/src/arcrest/ags/_mobileservice.py b/src/arcrest/ags/_mobileservice.py index 5d8e26e..71a8c70 100644 --- a/src/arcrest/ags/_mobileservice.py +++ b/src/arcrest/ags/_mobileservice.py @@ -1,5 +1,5 @@ -from __future__ import absolute_import -from __future__ import print_function + + from .._abstract.abstract import BaseAGSServer import json ######################################################################## @@ -70,7 +70,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, v) else: @@ -87,7 +87,7 @@ def __iter__(self): returns key/value pair """ attributes = json.loads(str(self)) - for att in attributes.keys(): + for att in list(attributes.keys()): yield (att, getattr(self, att)) #---------------------------------------------------------------------- @property @@ -322,7 +322,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, v) else: @@ -339,7 +339,7 @@ def __iter__(self): returns key/value pair """ attributes = json.loads(str(self)) - for att in attributes.keys(): + for att in list(attributes.keys()): yield [att, getattr(self, att)] #---------------------------------------------------------------------- @property diff --git a/src/arcrest/ags/_networkservice.py b/src/arcrest/ags/_networkservice.py index a029f65..d784c7d 100644 --- a/src/arcrest/ags/_networkservice.py +++ b/src/arcrest/ags/_networkservice.py @@ -1,5 +1,5 @@ -from __future__ import absolute_import -from __future__ import print_function + + from .._abstract.abstract import BaseAGSServer import json @@ -59,7 +59,7 @@ def __init(self): if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: if k == "routeLayers" and json_dict[k]: self._routeLayers = [] @@ -106,7 +106,7 @@ def __iter__(self): returns key/value pair """ attributes = json.loads(str(self)) - for att in attributes.keys(): + for att in list(attributes.keys()): yield [att, getattr(self, att)] #---------------------------------------------------------------------- @@ -234,7 +234,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, json_dict[k]) else: @@ -449,7 +449,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, json_dict[k]) else: @@ -849,7 +849,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, json_dict[k]) else: @@ -1267,7 +1267,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, json_dict[k]) else: diff --git a/src/arcrest/ags/_schematicsservice.py b/src/arcrest/ags/_schematicsservice.py index 0607db0..4d4fb90 100644 --- a/src/arcrest/ags/_schematicsservice.py +++ b/src/arcrest/ags/_schematicsservice.py @@ -1,5 +1,5 @@ -from __future__ import absolute_import -from __future__ import print_function + + from .._abstract.abstract import BaseAGSServer import json @@ -51,7 +51,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, v) else: @@ -68,7 +68,7 @@ def __iter__(self): returns key/value pair """ attributes = json.loads(str(self)) - for att in attributes.keys(): + for att in list(attributes.keys()): yield [att, getattr(self, att)] #---------------------------------------------------------------------- @property diff --git a/src/arcrest/ags/_streamservice.py b/src/arcrest/ags/_streamservice.py index 0569f22..e0d9d42 100644 --- a/src/arcrest/ags/_streamservice.py +++ b/src/arcrest/ags/_streamservice.py @@ -1,5 +1,5 @@ -from __future__ import absolute_import -from __future__ import print_function + + from .._abstract.abstract import BaseAGSServer import json @@ -72,7 +72,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, v) else: @@ -89,7 +89,7 @@ def __iter__(self): returns key/value pair """ attributes = json.loads(str(self)) - for att in attributes.keys(): + for att in list(attributes.keys()): yield [att, getattr(self, att)] #---------------------------------------------------------------------- diff --git a/src/arcrest/ags/_uploads.py b/src/arcrest/ags/_uploads.py index 7ce2bb1..a4e5308 100644 --- a/src/arcrest/ags/_uploads.py +++ b/src/arcrest/ags/_uploads.py @@ -1,5 +1,5 @@ -from __future__ import absolute_import -from __future__ import print_function + + from ..packages.six.moves import urllib_parse as urlparse from ..packages.six.moves.urllib.parse import urlencode from .._abstract.abstract import BaseAGSServer @@ -119,7 +119,7 @@ def download(self, itemID, savePath): url = self._url + "/%s/download" % itemID params = { } - if len(params.keys()): + if len(list(params.keys())): url = url + "?%s" % urlencode(params) return self._get(url=url, param_dict=params, diff --git a/src/arcrest/ags/_vectortile.py b/src/arcrest/ags/_vectortile.py index 76b5c08..e231452 100644 --- a/src/arcrest/ags/_vectortile.py +++ b/src/arcrest/ags/_vectortile.py @@ -7,8 +7,8 @@ .. moduleauthor:: Esri """ -from __future__ import absolute_import -from __future__ import print_function + + import tempfile from .._abstract.abstract import BaseAGSServer import json @@ -66,7 +66,7 @@ def init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, v) else: diff --git a/src/arcrest/ags/featureservice.py b/src/arcrest/ags/featureservice.py index 161e831..03f9247 100644 --- a/src/arcrest/ags/featureservice.py +++ b/src/arcrest/ags/featureservice.py @@ -1,8 +1,8 @@ """ Contains information regarding an ArcGIS Server Feature Server """ -from __future__ import absolute_import -from __future__ import print_function + + from re import search from .._abstract.abstract import BaseAGSServer, BaseSecurityHandler from ..security import security @@ -77,7 +77,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, v) else: @@ -144,7 +144,7 @@ def __iter__(self): """returns the JSON response in key/value pairs""" if self._json_dict is None: self.__init() - for k,v in self._json_dict.items(): + for k,v in list(self._json_dict.items()): yield [k,v] #---------------------------------------------------------------------- @property diff --git a/src/arcrest/ags/layer.py b/src/arcrest/ags/layer.py index e5b745a..7c5cea6 100644 --- a/src/arcrest/ags/layer.py +++ b/src/arcrest/ags/layer.py @@ -1,6 +1,6 @@ -from __future__ import absolute_import -from __future__ import print_function -from __future__ import division + + + import os import json import uuid @@ -118,7 +118,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, v) else: @@ -547,7 +547,7 @@ def addFeatures(self, fc, attachmentTable=None, js = js['features'] if lowerCaseFieldNames == True: for feat in js: - feat['attributes'] = dict((k.lower(), v) for k,v in feat['attributes'].items()) + feat['attributes'] = dict((k.lower(), v) for k,v in list(feat['attributes'].items())) if len(js) == 0: return {'addResults':None} if len(js) <= max_chunk: @@ -890,7 +890,7 @@ def query(self, params['maxAllowableOffset'] = maxAllowableOffset if not geometryPrecision is None: params['geometryPrecision'] = geometryPrecision - for k,v in kwargs.items(): + for k,v in list(kwargs.items()): params[k] = v if returnDistinctValues: params["returnGeometry"] = False @@ -1173,7 +1173,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, v) else: diff --git a/src/arcrest/ags/mapservice.py b/src/arcrest/ags/mapservice.py index c19e62e..c4f5e56 100644 --- a/src/arcrest/ags/mapservice.py +++ b/src/arcrest/ags/mapservice.py @@ -1,5 +1,5 @@ -from __future__ import absolute_import -from __future__ import print_function + + import json import time import tempfile @@ -142,7 +142,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k == "tables": self._tables = [] for tbl in v: @@ -198,7 +198,7 @@ def __iter__(self): """returns the JSON response in key/value pairs""" if self._json_dict is None: self.__init() - for k,v in self._json_dict.items(): + for k,v in list(self._json_dict.items()): yield [k,v] #---------------------------------------------------------------------- @property @@ -456,7 +456,7 @@ def allLayers(self): "layers" : [], "tables" : [] } - for k, v in res.items(): + for k, v in list(res.items()): if k == "layers": for val in v: return_dict['layers'].append( @@ -1095,7 +1095,7 @@ def exportTiles(self, time.sleep(5) status = gpJob.jobStatus allResults = gpJob.results - for k,v in allResults.items(): + for k,v in list(allResults.items()): if k == "out_service_url": value = v['value'] params = { diff --git a/src/arcrest/ags/server.py b/src/arcrest/ags/server.py index 0da4363..48298a1 100644 --- a/src/arcrest/ags/server.py +++ b/src/arcrest/ags/server.py @@ -3,8 +3,8 @@ functions. This allows developers to access a REST service just like a user/developer would. """ -from __future__ import absolute_import -from __future__ import print_function + + from . import BaseAGSServer from ..packages.six.moves.urllib_parse import urlparse @@ -84,7 +84,7 @@ def __init(self, folder='root'): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k == "folders": pass elif k in attributes: @@ -96,7 +96,7 @@ def __init(self, folder='root'): securityHandler=self._securityHandler, proxy_port=self._proxy_port, proxy_url=self._proxy_url) - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k == 'folders': v.insert(0, 'root') setattr(self, "_"+ k, v) @@ -134,7 +134,7 @@ def __iter__(self): if self._json_dict is None: self._json_dict = {} self.__init() - for k,v in self._json_dict.items(): + for k,v in list(self._json_dict.items()): yield [k,v] #---------------------------------------------------------------------- @property diff --git a/src/arcrest/ags/services.py b/src/arcrest/ags/services.py index 10f0d93..4bc1fd3 100644 --- a/src/arcrest/ags/services.py +++ b/src/arcrest/ags/services.py @@ -1,8 +1,8 @@ """ Contains information regarding an ArcGIS Server Feature Server """ -from __future__ import absolute_import -from __future__ import print_function + + from re import search from .._abstract.abstract import BaseAGSServer, BaseSecurityHandler from ..security import security @@ -75,7 +75,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, v) else: @@ -142,7 +142,7 @@ def __iter__(self): """returns the JSON response in key/value pairs""" if self._json_dict is None: self.__init() - for k,v in self._json_dict.items(): + for k,v in list(self._json_dict.items()): yield [k,v] #---------------------------------------------------------------------- @property diff --git a/src/arcrest/cmp/__init__.py b/src/arcrest/cmp/__init__.py index 52cba6c..a0610f7 100644 --- a/src/arcrest/cmp/__init__.py +++ b/src/arcrest/cmp/__init__.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from . import community __version__ = "3.5.9" \ No newline at end of file diff --git a/src/arcrest/cmp/community.py b/src/arcrest/cmp/community.py index 30390bb..5005d64 100644 --- a/src/arcrest/cmp/community.py +++ b/src/arcrest/cmp/community.py @@ -1,5 +1,5 @@ -from __future__ import print_function -from __future__ import absolute_import + + import json from ..packages.six.moves.urllib_parse import quote from ..agol import FeatureService @@ -179,7 +179,7 @@ def __iter__(self): """returns properties (key/values) from the JSON response""" if self._json_dict is None: self.__init() - for k,v in self._json_dict.items(): + for k,v in list(self._json_dict.items()): yield [k,v] #---------------------------------------------------------------------- @property @@ -248,7 +248,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, json_dict[k]) else: diff --git a/src/arcrest/common/__init__.py b/src/arcrest/common/__init__.py index 67cebd5..2f4e382 100644 --- a/src/arcrest/common/__init__.py +++ b/src/arcrest/common/__init__.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from . import spatial from . import general from . import geometry diff --git a/src/arcrest/common/domain.py b/src/arcrest/common/domain.py index d357910..888902a 100644 --- a/src/arcrest/common/domain.py +++ b/src/arcrest/common/domain.py @@ -2,8 +2,8 @@ This module contains the JSON domain objects. Domains specify the set of valid values for a field. """ -from __future__ import absolute_import -from __future__ import print_function + + import json ######################################################################## class CodedValueDomain(object): @@ -160,7 +160,7 @@ def minValue(self): @minValue.setter def minValue(self, value): """gets/sets the min value""" - if isinstance(value, [int, float, long]): + if isinstance(value, [int, float, int]): self._rangeMin = value #---------------------------------------------------------------------- @property @@ -171,5 +171,5 @@ def maxValue(self): @maxValue.setter def maxValue(self, value): """gets/sets the min value""" - if isinstance(value, [int, float, long]): + if isinstance(value, [int, float, int]): self._rangeMax = value \ No newline at end of file diff --git a/src/arcrest/common/errorhandlers.py b/src/arcrest/common/errorhandlers.py index 745ceae..4462f80 100644 --- a/src/arcrest/common/errorhandlers.py +++ b/src/arcrest/common/errorhandlers.py @@ -1,8 +1,8 @@ """ contains all error handlers for ArcREST """ -from __future__ import absolute_import -from __future__ import print_function + + MSGS = { 100 : "100: Invalid Inputs", 200 : "200: Error with the GET Operation", diff --git a/src/arcrest/common/filters.py b/src/arcrest/common/filters.py index 8e29f53..d55fb78 100644 --- a/src/arcrest/common/filters.py +++ b/src/arcrest/common/filters.py @@ -1,5 +1,5 @@ -from __future__ import absolute_import -from __future__ import print_function + + import json from ..common.geometry import Polygon, Polyline, Point, MultiPoint from .._abstract.abstract import AbstractGeometry, BaseFilter diff --git a/src/arcrest/common/find.py b/src/arcrest/common/find.py index 947c640..78c30cb 100644 --- a/src/arcrest/common/find.py +++ b/src/arcrest/common/find.py @@ -1,5 +1,5 @@ -from __future__ import absolute_import -from __future__ import print_function + + from ..packages import six from ..web._base import BaseWebOperations _url = None diff --git a/src/arcrest/common/general.py b/src/arcrest/common/general.py index 39b0574..5f3f117 100644 --- a/src/arcrest/common/general.py +++ b/src/arcrest/common/general.py @@ -1,6 +1,6 @@ -from __future__ import absolute_import -from __future__ import print_function -from __future__ import division + + + import datetime import time import json @@ -29,7 +29,7 @@ def create_uid(): def _unicode_convert(obj): """ converts unicode to anscii """ if isinstance(obj, dict): - return {_unicode_convert(key): _unicode_convert(value) for key, value in obj.items()} + return {_unicode_convert(key): _unicode_convert(value) for key, value in list(obj.items())} elif isinstance(obj, list): return [_unicode_convert(element) for element in obj] elif isinstance(obj, str): @@ -144,7 +144,7 @@ def set_value(self, field_name, value): if isinstance(value, dict): if 'geometry' in value: self._dict['geometry'] = value['geometry'] - elif any(k in value.keys() for k in ['x','y','points','paths','rings', 'spatialReference']): + elif any(k in list(value.keys()) for k in ['x','y','points','paths','rings', 'spatialReference']): self._dict['geometry'] = value elif isinstance(value, AbstractGeometry): self._dict['geometry'] = value.asDictionary @@ -191,7 +191,7 @@ def asRow(self): """ fields = self.fields row = [""] * len(fields) - for k,v in self._attributes.items(): + for k,v in list(self._attributes.items()): row[fields.index(k)] = v del v del k @@ -231,7 +231,7 @@ def fields(self): self._attributes = self._dict['feature']['attributes'] else: self._attributes = self._dict['attributes'] - return self._attributes.keys() + return list(self._attributes.keys()) #---------------------------------------------------------------------- @property def geometryType(self): @@ -267,7 +267,7 @@ def fc_to_features(dataset): if row[fields.index(df)] != None: row[fields.index(df)] = int((_date_handler(row[fields.index(df)]))) template = { - "attributes" : dict(zip(non_geom_fields, row)) + "attributes" : dict(list(zip(non_geom_fields, row))) } if "SHAPE@JSON" in fields: template['geometry'] = \ diff --git a/src/arcrest/common/geometry.py b/src/arcrest/common/geometry.py index 1a23b6d..719c201 100644 --- a/src/arcrest/common/geometry.py +++ b/src/arcrest/common/geometry.py @@ -1,5 +1,5 @@ -from __future__ import absolute_import -from __future__ import print_function + + import json try: import arcpy @@ -165,8 +165,7 @@ def X(self): @X.setter def X(self, value): """sets the X coordinate""" - if isinstance(value, (int, float, - long, types.NoneType)): + if isinstance(value, (int, float, type(None))): self._x = value #---------------------------------------------------------------------- @property @@ -177,8 +176,7 @@ def Y(self): @Y.setter def Y(self, value): """ sets the Y coordinate """ - if isinstance(value, (int, float, - long, types.NoneType)): + if isinstance(value, (int, float, type(None))): self._y = value #---------------------------------------------------------------------- @property @@ -189,8 +187,7 @@ def Z(self): @Z.setter def Z(self, value): """ sets the Z coordinate """ - if isinstance(value, (int, float, - long, types.NoneType)): + if isinstance(value, (int, float, type(None))): self._z = value #---------------------------------------------------------------------- @property @@ -201,8 +198,7 @@ def wkid(self): @wkid.setter def wkid(self, value): """ sets the wkid """ - if isinstance(value, (int, - long)): + if isinstance(value, int): self._wkid = value #---------------------------------------------------------------------- @property diff --git a/src/arcrest/common/renderer.py b/src/arcrest/common/renderer.py index 1c59b29..95e81f2 100644 --- a/src/arcrest/common/renderer.py +++ b/src/arcrest/common/renderer.py @@ -1,5 +1,5 @@ -from __future__ import absolute_import -from __future__ import print_function + + import json ######################################################################## class BaseRenderer(object): diff --git a/src/arcrest/common/servicedef.py b/src/arcrest/common/servicedef.py index d38f1bb..bf75d07 100644 --- a/src/arcrest/common/servicedef.py +++ b/src/arcrest/common/servicedef.py @@ -1,5 +1,5 @@ -from __future__ import absolute_import -from __future__ import print_function + + from ..packages import six import os diff --git a/src/arcrest/common/spatial.py b/src/arcrest/common/spatial.py index 4dbcf16..aac3a24 100644 --- a/src/arcrest/common/spatial.py +++ b/src/arcrest/common/spatial.py @@ -1,9 +1,9 @@ """ Contains all the spatial functions """ -from __future__ import absolute_import -from __future__ import print_function -from __future__ import division + + + import os, datetime try: import arcpy @@ -286,7 +286,7 @@ def _unicode_convert(obj): if isinstance(obj, dict): return {_unicode_convert(key): \ _unicode_convert(value) \ - for key, value in obj.items()} + for key, value in list(obj.items())} elif isinstance(obj, list): return [_unicode_convert(element) for element in obj] elif isinstance(obj, str): diff --git a/src/arcrest/common/symbology.py b/src/arcrest/common/symbology.py index 955768d..db86e42 100644 --- a/src/arcrest/common/symbology.py +++ b/src/arcrest/common/symbology.py @@ -1,5 +1,5 @@ -from __future__ import absolute_import -from __future__ import print_function + + import json class BaseSymbol(object): @@ -74,7 +74,7 @@ def angle(self): def angle(self, value): """gets/sets the angle""" if self._angle != value and \ - isinstance(value, (int, float, long)): + isinstance(value, (int, float)): self._angle = value #---------------------------------------------------------------------- @property @@ -98,7 +98,7 @@ def size(self): def size(self, value): """gets/sets the size""" if self._size != value and \ - isinstance(value, (int, float, long)): + isinstance(value, (int, float)): self._size = value #---------------------------------------------------------------------- @property @@ -110,7 +110,7 @@ def xoffset(self): def xoffset(self, value): """gets/sets the xoffset""" if self._xoffset != value and \ - isinstance(value, (int, float, long)): + isinstance(value, (int, float)): self._xoffset = value #---------------------------------------------------------------------- @property @@ -122,7 +122,7 @@ def yoffset(self): def yoffset(self, value): """gets/sets the yoffset""" if self._yoffset != value and \ - isinstance(value, (int, float, long)): + isinstance(value, (int, float)): self._yoffset = value #---------------------------------------------------------------------- @property @@ -135,7 +135,7 @@ def outlineWidth(self): @outlineWidth.setter def outlineWidth(self, value): """gets/sets the outlineWidth""" - if isinstance(value, (int, float, long)) and \ + if isinstance(value, (int, float)) and \ not self._outline is None: self._outline['width'] = value #---------------------------------------------------------------------- @@ -229,7 +229,7 @@ def width(self): def width(self, value): """gets/sets the width""" if self._width != value and \ - isinstance(value, (int, float, long)): + isinstance(value, (int, float)): self._width = value def __str__(self): diff --git a/src/arcrest/enrichment/__init__.py b/src/arcrest/enrichment/__init__.py index b2a2850..3e41336 100644 --- a/src/arcrest/enrichment/__init__.py +++ b/src/arcrest/enrichment/__init__.py @@ -22,6 +22,6 @@ and the demographics and other relevant characteristics associated with the area around the site will be returned. """ -from __future__ import absolute_import + from ._geoenrichment import GeoEnrichment __version__ = "3.5.9" \ No newline at end of file diff --git a/src/arcrest/enrichment/_geoenrichment.py b/src/arcrest/enrichment/_geoenrichment.py index cfd6ad6..301122e 100644 --- a/src/arcrest/enrichment/_geoenrichment.py +++ b/src/arcrest/enrichment/_geoenrichment.py @@ -1,5 +1,5 @@ -from __future__ import absolute_import -from __future__ import print_function + + from ..common.geometry import Point, Polygon, Envelope, SpatialReference from .._abstract.abstract import BaseGeoEnrichment from ..manageorg import Administration diff --git a/src/arcrest/geometryservice/__init__.py b/src/arcrest/geometryservice/__init__.py index 2b93796..569befd 100644 --- a/src/arcrest/geometryservice/__init__.py +++ b/src/arcrest/geometryservice/__init__.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from .geometryservice import GeometryService __version__ = "3.5.9" \ No newline at end of file diff --git a/src/arcrest/geometryservice/geometryservice.py b/src/arcrest/geometryservice/geometryservice.py index 32d7573..0b77fe8 100644 --- a/src/arcrest/geometryservice/geometryservice.py +++ b/src/arcrest/geometryservice/geometryservice.py @@ -1,5 +1,5 @@ -from __future__ import absolute_import -from __future__ import print_function + + from .._abstract import abstract from ..common.geometry import Point, Polyline, Polygon, MultiPoint, Envelope import json @@ -39,7 +39,7 @@ def __init(self): proxy_port=self._proxy_port) self._json_dict = res self._json_string = json.dumps(self._json_dict) - for k,v in self._json_dict.items(): + for k,v in list(self._json_dict.items()): setattr(self, k, v) #---------------------------------------------------------------------- def __str__(self): @@ -52,7 +52,7 @@ def __iter__(self): """returns the JSON response in key/value pairs""" if self._json_dict is None: self.__init() - for k,v in self._json_dict.items(): + for k,v in list(self._json_dict.items()): yield [k,v] #---------------------------------------------------------------------- def areasAndLengths(self, diff --git a/src/arcrest/hostedservice/__init__.py b/src/arcrest/hostedservice/__init__.py index a90318e..5dea2fb 100644 --- a/src/arcrest/hostedservice/__init__.py +++ b/src/arcrest/hostedservice/__init__.py @@ -1,3 +1,3 @@ -from __future__ import absolute_import + from .service import AdminFeatureService, AdminFeatureServiceLayer, AdminMapService, Services __version__ = "3.5.9" \ No newline at end of file diff --git a/src/arcrest/hostedservice/service.py b/src/arcrest/hostedservice/service.py index db208e9..b659193 100644 --- a/src/arcrest/hostedservice/service.py +++ b/src/arcrest/hostedservice/service.py @@ -73,11 +73,11 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, json_dict[k]) else: - print( k, " - attribute not implemented in hostedservice.Services.") + print(( k, " - attribute not implemented in hostedservice.Services.")) del k, v #---------------------------------------------------------------------- @property @@ -153,7 +153,7 @@ def services(self): securityHandler=self._securityHandler, proxy_port=self._proxy_port, proxy_url=self._proxy_url) - for k, v in res.items(): + for k, v in list(res.items()): if k == "foldersDetail": for item in v: if 'isDefault' in item and item['isDefault'] == False: @@ -162,7 +162,7 @@ def services(self): securityHandler=self._securityHandler, proxy_port=self._proxy_port, proxy_url=self._proxy_url) - for k1, v1 in resFolder.items(): + for k1, v1 in list(resFolder.items()): if k1 == "services": self._checkservice(k1,v1,fURL) elif k == "services": @@ -295,21 +295,21 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k == "url": self._urlService = v elif k in attributes: setattr(self, "_"+ k, json_dict[k]) else: - print( k, " - attribute not implemented. Please log an support request.") + print(( k, " - attribute not implemented. Please log an support request.")) del k, v #---------------------------------------------------------------------- def __iter__(self): """returns the key/value pair of the raw JSON""" if self._json_dict is None: self.__init() - for k,v in self._json_dict.items(): + for k,v in list(self._json_dict.items()): yield [k,v] #---------------------------------------------------------------------- def __str__(self): @@ -729,7 +729,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k == "layers": self._layers = [] for lyr in v: @@ -755,7 +755,7 @@ def __init(self): elif k in attributes: setattr(self, "_"+ k, json_dict[k]) else: - print( k, " - attribute not implemented in AdminFeatureService.") + print(( k, " - attribute not implemented in AdminFeatureService.")) #---------------------------------------------------------------------- @property def supportsApplyEditsWithGlobalIds(self): @@ -803,7 +803,7 @@ def __iter__(self): """returns the key/value pair of the raw JSON""" if self._json_dict is None: self.__init() - for k,v in self._json_dict.items(): + for k,v in list(self._json_dict.items()): yield [k,v] #---------------------------------------------------------------------- @@ -1098,11 +1098,11 @@ def updateDefinition(self, json_dict): if 'allowOthersToQuery' in json_dict['editorTrackingInfo']: definition['editorTrackingInfo']['allowOthersToQuery'] = json_dict['editorTrackingInfo']['allowOthersToQuery'] if isinstance(json_dict['editorTrackingInfo'],dict): - for k,v in json_dict['editorTrackingInfo'].items(): + for k,v in list(json_dict['editorTrackingInfo'].items()): if k not in definition['editorTrackingInfo']: definition['editorTrackingInfo'][k] = v if isinstance(json_dict,dict): - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k not in definition: definition[k] = v @@ -1326,7 +1326,7 @@ def __iter__(self): """returns the key/value pair of the raw JSON""" if self._json_dict is None: self.__init() - for k,v in self._json_dict.items(): + for k,v in list(self._json_dict.items()): yield [k,v] #---------------------------------------------------------------------- @property @@ -1370,11 +1370,11 @@ def loadAttributes(self,json_dict): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, json_dict[k]) else: - print( k, " - attribute not implemented AdminFeatureServiceLayer.") + print(( k, " - attribute not implemented AdminFeatureServiceLayer.")) del k, v #---------------------------------------------------------------------- def refresh(self): diff --git a/src/arcrest/manageags/__init__.py b/src/arcrest/manageags/__init__.py index 1f228cf..9e1b455 100644 --- a/src/arcrest/manageags/__init__.py +++ b/src/arcrest/manageags/__init__.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from .administration import AGSAdministration from .parameters import ClusterProtocol, Extension diff --git a/src/arcrest/manageags/_clusters.py b/src/arcrest/manageags/_clusters.py index 76e77da..fdeff24 100644 --- a/src/arcrest/manageags/_clusters.py +++ b/src/arcrest/manageags/_clusters.py @@ -1,5 +1,5 @@ -from __future__ import absolute_import -from __future__ import print_function + + from .._abstract.abstract import BaseAGSServer import json from .parameters import ClusterProtocol @@ -52,7 +52,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, json_dict[k]) else: @@ -166,7 +166,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, json_dict[k]) else: diff --git a/src/arcrest/manageags/_data.py b/src/arcrest/manageags/_data.py index 1eb92ad..5967e44 100644 --- a/src/arcrest/manageags/_data.py +++ b/src/arcrest/manageags/_data.py @@ -1,5 +1,5 @@ -from __future__ import absolute_import -from __future__ import print_function + + from .._abstract.abstract import BaseAGSServer ######################################################################## class Data(BaseAGSServer): diff --git a/src/arcrest/manageags/_info.py b/src/arcrest/manageags/_info.py index 4ffb2e3..d3cd792 100644 --- a/src/arcrest/manageags/_info.py +++ b/src/arcrest/manageags/_info.py @@ -1,5 +1,5 @@ -from __future__ import absolute_import -from __future__ import print_function + + import json from .._abstract.abstract import BaseAGSServer @@ -50,7 +50,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, json_dict[k]) else: diff --git a/src/arcrest/manageags/_kml.py b/src/arcrest/manageags/_kml.py index fd7cb72..c5690e4 100644 --- a/src/arcrest/manageags/_kml.py +++ b/src/arcrest/manageags/_kml.py @@ -1,5 +1,5 @@ -from __future__ import absolute_import -from __future__ import print_function + + from .._abstract.abstract import BaseAGSServer ######################################################################## @@ -40,7 +40,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, json_dict[k]) else: diff --git a/src/arcrest/manageags/_logs.py b/src/arcrest/manageags/_logs.py index bc9b535..345b82e 100644 --- a/src/arcrest/manageags/_logs.py +++ b/src/arcrest/manageags/_logs.py @@ -1,5 +1,5 @@ -from __future__ import absolute_import -from __future__ import print_function + + from .._abstract.abstract import BaseAGSServer from datetime import datetime import csv, json @@ -44,7 +44,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, json_dict[k]) else: @@ -217,9 +217,9 @@ def query(self, csvwriter = csv.writer(f) for message in messages['logMessages']: if hasKeys == False: - csvwriter.writerow(message.keys()) + csvwriter.writerow(list(message.keys())) hasKeys = True - csvwriter.writerow(message.values()) + csvwriter.writerow(list(message.values())) del message del messages return out_path diff --git a/src/arcrest/manageags/_machines.py b/src/arcrest/manageags/_machines.py index 9b09698..8d926ae 100644 --- a/src/arcrest/manageags/_machines.py +++ b/src/arcrest/manageags/_machines.py @@ -1,5 +1,5 @@ -from __future__ import absolute_import -from __future__ import print_function + + from .._abstract.abstract import BaseAGSServer import json ######################################################################## @@ -56,7 +56,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k == "machines": self._machines = [] for m in v: @@ -235,7 +235,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, json_dict[k]) else: diff --git a/src/arcrest/manageags/_mode.py b/src/arcrest/manageags/_mode.py index ae057b8..4272038 100644 --- a/src/arcrest/manageags/_mode.py +++ b/src/arcrest/manageags/_mode.py @@ -1,5 +1,5 @@ -from __future__ import absolute_import -from __future__ import print_function + + from .._abstract.abstract import BaseAGSServer import json @@ -50,7 +50,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, json_dict[k]) else: diff --git a/src/arcrest/manageags/_security.py b/src/arcrest/manageags/_security.py index e2fbdb8..67b5534 100644 --- a/src/arcrest/manageags/_security.py +++ b/src/arcrest/manageags/_security.py @@ -1,5 +1,5 @@ -from __future__ import absolute_import -from __future__ import print_function + + from .._abstract.abstract import BaseAGSServer import json ######################################################################## @@ -49,7 +49,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, json_dict[k]) else: diff --git a/src/arcrest/manageags/_services.py b/src/arcrest/manageags/_services.py index 254176a..1d9ffa3 100644 --- a/src/arcrest/manageags/_services.py +++ b/src/arcrest/manageags/_services.py @@ -1,5 +1,5 @@ -from __future__ import absolute_import -from __future__ import print_function + + from .._abstract.abstract import BaseAGSServer from ..packages.six.moves.urllib_parse import urlparse from .parameters import Extension @@ -57,7 +57,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, json_dict[k]) else: @@ -147,7 +147,7 @@ def services(self): securityHandler=self._securityHandler, proxy_url=self._proxy_url, proxy_port=self._proxy_port) - if "services" in json_dict.keys(): + if "services" in list(json_dict.keys()): for s in json_dict['services']: uURL = self._currentURL + "/%s.%s" % (s['serviceName'], s['type']) self._services.append( @@ -627,7 +627,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k.lower() == "extensions": self._extensions = [] for ext in v: @@ -686,7 +686,7 @@ def __iter__(self): """class iterator which yields a key/value pair""" if self._json_dict is None: self.__init() - for k,v in self._json_dict.items(): + for k,v in list(self._json_dict.items()): yield (k,v) #---------------------------------------------------------------------- def jsonProperties(self): diff --git a/src/arcrest/manageags/_system.py b/src/arcrest/manageags/_system.py index 62d8175..fa555a4 100644 --- a/src/arcrest/manageags/_system.py +++ b/src/arcrest/manageags/_system.py @@ -1,5 +1,5 @@ -from __future__ import absolute_import -from __future__ import print_function + + from .._abstract.abstract import BaseAGSServer import json ######################################################################## @@ -46,7 +46,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, json_dict[k]) else: @@ -514,7 +514,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k == "class": self._class = v elif k in attributes: @@ -671,7 +671,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, json_dict[k]) else: @@ -832,7 +832,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, json_dict[k]) else: @@ -926,7 +926,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, json_dict[k]) else: diff --git a/src/arcrest/manageags/_uploads.py b/src/arcrest/manageags/_uploads.py index 0ee7539..23619cc 100644 --- a/src/arcrest/manageags/_uploads.py +++ b/src/arcrest/manageags/_uploads.py @@ -1,5 +1,5 @@ -from __future__ import absolute_import -from __future__ import print_function + + from .._abstract.abstract import BaseAGSServer import os ######################################################################## @@ -93,7 +93,7 @@ def uploadItem(self, filePath, description): filePath - the file to be uploaded. description - optional description for the uploaded item. """ - import urlparse + import urllib.parse url = self._url + "/upload" params = { "f" : "json" diff --git a/src/arcrest/manageags/_usagereports.py b/src/arcrest/manageags/_usagereports.py index b984ffe..73bf11b 100644 --- a/src/arcrest/manageags/_usagereports.py +++ b/src/arcrest/manageags/_usagereports.py @@ -1,5 +1,5 @@ -from __future__ import absolute_import -from __future__ import print_function + + from ..packages import six from .._abstract.abstract import BaseAGSServer import json @@ -47,7 +47,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, json_dict[k]) else: @@ -319,7 +319,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k.lower() == "from": self._from = v elif k.lower() == "to": diff --git a/src/arcrest/manageags/administration.py b/src/arcrest/manageags/administration.py index ce346fc..edffd41 100644 --- a/src/arcrest/manageags/administration.py +++ b/src/arcrest/manageags/administration.py @@ -3,8 +3,8 @@ through the Administration REST API """ -from __future__ import absolute_import -from __future__ import print_function + + from .._abstract.abstract import BaseAGSServer from ..security import OAuthSecurityHandler, NTLMSecurityHandler, PKISecurityHandler, \ @@ -92,7 +92,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, json_dict[k]) else: diff --git a/src/arcrest/manageorg/__init__.py b/src/arcrest/manageorg/__init__.py index 40d9e17..6e1290d 100644 --- a/src/arcrest/manageorg/__init__.py +++ b/src/arcrest/manageorg/__init__.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from .administration import Administration from ._parameters import * diff --git a/src/arcrest/manageorg/_community.py b/src/arcrest/manageorg/_community.py index 787130b..41d1f41 100644 --- a/src/arcrest/manageorg/_community.py +++ b/src/arcrest/manageorg/_community.py @@ -1,5 +1,5 @@ -from __future__ import absolute_import -from __future__ import print_function + + from ..packages.six.moves import urllib_parse as urlparse from .._abstract.abstract import BaseAGOLClass @@ -37,7 +37,7 @@ def __str__(self): #---------------------------------------------------------------------- def __iter__(self): """returns the key/values of an object""" - for k,v in {}.items(): + for k,v in list({}.items()): yield k,v #---------------------------------------------------------------------- def checkUserName(self, username): @@ -131,7 +131,7 @@ def getGroupIDs(self, groupNames,communityInfo=None): communityInfo = self.communitySelf if isinstance(groupNames,list): - groupNames = map(str.upper, groupNames) + groupNames = list(map(str.upper, groupNames)) else: groupNames = groupNames.upper() if 'groups' in communityInfo: @@ -488,7 +488,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, json_dict[k]) else: @@ -504,7 +504,7 @@ def __iter__(self): """returns properties (key/values) from the JSON response""" if self._json_dict is None: self.__init() - for k,v in self._json_dict.items(): + for k,v in list(self._json_dict.items()): yield [k,v] #---------------------------------------------------------------------- @property @@ -993,7 +993,7 @@ def applications(self): proxy_url=self._proxy_url, proxy_port=self._proxy_port) items = [] - if "applications" in res.keys(): + if "applications" in list(res.keys()): for apps in res['applications']: items.append( self.Application(url="%s/%s" % (self._url, apps['username']), @@ -1043,7 +1043,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, json_dict[k]) else: @@ -1085,7 +1085,7 @@ def __iter__(self): """returns JSON as [key,value] objects""" if self._json_dict is None: self.__init() - for k,v in self._json_dict.items(): + for k,v in list(self._json_dict.items()): yield [k,v] #---------------------------------------------------------------------- def accept(self): @@ -1319,7 +1319,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, json_dict[k]) else: @@ -1341,7 +1341,7 @@ def __iter__(self): if self._json_dict is None: self._json_dict = {} self.__init() - for k,v in self._json_dict.items(): + for k,v in list(self._json_dict.items()): yield [k,v] #---------------------------------------------------------------------- @property @@ -1725,7 +1725,7 @@ def expirePassword(self, expiration = 0 else: expiration = -1 - elif isinstance(expiration, (int, long)): + elif isinstance(expiration, int): dt = datetime.now() + timedelta(hours=hours) expiration = local_time_to_online(dt=dt) else: @@ -1969,7 +1969,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, json_dict[k]) else: @@ -1990,7 +1990,7 @@ def __iter__(self): """returns JSON as [key,value] objects""" if self._json_dict is None: self.__init() - for k,v in self._json_dict.items(): + for k,v in list(self._json_dict.items()): yield [k,v] #---------------------------------------------------------------------- @property @@ -2141,7 +2141,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, json_dict[k]) else: @@ -2162,7 +2162,7 @@ def __iter__(self): """returns JSON as [key,value] objects""" if self._json_dict is None: self.__init() - for k,v in self._json_dict.items(): + for k,v in list(self._json_dict.items()): yield [k,v] #---------------------------------------------------------------------- @property @@ -2238,7 +2238,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, json_dict[k]) else: @@ -2306,7 +2306,7 @@ def __iter__(self): """returns JSON as [key,value] objects""" if self._json_dict is None: self.__init() - for k,v in self._json_dict.items(): + for k,v in list(self._json_dict.items()): yield [k,v] #---------------------------------------------------------------------- def delete(self): @@ -2350,7 +2350,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, json_dict[k]) else: @@ -2371,7 +2371,7 @@ def __iter__(self): """returns JSON as [key,value] objects""" if self._json_dict is None: self.__init() - for k,v in self._json_dict.items(): + for k,v in list(self._json_dict.items()): yield [k,v] #---------------------------------------------------------------------- @property diff --git a/src/arcrest/manageorg/_content.py b/src/arcrest/manageorg/_content.py index 5b4d36f..c826611 100644 --- a/src/arcrest/manageorg/_content.py +++ b/src/arcrest/manageorg/_content.py @@ -1,5 +1,5 @@ -from __future__ import absolute_import -from __future__ import print_function + + from ..packages import six from ..packages.six.moves import urllib_parse as urlparse from ..security import OAuthSecurityHandler, AGOLTokenSecurityHandler, PortalTokenSecurityHandler @@ -50,7 +50,7 @@ def __str__(self): def __iter__(self): """iterates over raw json and returns [key, values]""" a = {} - for k,v in a.items(): + for k,v in list(a.items()): yield [k,v] #---------------------------------------------------------------------- @property @@ -280,7 +280,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, json_dict[k]) else: @@ -694,7 +694,7 @@ def __iter__(self): """returns properties (key/values) from the JSON response""" if self._json_dict is None: self.__init() - for k,v in self._json_dict.items(): + for k,v in list(self._json_dict.items()): yield [k,v] #---------------------------------------------------------------------- @property @@ -1133,9 +1133,9 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k == "item": - for key,value in v.items(): + for key,value in list(v.items()): if key in attributes: setattr(self, "_" + key, value) else: @@ -1506,7 +1506,7 @@ def __iter__(self): """returns properties (key/values) from the JSON response""" if self._json_dict is None: self.__init() - for k,v in self._json_dict.items(): + for k,v in list(self._json_dict.items()): yield [k,v] #---------------------------------------------------------------------- def deleteItem(self): @@ -1846,7 +1846,7 @@ def commit(self, wait=False, additionalParams={}): params = { "f" : "json", } - for key, value in additionalParams.items(): + for key, value in list(additionalParams.items()): params[key] = value if wait == True: res = self._post(url=url, @@ -2034,7 +2034,7 @@ def __init(self, folder='/'): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in result_template.items(): + for k,v in list(result_template.items()): if k in attributes: setattr(self, "_"+ k, result_template[k]) else: @@ -2255,7 +2255,7 @@ def __iter__(self): """returns properties (key/values) from the JSON response""" if self._json_dict is None: self.__init() - for k,v in self._json_dict.items(): + for k,v in list(self._json_dict.items()): yield [k,v] #---------------------------------------------------------------------- def refresh(self): @@ -2731,8 +2731,8 @@ def _addItemMultiPart(self, 'filename': os.path.basename(filePath), 'type': itemParameters.type, 'f': 'json'} - for k,v in itemParameters.value.items(): - if k not in data.keys(): + for k,v in list(itemParameters.value.items()): + if k not in list(data.keys()): if isinstance(v, bool): data[k] = json.dumps(v) else: @@ -2800,7 +2800,7 @@ def addItem(self, } res = "" if itemParameters is not None: - for k,v in itemParameters.value.items(): + for k,v in list(itemParameters.value.items()): if isinstance(v, bool): params[k] = json.dumps(v) else: @@ -3093,7 +3093,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, json_dict[k]) else: @@ -3119,7 +3119,7 @@ def __iter__(self): """returns properties (key/values) from the JSON response""" if self._json_dict is None: self.__init() - for k,v in self._json_dict.items(): + for k,v in list(self._json_dict.items()): yield [k,v] #---------------------------------------------------------------------- def refresh(self): diff --git a/src/arcrest/manageorg/_content_constants.py b/src/arcrest/manageorg/_content_constants.py index 892aa0b..cc8e62c 100644 --- a/src/arcrest/manageorg/_content_constants.py +++ b/src/arcrest/manageorg/_content_constants.py @@ -3,8 +3,8 @@ tasks related to moving, updating or managing one's content on Portal or ArcGIS Online. """ -from __future__ import absolute_import -from __future__ import print_function + + URL_BASED_ITEM_TYPES = ('Feature Service', 'Map Service', 'Image Service', 'Web Mapping Application','WMS','WMTS', 'Geodata Service', 'Globe Service','Geometry Service', 'Geocoding Service', diff --git a/src/arcrest/manageorg/_marketplace.py b/src/arcrest/manageorg/_marketplace.py index 30fd9a7..f4e17c9 100644 --- a/src/arcrest/manageorg/_marketplace.py +++ b/src/arcrest/manageorg/_marketplace.py @@ -2,5 +2,4 @@ Module that controls marketplace functions TODO """ -from __future__ import absolute_import -from __future__ import print_function \ No newline at end of file + diff --git a/src/arcrest/manageorg/_oauth2.py b/src/arcrest/manageorg/_oauth2.py index 2182dfe..3c9e21b 100644 --- a/src/arcrest/manageorg/_oauth2.py +++ b/src/arcrest/manageorg/_oauth2.py @@ -1,5 +1,5 @@ -from __future__ import absolute_import -from __future__ import print_function + + from .._abstract.abstract import BaseAGOLClass ######################################################################## diff --git a/src/arcrest/manageorg/_parameters.py b/src/arcrest/manageorg/_parameters.py index beccda7..d41cd24 100644 --- a/src/arcrest/manageorg/_parameters.py +++ b/src/arcrest/manageorg/_parameters.py @@ -1,5 +1,5 @@ -from __future__ import absolute_import -from __future__ import print_function + + from .._abstract.abstract import BaseParameters from ..common.geometry import SpatialReference, Envelope import os @@ -435,7 +435,7 @@ def fromDictionary(value): """creates the portal properties object from a dictionary""" if isinstance(value, dict): pp = PortalParameters() - for k,v in value.items(): + for k,v in list(value.items()): setattr(pp, "_%s" % k, v) return pp else: diff --git a/src/arcrest/manageorg/_portals.py b/src/arcrest/manageorg/_portals.py index deb2423..438fd8b 100644 --- a/src/arcrest/manageorg/_portals.py +++ b/src/arcrest/manageorg/_portals.py @@ -1,6 +1,6 @@ -from __future__ import absolute_import -from __future__ import print_function -from __future__ import division + + + from ..security import PortalServerSecurityHandler from ..manageags import AGSAdministration from ..hostedservice import Services @@ -238,7 +238,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, json_dict[k]) else: @@ -397,7 +397,7 @@ def __iter__(self): """iterates through raw JSON""" if self._json_dict is None: self.__init() - for k,v in self._json_dict.items(): + for k,v in list(self._json_dict.items()): yield [k,v] #---------------------------------------------------------------------- @property @@ -1135,7 +1135,7 @@ def update(self, if isinstance(updatePortalParameters, parameters.PortalParameters): params.update(updatePortalParameters.value) elif isinstance(updatePortalParameters, dict): - for k,v in updatePortalParameters.items(): + for k,v in list(updatePortalParameters.items()): params[k] = v else: raise AttributeError("updatePortalParameters must be of type parameter.PortalParameters") @@ -1642,7 +1642,7 @@ def usage(self, startTime, endTime, vars=None, period=None, 'hostOrgId' : hostOrgId, } - params = {key:item for key,item in params.items() if item is not None} + params = {key:item for key,item in list(params.items()) if item is not None} return self._post(url=url, param_dict=params, securityHandler=self._securityHandler, @@ -1724,7 +1724,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, json_dict[k]) else: @@ -1740,7 +1740,7 @@ def __iter__(self): """iterates through raw JSON""" if self._json_dict is None: self.__init() - for k,v in self._json_dict.items(): + for k,v in list(self._json_dict.items()): yield [k,v] #---------------------------------------------------------------------- @property @@ -1892,7 +1892,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, json_dict[k]) else: @@ -1908,7 +1908,7 @@ def __iter__(self): """iterates through raw JSON""" if self._json_dict is None: self.__init() - for k,v in self._json_dict.items(): + for k,v in list(self._json_dict.items()): yield [k,v] #---------------------------------------------------------------------- @property @@ -1977,7 +1977,7 @@ def servers(self): """gets all the server resources""" self.__init() items = [] - for k,v in self._json_dict.items(): + for k,v in list(self._json_dict.items()): if k == "servers": for s in v: if 'id' in s: diff --git a/src/arcrest/manageorg/administration.py b/src/arcrest/manageorg/administration.py index 1d24b6d..3b6e25c 100644 --- a/src/arcrest/manageorg/administration.py +++ b/src/arcrest/manageorg/administration.py @@ -1,8 +1,8 @@ """ Manages Portal/AGOL content, users, items, etc.. """ -from __future__ import absolute_import -from __future__ import print_function + + from ..security import PortalServerSecurityHandler from .._abstract.abstract import BaseAGOLClass import json @@ -79,7 +79,7 @@ def __init(self, url=None): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, json_dict[k]) else: @@ -101,7 +101,7 @@ def __str__(self): #---------------------------------------------------------------------- def __iter__(self): """iterates over raw json and returns the values""" - for k,v in self._json_dict.items(): + for k,v in list(self._json_dict.items()): yield k,v #---------------------------------------------------------------------- @property diff --git a/src/arcrest/manageportal/__init__.py b/src/arcrest/manageportal/__init__.py index e213290..24c5a53 100644 --- a/src/arcrest/manageportal/__init__.py +++ b/src/arcrest/manageportal/__init__.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from .administration import PortalAdministration, _log, _Security, _System __version__ = "3.5.9" \ No newline at end of file diff --git a/src/arcrest/manageportal/administration.py b/src/arcrest/manageportal/administration.py index 08932e1..3b5e955 100644 --- a/src/arcrest/manageportal/administration.py +++ b/src/arcrest/manageportal/administration.py @@ -6,8 +6,8 @@ resources and update their information or state. Resources and operations are hierarchical and have unique universal resource locators (URLs). """ -from __future__ import absolute_import -from __future__ import print_function + + import json import tempfile from datetime import datetime @@ -48,7 +48,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, json_dict[k]) else: @@ -173,7 +173,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, json_dict[k]) else: @@ -278,7 +278,7 @@ def query(self, logLevel="WARNING", source="ALL", filter_value['users'] = users.split(',') if messageCount is None: params['pageSize'] = 1000 - elif isinstance(messageCount, (int, long, float)): + elif isinstance(messageCount, (int, float)): params['pageSize'] = int(messageCount) else: params['pageSize'] = 1000 @@ -348,7 +348,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, json_dict[k]) else: @@ -1631,7 +1631,7 @@ def __init(self): attributes = [attr for attr in dir(self) if not attr.startswith('__') and \ not attr.startswith('_')] - for k,v in json_dict.items(): + for k,v in list(json_dict.items()): if k in attributes: setattr(self, "_"+ k, json_dict[k]) else: @@ -1648,7 +1648,7 @@ def __iter__(self): """returns the raw key/values for the object""" if self._json_dict is None: self.__init() - for k,v in self._json_dict.items(): + for k,v in list(self._json_dict.items()): yield [k,v] #---------------------------------------------------------------------- @property diff --git a/src/arcrest/opendata/__init__.py b/src/arcrest/opendata/__init__.py index eefb92c..70d20c5 100644 --- a/src/arcrest/opendata/__init__.py +++ b/src/arcrest/opendata/__init__.py @@ -1,6 +1,6 @@ """ initializer code. """ -from __future__ import absolute_import + from .opendata import OpenDataItem, OpenData from ._web import WebOperations \ No newline at end of file diff --git a/src/arcrest/opendata/_web.py b/src/arcrest/opendata/_web.py index bf25abf..9248245 100644 --- a/src/arcrest/opendata/_web.py +++ b/src/arcrest/opendata/_web.py @@ -4,8 +4,8 @@ """ #from __future__ import absolute_import -from __future__ import print_function -from __future__ import absolute_import + + import io import os import re @@ -19,7 +19,7 @@ import email.generator from io import BytesIO try: - from cStringIO import StringIO + from io import StringIO except: from io import StringIO @@ -56,13 +56,13 @@ def __init__(self, param_dict={}, files={}): if len(param_dict) == 0: self.form_fields = [] else: - for k,v in param_dict.items(): + for k,v in list(param_dict.items()): self.form_fields.append((k,v)) del k,v if len(files) == 0: self.files = [] else: - for key,v in files.items(): + for key,v in list(files.items()): self.add_file(fieldname=key, filename=os.path.basename(v), filePath=v, @@ -379,12 +379,12 @@ def _post(self, url, headers['Accept-Encoding'] = 'gzip' else: headers['Accept-Encoding'] = '' - for k,v in additional_headers.items(): + for k,v in list(additional_headers.items()): headers[k] = v del k,v opener = request.build_opener(*handlers) request.install_opener(opener) - opener.addheaders = [(k,v) for k,v in headers.items()] + opener.addheaders = [(k,v) for k,v in list(headers.items())] if len(files) == 0: data = urlencode(param_dict) if self.PY3: @@ -454,7 +454,7 @@ def _get(self, url, else: headers.append(('Accept-encoding', '')) headers.append(('User-Agent', self.useragent)) - if len(param_dict.keys()) == 0: + if len(list(param_dict.keys())) == 0: param_dict = None if handlers is None: handlers = [] diff --git a/src/arcrest/opendata/opendata.py b/src/arcrest/opendata/opendata.py index 4e12589..8f1505b 100644 --- a/src/arcrest/opendata/opendata.py +++ b/src/arcrest/opendata/opendata.py @@ -1,8 +1,8 @@ """ OpenData Operations """ -from __future__ import absolute_import -from __future__ import print_function + + import json from ._base import BaseOpenData from ..web._base import BaseWebOperations @@ -134,7 +134,7 @@ def __init(self): self._json = json.dumps(self._json_dict) setattr(self, "data", json_dict['data']) if 'data' in json_dict: - for k,v in json_dict['data'].items(): + for k,v in list(json_dict['data'].items()): setattr(self, k, v) del k,v #---------------------------------------------------------------------- diff --git a/src/arcrest/packages/__init__.py b/src/arcrest/packages/__init__.py index a3883a7..ee4405f 100644 --- a/src/arcrest/packages/__init__.py +++ b/src/arcrest/packages/__init__.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from . import six from . import ntlm3 \ No newline at end of file diff --git a/src/arcrest/packages/ntlm3/HTTPNtlmAuthHandler.py b/src/arcrest/packages/ntlm3/HTTPNtlmAuthHandler.py index d20725f..fa31e06 100644 --- a/src/arcrest/packages/ntlm3/HTTPNtlmAuthHandler.py +++ b/src/arcrest/packages/ntlm3/HTTPNtlmAuthHandler.py @@ -74,7 +74,7 @@ def retry_using_http_NTLM_auth(self, req, auth_header_field, realm, headers): # we must keep the connection because NTLM authenticates the connection, not single requests headers["Connection"] = "Keep-Alive" - headers = dict((name.title(), val) for name, val in headers.items()) + headers = dict((name.title(), val) for name, val in list(headers.items())) # For some reason, six doesn't do this translation correctly # TODO rsanders low - find bug in six & fix it @@ -107,7 +107,7 @@ def retry_using_http_NTLM_auth(self, req, auth_header_field, realm, headers): NegotiateFlags) headers[self.auth_header] = auth headers["Connection"] = "Close" - headers = dict((name.title(), val) for name, val in headers.items()) + headers = dict((name.title(), val) for name, val in list(headers.items())) try: h.request(req.get_method(), selector, req.data, headers) # none of the configured handlers are triggered, for example redirect-responses are not handled! diff --git a/src/arcrest/packages/ntlm3/U32.py b/src/arcrest/packages/ntlm3/U32.py index 50d0d69..cef40ef 100644 --- a/src/arcrest/packages/ntlm3/U32.py +++ b/src/arcrest/packages/ntlm3/U32.py @@ -14,7 +14,7 @@ # You should have received a copy of the GNU Lesser General Public # License along with this library. If not, see or . -from __future__ import division + from .. import six C = 0x1000000000 @@ -152,5 +152,5 @@ def __ge__(self, other): def __ne__(self, other): return self.v != other.v - def __nonzero__(self): + def __bool__(self): return norm(self.v) diff --git a/src/arcrest/packages/ntlm3/compat.py b/src/arcrest/packages/ntlm3/compat.py index bf23bc2..07b8d7e 100644 --- a/src/arcrest/packages/ntlm3/compat.py +++ b/src/arcrest/packages/ntlm3/compat.py @@ -2,6 +2,6 @@ def _long(value): try: - return long(value) + return int(value) except NameError: # we're Python 3, we don't have longs return int(value) diff --git a/src/arcrest/packages/six.py b/src/arcrest/packages/six.py index 190c023..889d023 100644 --- a/src/arcrest/packages/six.py +++ b/src/arcrest/packages/six.py @@ -20,7 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -from __future__ import absolute_import + import functools import itertools @@ -46,10 +46,10 @@ MAXSIZE = sys.maxsize else: - string_types = basestring, - integer_types = (int, long) - class_types = (type, types.ClassType) - text_type = unicode + string_types = str, + integer_types = (int, int) + class_types = (type, type) + text_type = str binary_type = str if sys.platform.startswith("java"): @@ -521,7 +521,7 @@ def remove_move(name): advance_iterator = next except NameError: def advance_iterator(it): - return it.next() + return it.__next__() next = advance_iterator @@ -544,7 +544,7 @@ def create_unbound_method(func, cls): Iterator = object else: def get_unbound_function(unbound): - return unbound.im_func + return unbound.__func__ def create_bound_method(func, obj): return types.MethodType(func, obj, obj.__class__) @@ -554,7 +554,7 @@ def create_unbound_method(func, cls): class Iterator(object): - def next(self): + def __next__(self): return type(self).__next__(self) callable = callable @@ -621,7 +621,7 @@ def b(s): def u(s): return s - unichr = chr + chr = chr import struct int2byte = struct.Struct(">B").pack del struct @@ -644,8 +644,8 @@ def b(s): # Workaround for standalone backslash def u(s): - return unicode(s.replace(r'\\', r'\\\\'), "unicode_escape") - unichr = unichr + return str(s.replace(r'\\', r'\\\\'), "unicode_escape") + chr = chr int2byte = chr def byte2int(bs): @@ -654,8 +654,8 @@ def byte2int(bs): def indexbytes(buf, i): return ord(buf[i]) iterbytes = functools.partial(itertools.imap, ord) - import StringIO - StringIO = BytesIO = StringIO.StringIO + import io + StringIO = BytesIO = io.StringIO _assertCountEqual = "assertItemsEqual" _assertRaisesRegex = "assertRaisesRegexp" _assertRegex = "assertRegexpMatches" @@ -727,11 +727,11 @@ def print_(*args, **kwargs): return def write(data): - if not isinstance(data, basestring): + if not isinstance(data, str): data = str(data) # If the file has an encoding, encode unicode with it. if (isinstance(fp, file) and - isinstance(data, unicode) and + isinstance(data, str) and fp.encoding is not None): errors = getattr(fp, "errors", None) if errors is None: @@ -741,13 +741,13 @@ def write(data): want_unicode = False sep = kwargs.pop("sep", None) if sep is not None: - if isinstance(sep, unicode): + if isinstance(sep, str): want_unicode = True elif not isinstance(sep, str): raise TypeError("sep must be None or a string") end = kwargs.pop("end", None) if end is not None: - if isinstance(end, unicode): + if isinstance(end, str): want_unicode = True elif not isinstance(end, str): raise TypeError("end must be None or a string") @@ -755,12 +755,12 @@ def write(data): raise TypeError("invalid keyword arguments to print()") if not want_unicode: for arg in args: - if isinstance(arg, unicode): + if isinstance(arg, str): want_unicode = True break if want_unicode: - newline = unicode("\n") - space = unicode(" ") + newline = str("\n") + space = str(" ") else: newline = "\n" space = " " diff --git a/src/arcrest/security/__init__.py b/src/arcrest/security/__init__.py index 8e49f12..c29c8e2 100644 --- a/src/arcrest/security/__init__.py +++ b/src/arcrest/security/__init__.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from .security import LDAPSecurityHandler, NTLMSecurityHandler, OAuthSecurityHandler, AGOLTokenSecurityHandler,\ AGSTokenSecurityHandler, ArcGISTokenSecurityHandler, PKISecurityHandler, PortalServerSecurityHandler, \ diff --git a/src/arcrest/security/security.py b/src/arcrest/security/security.py index 9532303..6a077d1 100644 --- a/src/arcrest/security/security.py +++ b/src/arcrest/security/security.py @@ -2,8 +2,8 @@ Handles all the security operations for the product logins. """ -from __future__ import print_function -from __future__ import absolute_import + + import datetime try: import arcpy diff --git a/src/arcrest/web/__init__.py b/src/arcrest/web/__init__.py index ae5c571..f5a44a1 100644 --- a/src/arcrest/web/__init__.py +++ b/src/arcrest/web/__init__.py @@ -1,6 +1,6 @@ """ _web constructor """ -from __future__ import absolute_import + from . import _base __version__ = "3.5.9" \ No newline at end of file diff --git a/src/arcrest/web/_base.py b/src/arcrest/web/_base.py index 41208c9..39ca25b 100644 --- a/src/arcrest/web/_base.py +++ b/src/arcrest/web/_base.py @@ -2,8 +2,8 @@ Contains POST and GET web operations for ArcREST Python Package. """ -from __future__ import absolute_import -from __future__ import print_function + + import io import os import re @@ -19,8 +19,9 @@ import email.generator from io import BytesIO +import collections try: - from cStringIO import StringIO + from io import StringIO except ImportError: from io import StringIO @@ -41,7 +42,7 @@ def error(self): try: #__init is renamed to the class with an _ init = getattr(self, "_" + self.__class__.__name__ + "__init", None) - if init is not None and callable(init): + if init is not None and isinstance(init, collections.Callable): init() except Exception as e: pass @@ -90,13 +91,13 @@ def __init__(self, param_dict=None, files=None): if len(param_dict) == 0: self.form_fields = [] else: - for k,v in param_dict.items(): + for k,v in list(param_dict.items()): self.form_fields.append((k,v)) del k,v if len(files) == 0: self.files = [] else: - for key,v in files.items(): + for key,v in list(files.items()): if isinstance(v, list): fileName = os.path.basename(v[1]) filePath = v[0] @@ -278,7 +279,7 @@ def _processHandler(self, securityHandler, param_dict): handler = securityHandler.handler cj = securityHandler.cookiejar if len(param_dict) > 0: - for k,v in param_dict.items(): + for k,v in list(param_dict.items()): if isinstance(v, bool): param_dict[k] = json.dumps(v) return param_dict, handler, cj @@ -456,7 +457,7 @@ def _post(self, url, headers['Accept-Encoding'] = 'gzip' else: headers['Accept-Encoding'] = '' - for k,v in additional_headers.items(): + for k,v in list(additional_headers.items()): headers[k] = v del k,v hasContext = 'context' in self._has_context(request.urlopen) @@ -467,7 +468,7 @@ def _post(self, url, ctx.verify_mode = ssl.CERT_NONE opener = request.build_opener(*handlers) - opener.addheaders = [(k,v) for k,v in headers.items()] + opener.addheaders = [(k,v) for k,v in list(headers.items())] request.install_opener(opener) if force_form_post == False: data = urlencode(param_dict) @@ -477,7 +478,7 @@ def _post(self, url, req = request.Request(self._asString(url), data = data, headers=headers) - for k,v in headers.items(): + for k,v in list(headers.items()): req.add_header(k,v) if hasContext and self._verify == False: resp = request.urlopen(req, context=ctx) @@ -586,7 +587,7 @@ def _get(self, url, pass_headers['Accept-encoding'] = "" #headers.append(('User-Agent', USER_AGENT)) pass_headers['User-Agent'] = self.useragent - if len(param_dict.keys()) == 0: + if len(list(param_dict.keys())) == 0: param_dict = None if handlers is None: handlers = [] diff --git a/src/arcrest/webmap/__init__.py b/src/arcrest/webmap/__init__.py index 3f7878b..78d1cca 100644 --- a/src/arcrest/webmap/__init__.py +++ b/src/arcrest/webmap/__init__.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + import domain import renderer import symbols diff --git a/src/arcrest/webmap/domain.py b/src/arcrest/webmap/domain.py index 5bc6109..870c7b6 100644 --- a/src/arcrest/webmap/domain.py +++ b/src/arcrest/webmap/domain.py @@ -1,8 +1,8 @@ """ Contains all domain types """ -from __future__ import absolute_import -from __future__ import print_function + + from .._abstract.abstract import BaseDomain import json diff --git a/src/arcrest/webmap/operationallayers.py b/src/arcrest/webmap/operationallayers.py index d7fa28b..1a94b54 100644 --- a/src/arcrest/webmap/operationallayers.py +++ b/src/arcrest/webmap/operationallayers.py @@ -1,5 +1,5 @@ -from __future__ import absolute_import -from __future__ import print_function + + from .._abstract.abstract import BaseOperationalLayer from ..common.general import _date_handler, _unicode_convert import json diff --git a/src/arcrest/webmap/renderer.py b/src/arcrest/webmap/renderer.py index d320d7e..2a9cd40 100644 --- a/src/arcrest/webmap/renderer.py +++ b/src/arcrest/webmap/renderer.py @@ -1,5 +1,5 @@ -from __future__ import absolute_import -from __future__ import print_function + + from .._abstract.abstract import BaseRenderer import json diff --git a/src/arcrest/webmap/symbols.py b/src/arcrest/webmap/symbols.py index da01c64..5329cea 100644 --- a/src/arcrest/webmap/symbols.py +++ b/src/arcrest/webmap/symbols.py @@ -1,5 +1,5 @@ -from __future__ import absolute_import -from __future__ import print_function + + from .._abstract.abstract import BaseSymbol import os import json @@ -206,7 +206,7 @@ def xoffset(self): @xoffset.setter def xoffset(self, value): """ sets the xoffset """ - if isinstance(value (int, float, long)): + if isinstance(value (int, float, int)): self._xoffset = value #---------------------------------------------------------------------- @property @@ -217,7 +217,7 @@ def yoffset(self): @yoffset.setter def yoffset(self, value): """ sets the y offset """ - if isinstance(value (int, float, long)): + if isinstance(value (int, float, int)): self._yoffset = value #---------------------------------------------------------------------- @property diff --git a/src/arcresthelper/__init__.py b/src/arcresthelper/__init__.py index ed0a976..20e9df0 100644 --- a/src/arcresthelper/__init__.py +++ b/src/arcresthelper/__init__.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from . import common from . import featureservicetools diff --git a/src/arcresthelper/common.py b/src/arcresthelper/common.py index 4c0301b..4315cb9 100644 --- a/src/arcresthelper/common.py +++ b/src/arcresthelper/common.py @@ -1,5 +1,5 @@ -from __future__ import print_function -from __future__ import absolute_import + + import os @@ -53,7 +53,7 @@ def merge_dicts(dicts, op=operator.add): if a is None: a = b.copy() else: - a = dict(a.items() + b.items() + [(k, op(a[k], b[k])) for k in set(b) & set(a)]) + a = dict(list(a.items()) + list(b.items()) + [(k, op(a[k], b[k])) for k in set(b) & set(a)]) return a ##---------------------------------------------------------------------- @@ -442,7 +442,7 @@ def unicode_convert(obj): """ try: if isinstance(obj, dict): - return {unicode_convert(key): unicode_convert(value) for key, value in obj.items()} + return {unicode_convert(key): unicode_convert(value) for key, value in list(obj.items())} elif isinstance(obj, list): return [unicode_convert(element) for element in obj] elif isinstance(obj, str): @@ -500,7 +500,7 @@ def find_replace(obj, find, replace): """ try: if isinstance(obj, dict): - return {find_replace(key,find,replace): find_replace(value,find,replace) for key, value in obj.items()} + return {find_replace(key,find,replace): find_replace(value,find,replace) for key, value in list(obj.items())} elif isinstance(obj, list): return [find_replace(element,find,replace) for element in obj] elif obj == find: diff --git a/src/arcresthelper/featureservicetools.py b/src/arcresthelper/featureservicetools.py index f5e137e..eb54aa5 100644 --- a/src/arcresthelper/featureservicetools.py +++ b/src/arcresthelper/featureservicetools.py @@ -1,6 +1,6 @@ -from __future__ import print_function -from __future__ import absolute_import + + from .securityhandlerhelper import securityhandlerhelper diff --git a/src/arcresthelper/orgtools.py b/src/arcresthelper/orgtools.py index df4fe99..c8e1e43 100644 --- a/src/arcresthelper/orgtools.py +++ b/src/arcresthelper/orgtools.py @@ -1,6 +1,6 @@ -from __future__ import print_function -from __future__ import absolute_import + + from .securityhandlerhelper import securityhandlerhelper diff --git a/src/arcresthelper/packages/__init__.py b/src/arcresthelper/packages/__init__.py index 1be4556..c07e323 100644 --- a/src/arcresthelper/packages/__init__.py +++ b/src/arcresthelper/packages/__init__.py @@ -1,3 +1,3 @@ -from __future__ import absolute_import + from . import six \ No newline at end of file diff --git a/src/arcresthelper/packages/six.py b/src/arcresthelper/packages/six.py index 190c023..889d023 100644 --- a/src/arcresthelper/packages/six.py +++ b/src/arcresthelper/packages/six.py @@ -20,7 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -from __future__ import absolute_import + import functools import itertools @@ -46,10 +46,10 @@ MAXSIZE = sys.maxsize else: - string_types = basestring, - integer_types = (int, long) - class_types = (type, types.ClassType) - text_type = unicode + string_types = str, + integer_types = (int, int) + class_types = (type, type) + text_type = str binary_type = str if sys.platform.startswith("java"): @@ -521,7 +521,7 @@ def remove_move(name): advance_iterator = next except NameError: def advance_iterator(it): - return it.next() + return it.__next__() next = advance_iterator @@ -544,7 +544,7 @@ def create_unbound_method(func, cls): Iterator = object else: def get_unbound_function(unbound): - return unbound.im_func + return unbound.__func__ def create_bound_method(func, obj): return types.MethodType(func, obj, obj.__class__) @@ -554,7 +554,7 @@ def create_unbound_method(func, cls): class Iterator(object): - def next(self): + def __next__(self): return type(self).__next__(self) callable = callable @@ -621,7 +621,7 @@ def b(s): def u(s): return s - unichr = chr + chr = chr import struct int2byte = struct.Struct(">B").pack del struct @@ -644,8 +644,8 @@ def b(s): # Workaround for standalone backslash def u(s): - return unicode(s.replace(r'\\', r'\\\\'), "unicode_escape") - unichr = unichr + return str(s.replace(r'\\', r'\\\\'), "unicode_escape") + chr = chr int2byte = chr def byte2int(bs): @@ -654,8 +654,8 @@ def byte2int(bs): def indexbytes(buf, i): return ord(buf[i]) iterbytes = functools.partial(itertools.imap, ord) - import StringIO - StringIO = BytesIO = StringIO.StringIO + import io + StringIO = BytesIO = io.StringIO _assertCountEqual = "assertItemsEqual" _assertRaisesRegex = "assertRaisesRegexp" _assertRegex = "assertRegexpMatches" @@ -727,11 +727,11 @@ def print_(*args, **kwargs): return def write(data): - if not isinstance(data, basestring): + if not isinstance(data, str): data = str(data) # If the file has an encoding, encode unicode with it. if (isinstance(fp, file) and - isinstance(data, unicode) and + isinstance(data, str) and fp.encoding is not None): errors = getattr(fp, "errors", None) if errors is None: @@ -741,13 +741,13 @@ def write(data): want_unicode = False sep = kwargs.pop("sep", None) if sep is not None: - if isinstance(sep, unicode): + if isinstance(sep, str): want_unicode = True elif not isinstance(sep, str): raise TypeError("sep must be None or a string") end = kwargs.pop("end", None) if end is not None: - if isinstance(end, unicode): + if isinstance(end, str): want_unicode = True elif not isinstance(end, str): raise TypeError("end must be None or a string") @@ -755,12 +755,12 @@ def write(data): raise TypeError("invalid keyword arguments to print()") if not want_unicode: for arg in args: - if isinstance(arg, unicode): + if isinstance(arg, str): want_unicode = True break if want_unicode: - newline = unicode("\n") - space = unicode(" ") + newline = str("\n") + space = str(" ") else: newline = "\n" space = " " diff --git a/src/arcresthelper/portalautomation.py b/src/arcresthelper/portalautomation.py index 19fddc9..551d82b 100644 --- a/src/arcresthelper/portalautomation.py +++ b/src/arcresthelper/portalautomation.py @@ -1,5 +1,5 @@ -from __future__ import print_function -from __future__ import absolute_import + + import gc import sys, os, datetime diff --git a/src/arcresthelper/publishingtools.py b/src/arcresthelper/publishingtools.py index ec242b8..24a3830 100644 --- a/src/arcresthelper/publishingtools.py +++ b/src/arcresthelper/publishingtools.py @@ -1,6 +1,6 @@ -from __future__ import print_function -from __future__ import absolute_import + + from .securityhandlerhelper import securityhandlerhelper import re as re @@ -1932,7 +1932,7 @@ def _publishAppLogic(self, appDet, map_info=None, fsInfo=None): repInfo = replaceItem['ReplaceString'].split("|") if len(repInfo) == 2: if repInfo[0] == mapDet['ReplaceTag']: - for key,value in mapDet['MapInfo']['Layers'].items(): + for key,value in list(mapDet['MapInfo']['Layers'].items()): if value["Name"] == repInfo[1]: replaceItem['ReplaceString'] = value["ID"] diff --git a/src/arcresthelper/resettools.py b/src/arcresthelper/resettools.py index c177d9a..a8d0f19 100644 --- a/src/arcresthelper/resettools.py +++ b/src/arcresthelper/resettools.py @@ -1,5 +1,5 @@ -from __future__ import print_function -from __future__ import absolute_import + + from .securityhandlerhelper import securityhandlerhelper diff --git a/src/arcresthelper/securityhandlerhelper.py b/src/arcresthelper/securityhandlerhelper.py index 18ee7e1..bc227a9 100644 --- a/src/arcresthelper/securityhandlerhelper.py +++ b/src/arcresthelper/securityhandlerhelper.py @@ -1,5 +1,5 @@ -from __future__ import print_function -from __future__ import absolute_import + + from arcrest import security diff --git a/tests/enrichment_tests.py b/tests/enrichment_tests.py index d1f7c91..7a56772 100644 --- a/tests/enrichment_tests.py +++ b/tests/enrichment_tests.py @@ -10,41 +10,41 @@ password = "" sh = AGOLTokenSecurityHandler(username, password) g = GeoEnrichment(securityHanlder=sh) - print g.allowedCountryNames - print g.allowedThreeDigitNames - print g.allowedTwoDigitCountryCodes - print g.findCountryThreeDigitCode(g.allowedCountryNames[11]) - print g.findCountryTwoDigitCode(g.allowedCountryNames[11]) - print g.queryDataCollectionByName(g.allowedCountryNames[11]) - print g.getVariables(sourceCountry='HKG') - print g.getVariables(sourceCountry='HKG', searchText="alias:2012 Population Per Mill") - print g.lookUpReportsByCountry(countryName="Panama") - print g.createReport( + print(g.allowedCountryNames) + print(g.allowedThreeDigitNames) + print(g.allowedTwoDigitCountryCodes) + print(g.findCountryThreeDigitCode(g.allowedCountryNames[11])) + print(g.findCountryTwoDigitCode(g.allowedCountryNames[11])) + print(g.queryDataCollectionByName(g.allowedCountryNames[11])) + print(g.getVariables(sourceCountry='HKG')) + print(g.getVariables(sourceCountry='HKG', searchText="alias:2012 Population Per Mill")) + print(g.lookUpReportsByCountry(countryName="Panama")) + print(g.createReport( out_file_path=tempfile.gettempdir(), - studyAreas=Point(coord=[-117.1956, 34.0572], wkid=4326)) - print g.createReport(out_file_path=tempfile.gettempdir(), + studyAreas=Point(coord=[-117.1956, 34.0572], wkid=4326))) + print(g.createReport(out_file_path=tempfile.gettempdir(), report="networth", studyAreas=Polygon(rings=[[[-117.185412,34.063170], [-122.81,37.81], [-117.200570,34.057196], [-117.185412,34.063170]]], wkid=4326) - ) - print g.createReport(out_file_path=tempfile.gettempdir(), + )) + print(g.createReport(out_file_path=tempfile.gettempdir(), studyAreas=[{"address":{"text":"380 New York St. Redlands, CA 92373"}}], - studyAreasOptions={"areaType":"RingBuffer","bufferUnits":"esriMiles","bufferRadii":[1,2,3]}) - print g.dataCollections(outFields=None, addDerivativeVariables=None) - print g.dataCollections(outFields=None, addDerivativeVariables=None, countryName="Canada") - print g.dataCollections(outFields=None, addDerivativeVariables=None, suppressNullValues=True) - print g.standardGeographyQuery(sourceCountry="CA", + studyAreasOptions={"areaType":"RingBuffer","bufferUnits":"esriMiles","bufferRadii":[1,2,3]})) + print(g.dataCollections(outFields=None, addDerivativeVariables=None)) + print(g.dataCollections(outFields=None, addDerivativeVariables=None, countryName="Canada")) + print(g.dataCollections(outFields=None, addDerivativeVariables=None, suppressNullValues=True)) + print(g.standardGeographyQuery(sourceCountry="CA", geographyIDs=["35"], - geographyLayers=["CAN.PR"]) - print g.standardGeographyQuery(sourceCountry="US", + geographyLayers=["CAN.PR"])) + print(g.standardGeographyQuery(sourceCountry="US", geographyIDs=["92129", "92126"], geographyLayers=["US.ZIP5"], returnGeometry=True, - returnCentroids=True) - print g.standardGeographyQuery(sourceCountry="CA", + returnCentroids=True)) + print(g.standardGeographyQuery(sourceCountry="CA", geographyIDs=["35"], geographyLayers=["CAN.PR"], - returnGeometry=True) - print 'fin' + returnGeometry=True)) + print('fin') diff --git a/tools/src/addItem.py b/tools/src/addItem.py index d930e5f..2136c01 100644 --- a/tools/src/addItem.py +++ b/tools/src/addItem.py @@ -72,7 +72,7 @@ def main(*argv): arcpy.AddError("error in file name: %s" % filename) arcpy.AddError("with error message: %s" % synerror) arcpy.AddError("ArcPy Error Message: %s" % arcpy.GetMessages(2)) - except FunctionError, f_e: + except FunctionError as f_e: messages = f_e.args[0] arcpy.AddError("error in function: %s" % messages["function"]) arcpy.AddError("error on line: %s" % messages["line"]) @@ -88,5 +88,5 @@ def main(*argv): if __name__ == "__main__": env.overwriteOutput = True argv = tuple(arcpy.GetParameterAsText(i) - for i in xrange(arcpy.GetArgumentCount())) + for i in range(arcpy.GetArgumentCount())) main(*argv) \ No newline at end of file diff --git a/tools/src/addUser.py b/tools/src/addUser.py index c4f5768..83cae81 100644 --- a/tools/src/addUser.py +++ b/tools/src/addUser.py @@ -11,7 +11,7 @@ import json from arcpy import env import arcpy -import ConfigParser +import configparser import arcrest #-------------------------------------------------------------------------- class FunctionError(Exception): @@ -38,7 +38,7 @@ def trace(): def get_config_value(config_file, section, variable): """ extracts a config file value """ try: - parser = ConfigParser.SafeConfigParser() + parser = configparser.SafeConfigParser() parser.read(config_file) return parser.get(section, variable) except: @@ -108,7 +108,7 @@ def main(*argv): arcpy.AddError("error in file name: %s" % filename) arcpy.AddError("with error message: %s" % synerror) arcpy.AddError("ArcPy Error Message: %s" % arcpy.GetMessages(2)) - except FunctionError, f_e: + except FunctionError as f_e: messages = f_e.args[0] arcpy.AddError("error in function: %s" % messages["function"]) arcpy.AddError("error on line: %s" % messages["line"]) @@ -124,5 +124,5 @@ def main(*argv): if __name__ == "__main__": env.overwriteOutput = True argv = tuple(str(arcpy.GetParameterAsText(i)) - for i in xrange(arcpy.GetArgumentCount())) + for i in range(arcpy.GetArgumentCount())) main(*argv) \ No newline at end of file diff --git a/tools/src/addUserToGroup.py b/tools/src/addUserToGroup.py index 4e21c18..365cf4d 100644 --- a/tools/src/addUserToGroup.py +++ b/tools/src/addUserToGroup.py @@ -66,7 +66,7 @@ def main(*argv): arcpy.AddError("error in file name: %s" % filename) arcpy.AddError("with error message: %s" % synerror) arcpy.AddError("ArcPy Error Message: %s" % arcpy.GetMessages(2)) - except FunctionError, f_e: + except FunctionError as f_e: messages = f_e.args[0] arcpy.AddError("error in function: %s" % messages["function"]) arcpy.AddError("error on line: %s" % messages["line"]) @@ -82,5 +82,5 @@ def main(*argv): if __name__ == "__main__": env.overwriteOutput = True argv = tuple(str(arcpy.GetParameterAsText(i)) - for i in xrange(arcpy.GetArgumentCount())) + for i in range(arcpy.GetArgumentCount())) main(*argv) \ No newline at end of file diff --git a/tools/src/append_fc_to_fs.py b/tools/src/append_fc_to_fs.py index 5a89963..c46f39b 100644 --- a/tools/src/append_fc_to_fs.py +++ b/tools/src/append_fc_to_fs.py @@ -7,7 +7,7 @@ @requirements: Python 2.7.x, ArcGIS 10.2.1 @copyright: Esri, 2016 ''' -from __future__ import print_function + import gc import os import sys @@ -181,7 +181,7 @@ def main(*argv): outputPrinter(message="with error message: %s" % synerror,typeOfMessage='error') outputPrinter(message="ArcPy Error Message: %s" % arcpy.GetMessages(2),typeOfMessage='error') arcpy.SetParameterAsText(9, "false") - except (common.ArcRestHelperError),e: + except (common.ArcRestHelperError) as e: outputPrinter(message=e,typeOfMessage='error') arcpy.SetParameterAsText(9, "false") except: @@ -251,7 +251,7 @@ def syncLayer(fst, fs, layer, layerName, displayName, lowerCaseFieldNames, showF if __name__ == "__main__": argv = tuple(arcpy.GetParameterAsText(i) - for i in xrange(arcpy.GetArgumentCount())) + for i in range(arcpy.GetArgumentCount())) main(*argv) diff --git a/tools/src/append_groupLayer_fs.py b/tools/src/append_groupLayer_fs.py index 4ae1daa..57c0cf2 100644 --- a/tools/src/append_groupLayer_fs.py +++ b/tools/src/append_groupLayer_fs.py @@ -7,7 +7,7 @@ @requirements: Python 2.7.x, ArcGIS 10.2.1 @copyright: Esri, 2016 ''' -from __future__ import print_function + import gc import os import sys @@ -157,7 +157,7 @@ def main(*argv): del row if groupLayer.isGroupLayer: for lyr in groupLayer: - for key, value in layerToServiceLayer.items(): + for key, value in list(layerToServiceLayer.items()): if str(matchEntireName).lower() =='true' and key == lyr.name: matches = True elif str(matchEntireName).lower() =='false' and str(lyr.name).startswith(key): @@ -225,7 +225,7 @@ def main(*argv): outputPrinter(message="with error message: %s" % synerror,typeOfMessage='error') outputPrinter(message="ArcPy Error Message: %s" % arcpy.GetMessages(2),typeOfMessage='error') arcpy.SetParameterAsText(10, "false") - except (common.ArcRestHelperError),e: + except (common.ArcRestHelperError) as e: outputPrinter(message=e,typeOfMessage='error') arcpy.SetParameterAsText(10, "false") except: @@ -298,6 +298,6 @@ def syncLayer(fst, fs, layer, layerName, displayName, lowerCaseFieldNames, showF if __name__ == "__main__": argv = tuple(arcpy.GetParameterAsText(i) - for i in xrange(arcpy.GetArgumentCount())) + for i in range(arcpy.GetArgumentCount())) main(*argv) diff --git a/tools/src/createGroup.py b/tools/src/createGroup.py index 46a7a63..181099c 100644 --- a/tools/src/createGroup.py +++ b/tools/src/createGroup.py @@ -74,7 +74,7 @@ def main(*argv): arcpy.AddError("error in file name: %s" % filename) arcpy.AddError("with error message: %s" % synerror) arcpy.AddError("ArcPy Error Message: %s" % arcpy.GetMessages(2)) - except FunctionError, f_e: + except FunctionError as f_e: messages = f_e.args[0] arcpy.AddError("error in function: %s" % messages["function"]) arcpy.AddError("error on line: %s" % messages["line"]) @@ -90,5 +90,5 @@ def main(*argv): if __name__ == "__main__": env.overwriteOutput = True argv = tuple(str(arcpy.GetParameterAsText(i)) - for i in xrange(arcpy.GetArgumentCount())) + for i in range(arcpy.GetArgumentCount())) main(*argv) \ No newline at end of file diff --git a/tools/src/deleteGroup.py b/tools/src/deleteGroup.py index 423f8a9..8a6ccda 100644 --- a/tools/src/deleteGroup.py +++ b/tools/src/deleteGroup.py @@ -12,7 +12,7 @@ from arcpy import mapping from arcpy import da import arcpy -import ConfigParser +import configparser import arcrest #-------------------------------------------------------------------------- class FunctionError(Exception): @@ -68,7 +68,7 @@ def main(*argv): arcpy.AddError("error in file name: %s" % filename) arcpy.AddError("with error message: %s" % synerror) arcpy.AddError("ArcPy Error Message: %s" % arcpy.GetMessages(2)) - except FunctionError, f_e: + except FunctionError as f_e: messages = f_e.args[0] arcpy.AddError("error in function: %s" % messages["function"]) arcpy.AddError("error on line: %s" % messages["line"]) @@ -84,5 +84,5 @@ def main(*argv): if __name__ == "__main__": env.overwriteOutput = True argv = tuple(str(arcpy.GetParameterAsText(i)) - for i in xrange(arcpy.GetArgumentCount())) + for i in range(arcpy.GetArgumentCount())) main(*argv) \ No newline at end of file diff --git a/tools/src/deleteItem.py b/tools/src/deleteItem.py index 79f9c1e..0f15d8a 100644 --- a/tools/src/deleteItem.py +++ b/tools/src/deleteItem.py @@ -63,7 +63,7 @@ def main(*argv): arcpy.AddError("error in file name: %s" % filename) arcpy.AddError("with error message: %s" % synerror) arcpy.AddError("ArcPy Error Message: %s" % arcpy.GetMessages(2)) - except FunctionError, f_e: + except FunctionError as f_e: messages = f_e.args[0] arcpy.AddError("error in function: %s" % messages["function"]) arcpy.AddError("error on line: %s" % messages["line"]) @@ -79,5 +79,5 @@ def main(*argv): if __name__ == "__main__": env.overwriteOutput = True argv = tuple(str(arcpy.GetParameterAsText(i)) - for i in xrange(arcpy.GetArgumentCount())) + for i in range(arcpy.GetArgumentCount())) main(*argv) \ No newline at end of file diff --git a/tools/src/deleteUser.py b/tools/src/deleteUser.py index 20113f2..9136d26 100644 --- a/tools/src/deleteUser.py +++ b/tools/src/deleteUser.py @@ -49,7 +49,7 @@ def main(*argv): community = admin.community user = community.user res = user.deleteUser(username=deleteUser) - if res.has_key('success'): + if 'success' in res: arcpy.SetParameterAsText(4, str(res['success']).lower() == "true") else: arcpy.SetParameterAsText(4, False) @@ -64,7 +64,7 @@ def main(*argv): arcpy.AddError("error in file name: %s" % filename) arcpy.AddError("with error message: %s" % synerror) arcpy.AddError("ArcPy Error Message: %s" % arcpy.GetMessages(2)) - except FunctionError, f_e: + except FunctionError as f_e: messages = f_e.args[0] arcpy.AddError("error in function: %s" % messages["function"]) arcpy.AddError("error on line: %s" % messages["line"]) @@ -80,5 +80,5 @@ def main(*argv): if __name__ == "__main__": env.overwriteOutput = True argv = tuple(str(arcpy.GetParameterAsText(i)) - for i in xrange(arcpy.GetArgumentCount())) + for i in range(arcpy.GetArgumentCount())) main(*argv) \ No newline at end of file diff --git a/tools/src/deleteUserContent.py b/tools/src/deleteUserContent.py index 47fbb4e..7db3936 100644 --- a/tools/src/deleteUserContent.py +++ b/tools/src/deleteUserContent.py @@ -12,7 +12,7 @@ from arcpy import mapping from arcpy import da import arcpy -import ConfigParser +import configparser import arcrest #-------------------------------------------------------------------------- class FunctionError(Exception): @@ -85,7 +85,7 @@ def main(*argv): arcpy.AddError("error in file name: %s" % filename) arcpy.AddError("with error message: %s" % synerror) arcpy.AddError("ArcPy Error Message: %s" % arcpy.GetMessages(2)) - except FunctionError, f_e: + except FunctionError as f_e: messages = f_e.args[0] arcpy.AddError("error in function: %s" % messages["function"]) arcpy.AddError("error on line: %s" % messages["line"]) @@ -101,5 +101,5 @@ def main(*argv): if __name__ == "__main__": env.overwriteOutput = True argv = tuple(str(arcpy.GetParameterAsText(i)) - for i in xrange(arcpy.GetArgumentCount())) + for i in range(arcpy.GetArgumentCount())) main(*argv) \ No newline at end of file diff --git a/tools/src/delete_rows_from_fs.py b/tools/src/delete_rows_from_fs.py index 39708cd..13ba328 100644 --- a/tools/src/delete_rows_from_fs.py +++ b/tools/src/delete_rows_from_fs.py @@ -8,7 +8,7 @@ @copyright: Esri, 2016 """ -from __future__ import print_function + import gc import os diff --git a/tools/src/post_layer_to_workforce_assignments.py b/tools/src/post_layer_to_workforce_assignments.py index 078bc4e..1331caa 100644 --- a/tools/src/post_layer_to_workforce_assignments.py +++ b/tools/src/post_layer_to_workforce_assignments.py @@ -42,7 +42,7 @@ def outputPrinter(message,typeOfMessage='message'): else: arcpy.AddMessage(message=message) - print message + print(message) def main(): arcpy.env.overwriteOutput = True fsId = None @@ -184,7 +184,7 @@ def main(): outputPrinter(message="with error message: %s" % synerror,typeOfMessage='error') outputPrinter(message="ArcPy Error Message: %s" % arcpy.GetMessages(2),typeOfMessage='error') arcpy.SetParameterAsText(8, "false") - except (common.ArcRestHelperError),e: + except (common.ArcRestHelperError) as e: outputPrinter(message=e,typeOfMessage='error') arcpy.SetParameterAsText(8, "false") except: