Skip to content
This repository has been archived by the owner on Mar 31, 2020. It is now read-only.

Commit

Permalink
Convert to python3
Browse files Browse the repository at this point in the history
  • Loading branch information
ralic committed May 18, 2017
1 parent 1920ad9 commit c89905c
Show file tree
Hide file tree
Showing 164 changed files with 674 additions and 678 deletions.
18 changes: 9 additions & 9 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
]

Expand All @@ -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'),
]
Expand Down
6 changes: 3 additions & 3 deletions samples/AGOLMapServices/tileserviceproperties.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
print(service.id)
print(service.urlService)
print(service.name)
12 changes: 6 additions & 6 deletions samples/AGS/agsserverObjectExample.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 '----------------------'
print('----------------------')
print(service.url)
print(str(service))
print('----------------------')
10 changes: 5 additions & 5 deletions samples/AGS/serverDetails.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
print("error on line: %s" % line)
print("error in file name: %s" % filename)
print("with error message: %s" % synerror)
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Original file line number Diff line number Diff line change
Expand Up @@ -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
print(lyr.name, lyr._url)
4 changes: 2 additions & 2 deletions samples/Workforce/create_replica_all_assignments.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
ArcREST 3.5
"""

from __future__ import print_function

import arcrest
from arcresthelper import securityhandlerhelper
from arcresthelper import common
Expand Down Expand Up @@ -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'])
Expand Down
8 changes: 4 additions & 4 deletions samples/Workforce/load_assignments_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
ArcREST 3.5
"""

from __future__ import print_function

import arcrest
from arcrest.common.general import Feature
from arcresthelper import featureservicetools
Expand All @@ -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
Expand Down Expand Up @@ -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'])
Expand Down
6 changes: 3 additions & 3 deletions samples/Workforce/load_assignments_lookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
ArcREST 3.5
"""

from __future__ import print_function

import arcrest
from arcrest.common.general import Feature
from arcresthelper import featureservicetools
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions samples/Workforce/query_completed_work.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'])
Expand Down
4 changes: 2 additions & 2 deletions samples/Workforce/query_delete_completed_work.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'])
Expand Down
4 changes: 2 additions & 2 deletions samples/Workforce/update_status_assignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
ArcREST 3.5
"""

from __future__ import print_function

import arcrest
from arcrest.common.general import Feature
from arcresthelper import featureservicetools
Expand Down Expand Up @@ -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'])
Expand Down
2 changes: 1 addition & 1 deletion samples/addItem_kml_sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
ArcREST version 3.5.x
Python 2/3
"""
from __future__ import print_function

import arcrest

if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion samples/add_field_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Python 2/3
"""
from __future__ import print_function

from arcrest.security import AGOLTokenSecurityHandler
from arcrest.agol import FeatureLayer

Expand Down
4 changes: 2 additions & 2 deletions samples/add_file_geodatabase.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from __future__ import print_function
from __future__ import absolute_import


import arcrest

if __name__ == "__main__":
Expand Down
10 changes: 5 additions & 5 deletions samples/add_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
4 changes: 2 additions & 2 deletions samples/add_user_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'])
Expand Down
10 changes: 5 additions & 5 deletions samples/add_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
2 changes: 1 addition & 1 deletion samples/additem_webmap_sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
version 3.5.x
Python 2/3
"""
from __future__ import print_function

import arcrest
import json
if __name__ == "__main__":
Expand Down
4 changes: 2 additions & 2 deletions samples/adds_rows_to_ags_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c89905c

Please sign in to comment.