repo
stringlengths 7
55
| path
stringlengths 4
127
| func_name
stringlengths 1
88
| original_string
stringlengths 75
19.8k
| language
stringclasses 1
value | code
stringlengths 75
19.8k
| code_tokens
sequence | docstring
stringlengths 3
17.3k
| docstring_tokens
sequence | sha
stringlengths 40
40
| url
stringlengths 87
242
| partition
stringclasses 1
value |
---|---|---|---|---|---|---|---|---|---|---|---|
Esri/ArcREST | src/arcrest/manageorg/_portals.py | Portal.featureServers | def featureServers(self):
"""gets the hosting feature AGS Server"""
if self.urls == {}:
return {}
featuresUrls = self.urls['urls']['features']
if 'https' in featuresUrls:
res = featuresUrls['https']
elif 'http' in featuresUrls:
res = featuresUrls['http']
else:
return None
services = []
for urlHost in res:
if self.isPortal:
services.append(AGSAdministration(
url='%s/admin' % urlHost,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port))
else:
services.append(Services(
url='https://%s/%s/ArcGIS/admin' % (urlHost, self.portalId),
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port))
return services | python | def featureServers(self):
"""gets the hosting feature AGS Server"""
if self.urls == {}:
return {}
featuresUrls = self.urls['urls']['features']
if 'https' in featuresUrls:
res = featuresUrls['https']
elif 'http' in featuresUrls:
res = featuresUrls['http']
else:
return None
services = []
for urlHost in res:
if self.isPortal:
services.append(AGSAdministration(
url='%s/admin' % urlHost,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port))
else:
services.append(Services(
url='https://%s/%s/ArcGIS/admin' % (urlHost, self.portalId),
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port))
return services | [
"def",
"featureServers",
"(",
"self",
")",
":",
"if",
"self",
".",
"urls",
"==",
"{",
"}",
":",
"return",
"{",
"}",
"featuresUrls",
"=",
"self",
".",
"urls",
"[",
"'urls'",
"]",
"[",
"'features'",
"]",
"if",
"'https'",
"in",
"featuresUrls",
":",
"res",
"=",
"featuresUrls",
"[",
"'https'",
"]",
"elif",
"'http'",
"in",
"featuresUrls",
":",
"res",
"=",
"featuresUrls",
"[",
"'http'",
"]",
"else",
":",
"return",
"None",
"services",
"=",
"[",
"]",
"for",
"urlHost",
"in",
"res",
":",
"if",
"self",
".",
"isPortal",
":",
"services",
".",
"append",
"(",
"AGSAdministration",
"(",
"url",
"=",
"'%s/admin'",
"%",
"urlHost",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")",
")",
"else",
":",
"services",
".",
"append",
"(",
"Services",
"(",
"url",
"=",
"'https://%s/%s/ArcGIS/admin'",
"%",
"(",
"urlHost",
",",
"self",
".",
"portalId",
")",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")",
")",
"return",
"services"
] | gets the hosting feature AGS Server | [
"gets",
"the",
"hosting",
"feature",
"AGS",
"Server"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_portals.py#L1000-L1028 | train |
Esri/ArcREST | src/arcrest/manageorg/_portals.py | Portal.update | def update(self,
updatePortalParameters,
clearEmptyFields=False):
"""
The Update operation allows administrators only to update the
organization information such as name, description, thumbnail, and
featured groups.
Inputs:
updatePortalParamters - parameter.PortalParameters object that holds information to update
clearEmptyFields - boolean that clears all whitespace from fields
"""
url = self.root + "/update"
params = {
"f" : "json",
"clearEmptyFields" : clearEmptyFields
}
if isinstance(updatePortalParameters, parameters.PortalParameters):
params.update(updatePortalParameters.value)
elif isinstance(updatePortalParameters, dict):
for k,v in updatePortalParameters.items():
params[k] = v
else:
raise AttributeError("updatePortalParameters must be of type parameter.PortalParameters")
return self._post(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | python | def update(self,
updatePortalParameters,
clearEmptyFields=False):
"""
The Update operation allows administrators only to update the
organization information such as name, description, thumbnail, and
featured groups.
Inputs:
updatePortalParamters - parameter.PortalParameters object that holds information to update
clearEmptyFields - boolean that clears all whitespace from fields
"""
url = self.root + "/update"
params = {
"f" : "json",
"clearEmptyFields" : clearEmptyFields
}
if isinstance(updatePortalParameters, parameters.PortalParameters):
params.update(updatePortalParameters.value)
elif isinstance(updatePortalParameters, dict):
for k,v in updatePortalParameters.items():
params[k] = v
else:
raise AttributeError("updatePortalParameters must be of type parameter.PortalParameters")
return self._post(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | [
"def",
"update",
"(",
"self",
",",
"updatePortalParameters",
",",
"clearEmptyFields",
"=",
"False",
")",
":",
"url",
"=",
"self",
".",
"root",
"+",
"\"/update\"",
"params",
"=",
"{",
"\"f\"",
":",
"\"json\"",
",",
"\"clearEmptyFields\"",
":",
"clearEmptyFields",
"}",
"if",
"isinstance",
"(",
"updatePortalParameters",
",",
"parameters",
".",
"PortalParameters",
")",
":",
"params",
".",
"update",
"(",
"updatePortalParameters",
".",
"value",
")",
"elif",
"isinstance",
"(",
"updatePortalParameters",
",",
"dict",
")",
":",
"for",
"k",
",",
"v",
"in",
"updatePortalParameters",
".",
"items",
"(",
")",
":",
"params",
"[",
"k",
"]",
"=",
"v",
"else",
":",
"raise",
"AttributeError",
"(",
"\"updatePortalParameters must be of type parameter.PortalParameters\"",
")",
"return",
"self",
".",
"_post",
"(",
"url",
"=",
"url",
",",
"param_dict",
"=",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")"
] | The Update operation allows administrators only to update the
organization information such as name, description, thumbnail, and
featured groups.
Inputs:
updatePortalParamters - parameter.PortalParameters object that holds information to update
clearEmptyFields - boolean that clears all whitespace from fields | [
"The",
"Update",
"operation",
"allows",
"administrators",
"only",
"to",
"update",
"the",
"organization",
"information",
"such",
"as",
"name",
"description",
"thumbnail",
"and",
"featured",
"groups",
"."
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_portals.py#L1118-L1146 | train |
Esri/ArcREST | src/arcrest/manageorg/_portals.py | Portal.updateUserRole | def updateUserRole(self,
user,
role):
"""
The Update User Role operation allows the administrator of an org
anization to update the role of a user within a portal.
Inputs:
role - Sets the user's role.
Roles are the following:
org_user - Ability to add items, create groups, and
share in the organization.
org_publisher - Same privileges as org_user plus the
ability to publish hosted services from ArcGIS for
Desktop and ArcGIS Online.
org_admin - In addition to add, create, share, and publish
capabilities, an org_admin administers and customizes
the organization.
Example: role=org_publisher
user - The username whose role you want to change.
"""
url = self._url + "/updateuserrole"
params = {
"f" : "json",
"user" : user,
"role" : role
}
return self._post(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | python | def updateUserRole(self,
user,
role):
"""
The Update User Role operation allows the administrator of an org
anization to update the role of a user within a portal.
Inputs:
role - Sets the user's role.
Roles are the following:
org_user - Ability to add items, create groups, and
share in the organization.
org_publisher - Same privileges as org_user plus the
ability to publish hosted services from ArcGIS for
Desktop and ArcGIS Online.
org_admin - In addition to add, create, share, and publish
capabilities, an org_admin administers and customizes
the organization.
Example: role=org_publisher
user - The username whose role you want to change.
"""
url = self._url + "/updateuserrole"
params = {
"f" : "json",
"user" : user,
"role" : role
}
return self._post(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | [
"def",
"updateUserRole",
"(",
"self",
",",
"user",
",",
"role",
")",
":",
"url",
"=",
"self",
".",
"_url",
"+",
"\"/updateuserrole\"",
"params",
"=",
"{",
"\"f\"",
":",
"\"json\"",
",",
"\"user\"",
":",
"user",
",",
"\"role\"",
":",
"role",
"}",
"return",
"self",
".",
"_post",
"(",
"url",
"=",
"url",
",",
"param_dict",
"=",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")"
] | The Update User Role operation allows the administrator of an org
anization to update the role of a user within a portal.
Inputs:
role - Sets the user's role.
Roles are the following:
org_user - Ability to add items, create groups, and
share in the organization.
org_publisher - Same privileges as org_user plus the
ability to publish hosted services from ArcGIS for
Desktop and ArcGIS Online.
org_admin - In addition to add, create, share, and publish
capabilities, an org_admin administers and customizes
the organization.
Example: role=org_publisher
user - The username whose role you want to change. | [
"The",
"Update",
"User",
"Role",
"operation",
"allows",
"the",
"administrator",
"of",
"an",
"org",
"anization",
"to",
"update",
"the",
"role",
"of",
"a",
"user",
"within",
"a",
"portal",
"."
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_portals.py#L1148-L1180 | train |
Esri/ArcREST | src/arcrest/manageorg/_portals.py | Portal.isServiceNameAvailable | def isServiceNameAvailable(self,
name,
serviceType):
"""
Checks to see if a given service name and type are available for
publishing a new service. true indicates that the name and type is
not found in the organization's services and is available for
publishing. false means the requested name and type are not available.
Inputs:
name - requested name of service
serviceType - type of service allowed values: Feature Service or
Map Service
"""
_allowedTypes = ['Feature Service', "Map Service"]
url = self._url + "/isServiceNameAvailable"
params = {
"f" : "json",
"name" : name,
"type" : serviceType
}
return self._get(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | python | def isServiceNameAvailable(self,
name,
serviceType):
"""
Checks to see if a given service name and type are available for
publishing a new service. true indicates that the name and type is
not found in the organization's services and is available for
publishing. false means the requested name and type are not available.
Inputs:
name - requested name of service
serviceType - type of service allowed values: Feature Service or
Map Service
"""
_allowedTypes = ['Feature Service', "Map Service"]
url = self._url + "/isServiceNameAvailable"
params = {
"f" : "json",
"name" : name,
"type" : serviceType
}
return self._get(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | [
"def",
"isServiceNameAvailable",
"(",
"self",
",",
"name",
",",
"serviceType",
")",
":",
"_allowedTypes",
"=",
"[",
"'Feature Service'",
",",
"\"Map Service\"",
"]",
"url",
"=",
"self",
".",
"_url",
"+",
"\"/isServiceNameAvailable\"",
"params",
"=",
"{",
"\"f\"",
":",
"\"json\"",
",",
"\"name\"",
":",
"name",
",",
"\"type\"",
":",
"serviceType",
"}",
"return",
"self",
".",
"_get",
"(",
"url",
"=",
"url",
",",
"param_dict",
"=",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")"
] | Checks to see if a given service name and type are available for
publishing a new service. true indicates that the name and type is
not found in the organization's services and is available for
publishing. false means the requested name and type are not available.
Inputs:
name - requested name of service
serviceType - type of service allowed values: Feature Service or
Map Service | [
"Checks",
"to",
"see",
"if",
"a",
"given",
"service",
"name",
"and",
"type",
"are",
"available",
"for",
"publishing",
"a",
"new",
"service",
".",
"true",
"indicates",
"that",
"the",
"name",
"and",
"type",
"is",
"not",
"found",
"in",
"the",
"organization",
"s",
"services",
"and",
"is",
"available",
"for",
"publishing",
".",
"false",
"means",
"the",
"requested",
"name",
"and",
"type",
"are",
"not",
"available",
"."
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_portals.py#L1201-L1226 | train |
Esri/ArcREST | src/arcrest/manageorg/_portals.py | Portal.servers | def servers(self):
"""gets the federated or registered servers for Portal"""
url = "%s/servers" % self.root
return Servers(url=url,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | python | def servers(self):
"""gets the federated or registered servers for Portal"""
url = "%s/servers" % self.root
return Servers(url=url,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | [
"def",
"servers",
"(",
"self",
")",
":",
"url",
"=",
"\"%s/servers\"",
"%",
"self",
".",
"root",
"return",
"Servers",
"(",
"url",
"=",
"url",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")"
] | gets the federated or registered servers for Portal | [
"gets",
"the",
"federated",
"or",
"registered",
"servers",
"for",
"Portal"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_portals.py#L1229-L1235 | train |
Esri/ArcREST | src/arcrest/manageorg/_portals.py | Portal.users | def users(self,
start=1,
num=10,
sortField="fullName",
sortOrder="asc",
role=None):
"""
Lists all the members of the organization. The start and num paging
parameters are supported.
Inputs:
start - The number of the first entry in the result set response.
The index number is 1-based.
The default value of start is 1 (that is, the first
search result).
The start parameter, along with the num parameter, can
be used to paginate the search results.
num - The maximum number of results to be included in the result
set response.
The default value is 10, and the maximum allowed value is
100.The start parameter, along with the num parameter, can
be used to paginate the search results.
sortField - field to sort on
sortOrder - asc or desc on the sortField
role - name of the role or role id to search
Output:
list of User classes
"""
users = []
url = self._url + "/users"
params = {
"f" : "json",
"start" : start,
"num" : num
}
if not role is None:
params['role'] = role
if not sortField is None:
params['sortField'] = sortField
if not sortOrder is None:
params['sortOrder'] = sortOrder
from ._community import Community
res = self._post(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port)
if "users" in res:
if len(res['users']) > 0:
parsed = urlparse.urlparse(self._url)
if parsed.netloc.lower().find('arcgis.com') == -1:
cURL = "%s://%s/%s/sharing/rest/community" % (parsed.scheme,
parsed.netloc,
parsed.path[1:].split('/')[0])
else:
cURL = "%s://%s/sharing/rest/community" % (parsed.scheme,
parsed.netloc)
com = Community(url=cURL,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port)
for r in res['users']:
users.append(
com.users.user(r["username"])
)
res['users'] = users
return res | python | def users(self,
start=1,
num=10,
sortField="fullName",
sortOrder="asc",
role=None):
"""
Lists all the members of the organization. The start and num paging
parameters are supported.
Inputs:
start - The number of the first entry in the result set response.
The index number is 1-based.
The default value of start is 1 (that is, the first
search result).
The start parameter, along with the num parameter, can
be used to paginate the search results.
num - The maximum number of results to be included in the result
set response.
The default value is 10, and the maximum allowed value is
100.The start parameter, along with the num parameter, can
be used to paginate the search results.
sortField - field to sort on
sortOrder - asc or desc on the sortField
role - name of the role or role id to search
Output:
list of User classes
"""
users = []
url = self._url + "/users"
params = {
"f" : "json",
"start" : start,
"num" : num
}
if not role is None:
params['role'] = role
if not sortField is None:
params['sortField'] = sortField
if not sortOrder is None:
params['sortOrder'] = sortOrder
from ._community import Community
res = self._post(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port)
if "users" in res:
if len(res['users']) > 0:
parsed = urlparse.urlparse(self._url)
if parsed.netloc.lower().find('arcgis.com') == -1:
cURL = "%s://%s/%s/sharing/rest/community" % (parsed.scheme,
parsed.netloc,
parsed.path[1:].split('/')[0])
else:
cURL = "%s://%s/sharing/rest/community" % (parsed.scheme,
parsed.netloc)
com = Community(url=cURL,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port)
for r in res['users']:
users.append(
com.users.user(r["username"])
)
res['users'] = users
return res | [
"def",
"users",
"(",
"self",
",",
"start",
"=",
"1",
",",
"num",
"=",
"10",
",",
"sortField",
"=",
"\"fullName\"",
",",
"sortOrder",
"=",
"\"asc\"",
",",
"role",
"=",
"None",
")",
":",
"users",
"=",
"[",
"]",
"url",
"=",
"self",
".",
"_url",
"+",
"\"/users\"",
"params",
"=",
"{",
"\"f\"",
":",
"\"json\"",
",",
"\"start\"",
":",
"start",
",",
"\"num\"",
":",
"num",
"}",
"if",
"not",
"role",
"is",
"None",
":",
"params",
"[",
"'role'",
"]",
"=",
"role",
"if",
"not",
"sortField",
"is",
"None",
":",
"params",
"[",
"'sortField'",
"]",
"=",
"sortField",
"if",
"not",
"sortOrder",
"is",
"None",
":",
"params",
"[",
"'sortOrder'",
"]",
"=",
"sortOrder",
"from",
".",
"_community",
"import",
"Community",
"res",
"=",
"self",
".",
"_post",
"(",
"url",
"=",
"url",
",",
"param_dict",
"=",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")",
"if",
"\"users\"",
"in",
"res",
":",
"if",
"len",
"(",
"res",
"[",
"'users'",
"]",
")",
">",
"0",
":",
"parsed",
"=",
"urlparse",
".",
"urlparse",
"(",
"self",
".",
"_url",
")",
"if",
"parsed",
".",
"netloc",
".",
"lower",
"(",
")",
".",
"find",
"(",
"'arcgis.com'",
")",
"==",
"-",
"1",
":",
"cURL",
"=",
"\"%s://%s/%s/sharing/rest/community\"",
"%",
"(",
"parsed",
".",
"scheme",
",",
"parsed",
".",
"netloc",
",",
"parsed",
".",
"path",
"[",
"1",
":",
"]",
".",
"split",
"(",
"'/'",
")",
"[",
"0",
"]",
")",
"else",
":",
"cURL",
"=",
"\"%s://%s/sharing/rest/community\"",
"%",
"(",
"parsed",
".",
"scheme",
",",
"parsed",
".",
"netloc",
")",
"com",
"=",
"Community",
"(",
"url",
"=",
"cURL",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")",
"for",
"r",
"in",
"res",
"[",
"'users'",
"]",
":",
"users",
".",
"append",
"(",
"com",
".",
"users",
".",
"user",
"(",
"r",
"[",
"\"username\"",
"]",
")",
")",
"res",
"[",
"'users'",
"]",
"=",
"users",
"return",
"res"
] | Lists all the members of the organization. The start and num paging
parameters are supported.
Inputs:
start - The number of the first entry in the result set response.
The index number is 1-based.
The default value of start is 1 (that is, the first
search result).
The start parameter, along with the num parameter, can
be used to paginate the search results.
num - The maximum number of results to be included in the result
set response.
The default value is 10, and the maximum allowed value is
100.The start parameter, along with the num parameter, can
be used to paginate the search results.
sortField - field to sort on
sortOrder - asc or desc on the sortField
role - name of the role or role id to search
Output:
list of User classes | [
"Lists",
"all",
"the",
"members",
"of",
"the",
"organization",
".",
"The",
"start",
"and",
"num",
"paging",
"parameters",
"are",
"supported",
"."
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_portals.py#L1267-L1334 | train |
Esri/ArcREST | src/arcrest/manageorg/_portals.py | Portal.roles | def roles(self):
"""gets the roles class that allows admins to manage custom roles
on portal"""
return Roles(url="%s/roles" % self.root,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | python | def roles(self):
"""gets the roles class that allows admins to manage custom roles
on portal"""
return Roles(url="%s/roles" % self.root,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | [
"def",
"roles",
"(",
"self",
")",
":",
"return",
"Roles",
"(",
"url",
"=",
"\"%s/roles\"",
"%",
"self",
".",
"root",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")"
] | gets the roles class that allows admins to manage custom roles
on portal | [
"gets",
"the",
"roles",
"class",
"that",
"allows",
"admins",
"to",
"manage",
"custom",
"roles",
"on",
"portal"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_portals.py#L1359-L1365 | train |
Esri/ArcREST | src/arcrest/manageorg/_portals.py | Portal.resources | def resources(self,
start=1,
num=10):
"""
Resources lists all file resources for the organization. The start
and num paging parameters are supported.
Inputs:
start - the number of the first entry in the result set response
The index number is 1-based and the default is 1
num - the maximum number of results to be returned as a whole #
"""
url = self._url + "/resources"
params = {
"f" : "json",
"start" : start,
"num" : num
}
return self._get(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | python | def resources(self,
start=1,
num=10):
"""
Resources lists all file resources for the organization. The start
and num paging parameters are supported.
Inputs:
start - the number of the first entry in the result set response
The index number is 1-based and the default is 1
num - the maximum number of results to be returned as a whole #
"""
url = self._url + "/resources"
params = {
"f" : "json",
"start" : start,
"num" : num
}
return self._get(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | [
"def",
"resources",
"(",
"self",
",",
"start",
"=",
"1",
",",
"num",
"=",
"10",
")",
":",
"url",
"=",
"self",
".",
"_url",
"+",
"\"/resources\"",
"params",
"=",
"{",
"\"f\"",
":",
"\"json\"",
",",
"\"start\"",
":",
"start",
",",
"\"num\"",
":",
"num",
"}",
"return",
"self",
".",
"_get",
"(",
"url",
"=",
"url",
",",
"param_dict",
"=",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")"
] | Resources lists all file resources for the organization. The start
and num paging parameters are supported.
Inputs:
start - the number of the first entry in the result set response
The index number is 1-based and the default is 1
num - the maximum number of results to be returned as a whole # | [
"Resources",
"lists",
"all",
"file",
"resources",
"for",
"the",
"organization",
".",
"The",
"start",
"and",
"num",
"paging",
"parameters",
"are",
"supported",
"."
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_portals.py#L1410-L1432 | train |
Esri/ArcREST | src/arcrest/manageorg/_portals.py | Portal.addResource | def addResource(self, key, filePath, text):
"""
The add resource operation allows the administrator to add a file
resource, for example, the organization's logo or custom banner.
The resource can be used by any member of the organization. File
resources use storage space from your quota and are scanned for
viruses.
Inputs:
key - The name the resource should be stored under.
filePath - path of file to upload
text - Some text to be written (for example, JSON or JavaScript)
directly to the resource from a web client.
"""
url = self.root + "/addresource"
params = {
"f": "json",
"token" : self._securityHandler.token,
"key" : key,
"text" : text
}
files = {}
files['file'] = filePath
res = self._post(url=url,
param_dict=params,
files=files,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port)
return res | python | def addResource(self, key, filePath, text):
"""
The add resource operation allows the administrator to add a file
resource, for example, the organization's logo or custom banner.
The resource can be used by any member of the organization. File
resources use storage space from your quota and are scanned for
viruses.
Inputs:
key - The name the resource should be stored under.
filePath - path of file to upload
text - Some text to be written (for example, JSON or JavaScript)
directly to the resource from a web client.
"""
url = self.root + "/addresource"
params = {
"f": "json",
"token" : self._securityHandler.token,
"key" : key,
"text" : text
}
files = {}
files['file'] = filePath
res = self._post(url=url,
param_dict=params,
files=files,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port)
return res | [
"def",
"addResource",
"(",
"self",
",",
"key",
",",
"filePath",
",",
"text",
")",
":",
"url",
"=",
"self",
".",
"root",
"+",
"\"/addresource\"",
"params",
"=",
"{",
"\"f\"",
":",
"\"json\"",
",",
"\"token\"",
":",
"self",
".",
"_securityHandler",
".",
"token",
",",
"\"key\"",
":",
"key",
",",
"\"text\"",
":",
"text",
"}",
"files",
"=",
"{",
"}",
"files",
"[",
"'file'",
"]",
"=",
"filePath",
"res",
"=",
"self",
".",
"_post",
"(",
"url",
"=",
"url",
",",
"param_dict",
"=",
"params",
",",
"files",
"=",
"files",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")",
"return",
"res"
] | The add resource operation allows the administrator to add a file
resource, for example, the organization's logo or custom banner.
The resource can be used by any member of the organization. File
resources use storage space from your quota and are scanned for
viruses.
Inputs:
key - The name the resource should be stored under.
filePath - path of file to upload
text - Some text to be written (for example, JSON or JavaScript)
directly to the resource from a web client. | [
"The",
"add",
"resource",
"operation",
"allows",
"the",
"administrator",
"to",
"add",
"a",
"file",
"resource",
"for",
"example",
"the",
"organization",
"s",
"logo",
"or",
"custom",
"banner",
".",
"The",
"resource",
"can",
"be",
"used",
"by",
"any",
"member",
"of",
"the",
"organization",
".",
"File",
"resources",
"use",
"storage",
"space",
"from",
"your",
"quota",
"and",
"are",
"scanned",
"for",
"viruses",
"."
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_portals.py#L1434-L1464 | train |
Esri/ArcREST | src/arcrest/manageorg/_portals.py | Portal.updateSecurityPolicy | def updateSecurityPolicy(self,
minLength=8,
minUpper=None,
minLower=None,
minLetter=None,
minDigit=None,
minOther=None,
expirationInDays=None,
historySize=None):
"""updates the Portals security policy"""
params = {
"f" : "json",
"minLength" : minLength,
"minUpper": minUpper,
"minLower": minLower,
"minLetter": minLetter,
"minDigit": minDigit,
"minOther": minOther,
"expirationInDays" : expirationInDays,
"historySize": historySize
}
url = "%s/securityPolicy/update" % self.root
return self._post(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | python | def updateSecurityPolicy(self,
minLength=8,
minUpper=None,
minLower=None,
minLetter=None,
minDigit=None,
minOther=None,
expirationInDays=None,
historySize=None):
"""updates the Portals security policy"""
params = {
"f" : "json",
"minLength" : minLength,
"minUpper": minUpper,
"minLower": minLower,
"minLetter": minLetter,
"minDigit": minDigit,
"minOther": minOther,
"expirationInDays" : expirationInDays,
"historySize": historySize
}
url = "%s/securityPolicy/update" % self.root
return self._post(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | [
"def",
"updateSecurityPolicy",
"(",
"self",
",",
"minLength",
"=",
"8",
",",
"minUpper",
"=",
"None",
",",
"minLower",
"=",
"None",
",",
"minLetter",
"=",
"None",
",",
"minDigit",
"=",
"None",
",",
"minOther",
"=",
"None",
",",
"expirationInDays",
"=",
"None",
",",
"historySize",
"=",
"None",
")",
":",
"params",
"=",
"{",
"\"f\"",
":",
"\"json\"",
",",
"\"minLength\"",
":",
"minLength",
",",
"\"minUpper\"",
":",
"minUpper",
",",
"\"minLower\"",
":",
"minLower",
",",
"\"minLetter\"",
":",
"minLetter",
",",
"\"minDigit\"",
":",
"minDigit",
",",
"\"minOther\"",
":",
"minOther",
",",
"\"expirationInDays\"",
":",
"expirationInDays",
",",
"\"historySize\"",
":",
"historySize",
"}",
"url",
"=",
"\"%s/securityPolicy/update\"",
"%",
"self",
".",
"root",
"return",
"self",
".",
"_post",
"(",
"url",
"=",
"url",
",",
"param_dict",
"=",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")"
] | updates the Portals security policy | [
"updates",
"the",
"Portals",
"security",
"policy"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_portals.py#L1506-L1532 | train |
Esri/ArcREST | src/arcrest/manageorg/_portals.py | Portal.portalAdmin | def portalAdmin(self):
"""gets a reference to a portal administration class"""
from ..manageportal import PortalAdministration
return PortalAdministration(admin_url="https://%s/portaladmin" % self.portalHostname,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port,
initalize=False) | python | def portalAdmin(self):
"""gets a reference to a portal administration class"""
from ..manageportal import PortalAdministration
return PortalAdministration(admin_url="https://%s/portaladmin" % self.portalHostname,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port,
initalize=False) | [
"def",
"portalAdmin",
"(",
"self",
")",
":",
"from",
".",
".",
"manageportal",
"import",
"PortalAdministration",
"return",
"PortalAdministration",
"(",
"admin_url",
"=",
"\"https://%s/portaladmin\"",
"%",
"self",
".",
"portalHostname",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
",",
"initalize",
"=",
"False",
")"
] | gets a reference to a portal administration class | [
"gets",
"a",
"reference",
"to",
"a",
"portal",
"administration",
"class"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_portals.py#L1536-L1543 | train |
Esri/ArcREST | src/arcrest/manageorg/_portals.py | Portal.addUser | def addUser(self, invitationList,
subject, html):
"""
adds a user without sending an invitation email
Inputs:
invitationList - InvitationList class used to add users without
sending an email
subject - email subject
html - email message sent to users in invitation list object
"""
url = self._url + "/invite"
params = {"f" : "json"}
if isinstance(invitationList, parameters.InvitationList):
params['invitationList'] = invitationList.value()
params['html'] = html
params['subject'] = subject
return self._post(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | python | def addUser(self, invitationList,
subject, html):
"""
adds a user without sending an invitation email
Inputs:
invitationList - InvitationList class used to add users without
sending an email
subject - email subject
html - email message sent to users in invitation list object
"""
url = self._url + "/invite"
params = {"f" : "json"}
if isinstance(invitationList, parameters.InvitationList):
params['invitationList'] = invitationList.value()
params['html'] = html
params['subject'] = subject
return self._post(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | [
"def",
"addUser",
"(",
"self",
",",
"invitationList",
",",
"subject",
",",
"html",
")",
":",
"url",
"=",
"self",
".",
"_url",
"+",
"\"/invite\"",
"params",
"=",
"{",
"\"f\"",
":",
"\"json\"",
"}",
"if",
"isinstance",
"(",
"invitationList",
",",
"parameters",
".",
"InvitationList",
")",
":",
"params",
"[",
"'invitationList'",
"]",
"=",
"invitationList",
".",
"value",
"(",
")",
"params",
"[",
"'html'",
"]",
"=",
"html",
"params",
"[",
"'subject'",
"]",
"=",
"subject",
"return",
"self",
".",
"_post",
"(",
"url",
"=",
"url",
",",
"param_dict",
"=",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")"
] | adds a user without sending an invitation email
Inputs:
invitationList - InvitationList class used to add users without
sending an email
subject - email subject
html - email message sent to users in invitation list object | [
"adds",
"a",
"user",
"without",
"sending",
"an",
"invitation",
"email"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_portals.py#L1545-L1566 | train |
Esri/ArcREST | src/arcrest/manageorg/_portals.py | Portal.inviteByEmail | def inviteByEmail(self,
emails,
subject,
text,
html,
role="org_user",
mustApprove=True,
expiration=1440):
"""Invites a user or users to a site.
Inputs:
emails - comma seperated list of emails
subject - title of email
text - email text
html - email text in html
role - site role (can't be administrator)
mustApprove - verifies if user that is join must be approved by
an administrator
expiration - time in seconds. Default is 1 day 1440
"""
url = self.root + "/inviteByEmail"
params = {
"f" : "json",
"emails": emails,
"subject": subject,
"text": text,
"html" : html,
"role" : role,
"mustApprove": mustApprove,
"expiration" : expiration
}
return self._post(url=url, param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | python | def inviteByEmail(self,
emails,
subject,
text,
html,
role="org_user",
mustApprove=True,
expiration=1440):
"""Invites a user or users to a site.
Inputs:
emails - comma seperated list of emails
subject - title of email
text - email text
html - email text in html
role - site role (can't be administrator)
mustApprove - verifies if user that is join must be approved by
an administrator
expiration - time in seconds. Default is 1 day 1440
"""
url = self.root + "/inviteByEmail"
params = {
"f" : "json",
"emails": emails,
"subject": subject,
"text": text,
"html" : html,
"role" : role,
"mustApprove": mustApprove,
"expiration" : expiration
}
return self._post(url=url, param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | [
"def",
"inviteByEmail",
"(",
"self",
",",
"emails",
",",
"subject",
",",
"text",
",",
"html",
",",
"role",
"=",
"\"org_user\"",
",",
"mustApprove",
"=",
"True",
",",
"expiration",
"=",
"1440",
")",
":",
"url",
"=",
"self",
".",
"root",
"+",
"\"/inviteByEmail\"",
"params",
"=",
"{",
"\"f\"",
":",
"\"json\"",
",",
"\"emails\"",
":",
"emails",
",",
"\"subject\"",
":",
"subject",
",",
"\"text\"",
":",
"text",
",",
"\"html\"",
":",
"html",
",",
"\"role\"",
":",
"role",
",",
"\"mustApprove\"",
":",
"mustApprove",
",",
"\"expiration\"",
":",
"expiration",
"}",
"return",
"self",
".",
"_post",
"(",
"url",
"=",
"url",
",",
"param_dict",
"=",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")"
] | Invites a user or users to a site.
Inputs:
emails - comma seperated list of emails
subject - title of email
text - email text
html - email text in html
role - site role (can't be administrator)
mustApprove - verifies if user that is join must be approved by
an administrator
expiration - time in seconds. Default is 1 day 1440 | [
"Invites",
"a",
"user",
"or",
"users",
"to",
"a",
"site",
"."
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_portals.py#L1568-L1602 | train |
Esri/ArcREST | src/arcrest/manageorg/_portals.py | Portal.usage | def usage(self, startTime, endTime, vars=None, period=None,
groupby=None, name=None, stype=None, etype=None,
appId=None, deviceId=None, username=None, appOrgId=None,
userOrgId=None, hostOrgId=None):
"""
returns the usage statistics value
"""
url = self.root + "/usage"
startTime = str(int(local_time_to_online(dt=startTime)))
endTime = str(int(local_time_to_online(dt=endTime)))
params = {
'f' : 'json',
'startTime' : startTime,
'endTime' : endTime,
'vars' : vars,
'period' : period,
'groupby' : groupby,
'name' : name,
'stype' : stype,
'etype' : etype,
'appId' : appId,
'deviceId' : deviceId,
'username' : username,
'appOrgId' : appOrgId,
'userOrgId' : userOrgId,
'hostOrgId' : hostOrgId,
}
params = {key:item for key,item in params.items() if item is not None}
return self._post(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | python | def usage(self, startTime, endTime, vars=None, period=None,
groupby=None, name=None, stype=None, etype=None,
appId=None, deviceId=None, username=None, appOrgId=None,
userOrgId=None, hostOrgId=None):
"""
returns the usage statistics value
"""
url = self.root + "/usage"
startTime = str(int(local_time_to_online(dt=startTime)))
endTime = str(int(local_time_to_online(dt=endTime)))
params = {
'f' : 'json',
'startTime' : startTime,
'endTime' : endTime,
'vars' : vars,
'period' : period,
'groupby' : groupby,
'name' : name,
'stype' : stype,
'etype' : etype,
'appId' : appId,
'deviceId' : deviceId,
'username' : username,
'appOrgId' : appOrgId,
'userOrgId' : userOrgId,
'hostOrgId' : hostOrgId,
}
params = {key:item for key,item in params.items() if item is not None}
return self._post(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | [
"def",
"usage",
"(",
"self",
",",
"startTime",
",",
"endTime",
",",
"vars",
"=",
"None",
",",
"period",
"=",
"None",
",",
"groupby",
"=",
"None",
",",
"name",
"=",
"None",
",",
"stype",
"=",
"None",
",",
"etype",
"=",
"None",
",",
"appId",
"=",
"None",
",",
"deviceId",
"=",
"None",
",",
"username",
"=",
"None",
",",
"appOrgId",
"=",
"None",
",",
"userOrgId",
"=",
"None",
",",
"hostOrgId",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"root",
"+",
"\"/usage\"",
"startTime",
"=",
"str",
"(",
"int",
"(",
"local_time_to_online",
"(",
"dt",
"=",
"startTime",
")",
")",
")",
"endTime",
"=",
"str",
"(",
"int",
"(",
"local_time_to_online",
"(",
"dt",
"=",
"endTime",
")",
")",
")",
"params",
"=",
"{",
"'f'",
":",
"'json'",
",",
"'startTime'",
":",
"startTime",
",",
"'endTime'",
":",
"endTime",
",",
"'vars'",
":",
"vars",
",",
"'period'",
":",
"period",
",",
"'groupby'",
":",
"groupby",
",",
"'name'",
":",
"name",
",",
"'stype'",
":",
"stype",
",",
"'etype'",
":",
"etype",
",",
"'appId'",
":",
"appId",
",",
"'deviceId'",
":",
"deviceId",
",",
"'username'",
":",
"username",
",",
"'appOrgId'",
":",
"appOrgId",
",",
"'userOrgId'",
":",
"userOrgId",
",",
"'hostOrgId'",
":",
"hostOrgId",
",",
"}",
"params",
"=",
"{",
"key",
":",
"item",
"for",
"key",
",",
"item",
"in",
"params",
".",
"items",
"(",
")",
"if",
"item",
"is",
"not",
"None",
"}",
"return",
"self",
".",
"_post",
"(",
"url",
"=",
"url",
",",
"param_dict",
"=",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")"
] | returns the usage statistics value | [
"returns",
"the",
"usage",
"statistics",
"value"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_portals.py#L1615-L1650 | train |
Esri/ArcREST | src/arcrest/manageorg/_portals.py | Servers.servers | def servers(self):
"""gets all the server resources"""
self.__init()
items = []
for k,v in self._json_dict.items():
if k == "servers":
for s in v:
if 'id' in s:
url = "%s/%s" % (self.root, s['id'])
items.append(
self.Server(url=url,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port))
del k,v
return items | python | def servers(self):
"""gets all the server resources"""
self.__init()
items = []
for k,v in self._json_dict.items():
if k == "servers":
for s in v:
if 'id' in s:
url = "%s/%s" % (self.root, s['id'])
items.append(
self.Server(url=url,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port))
del k,v
return items | [
"def",
"servers",
"(",
"self",
")",
":",
"self",
".",
"__init",
"(",
")",
"items",
"=",
"[",
"]",
"for",
"k",
",",
"v",
"in",
"self",
".",
"_json_dict",
".",
"items",
"(",
")",
":",
"if",
"k",
"==",
"\"servers\"",
":",
"for",
"s",
"in",
"v",
":",
"if",
"'id'",
"in",
"s",
":",
"url",
"=",
"\"%s/%s\"",
"%",
"(",
"self",
".",
"root",
",",
"s",
"[",
"'id'",
"]",
")",
"items",
".",
"append",
"(",
"self",
".",
"Server",
"(",
"url",
"=",
"url",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")",
")",
"del",
"k",
",",
"v",
"return",
"items"
] | gets all the server resources | [
"gets",
"all",
"the",
"server",
"resources"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_portals.py#L1976-L1991 | train |
Esri/ArcREST | src/arcrest/manageorg/_portals.py | Roles.deleteRole | def deleteRole(self, roleID):
"""
deletes a role by ID
"""
url = self._url + "/%s/delete" % roleID
params = {
"f" : "json"
}
return self._post(url=url,
param_dict=params,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | python | def deleteRole(self, roleID):
"""
deletes a role by ID
"""
url = self._url + "/%s/delete" % roleID
params = {
"f" : "json"
}
return self._post(url=url,
param_dict=params,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | [
"def",
"deleteRole",
"(",
"self",
",",
"roleID",
")",
":",
"url",
"=",
"self",
".",
"_url",
"+",
"\"/%s/delete\"",
"%",
"roleID",
"params",
"=",
"{",
"\"f\"",
":",
"\"json\"",
"}",
"return",
"self",
".",
"_post",
"(",
"url",
"=",
"url",
",",
"param_dict",
"=",
"params",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")"
] | deletes a role by ID | [
"deletes",
"a",
"role",
"by",
"ID"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_portals.py#L2059-L2071 | train |
Esri/ArcREST | src/arcrest/manageorg/_portals.py | Roles.updateRole | def updateRole(self, roleID, name, description):
"""allows for the role name or description to be modified"""
params = {
"name" : name,
"description" : description,
"f" : "json"
}
url = self._url + "/%s/update"
return self._post(url=url,
param_dict=params,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | python | def updateRole(self, roleID, name, description):
"""allows for the role name or description to be modified"""
params = {
"name" : name,
"description" : description,
"f" : "json"
}
url = self._url + "/%s/update"
return self._post(url=url,
param_dict=params,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | [
"def",
"updateRole",
"(",
"self",
",",
"roleID",
",",
"name",
",",
"description",
")",
":",
"params",
"=",
"{",
"\"name\"",
":",
"name",
",",
"\"description\"",
":",
"description",
",",
"\"f\"",
":",
"\"json\"",
"}",
"url",
"=",
"self",
".",
"_url",
"+",
"\"/%s/update\"",
"return",
"self",
".",
"_post",
"(",
"url",
"=",
"url",
",",
"param_dict",
"=",
"params",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")"
] | allows for the role name or description to be modified | [
"allows",
"for",
"the",
"role",
"name",
"or",
"description",
"to",
"be",
"modified"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_portals.py#L2073-L2084 | train |
Esri/ArcREST | src/arcrest/manageorg/_portals.py | Roles.findRoleID | def findRoleID(self, name):
"""searches the roles by name and returns the role's ID"""
for r in self:
if r['name'].lower() == name.lower():
return r['id']
del r
return None | python | def findRoleID(self, name):
"""searches the roles by name and returns the role's ID"""
for r in self:
if r['name'].lower() == name.lower():
return r['id']
del r
return None | [
"def",
"findRoleID",
"(",
"self",
",",
"name",
")",
":",
"for",
"r",
"in",
"self",
":",
"if",
"r",
"[",
"'name'",
"]",
".",
"lower",
"(",
")",
"==",
"name",
".",
"lower",
"(",
")",
":",
"return",
"r",
"[",
"'id'",
"]",
"del",
"r",
"return",
"None"
] | searches the roles by name and returns the role's ID | [
"searches",
"the",
"roles",
"by",
"name",
"and",
"returns",
"the",
"role",
"s",
"ID"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_portals.py#L2096-L2102 | train |
Esri/ArcREST | tools/src/addUser.py | get_config_value | def get_config_value(config_file, section, variable):
""" extracts a config file value """
try:
parser = ConfigParser.SafeConfigParser()
parser.read(config_file)
return parser.get(section, variable)
except:
return None | python | def get_config_value(config_file, section, variable):
""" extracts a config file value """
try:
parser = ConfigParser.SafeConfigParser()
parser.read(config_file)
return parser.get(section, variable)
except:
return None | [
"def",
"get_config_value",
"(",
"config_file",
",",
"section",
",",
"variable",
")",
":",
"try",
":",
"parser",
"=",
"ConfigParser",
".",
"SafeConfigParser",
"(",
")",
"parser",
".",
"read",
"(",
"config_file",
")",
"return",
"parser",
".",
"get",
"(",
"section",
",",
"variable",
")",
"except",
":",
"return",
"None"
] | extracts a config file value | [
"extracts",
"a",
"config",
"file",
"value"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/tools/src/addUser.py#L38-L45 | train |
Esri/ArcREST | src/arcrest/manageorg/_content.py | Content.users | def users(self):
"""
Provides access to all user resources
"""
return Users(url="%s/users" % self.root,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | python | def users(self):
"""
Provides access to all user resources
"""
return Users(url="%s/users" % self.root,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | [
"def",
"users",
"(",
"self",
")",
":",
"return",
"Users",
"(",
"url",
"=",
"\"%s/users\"",
"%",
"self",
".",
"root",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")"
] | Provides access to all user resources | [
"Provides",
"access",
"to",
"all",
"user",
"resources"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_content.py#L62-L69 | train |
Esri/ArcREST | src/arcrest/manageorg/_content.py | Content.getItem | def getItem(self, itemId):
"""gets the refernce to the Items class which manages content on a
given AGOL or Portal site.
"""
url = "%s/items/%s" % (self.root, itemId)
return Item(url=url,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | python | def getItem(self, itemId):
"""gets the refernce to the Items class which manages content on a
given AGOL or Portal site.
"""
url = "%s/items/%s" % (self.root, itemId)
return Item(url=url,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | [
"def",
"getItem",
"(",
"self",
",",
"itemId",
")",
":",
"url",
"=",
"\"%s/items/%s\"",
"%",
"(",
"self",
".",
"root",
",",
"itemId",
")",
"return",
"Item",
"(",
"url",
"=",
"url",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")"
] | gets the refernce to the Items class which manages content on a
given AGOL or Portal site. | [
"gets",
"the",
"refernce",
"to",
"the",
"Items",
"class",
"which",
"manages",
"content",
"on",
"a",
"given",
"AGOL",
"or",
"Portal",
"site",
"."
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_content.py#L71-L79 | train |
Esri/ArcREST | src/arcrest/manageorg/_content.py | Content.FeatureContent | def FeatureContent(self):
"""Feature Content class id the parent resource for feature
operations such as Analyze and Generate."""
return FeatureContent(url="%s/%s" % (self.root, "features"),
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | python | def FeatureContent(self):
"""Feature Content class id the parent resource for feature
operations such as Analyze and Generate."""
return FeatureContent(url="%s/%s" % (self.root, "features"),
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | [
"def",
"FeatureContent",
"(",
"self",
")",
":",
"return",
"FeatureContent",
"(",
"url",
"=",
"\"%s/%s\"",
"%",
"(",
"self",
".",
"root",
",",
"\"features\"",
")",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")"
] | Feature Content class id the parent resource for feature
operations such as Analyze and Generate. | [
"Feature",
"Content",
"class",
"id",
"the",
"parent",
"resource",
"for",
"feature",
"operations",
"such",
"as",
"Analyze",
"and",
"Generate",
"."
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_content.py#L82-L88 | train |
Esri/ArcREST | src/arcrest/manageorg/_content.py | Users.user | def user(self, username=None):
"""gets the user's content. If None is passed, the current user is
used.
Input:
username - name of the login for a given user on a site.
"""
if username is None:
username = self.__getUsername()
url = "%s/%s" % (self.root, username)
return User(url=url,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port,
initalize=True) | python | def user(self, username=None):
"""gets the user's content. If None is passed, the current user is
used.
Input:
username - name of the login for a given user on a site.
"""
if username is None:
username = self.__getUsername()
url = "%s/%s" % (self.root, username)
return User(url=url,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port,
initalize=True) | [
"def",
"user",
"(",
"self",
",",
"username",
"=",
"None",
")",
":",
"if",
"username",
"is",
"None",
":",
"username",
"=",
"self",
".",
"__getUsername",
"(",
")",
"url",
"=",
"\"%s/%s\"",
"%",
"(",
"self",
".",
"root",
",",
"username",
")",
"return",
"User",
"(",
"url",
"=",
"url",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
",",
"initalize",
"=",
"True",
")"
] | gets the user's content. If None is passed, the current user is
used.
Input:
username - name of the login for a given user on a site. | [
"gets",
"the",
"user",
"s",
"content",
".",
"If",
"None",
"is",
"passed",
"the",
"current",
"user",
"is",
"used",
"."
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_content.py#L182-L197 | train |
Esri/ArcREST | src/arcrest/manageorg/_content.py | Item.saveThumbnail | def saveThumbnail(self,fileName,filePath):
""" URL to the thumbnail used for the item """
if self._thumbnail is None:
self.__init()
param_dict = {}
if self._thumbnail is not None:
imgUrl = self.root + "/info/" + self._thumbnail
onlineFileName, file_ext = splitext(self._thumbnail)
fileNameSafe = "".join(x for x in fileName if x.isalnum()) + file_ext
result = self._get(url=imgUrl,
param_dict=param_dict,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port,
out_folder=filePath,
file_name=fileNameSafe)
return result
else:
return None | python | def saveThumbnail(self,fileName,filePath):
""" URL to the thumbnail used for the item """
if self._thumbnail is None:
self.__init()
param_dict = {}
if self._thumbnail is not None:
imgUrl = self.root + "/info/" + self._thumbnail
onlineFileName, file_ext = splitext(self._thumbnail)
fileNameSafe = "".join(x for x in fileName if x.isalnum()) + file_ext
result = self._get(url=imgUrl,
param_dict=param_dict,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port,
out_folder=filePath,
file_name=fileNameSafe)
return result
else:
return None | [
"def",
"saveThumbnail",
"(",
"self",
",",
"fileName",
",",
"filePath",
")",
":",
"if",
"self",
".",
"_thumbnail",
"is",
"None",
":",
"self",
".",
"__init",
"(",
")",
"param_dict",
"=",
"{",
"}",
"if",
"self",
".",
"_thumbnail",
"is",
"not",
"None",
":",
"imgUrl",
"=",
"self",
".",
"root",
"+",
"\"/info/\"",
"+",
"self",
".",
"_thumbnail",
"onlineFileName",
",",
"file_ext",
"=",
"splitext",
"(",
"self",
".",
"_thumbnail",
")",
"fileNameSafe",
"=",
"\"\"",
".",
"join",
"(",
"x",
"for",
"x",
"in",
"fileName",
"if",
"x",
".",
"isalnum",
"(",
")",
")",
"+",
"file_ext",
"result",
"=",
"self",
".",
"_get",
"(",
"url",
"=",
"imgUrl",
",",
"param_dict",
"=",
"param_dict",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
",",
"out_folder",
"=",
"filePath",
",",
"file_name",
"=",
"fileNameSafe",
")",
"return",
"result",
"else",
":",
"return",
"None"
] | URL to the thumbnail used for the item | [
"URL",
"to",
"the",
"thumbnail",
"used",
"for",
"the",
"item"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_content.py#L501-L519 | train |
Esri/ArcREST | src/arcrest/manageorg/_content.py | Item.userItem | def userItem(self):
"""returns a reference to the UserItem class"""
if self.ownerFolder is not None:
url = "%s/users/%s/%s/items/%s" % (self.root.split('/items/')[0], self.owner,self.ownerFolder, self.id)
else:
url = "%s/users/%s/items/%s" % (self.root.split('/items/')[0], self.owner, self.id)
return UserItem(url=url,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | python | def userItem(self):
"""returns a reference to the UserItem class"""
if self.ownerFolder is not None:
url = "%s/users/%s/%s/items/%s" % (self.root.split('/items/')[0], self.owner,self.ownerFolder, self.id)
else:
url = "%s/users/%s/items/%s" % (self.root.split('/items/')[0], self.owner, self.id)
return UserItem(url=url,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | [
"def",
"userItem",
"(",
"self",
")",
":",
"if",
"self",
".",
"ownerFolder",
"is",
"not",
"None",
":",
"url",
"=",
"\"%s/users/%s/%s/items/%s\"",
"%",
"(",
"self",
".",
"root",
".",
"split",
"(",
"'/items/'",
")",
"[",
"0",
"]",
",",
"self",
".",
"owner",
",",
"self",
".",
"ownerFolder",
",",
"self",
".",
"id",
")",
"else",
":",
"url",
"=",
"\"%s/users/%s/items/%s\"",
"%",
"(",
"self",
".",
"root",
".",
"split",
"(",
"'/items/'",
")",
"[",
"0",
"]",
",",
"self",
".",
"owner",
",",
"self",
".",
"id",
")",
"return",
"UserItem",
"(",
"url",
"=",
"url",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")"
] | returns a reference to the UserItem class | [
"returns",
"a",
"reference",
"to",
"the",
"UserItem",
"class"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_content.py#L675-L684 | train |
Esri/ArcREST | src/arcrest/manageorg/_content.py | Item.addRating | def addRating(self, rating=5.0):
"""Adds a rating to an item between 1.0 and 5.0"""
if rating > 5.0:
rating = 5.0
elif rating < 1.0:
rating = 1.0
url = "%s/addRating" % self.root
params = {
"f": "json",
"rating" : "%s" % rating
}
return self._post(url,
params,
proxy_port=self._proxy_port,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url) | python | def addRating(self, rating=5.0):
"""Adds a rating to an item between 1.0 and 5.0"""
if rating > 5.0:
rating = 5.0
elif rating < 1.0:
rating = 1.0
url = "%s/addRating" % self.root
params = {
"f": "json",
"rating" : "%s" % rating
}
return self._post(url,
params,
proxy_port=self._proxy_port,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url) | [
"def",
"addRating",
"(",
"self",
",",
"rating",
"=",
"5.0",
")",
":",
"if",
"rating",
">",
"5.0",
":",
"rating",
"=",
"5.0",
"elif",
"rating",
"<",
"1.0",
":",
"rating",
"=",
"1.0",
"url",
"=",
"\"%s/addRating\"",
"%",
"self",
".",
"root",
"params",
"=",
"{",
"\"f\"",
":",
"\"json\"",
",",
"\"rating\"",
":",
"\"%s\"",
"%",
"rating",
"}",
"return",
"self",
".",
"_post",
"(",
"url",
",",
"params",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
")"
] | Adds a rating to an item between 1.0 and 5.0 | [
"Adds",
"a",
"rating",
"to",
"an",
"item",
"between",
"1",
".",
"0",
"and",
"5",
".",
"0"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_content.py#L781-L796 | train |
Esri/ArcREST | src/arcrest/manageorg/_content.py | Item.addComment | def addComment(self, comment):
""" adds a comment to a given item. Must be authenticated """
url = "%s/addComment" % self.root
params = {
"f" : "json",
"comment" : comment
}
return self._post(url, params, proxy_port=self._proxy_port,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url) | python | def addComment(self, comment):
""" adds a comment to a given item. Must be authenticated """
url = "%s/addComment" % self.root
params = {
"f" : "json",
"comment" : comment
}
return self._post(url, params, proxy_port=self._proxy_port,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url) | [
"def",
"addComment",
"(",
"self",
",",
"comment",
")",
":",
"url",
"=",
"\"%s/addComment\"",
"%",
"self",
".",
"root",
"params",
"=",
"{",
"\"f\"",
":",
"\"json\"",
",",
"\"comment\"",
":",
"comment",
"}",
"return",
"self",
".",
"_post",
"(",
"url",
",",
"params",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
")"
] | adds a comment to a given item. Must be authenticated | [
"adds",
"a",
"comment",
"to",
"a",
"given",
"item",
".",
"Must",
"be",
"authenticated"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_content.py#L811-L820 | train |
Esri/ArcREST | src/arcrest/manageorg/_content.py | Item.itemComment | def itemComment(self, commentId):
""" returns details of a single comment """
url = "%s/comments/%s" % (self.root, commentId)
params = {
"f": "json"
}
return self._get(url,
params,
securityHandler=self._securityHandler,
proxy_port=self._proxy_port,
proxy_url=self._proxy_url) | python | def itemComment(self, commentId):
""" returns details of a single comment """
url = "%s/comments/%s" % (self.root, commentId)
params = {
"f": "json"
}
return self._get(url,
params,
securityHandler=self._securityHandler,
proxy_port=self._proxy_port,
proxy_url=self._proxy_url) | [
"def",
"itemComment",
"(",
"self",
",",
"commentId",
")",
":",
"url",
"=",
"\"%s/comments/%s\"",
"%",
"(",
"self",
".",
"root",
",",
"commentId",
")",
"params",
"=",
"{",
"\"f\"",
":",
"\"json\"",
"}",
"return",
"self",
".",
"_get",
"(",
"url",
",",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
")"
] | returns details of a single comment | [
"returns",
"details",
"of",
"a",
"single",
"comment"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_content.py#L822-L832 | train |
Esri/ArcREST | src/arcrest/manageorg/_content.py | Item.itemComments | def itemComments(self):
""" returns all comments for a given item """
url = "%s/comments/" % self.root
params = {
"f": "json"
}
return self._get(url,
params,
securityHandler=self._securityHandler,
proxy_port=self._proxy_port,
proxy_url=self._proxy_url) | python | def itemComments(self):
""" returns all comments for a given item """
url = "%s/comments/" % self.root
params = {
"f": "json"
}
return self._get(url,
params,
securityHandler=self._securityHandler,
proxy_port=self._proxy_port,
proxy_url=self._proxy_url) | [
"def",
"itemComments",
"(",
"self",
")",
":",
"url",
"=",
"\"%s/comments/\"",
"%",
"self",
".",
"root",
"params",
"=",
"{",
"\"f\"",
":",
"\"json\"",
"}",
"return",
"self",
".",
"_get",
"(",
"url",
",",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
")"
] | returns all comments for a given item | [
"returns",
"all",
"comments",
"for",
"a",
"given",
"item"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_content.py#L835-L845 | train |
Esri/ArcREST | src/arcrest/manageorg/_content.py | Item.deleteComment | def deleteComment(self, commentId):
""" removes a comment from an Item
Inputs:
commentId - unique id of comment to remove
"""
url = "%s/comments/%s/delete" % (self.root, commentId)
params = {
"f": "json",
}
return self._post(url,
params,
securityHandler=self._securityHandler,
proxy_port=self._proxy_port,
proxy_url=self._proxy_url) | python | def deleteComment(self, commentId):
""" removes a comment from an Item
Inputs:
commentId - unique id of comment to remove
"""
url = "%s/comments/%s/delete" % (self.root, commentId)
params = {
"f": "json",
}
return self._post(url,
params,
securityHandler=self._securityHandler,
proxy_port=self._proxy_port,
proxy_url=self._proxy_url) | [
"def",
"deleteComment",
"(",
"self",
",",
"commentId",
")",
":",
"url",
"=",
"\"%s/comments/%s/delete\"",
"%",
"(",
"self",
".",
"root",
",",
"commentId",
")",
"params",
"=",
"{",
"\"f\"",
":",
"\"json\"",
",",
"}",
"return",
"self",
".",
"_post",
"(",
"url",
",",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
")"
] | removes a comment from an Item
Inputs:
commentId - unique id of comment to remove | [
"removes",
"a",
"comment",
"from",
"an",
"Item"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_content.py#L847-L861 | train |
Esri/ArcREST | src/arcrest/manageorg/_content.py | Item.packageInfo | def packageInfo(self):
"""gets the item's package information file"""
url = "%s/item.pkinfo" % self.root
params = {'f' : 'json'}
result = self._get(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port,
out_folder=tempfile.gettempdir())
return result | python | def packageInfo(self):
"""gets the item's package information file"""
url = "%s/item.pkinfo" % self.root
params = {'f' : 'json'}
result = self._get(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port,
out_folder=tempfile.gettempdir())
return result | [
"def",
"packageInfo",
"(",
"self",
")",
":",
"url",
"=",
"\"%s/item.pkinfo\"",
"%",
"self",
".",
"root",
"params",
"=",
"{",
"'f'",
":",
"'json'",
"}",
"result",
"=",
"self",
".",
"_get",
"(",
"url",
"=",
"url",
",",
"param_dict",
"=",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
",",
"out_folder",
"=",
"tempfile",
".",
"gettempdir",
"(",
")",
")",
"return",
"result"
] | gets the item's package information file | [
"gets",
"the",
"item",
"s",
"package",
"information",
"file"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_content.py#L936-L946 | train |
Esri/ArcREST | src/arcrest/manageorg/_content.py | UserItem.item | def item(self):
"""returns the Item class of an Item"""
url = self._contentURL
return Item(url=self._contentURL,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port,
initalize=True) | python | def item(self):
"""returns the Item class of an Item"""
url = self._contentURL
return Item(url=self._contentURL,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port,
initalize=True) | [
"def",
"item",
"(",
"self",
")",
":",
"url",
"=",
"self",
".",
"_contentURL",
"return",
"Item",
"(",
"url",
"=",
"self",
".",
"_contentURL",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
",",
"initalize",
"=",
"True",
")"
] | returns the Item class of an Item | [
"returns",
"the",
"Item",
"class",
"of",
"an",
"Item"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_content.py#L1478-L1485 | train |
Esri/ArcREST | src/arcrest/manageorg/_content.py | UserItem.reassignItem | def reassignItem(self,
targetUsername,
targetFoldername):
"""
The Reassign Item operation allows the administrator of an
organization to reassign a member's item to another member of the
organization.
Inputs:
targetUsername - The target username of the new owner of the
item
targetFoldername - The destination folder for the item. If the
item is to be moved to the root folder,
specify the value as "/" (forward slash). If
the target folder doesn't exist, it will be
created automatically.
"""
params = {
"f" : "json",
"targetUsername" : targetUsername,
"targetFoldername" : targetFoldername
}
url = "%s/reassign" % self.root
return self._post(
url = url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | python | def reassignItem(self,
targetUsername,
targetFoldername):
"""
The Reassign Item operation allows the administrator of an
organization to reassign a member's item to another member of the
organization.
Inputs:
targetUsername - The target username of the new owner of the
item
targetFoldername - The destination folder for the item. If the
item is to be moved to the root folder,
specify the value as "/" (forward slash). If
the target folder doesn't exist, it will be
created automatically.
"""
params = {
"f" : "json",
"targetUsername" : targetUsername,
"targetFoldername" : targetFoldername
}
url = "%s/reassign" % self.root
return self._post(
url = url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | [
"def",
"reassignItem",
"(",
"self",
",",
"targetUsername",
",",
"targetFoldername",
")",
":",
"params",
"=",
"{",
"\"f\"",
":",
"\"json\"",
",",
"\"targetUsername\"",
":",
"targetUsername",
",",
"\"targetFoldername\"",
":",
"targetFoldername",
"}",
"url",
"=",
"\"%s/reassign\"",
"%",
"self",
".",
"root",
"return",
"self",
".",
"_post",
"(",
"url",
"=",
"url",
",",
"param_dict",
"=",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")"
] | The Reassign Item operation allows the administrator of an
organization to reassign a member's item to another member of the
organization.
Inputs:
targetUsername - The target username of the new owner of the
item
targetFoldername - The destination folder for the item. If the
item is to be moved to the root folder,
specify the value as "/" (forward slash). If
the target folder doesn't exist, it will be
created automatically. | [
"The",
"Reassign",
"Item",
"operation",
"allows",
"the",
"administrator",
"of",
"an",
"organization",
"to",
"reassign",
"a",
"member",
"s",
"item",
"to",
"another",
"member",
"of",
"the",
"organization",
"."
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_content.py#L1576-L1604 | train |
Esri/ArcREST | src/arcrest/manageorg/_content.py | UserItem.updateItem | def updateItem(self,
itemParameters,
clearEmptyFields=False,
data=None,
metadata=None,
text=None,
serviceUrl=None,
multipart=False):
"""
updates an item's properties using the ItemParameter class.
Inputs:
itemParameters - property class to update
clearEmptyFields - boolean, cleans up empty values
data - updates the file property of the service like a .sd file
metadata - this is an xml file that contains metadata information
text - The text content for the item to be updated.
serviceUrl - this is a service url endpoint.
multipart - this is a boolean value that means the file will be
broken up into smaller pieces and uploaded.
"""
thumbnail = None
largeThumbnail = None
files = {}
params = {
"f": "json",
}
if clearEmptyFields:
params["clearEmptyFields"] = clearEmptyFields
if serviceUrl is not None:
params['url'] = serviceUrl
if text is not None:
params['text'] = text
if isinstance(itemParameters, ItemParameter) == False:
raise AttributeError("itemParameters must be of type parameter.ItemParameter")
keys_to_delete = ['id', 'owner', 'size', 'numComments',
'numRatings', 'avgRating', 'numViews' ,
'overwrite']
dictItem = itemParameters.value
for key in keys_to_delete:
if key in dictItem:
del dictItem[key]
for key in dictItem:
if key == "thumbnail":
files['thumbnail'] = dictItem['thumbnail']
elif key == "largeThumbnail":
files['largeThumbnail'] = dictItem['largeThumbnail']
elif key == "metadata":
metadata = dictItem['metadata']
if os.path.basename(metadata) != 'metadata.xml':
tempxmlfile = os.path.join(tempfile.gettempdir(), "metadata.xml")
if os.path.isfile(tempxmlfile) == True:
os.remove(tempxmlfile)
import shutil
shutil.copy(metadata, tempxmlfile)
metadata = tempxmlfile
files['metadata'] = dictItem['metadata']
else:
params[key] = dictItem[key]
if data is not None:
files['file'] = data
if metadata and os.path.isfile(metadata):
files['metadata'] = metadata
url = "%s/update" % self.root
if multipart:
itemID = self.id
params['multipart'] = True
params['fileName'] = os.path.basename(data)
res = self._post(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port)
itemPartJSON = self.addByPart(filePath=data)
res = self.commit(wait=True, additionalParams=\
{'type' : self.type })
else:
res = self._post(url=url,
param_dict=params,
files=files,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port,
force_form_post=True)
self.__init()
return self | python | def updateItem(self,
itemParameters,
clearEmptyFields=False,
data=None,
metadata=None,
text=None,
serviceUrl=None,
multipart=False):
"""
updates an item's properties using the ItemParameter class.
Inputs:
itemParameters - property class to update
clearEmptyFields - boolean, cleans up empty values
data - updates the file property of the service like a .sd file
metadata - this is an xml file that contains metadata information
text - The text content for the item to be updated.
serviceUrl - this is a service url endpoint.
multipart - this is a boolean value that means the file will be
broken up into smaller pieces and uploaded.
"""
thumbnail = None
largeThumbnail = None
files = {}
params = {
"f": "json",
}
if clearEmptyFields:
params["clearEmptyFields"] = clearEmptyFields
if serviceUrl is not None:
params['url'] = serviceUrl
if text is not None:
params['text'] = text
if isinstance(itemParameters, ItemParameter) == False:
raise AttributeError("itemParameters must be of type parameter.ItemParameter")
keys_to_delete = ['id', 'owner', 'size', 'numComments',
'numRatings', 'avgRating', 'numViews' ,
'overwrite']
dictItem = itemParameters.value
for key in keys_to_delete:
if key in dictItem:
del dictItem[key]
for key in dictItem:
if key == "thumbnail":
files['thumbnail'] = dictItem['thumbnail']
elif key == "largeThumbnail":
files['largeThumbnail'] = dictItem['largeThumbnail']
elif key == "metadata":
metadata = dictItem['metadata']
if os.path.basename(metadata) != 'metadata.xml':
tempxmlfile = os.path.join(tempfile.gettempdir(), "metadata.xml")
if os.path.isfile(tempxmlfile) == True:
os.remove(tempxmlfile)
import shutil
shutil.copy(metadata, tempxmlfile)
metadata = tempxmlfile
files['metadata'] = dictItem['metadata']
else:
params[key] = dictItem[key]
if data is not None:
files['file'] = data
if metadata and os.path.isfile(metadata):
files['metadata'] = metadata
url = "%s/update" % self.root
if multipart:
itemID = self.id
params['multipart'] = True
params['fileName'] = os.path.basename(data)
res = self._post(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port)
itemPartJSON = self.addByPart(filePath=data)
res = self.commit(wait=True, additionalParams=\
{'type' : self.type })
else:
res = self._post(url=url,
param_dict=params,
files=files,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port,
force_form_post=True)
self.__init()
return self | [
"def",
"updateItem",
"(",
"self",
",",
"itemParameters",
",",
"clearEmptyFields",
"=",
"False",
",",
"data",
"=",
"None",
",",
"metadata",
"=",
"None",
",",
"text",
"=",
"None",
",",
"serviceUrl",
"=",
"None",
",",
"multipart",
"=",
"False",
")",
":",
"thumbnail",
"=",
"None",
"largeThumbnail",
"=",
"None",
"files",
"=",
"{",
"}",
"params",
"=",
"{",
"\"f\"",
":",
"\"json\"",
",",
"}",
"if",
"clearEmptyFields",
":",
"params",
"[",
"\"clearEmptyFields\"",
"]",
"=",
"clearEmptyFields",
"if",
"serviceUrl",
"is",
"not",
"None",
":",
"params",
"[",
"'url'",
"]",
"=",
"serviceUrl",
"if",
"text",
"is",
"not",
"None",
":",
"params",
"[",
"'text'",
"]",
"=",
"text",
"if",
"isinstance",
"(",
"itemParameters",
",",
"ItemParameter",
")",
"==",
"False",
":",
"raise",
"AttributeError",
"(",
"\"itemParameters must be of type parameter.ItemParameter\"",
")",
"keys_to_delete",
"=",
"[",
"'id'",
",",
"'owner'",
",",
"'size'",
",",
"'numComments'",
",",
"'numRatings'",
",",
"'avgRating'",
",",
"'numViews'",
",",
"'overwrite'",
"]",
"dictItem",
"=",
"itemParameters",
".",
"value",
"for",
"key",
"in",
"keys_to_delete",
":",
"if",
"key",
"in",
"dictItem",
":",
"del",
"dictItem",
"[",
"key",
"]",
"for",
"key",
"in",
"dictItem",
":",
"if",
"key",
"==",
"\"thumbnail\"",
":",
"files",
"[",
"'thumbnail'",
"]",
"=",
"dictItem",
"[",
"'thumbnail'",
"]",
"elif",
"key",
"==",
"\"largeThumbnail\"",
":",
"files",
"[",
"'largeThumbnail'",
"]",
"=",
"dictItem",
"[",
"'largeThumbnail'",
"]",
"elif",
"key",
"==",
"\"metadata\"",
":",
"metadata",
"=",
"dictItem",
"[",
"'metadata'",
"]",
"if",
"os",
".",
"path",
".",
"basename",
"(",
"metadata",
")",
"!=",
"'metadata.xml'",
":",
"tempxmlfile",
"=",
"os",
".",
"path",
".",
"join",
"(",
"tempfile",
".",
"gettempdir",
"(",
")",
",",
"\"metadata.xml\"",
")",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"tempxmlfile",
")",
"==",
"True",
":",
"os",
".",
"remove",
"(",
"tempxmlfile",
")",
"import",
"shutil",
"shutil",
".",
"copy",
"(",
"metadata",
",",
"tempxmlfile",
")",
"metadata",
"=",
"tempxmlfile",
"files",
"[",
"'metadata'",
"]",
"=",
"dictItem",
"[",
"'metadata'",
"]",
"else",
":",
"params",
"[",
"key",
"]",
"=",
"dictItem",
"[",
"key",
"]",
"if",
"data",
"is",
"not",
"None",
":",
"files",
"[",
"'file'",
"]",
"=",
"data",
"if",
"metadata",
"and",
"os",
".",
"path",
".",
"isfile",
"(",
"metadata",
")",
":",
"files",
"[",
"'metadata'",
"]",
"=",
"metadata",
"url",
"=",
"\"%s/update\"",
"%",
"self",
".",
"root",
"if",
"multipart",
":",
"itemID",
"=",
"self",
".",
"id",
"params",
"[",
"'multipart'",
"]",
"=",
"True",
"params",
"[",
"'fileName'",
"]",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"data",
")",
"res",
"=",
"self",
".",
"_post",
"(",
"url",
"=",
"url",
",",
"param_dict",
"=",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")",
"itemPartJSON",
"=",
"self",
".",
"addByPart",
"(",
"filePath",
"=",
"data",
")",
"res",
"=",
"self",
".",
"commit",
"(",
"wait",
"=",
"True",
",",
"additionalParams",
"=",
"{",
"'type'",
":",
"self",
".",
"type",
"}",
")",
"else",
":",
"res",
"=",
"self",
".",
"_post",
"(",
"url",
"=",
"url",
",",
"param_dict",
"=",
"params",
",",
"files",
"=",
"files",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
",",
"force_form_post",
"=",
"True",
")",
"self",
".",
"__init",
"(",
")",
"return",
"self"
] | updates an item's properties using the ItemParameter class.
Inputs:
itemParameters - property class to update
clearEmptyFields - boolean, cleans up empty values
data - updates the file property of the service like a .sd file
metadata - this is an xml file that contains metadata information
text - The text content for the item to be updated.
serviceUrl - this is a service url endpoint.
multipart - this is a boolean value that means the file will be
broken up into smaller pieces and uploaded. | [
"updates",
"an",
"item",
"s",
"properties",
"using",
"the",
"ItemParameter",
"class",
"."
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_content.py#L1674-L1763 | train |
Esri/ArcREST | src/arcrest/manageorg/_content.py | UserItem.status | def status(self, jobId=None, jobType=None):
"""
Inquire about status when publishing an item, adding an item in
async mode, or adding with a multipart upload. "Partial" is
available for Add Item Multipart, when only a part is uploaded
and the item is not committed.
Input:
jobType The type of asynchronous job for which the status has
to be checked. Default is none, which check the
item's status. This parameter is optional unless
used with the operations listed below.
Values: publish, generateFeatures, export,
and createService
jobId - The job ID returned during publish, generateFeatures,
export, and createService calls.
"""
params = {
"f" : "json"
}
if jobType is not None:
params['jobType'] = jobType
if jobId is not None:
params["jobId"] = jobId
url = "%s/status" % self.root
return self._get(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_port=self._proxy_port,
proxy_url=self._proxy_url) | python | def status(self, jobId=None, jobType=None):
"""
Inquire about status when publishing an item, adding an item in
async mode, or adding with a multipart upload. "Partial" is
available for Add Item Multipart, when only a part is uploaded
and the item is not committed.
Input:
jobType The type of asynchronous job for which the status has
to be checked. Default is none, which check the
item's status. This parameter is optional unless
used with the operations listed below.
Values: publish, generateFeatures, export,
and createService
jobId - The job ID returned during publish, generateFeatures,
export, and createService calls.
"""
params = {
"f" : "json"
}
if jobType is not None:
params['jobType'] = jobType
if jobId is not None:
params["jobId"] = jobId
url = "%s/status" % self.root
return self._get(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_port=self._proxy_port,
proxy_url=self._proxy_url) | [
"def",
"status",
"(",
"self",
",",
"jobId",
"=",
"None",
",",
"jobType",
"=",
"None",
")",
":",
"params",
"=",
"{",
"\"f\"",
":",
"\"json\"",
"}",
"if",
"jobType",
"is",
"not",
"None",
":",
"params",
"[",
"'jobType'",
"]",
"=",
"jobType",
"if",
"jobId",
"is",
"not",
"None",
":",
"params",
"[",
"\"jobId\"",
"]",
"=",
"jobId",
"url",
"=",
"\"%s/status\"",
"%",
"self",
".",
"root",
"return",
"self",
".",
"_get",
"(",
"url",
"=",
"url",
",",
"param_dict",
"=",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
")"
] | Inquire about status when publishing an item, adding an item in
async mode, or adding with a multipart upload. "Partial" is
available for Add Item Multipart, when only a part is uploaded
and the item is not committed.
Input:
jobType The type of asynchronous job for which the status has
to be checked. Default is none, which check the
item's status. This parameter is optional unless
used with the operations listed below.
Values: publish, generateFeatures, export,
and createService
jobId - The job ID returned during publish, generateFeatures,
export, and createService calls. | [
"Inquire",
"about",
"status",
"when",
"publishing",
"an",
"item",
"adding",
"an",
"item",
"in",
"async",
"mode",
"or",
"adding",
"with",
"a",
"multipart",
"upload",
".",
"Partial",
"is",
"available",
"for",
"Add",
"Item",
"Multipart",
"when",
"only",
"a",
"part",
"is",
"uploaded",
"and",
"the",
"item",
"is",
"not",
"committed",
"."
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_content.py#L1784-L1813 | train |
Esri/ArcREST | src/arcrest/manageorg/_content.py | UserItem.commit | def commit(self, wait=False, additionalParams={}):
"""
Commit is called once all parts are uploaded during a multipart Add
Item or Update Item operation. The parts are combined into a file,
and the original file is overwritten during an Update Item
operation. This is an asynchronous call and returns immediately.
Status can be used to check the status of the operation until it is
completed.
Inputs:
itemId - unique item id
folderId - folder id value, optional
wait - stops the thread and waits for the commit to finish or fail.
additionalParams - optional key/value pair like
type : "File Geodatabase". This is mainly used
when multipart uploads occur.
"""
url = "%s/commit" % self.root
params = {
"f" : "json",
}
for key, value in additionalParams.items():
params[key] = value
if wait == True:
res = self._post(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_port=self._proxy_port,
proxy_url=self._proxy_url)
res = self.status()
import time
while res['status'].lower() in ["partial", "processing"]:
time.sleep(2)
res = self.status()
return res
else:
return self._post(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_port=self._proxy_port,
proxy_url=self._proxy_url) | python | def commit(self, wait=False, additionalParams={}):
"""
Commit is called once all parts are uploaded during a multipart Add
Item or Update Item operation. The parts are combined into a file,
and the original file is overwritten during an Update Item
operation. This is an asynchronous call and returns immediately.
Status can be used to check the status of the operation until it is
completed.
Inputs:
itemId - unique item id
folderId - folder id value, optional
wait - stops the thread and waits for the commit to finish or fail.
additionalParams - optional key/value pair like
type : "File Geodatabase". This is mainly used
when multipart uploads occur.
"""
url = "%s/commit" % self.root
params = {
"f" : "json",
}
for key, value in additionalParams.items():
params[key] = value
if wait == True:
res = self._post(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_port=self._proxy_port,
proxy_url=self._proxy_url)
res = self.status()
import time
while res['status'].lower() in ["partial", "processing"]:
time.sleep(2)
res = self.status()
return res
else:
return self._post(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_port=self._proxy_port,
proxy_url=self._proxy_url) | [
"def",
"commit",
"(",
"self",
",",
"wait",
"=",
"False",
",",
"additionalParams",
"=",
"{",
"}",
")",
":",
"url",
"=",
"\"%s/commit\"",
"%",
"self",
".",
"root",
"params",
"=",
"{",
"\"f\"",
":",
"\"json\"",
",",
"}",
"for",
"key",
",",
"value",
"in",
"additionalParams",
".",
"items",
"(",
")",
":",
"params",
"[",
"key",
"]",
"=",
"value",
"if",
"wait",
"==",
"True",
":",
"res",
"=",
"self",
".",
"_post",
"(",
"url",
"=",
"url",
",",
"param_dict",
"=",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
")",
"res",
"=",
"self",
".",
"status",
"(",
")",
"import",
"time",
"while",
"res",
"[",
"'status'",
"]",
".",
"lower",
"(",
")",
"in",
"[",
"\"partial\"",
",",
"\"processing\"",
"]",
":",
"time",
".",
"sleep",
"(",
"2",
")",
"res",
"=",
"self",
".",
"status",
"(",
")",
"return",
"res",
"else",
":",
"return",
"self",
".",
"_post",
"(",
"url",
"=",
"url",
",",
"param_dict",
"=",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
")"
] | Commit is called once all parts are uploaded during a multipart Add
Item or Update Item operation. The parts are combined into a file,
and the original file is overwritten during an Update Item
operation. This is an asynchronous call and returns immediately.
Status can be used to check the status of the operation until it is
completed.
Inputs:
itemId - unique item id
folderId - folder id value, optional
wait - stops the thread and waits for the commit to finish or fail.
additionalParams - optional key/value pair like
type : "File Geodatabase". This is mainly used
when multipart uploads occur. | [
"Commit",
"is",
"called",
"once",
"all",
"parts",
"are",
"uploaded",
"during",
"a",
"multipart",
"Add",
"Item",
"or",
"Update",
"Item",
"operation",
".",
"The",
"parts",
"are",
"combined",
"into",
"a",
"file",
"and",
"the",
"original",
"file",
"is",
"overwritten",
"during",
"an",
"Update",
"Item",
"operation",
".",
"This",
"is",
"an",
"asynchronous",
"call",
"and",
"returns",
"immediately",
".",
"Status",
"can",
"be",
"used",
"to",
"check",
"the",
"status",
"of",
"the",
"operation",
"until",
"it",
"is",
"completed",
"."
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_content.py#L1827-L1868 | train |
Esri/ArcREST | src/arcrest/manageorg/_content.py | User.folders | def folders(self):
'''gets the property value for folders'''
if self._folders is None :
self.__init()
if self._folders is not None and isinstance(self._folders, list):
if len(self._folders) == 0:
self._loadFolders()
return self._folders | python | def folders(self):
'''gets the property value for folders'''
if self._folders is None :
self.__init()
if self._folders is not None and isinstance(self._folders, list):
if len(self._folders) == 0:
self._loadFolders()
return self._folders | [
"def",
"folders",
"(",
"self",
")",
":",
"if",
"self",
".",
"_folders",
"is",
"None",
":",
"self",
".",
"__init",
"(",
")",
"if",
"self",
".",
"_folders",
"is",
"not",
"None",
"and",
"isinstance",
"(",
"self",
".",
"_folders",
",",
"list",
")",
":",
"if",
"len",
"(",
"self",
".",
"_folders",
")",
"==",
"0",
":",
"self",
".",
"_loadFolders",
"(",
")",
"return",
"self",
".",
"_folders"
] | gets the property value for folders | [
"gets",
"the",
"property",
"value",
"for",
"folders"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_content.py#L2146-L2153 | train |
Esri/ArcREST | src/arcrest/manageorg/_content.py | User.items | def items(self):
'''gets the property value for items'''
self.__init()
items = []
for item in self._items:
items.append(
UserItem(url="%s/items/%s" % (self.location, item['id']),
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port,
initalize=True)
)
return items | python | def items(self):
'''gets the property value for items'''
self.__init()
items = []
for item in self._items:
items.append(
UserItem(url="%s/items/%s" % (self.location, item['id']),
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port,
initalize=True)
)
return items | [
"def",
"items",
"(",
"self",
")",
":",
"self",
".",
"__init",
"(",
")",
"items",
"=",
"[",
"]",
"for",
"item",
"in",
"self",
".",
"_items",
":",
"items",
".",
"append",
"(",
"UserItem",
"(",
"url",
"=",
"\"%s/items/%s\"",
"%",
"(",
"self",
".",
"location",
",",
"item",
"[",
"'id'",
"]",
")",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
",",
"initalize",
"=",
"True",
")",
")",
"return",
"items"
] | gets the property value for items | [
"gets",
"the",
"property",
"value",
"for",
"items"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_content.py#L2202-L2214 | train |
Esri/ArcREST | src/arcrest/manageorg/_content.py | User.addRelationship | def addRelationship(self,
originItemId,
destinationItemId,
relationshipType):
"""
Adds a relationship of a certain type between two items.
Inputs:
originItemId - The item ID of the origin item of the
relationship
destinationItemId - The item ID of the destination item of the
relationship.
relationshipType - The type of relationship between the two
items. Must be defined in Relationship types.
"""
url = "%s/addRelationship" % self.root
params = {
"originItemId" : originItemId,
"destinationItemId": destinationItemId,
"relationshipType" : relationshipType,
"f" : "json"
}
return self._post(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_port=self._proxy_port,
proxy_url=self._proxy_url) | python | def addRelationship(self,
originItemId,
destinationItemId,
relationshipType):
"""
Adds a relationship of a certain type between two items.
Inputs:
originItemId - The item ID of the origin item of the
relationship
destinationItemId - The item ID of the destination item of the
relationship.
relationshipType - The type of relationship between the two
items. Must be defined in Relationship types.
"""
url = "%s/addRelationship" % self.root
params = {
"originItemId" : originItemId,
"destinationItemId": destinationItemId,
"relationshipType" : relationshipType,
"f" : "json"
}
return self._post(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_port=self._proxy_port,
proxy_url=self._proxy_url) | [
"def",
"addRelationship",
"(",
"self",
",",
"originItemId",
",",
"destinationItemId",
",",
"relationshipType",
")",
":",
"url",
"=",
"\"%s/addRelationship\"",
"%",
"self",
".",
"root",
"params",
"=",
"{",
"\"originItemId\"",
":",
"originItemId",
",",
"\"destinationItemId\"",
":",
"destinationItemId",
",",
"\"relationshipType\"",
":",
"relationshipType",
",",
"\"f\"",
":",
"\"json\"",
"}",
"return",
"self",
".",
"_post",
"(",
"url",
"=",
"url",
",",
"param_dict",
"=",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
")"
] | Adds a relationship of a certain type between two items.
Inputs:
originItemId - The item ID of the origin item of the
relationship
destinationItemId - The item ID of the destination item of the
relationship.
relationshipType - The type of relationship between the two
items. Must be defined in Relationship types. | [
"Adds",
"a",
"relationship",
"of",
"a",
"certain",
"type",
"between",
"two",
"items",
"."
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_content.py#L2266-L2292 | train |
Esri/ArcREST | src/arcrest/manageorg/_content.py | User.createService | def createService(self, createServiceParameter,
description=None,
tags="Feature Service",
snippet=None):
"""
The Create Service operation allows users to create a hosted
feature service. You can use the API to create an empty hosted
feaure service from feature service metadata JSON.
Inputs:
createServiceParameter - create service object
"""
url = "%s/createService" % self.location
val = createServiceParameter.value
params = {
"f" : "json",
"outputType" : "featureService",
"createParameters" : json.dumps(val),
"tags" : tags
}
if snippet is not None:
params['snippet'] = snippet
if description is not None:
params['description'] = description
res = self._post(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_port=self._proxy_port,
proxy_url=self._proxy_url)
if 'id' in res or \
'serviceItemId' in res:
if 'id' in res:
url = "%s/items/%s" % (self.location, res['id'])
else:
url = "%s/items/%s" % (self.location, res['serviceItemId'])
return UserItem(url=url,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port)
return res | python | def createService(self, createServiceParameter,
description=None,
tags="Feature Service",
snippet=None):
"""
The Create Service operation allows users to create a hosted
feature service. You can use the API to create an empty hosted
feaure service from feature service metadata JSON.
Inputs:
createServiceParameter - create service object
"""
url = "%s/createService" % self.location
val = createServiceParameter.value
params = {
"f" : "json",
"outputType" : "featureService",
"createParameters" : json.dumps(val),
"tags" : tags
}
if snippet is not None:
params['snippet'] = snippet
if description is not None:
params['description'] = description
res = self._post(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_port=self._proxy_port,
proxy_url=self._proxy_url)
if 'id' in res or \
'serviceItemId' in res:
if 'id' in res:
url = "%s/items/%s" % (self.location, res['id'])
else:
url = "%s/items/%s" % (self.location, res['serviceItemId'])
return UserItem(url=url,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port)
return res | [
"def",
"createService",
"(",
"self",
",",
"createServiceParameter",
",",
"description",
"=",
"None",
",",
"tags",
"=",
"\"Feature Service\"",
",",
"snippet",
"=",
"None",
")",
":",
"url",
"=",
"\"%s/createService\"",
"%",
"self",
".",
"location",
"val",
"=",
"createServiceParameter",
".",
"value",
"params",
"=",
"{",
"\"f\"",
":",
"\"json\"",
",",
"\"outputType\"",
":",
"\"featureService\"",
",",
"\"createParameters\"",
":",
"json",
".",
"dumps",
"(",
"val",
")",
",",
"\"tags\"",
":",
"tags",
"}",
"if",
"snippet",
"is",
"not",
"None",
":",
"params",
"[",
"'snippet'",
"]",
"=",
"snippet",
"if",
"description",
"is",
"not",
"None",
":",
"params",
"[",
"'description'",
"]",
"=",
"description",
"res",
"=",
"self",
".",
"_post",
"(",
"url",
"=",
"url",
",",
"param_dict",
"=",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
")",
"if",
"'id'",
"in",
"res",
"or",
"'serviceItemId'",
"in",
"res",
":",
"if",
"'id'",
"in",
"res",
":",
"url",
"=",
"\"%s/items/%s\"",
"%",
"(",
"self",
".",
"location",
",",
"res",
"[",
"'id'",
"]",
")",
"else",
":",
"url",
"=",
"\"%s/items/%s\"",
"%",
"(",
"self",
".",
"location",
",",
"res",
"[",
"'serviceItemId'",
"]",
")",
"return",
"UserItem",
"(",
"url",
"=",
"url",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")",
"return",
"res"
] | The Create Service operation allows users to create a hosted
feature service. You can use the API to create an empty hosted
feaure service from feature service metadata JSON.
Inputs:
createServiceParameter - create service object | [
"The",
"Create",
"Service",
"operation",
"allows",
"users",
"to",
"create",
"a",
"hosted",
"feature",
"service",
".",
"You",
"can",
"use",
"the",
"API",
"to",
"create",
"an",
"empty",
"hosted",
"feaure",
"service",
"from",
"feature",
"service",
"metadata",
"JSON",
"."
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_content.py#L2515-L2554 | train |
Esri/ArcREST | src/arcrest/manageorg/_content.py | User.shareItems | def shareItems(self, items, groups="", everyone=False,
org=False):
"""
Shares a batch of items with the specified list of groups. Users
can only share items with groups to which they belong. This
operation also allows a user to share items with everyone, in which
case the items are publicly accessible, or with everyone in their
organization.
Inputs:
everyone - boolean, makes item public
org - boolean, shares with all of the organization
items - comma seperated list of items to share
groups - comma sperated list of groups to share with
"""
url = "%s/shareItems" % self.root
params = {
"f" : "json",
"items" : items,
"everyone" : everyone,
"org" : org,
"groups" : groups
}
return self._post(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_port=self._proxy_port,
proxy_url=self._proxy_url) | python | def shareItems(self, items, groups="", everyone=False,
org=False):
"""
Shares a batch of items with the specified list of groups. Users
can only share items with groups to which they belong. This
operation also allows a user to share items with everyone, in which
case the items are publicly accessible, or with everyone in their
organization.
Inputs:
everyone - boolean, makes item public
org - boolean, shares with all of the organization
items - comma seperated list of items to share
groups - comma sperated list of groups to share with
"""
url = "%s/shareItems" % self.root
params = {
"f" : "json",
"items" : items,
"everyone" : everyone,
"org" : org,
"groups" : groups
}
return self._post(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_port=self._proxy_port,
proxy_url=self._proxy_url) | [
"def",
"shareItems",
"(",
"self",
",",
"items",
",",
"groups",
"=",
"\"\"",
",",
"everyone",
"=",
"False",
",",
"org",
"=",
"False",
")",
":",
"url",
"=",
"\"%s/shareItems\"",
"%",
"self",
".",
"root",
"params",
"=",
"{",
"\"f\"",
":",
"\"json\"",
",",
"\"items\"",
":",
"items",
",",
"\"everyone\"",
":",
"everyone",
",",
"\"org\"",
":",
"org",
",",
"\"groups\"",
":",
"groups",
"}",
"return",
"self",
".",
"_post",
"(",
"url",
"=",
"url",
",",
"param_dict",
"=",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
")"
] | Shares a batch of items with the specified list of groups. Users
can only share items with groups to which they belong. This
operation also allows a user to share items with everyone, in which
case the items are publicly accessible, or with everyone in their
organization.
Inputs:
everyone - boolean, makes item public
org - boolean, shares with all of the organization
items - comma seperated list of items to share
groups - comma sperated list of groups to share with | [
"Shares",
"a",
"batch",
"of",
"items",
"with",
"the",
"specified",
"list",
"of",
"groups",
".",
"Users",
"can",
"only",
"share",
"items",
"with",
"groups",
"to",
"which",
"they",
"belong",
".",
"This",
"operation",
"also",
"allows",
"a",
"user",
"to",
"share",
"items",
"with",
"everyone",
"in",
"which",
"case",
"the",
"items",
"are",
"publicly",
"accessible",
"or",
"with",
"everyone",
"in",
"their",
"organization",
"."
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_content.py#L2585-L2612 | train |
Esri/ArcREST | src/arcrest/manageorg/_content.py | User.createFolder | def createFolder(self, name):
"""
Creates a folder in which items can be placed. Folders are only
visible to a user and solely used for organizing content within
that user's content space.
"""
url = "%s/createFolder" % self.root
params = {
"f" : "json",
"title" : name
}
self._folders = None
return self._post(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_port=self._proxy_port,
proxy_url=self._proxy_url) | python | def createFolder(self, name):
"""
Creates a folder in which items can be placed. Folders are only
visible to a user and solely used for organizing content within
that user's content space.
"""
url = "%s/createFolder" % self.root
params = {
"f" : "json",
"title" : name
}
self._folders = None
return self._post(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_port=self._proxy_port,
proxy_url=self._proxy_url) | [
"def",
"createFolder",
"(",
"self",
",",
"name",
")",
":",
"url",
"=",
"\"%s/createFolder\"",
"%",
"self",
".",
"root",
"params",
"=",
"{",
"\"f\"",
":",
"\"json\"",
",",
"\"title\"",
":",
"name",
"}",
"self",
".",
"_folders",
"=",
"None",
"return",
"self",
".",
"_post",
"(",
"url",
"=",
"url",
",",
"param_dict",
"=",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
")"
] | Creates a folder in which items can be placed. Folders are only
visible to a user and solely used for organizing content within
that user's content space. | [
"Creates",
"a",
"folder",
"in",
"which",
"items",
"can",
"be",
"placed",
".",
"Folders",
"are",
"only",
"visible",
"to",
"a",
"user",
"and",
"solely",
"used",
"for",
"organizing",
"content",
"within",
"that",
"user",
"s",
"content",
"space",
"."
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_content.py#L2674-L2690 | train |
Esri/ArcREST | src/arcrest/manageorg/_content.py | FeatureContent.analyze | def analyze(self,
itemId=None,
filePath=None,
text=None,
fileType="csv",
analyzeParameters=None):
"""
The Analyze call helps a client analyze a CSV file prior to
publishing or generating features using the Publish or Generate
operation, respectively.
Analyze returns information about the file including the fields
present as well as sample records. Analyze attempts to detect the
presence of location fields that may be present as either X,Y
fields or address fields.
Analyze packages its result so that publishParameters within the
JSON response contains information that can be passed back to the
server in a subsequent call to Publish or Generate. The
publishParameters subobject contains properties that describe the
resulting layer after publishing, including its fields, the desired
renderer, and so on. Analyze will suggest defaults for the renderer.
In a typical workflow, the client will present portions of the
Analyze results to the user for editing before making the call to
Publish or Generate.
If the file to be analyzed currently exists in the portal as an
item, callers can pass in its itemId. Callers can also directly
post the file. In this case, the request must be a multipart post
request pursuant to IETF RFC1867. The third option for text files
is to pass the text in as the value of the text parameter.
Inputs:
itemid - The ID of the item to be analyzed.
file - The file to be analyzed.
text - The text in the file to be analyzed.
filetype - The type of input file.
analyzeParameters - A AnalyzeParameters object that provides
geocoding information
"""
files = []
url = self._url + "/analyze"
params = {
"f" : "json"
}
fileType = "csv"
params["fileType"] = fileType
if analyzeParameters is not None and\
isinstance(analyzeParameters, AnalyzeParameters):
params['analyzeParameters'] = analyzeParameters.value
if not (filePath is None) and \
os.path.isfile(filePath):
params['text'] = open(filePath, 'rb').read()
return self._post(url=url, param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port)
elif itemId is not None:
params["fileType"] = fileType
params['itemId'] = itemId
return self._post(url=url, param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port)
else:
raise AttributeError("either an Item ID or a file path must be given.") | python | def analyze(self,
itemId=None,
filePath=None,
text=None,
fileType="csv",
analyzeParameters=None):
"""
The Analyze call helps a client analyze a CSV file prior to
publishing or generating features using the Publish or Generate
operation, respectively.
Analyze returns information about the file including the fields
present as well as sample records. Analyze attempts to detect the
presence of location fields that may be present as either X,Y
fields or address fields.
Analyze packages its result so that publishParameters within the
JSON response contains information that can be passed back to the
server in a subsequent call to Publish or Generate. The
publishParameters subobject contains properties that describe the
resulting layer after publishing, including its fields, the desired
renderer, and so on. Analyze will suggest defaults for the renderer.
In a typical workflow, the client will present portions of the
Analyze results to the user for editing before making the call to
Publish or Generate.
If the file to be analyzed currently exists in the portal as an
item, callers can pass in its itemId. Callers can also directly
post the file. In this case, the request must be a multipart post
request pursuant to IETF RFC1867. The third option for text files
is to pass the text in as the value of the text parameter.
Inputs:
itemid - The ID of the item to be analyzed.
file - The file to be analyzed.
text - The text in the file to be analyzed.
filetype - The type of input file.
analyzeParameters - A AnalyzeParameters object that provides
geocoding information
"""
files = []
url = self._url + "/analyze"
params = {
"f" : "json"
}
fileType = "csv"
params["fileType"] = fileType
if analyzeParameters is not None and\
isinstance(analyzeParameters, AnalyzeParameters):
params['analyzeParameters'] = analyzeParameters.value
if not (filePath is None) and \
os.path.isfile(filePath):
params['text'] = open(filePath, 'rb').read()
return self._post(url=url, param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port)
elif itemId is not None:
params["fileType"] = fileType
params['itemId'] = itemId
return self._post(url=url, param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port)
else:
raise AttributeError("either an Item ID or a file path must be given.") | [
"def",
"analyze",
"(",
"self",
",",
"itemId",
"=",
"None",
",",
"filePath",
"=",
"None",
",",
"text",
"=",
"None",
",",
"fileType",
"=",
"\"csv\"",
",",
"analyzeParameters",
"=",
"None",
")",
":",
"files",
"=",
"[",
"]",
"url",
"=",
"self",
".",
"_url",
"+",
"\"/analyze\"",
"params",
"=",
"{",
"\"f\"",
":",
"\"json\"",
"}",
"fileType",
"=",
"\"csv\"",
"params",
"[",
"\"fileType\"",
"]",
"=",
"fileType",
"if",
"analyzeParameters",
"is",
"not",
"None",
"and",
"isinstance",
"(",
"analyzeParameters",
",",
"AnalyzeParameters",
")",
":",
"params",
"[",
"'analyzeParameters'",
"]",
"=",
"analyzeParameters",
".",
"value",
"if",
"not",
"(",
"filePath",
"is",
"None",
")",
"and",
"os",
".",
"path",
".",
"isfile",
"(",
"filePath",
")",
":",
"params",
"[",
"'text'",
"]",
"=",
"open",
"(",
"filePath",
",",
"'rb'",
")",
".",
"read",
"(",
")",
"return",
"self",
".",
"_post",
"(",
"url",
"=",
"url",
",",
"param_dict",
"=",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")",
"elif",
"itemId",
"is",
"not",
"None",
":",
"params",
"[",
"\"fileType\"",
"]",
"=",
"fileType",
"params",
"[",
"'itemId'",
"]",
"=",
"itemId",
"return",
"self",
".",
"_post",
"(",
"url",
"=",
"url",
",",
"param_dict",
"=",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")",
"else",
":",
"raise",
"AttributeError",
"(",
"\"either an Item ID or a file path must be given.\"",
")"
] | The Analyze call helps a client analyze a CSV file prior to
publishing or generating features using the Publish or Generate
operation, respectively.
Analyze returns information about the file including the fields
present as well as sample records. Analyze attempts to detect the
presence of location fields that may be present as either X,Y
fields or address fields.
Analyze packages its result so that publishParameters within the
JSON response contains information that can be passed back to the
server in a subsequent call to Publish or Generate. The
publishParameters subobject contains properties that describe the
resulting layer after publishing, including its fields, the desired
renderer, and so on. Analyze will suggest defaults for the renderer.
In a typical workflow, the client will present portions of the
Analyze results to the user for editing before making the call to
Publish or Generate.
If the file to be analyzed currently exists in the portal as an
item, callers can pass in its itemId. Callers can also directly
post the file. In this case, the request must be a multipart post
request pursuant to IETF RFC1867. The third option for text files
is to pass the text in as the value of the text parameter.
Inputs:
itemid - The ID of the item to be analyzed.
file - The file to be analyzed.
text - The text in the file to be analyzed.
filetype - The type of input file.
analyzeParameters - A AnalyzeParameters object that provides
geocoding information | [
"The",
"Analyze",
"call",
"helps",
"a",
"client",
"analyze",
"a",
"CSV",
"file",
"prior",
"to",
"publishing",
"or",
"generating",
"features",
"using",
"the",
"Publish",
"or",
"Generate",
"operation",
"respectively",
".",
"Analyze",
"returns",
"information",
"about",
"the",
"file",
"including",
"the",
"fields",
"present",
"as",
"well",
"as",
"sample",
"records",
".",
"Analyze",
"attempts",
"to",
"detect",
"the",
"presence",
"of",
"location",
"fields",
"that",
"may",
"be",
"present",
"as",
"either",
"X",
"Y",
"fields",
"or",
"address",
"fields",
".",
"Analyze",
"packages",
"its",
"result",
"so",
"that",
"publishParameters",
"within",
"the",
"JSON",
"response",
"contains",
"information",
"that",
"can",
"be",
"passed",
"back",
"to",
"the",
"server",
"in",
"a",
"subsequent",
"call",
"to",
"Publish",
"or",
"Generate",
".",
"The",
"publishParameters",
"subobject",
"contains",
"properties",
"that",
"describe",
"the",
"resulting",
"layer",
"after",
"publishing",
"including",
"its",
"fields",
"the",
"desired",
"renderer",
"and",
"so",
"on",
".",
"Analyze",
"will",
"suggest",
"defaults",
"for",
"the",
"renderer",
".",
"In",
"a",
"typical",
"workflow",
"the",
"client",
"will",
"present",
"portions",
"of",
"the",
"Analyze",
"results",
"to",
"the",
"user",
"for",
"editing",
"before",
"making",
"the",
"call",
"to",
"Publish",
"or",
"Generate",
".",
"If",
"the",
"file",
"to",
"be",
"analyzed",
"currently",
"exists",
"in",
"the",
"portal",
"as",
"an",
"item",
"callers",
"can",
"pass",
"in",
"its",
"itemId",
".",
"Callers",
"can",
"also",
"directly",
"post",
"the",
"file",
".",
"In",
"this",
"case",
"the",
"request",
"must",
"be",
"a",
"multipart",
"post",
"request",
"pursuant",
"to",
"IETF",
"RFC1867",
".",
"The",
"third",
"option",
"for",
"text",
"files",
"is",
"to",
"pass",
"the",
"text",
"in",
"as",
"the",
"value",
"of",
"the",
"text",
"parameter",
"."
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_content.py#L2905-L2969 | train |
Esri/ArcREST | src/arcrest/manageorg/_content.py | Group.__assembleURL | def __assembleURL(self, url, groupId):
"""private function that assembles the URL for the community.Group
class"""
from ..packages.six.moves.urllib_parse import urlparse
parsed = urlparse(url)
communityURL = "%s://%s%s/sharing/rest/community/groups/%s" % (parsed.scheme, parsed.netloc,
parsed.path.lower().split('/sharing/rest/')[0],
groupId)
return communityURL | python | def __assembleURL(self, url, groupId):
"""private function that assembles the URL for the community.Group
class"""
from ..packages.six.moves.urllib_parse import urlparse
parsed = urlparse(url)
communityURL = "%s://%s%s/sharing/rest/community/groups/%s" % (parsed.scheme, parsed.netloc,
parsed.path.lower().split('/sharing/rest/')[0],
groupId)
return communityURL | [
"def",
"__assembleURL",
"(",
"self",
",",
"url",
",",
"groupId",
")",
":",
"from",
".",
".",
"packages",
".",
"six",
".",
"moves",
".",
"urllib_parse",
"import",
"urlparse",
"parsed",
"=",
"urlparse",
"(",
"url",
")",
"communityURL",
"=",
"\"%s://%s%s/sharing/rest/community/groups/%s\"",
"%",
"(",
"parsed",
".",
"scheme",
",",
"parsed",
".",
"netloc",
",",
"parsed",
".",
"path",
".",
"lower",
"(",
")",
".",
"split",
"(",
"'/sharing/rest/'",
")",
"[",
"0",
"]",
",",
"groupId",
")",
"return",
"communityURL"
] | private function that assembles the URL for the community.Group
class | [
"private",
"function",
"that",
"assembles",
"the",
"URL",
"for",
"the",
"community",
".",
"Group",
"class"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_content.py#L3137-L3145 | train |
Esri/ArcREST | src/arcrest/manageorg/_content.py | Group.group | def group(self):
"""returns the community.Group class for the current group"""
split_count = self._url.lower().find("/content/")
len_count = len('/content/')
gURL = self._url[:self._url.lower().find("/content/")] + \
"/community/" + self._url[split_count+ len_count:]#self.__assembleURL(self._contentURL, self._groupId)
return CommunityGroup(url=gURL,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | python | def group(self):
"""returns the community.Group class for the current group"""
split_count = self._url.lower().find("/content/")
len_count = len('/content/')
gURL = self._url[:self._url.lower().find("/content/")] + \
"/community/" + self._url[split_count+ len_count:]#self.__assembleURL(self._contentURL, self._groupId)
return CommunityGroup(url=gURL,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | [
"def",
"group",
"(",
"self",
")",
":",
"split_count",
"=",
"self",
".",
"_url",
".",
"lower",
"(",
")",
".",
"find",
"(",
"\"/content/\"",
")",
"len_count",
"=",
"len",
"(",
"'/content/'",
")",
"gURL",
"=",
"self",
".",
"_url",
"[",
":",
"self",
".",
"_url",
".",
"lower",
"(",
")",
".",
"find",
"(",
"\"/content/\"",
")",
"]",
"+",
"\"/community/\"",
"+",
"self",
".",
"_url",
"[",
"split_count",
"+",
"len_count",
":",
"]",
"#self.__assembleURL(self._contentURL, self._groupId)",
"return",
"CommunityGroup",
"(",
"url",
"=",
"gURL",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")"
] | returns the community.Group class for the current group | [
"returns",
"the",
"community",
".",
"Group",
"class",
"for",
"the",
"current",
"group"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_content.py#L3149-L3159 | train |
Esri/ArcREST | src/arcrest/common/renderer.py | UniqueValueRenderer.addUniqueValue | def addUniqueValue(self, value, label, description, symbol):
"""
adds a unique value to the renderer
"""
if self._uniqueValueInfos is None:
self._uniqueValueInfos = []
self._uniqueValueInfos.append(
{
"value" : value,
"label" : label,
"description" : description,
"symbol" : symbol
}
) | python | def addUniqueValue(self, value, label, description, symbol):
"""
adds a unique value to the renderer
"""
if self._uniqueValueInfos is None:
self._uniqueValueInfos = []
self._uniqueValueInfos.append(
{
"value" : value,
"label" : label,
"description" : description,
"symbol" : symbol
}
) | [
"def",
"addUniqueValue",
"(",
"self",
",",
"value",
",",
"label",
",",
"description",
",",
"symbol",
")",
":",
"if",
"self",
".",
"_uniqueValueInfos",
"is",
"None",
":",
"self",
".",
"_uniqueValueInfos",
"=",
"[",
"]",
"self",
".",
"_uniqueValueInfos",
".",
"append",
"(",
"{",
"\"value\"",
":",
"value",
",",
"\"label\"",
":",
"label",
",",
"\"description\"",
":",
"description",
",",
"\"symbol\"",
":",
"symbol",
"}",
")"
] | adds a unique value to the renderer | [
"adds",
"a",
"unique",
"value",
"to",
"the",
"renderer"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/common/renderer.py#L249-L262 | train |
Esri/ArcREST | src/arcrest/common/renderer.py | UniqueValueRenderer.removeUniqueValue | def removeUniqueValue(self, value):
"""removes a unique value in unique Value Info"""
for v in self._uniqueValueInfos:
if v['value'] == value:
self._uniqueValueInfos.remove(v)
return True
del v
return False | python | def removeUniqueValue(self, value):
"""removes a unique value in unique Value Info"""
for v in self._uniqueValueInfos:
if v['value'] == value:
self._uniqueValueInfos.remove(v)
return True
del v
return False | [
"def",
"removeUniqueValue",
"(",
"self",
",",
"value",
")",
":",
"for",
"v",
"in",
"self",
".",
"_uniqueValueInfos",
":",
"if",
"v",
"[",
"'value'",
"]",
"==",
"value",
":",
"self",
".",
"_uniqueValueInfos",
".",
"remove",
"(",
"v",
")",
"return",
"True",
"del",
"v",
"return",
"False"
] | removes a unique value in unique Value Info | [
"removes",
"a",
"unique",
"value",
"in",
"unique",
"Value",
"Info"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/common/renderer.py#L264-L271 | train |
Esri/ArcREST | src/arcrest/common/renderer.py | ClassBreakRenderer.addClassBreak | def addClassBreak(self, classMinValue, classMaxValue, label, description, symbol):
"""
adds a classification break value to the renderer
"""
if self._classBreakInfos is None:
self._classBreakInfos = []
self._classBreakInfos.append(
{
"classMinValue" : classMinValue,
"classMaxValue" : classMaxValue,
"label" : label,
"description" : description,
"symbol" : symbol
}
) | python | def addClassBreak(self, classMinValue, classMaxValue, label, description, symbol):
"""
adds a classification break value to the renderer
"""
if self._classBreakInfos is None:
self._classBreakInfos = []
self._classBreakInfos.append(
{
"classMinValue" : classMinValue,
"classMaxValue" : classMaxValue,
"label" : label,
"description" : description,
"symbol" : symbol
}
) | [
"def",
"addClassBreak",
"(",
"self",
",",
"classMinValue",
",",
"classMaxValue",
",",
"label",
",",
"description",
",",
"symbol",
")",
":",
"if",
"self",
".",
"_classBreakInfos",
"is",
"None",
":",
"self",
".",
"_classBreakInfos",
"=",
"[",
"]",
"self",
".",
"_classBreakInfos",
".",
"append",
"(",
"{",
"\"classMinValue\"",
":",
"classMinValue",
",",
"\"classMaxValue\"",
":",
"classMaxValue",
",",
"\"label\"",
":",
"label",
",",
"\"description\"",
":",
"description",
",",
"\"symbol\"",
":",
"symbol",
"}",
")"
] | adds a classification break value to the renderer | [
"adds",
"a",
"classification",
"break",
"value",
"to",
"the",
"renderer"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/common/renderer.py#L400-L414 | train |
Esri/ArcREST | src/arcrest/common/renderer.py | ClassBreakRenderer.removeClassBreak | def removeClassBreak(self, label):
"""removes a classification break value to the renderer"""
for v in self._classBreakInfos:
if v['label'] == label:
self._classBreakInfos.remove(v)
return True
del v
return False | python | def removeClassBreak(self, label):
"""removes a classification break value to the renderer"""
for v in self._classBreakInfos:
if v['label'] == label:
self._classBreakInfos.remove(v)
return True
del v
return False | [
"def",
"removeClassBreak",
"(",
"self",
",",
"label",
")",
":",
"for",
"v",
"in",
"self",
".",
"_classBreakInfos",
":",
"if",
"v",
"[",
"'label'",
"]",
"==",
"label",
":",
"self",
".",
"_classBreakInfos",
".",
"remove",
"(",
"v",
")",
"return",
"True",
"del",
"v",
"return",
"False"
] | removes a classification break value to the renderer | [
"removes",
"a",
"classification",
"break",
"value",
"to",
"the",
"renderer"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/common/renderer.py#L416-L423 | train |
Esri/ArcREST | src/arcrest/ags/mapservice.py | MapService.downloadThumbnail | def downloadThumbnail(self, outPath):
"""downloads the items's thumbnail"""
url = self._url + "/info/thumbnail"
params = {
}
return self._get(url=url,
out_folder=outPath,
file_name=None,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | python | def downloadThumbnail(self, outPath):
"""downloads the items's thumbnail"""
url = self._url + "/info/thumbnail"
params = {
}
return self._get(url=url,
out_folder=outPath,
file_name=None,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | [
"def",
"downloadThumbnail",
"(",
"self",
",",
"outPath",
")",
":",
"url",
"=",
"self",
".",
"_url",
"+",
"\"/info/thumbnail\"",
"params",
"=",
"{",
"}",
"return",
"self",
".",
"_get",
"(",
"url",
"=",
"url",
",",
"out_folder",
"=",
"outPath",
",",
"file_name",
"=",
"None",
",",
"param_dict",
"=",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")"
] | downloads the items's thumbnail | [
"downloads",
"the",
"items",
"s",
"thumbnail"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/ags/mapservice.py#L92-L104 | train |
Esri/ArcREST | src/arcrest/ags/mapservice.py | MapService.__init | def __init(self):
""" populates all the properties for the map service """
params = {"f": "json"}
json_dict = self._get(self._url, params,
securityHandler=self._securityHandler,
proxy_port=self._proxy_port,
proxy_url=self._proxy_url)
self._json = json.dumps(json_dict)
self._json_dict = json_dict
attributes = [attr for attr in dir(self)
if not attr.startswith('__') and \
not attr.startswith('_')]
for k,v in json_dict.items():
if k == "tables":
self._tables = []
for tbl in v:
url = self._url + "/%s" % tbl['id']
self._tables.append(
TableLayer(url,
securityHandler=self._securityHandler,
proxy_port=self._proxy_port,
proxy_url=self._proxy_url)
)
elif k == "layers":
self._layers = []
for lyr in v:
url = self._url + "/%s" % lyr['id']
layer_type = self._getLayerType(url)
if layer_type == "Feature Layer":
self._layers.append(
FeatureLayer(url,
securityHandler=self._securityHandler,
proxy_port=self._proxy_port,
proxy_url=self._proxy_url)
)
elif layer_type == "Raster Layer":
self._layers.append(
RasterLayer(url,
securityHandler=self._securityHandler,
proxy_port=self._proxy_port,
proxy_url=self._proxy_url)
)
elif layer_type == "Group Layer":
self._layers.append(
GroupLayer(url,
securityHandler=self._securityHandler,
proxy_port=self._proxy_port,
proxy_url=self._proxy_url)
)
elif layer_type == "Schematics Layer":
self._layers.append(
SchematicsLayer(url,
securityHandler=self._securityHandler,
proxy_port=self._proxy_port,
proxy_url=self._proxy_url)
)
else:
print ('Type %s is not implemented' % layer_type)
elif k in attributes:
setattr(self, "_"+ k, json_dict[k])
else:
print (k, " is not implemented for mapservice.") | python | def __init(self):
""" populates all the properties for the map service """
params = {"f": "json"}
json_dict = self._get(self._url, params,
securityHandler=self._securityHandler,
proxy_port=self._proxy_port,
proxy_url=self._proxy_url)
self._json = json.dumps(json_dict)
self._json_dict = json_dict
attributes = [attr for attr in dir(self)
if not attr.startswith('__') and \
not attr.startswith('_')]
for k,v in json_dict.items():
if k == "tables":
self._tables = []
for tbl in v:
url = self._url + "/%s" % tbl['id']
self._tables.append(
TableLayer(url,
securityHandler=self._securityHandler,
proxy_port=self._proxy_port,
proxy_url=self._proxy_url)
)
elif k == "layers":
self._layers = []
for lyr in v:
url = self._url + "/%s" % lyr['id']
layer_type = self._getLayerType(url)
if layer_type == "Feature Layer":
self._layers.append(
FeatureLayer(url,
securityHandler=self._securityHandler,
proxy_port=self._proxy_port,
proxy_url=self._proxy_url)
)
elif layer_type == "Raster Layer":
self._layers.append(
RasterLayer(url,
securityHandler=self._securityHandler,
proxy_port=self._proxy_port,
proxy_url=self._proxy_url)
)
elif layer_type == "Group Layer":
self._layers.append(
GroupLayer(url,
securityHandler=self._securityHandler,
proxy_port=self._proxy_port,
proxy_url=self._proxy_url)
)
elif layer_type == "Schematics Layer":
self._layers.append(
SchematicsLayer(url,
securityHandler=self._securityHandler,
proxy_port=self._proxy_port,
proxy_url=self._proxy_url)
)
else:
print ('Type %s is not implemented' % layer_type)
elif k in attributes:
setattr(self, "_"+ k, json_dict[k])
else:
print (k, " is not implemented for mapservice.") | [
"def",
"__init",
"(",
"self",
")",
":",
"params",
"=",
"{",
"\"f\"",
":",
"\"json\"",
"}",
"json_dict",
"=",
"self",
".",
"_get",
"(",
"self",
".",
"_url",
",",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
")",
"self",
".",
"_json",
"=",
"json",
".",
"dumps",
"(",
"json_dict",
")",
"self",
".",
"_json_dict",
"=",
"json_dict",
"attributes",
"=",
"[",
"attr",
"for",
"attr",
"in",
"dir",
"(",
"self",
")",
"if",
"not",
"attr",
".",
"startswith",
"(",
"'__'",
")",
"and",
"not",
"attr",
".",
"startswith",
"(",
"'_'",
")",
"]",
"for",
"k",
",",
"v",
"in",
"json_dict",
".",
"items",
"(",
")",
":",
"if",
"k",
"==",
"\"tables\"",
":",
"self",
".",
"_tables",
"=",
"[",
"]",
"for",
"tbl",
"in",
"v",
":",
"url",
"=",
"self",
".",
"_url",
"+",
"\"/%s\"",
"%",
"tbl",
"[",
"'id'",
"]",
"self",
".",
"_tables",
".",
"append",
"(",
"TableLayer",
"(",
"url",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
")",
")",
"elif",
"k",
"==",
"\"layers\"",
":",
"self",
".",
"_layers",
"=",
"[",
"]",
"for",
"lyr",
"in",
"v",
":",
"url",
"=",
"self",
".",
"_url",
"+",
"\"/%s\"",
"%",
"lyr",
"[",
"'id'",
"]",
"layer_type",
"=",
"self",
".",
"_getLayerType",
"(",
"url",
")",
"if",
"layer_type",
"==",
"\"Feature Layer\"",
":",
"self",
".",
"_layers",
".",
"append",
"(",
"FeatureLayer",
"(",
"url",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
")",
")",
"elif",
"layer_type",
"==",
"\"Raster Layer\"",
":",
"self",
".",
"_layers",
".",
"append",
"(",
"RasterLayer",
"(",
"url",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
")",
")",
"elif",
"layer_type",
"==",
"\"Group Layer\"",
":",
"self",
".",
"_layers",
".",
"append",
"(",
"GroupLayer",
"(",
"url",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
")",
")",
"elif",
"layer_type",
"==",
"\"Schematics Layer\"",
":",
"self",
".",
"_layers",
".",
"append",
"(",
"SchematicsLayer",
"(",
"url",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
")",
")",
"else",
":",
"print",
"(",
"'Type %s is not implemented'",
"%",
"layer_type",
")",
"elif",
"k",
"in",
"attributes",
":",
"setattr",
"(",
"self",
",",
"\"_\"",
"+",
"k",
",",
"json_dict",
"[",
"k",
"]",
")",
"else",
":",
"print",
"(",
"k",
",",
"\" is not implemented for mapservice.\"",
")"
] | populates all the properties for the map service | [
"populates",
"all",
"the",
"properties",
"for",
"the",
"map",
"service"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/ags/mapservice.py#L132-L195 | train |
Esri/ArcREST | src/arcrest/ags/mapservice.py | MapService.getExtensions | def getExtensions(self):
"""returns objects for all map service extensions"""
extensions = []
if isinstance(self.supportedExtensions, list):
for ext in self.supportedExtensions:
extensionURL = self._url + "/exts/%s" % ext
if ext == "SchematicsServer":
extensions.append(SchematicsService(url=extensionURL,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port))
return extensions
else:
extensionURL = self._url + "/exts/%s" % self.supportedExtensions
if self.supportedExtensions == "SchematicsServer":
extensions.append(SchematicsService(url=extensionURL,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port))
return extensions | python | def getExtensions(self):
"""returns objects for all map service extensions"""
extensions = []
if isinstance(self.supportedExtensions, list):
for ext in self.supportedExtensions:
extensionURL = self._url + "/exts/%s" % ext
if ext == "SchematicsServer":
extensions.append(SchematicsService(url=extensionURL,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port))
return extensions
else:
extensionURL = self._url + "/exts/%s" % self.supportedExtensions
if self.supportedExtensions == "SchematicsServer":
extensions.append(SchematicsService(url=extensionURL,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port))
return extensions | [
"def",
"getExtensions",
"(",
"self",
")",
":",
"extensions",
"=",
"[",
"]",
"if",
"isinstance",
"(",
"self",
".",
"supportedExtensions",
",",
"list",
")",
":",
"for",
"ext",
"in",
"self",
".",
"supportedExtensions",
":",
"extensionURL",
"=",
"self",
".",
"_url",
"+",
"\"/exts/%s\"",
"%",
"ext",
"if",
"ext",
"==",
"\"SchematicsServer\"",
":",
"extensions",
".",
"append",
"(",
"SchematicsService",
"(",
"url",
"=",
"extensionURL",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")",
")",
"return",
"extensions",
"else",
":",
"extensionURL",
"=",
"self",
".",
"_url",
"+",
"\"/exts/%s\"",
"%",
"self",
".",
"supportedExtensions",
"if",
"self",
".",
"supportedExtensions",
"==",
"\"SchematicsServer\"",
":",
"extensions",
".",
"append",
"(",
"SchematicsService",
"(",
"url",
"=",
"extensionURL",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")",
")",
"return",
"extensions"
] | returns objects for all map service extensions | [
"returns",
"objects",
"for",
"all",
"map",
"service",
"extensions"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/ags/mapservice.py#L423-L442 | train |
Esri/ArcREST | src/arcrest/ags/mapservice.py | MapService.allLayers | def allLayers(self):
""" returns all layers for the service """
url = self._url + "/layers"
params = {
"f" : "json"
}
res = self._get(url, param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port)
return_dict = {
"layers" : [],
"tables" : []
}
for k, v in res.items():
if k == "layers":
for val in v:
return_dict['layers'].append(
FeatureLayer(url=self._url + "/%s" % val['id'],
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port)
)
elif k == "tables":
for val in v:
return_dict['tables'].append(
TableLayer(url=self._url + "/%s" % val['id'],
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port)
)
del k,v
return return_dict | python | def allLayers(self):
""" returns all layers for the service """
url = self._url + "/layers"
params = {
"f" : "json"
}
res = self._get(url, param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port)
return_dict = {
"layers" : [],
"tables" : []
}
for k, v in res.items():
if k == "layers":
for val in v:
return_dict['layers'].append(
FeatureLayer(url=self._url + "/%s" % val['id'],
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port)
)
elif k == "tables":
for val in v:
return_dict['tables'].append(
TableLayer(url=self._url + "/%s" % val['id'],
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port)
)
del k,v
return return_dict | [
"def",
"allLayers",
"(",
"self",
")",
":",
"url",
"=",
"self",
".",
"_url",
"+",
"\"/layers\"",
"params",
"=",
"{",
"\"f\"",
":",
"\"json\"",
"}",
"res",
"=",
"self",
".",
"_get",
"(",
"url",
",",
"param_dict",
"=",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")",
"return_dict",
"=",
"{",
"\"layers\"",
":",
"[",
"]",
",",
"\"tables\"",
":",
"[",
"]",
"}",
"for",
"k",
",",
"v",
"in",
"res",
".",
"items",
"(",
")",
":",
"if",
"k",
"==",
"\"layers\"",
":",
"for",
"val",
"in",
"v",
":",
"return_dict",
"[",
"'layers'",
"]",
".",
"append",
"(",
"FeatureLayer",
"(",
"url",
"=",
"self",
".",
"_url",
"+",
"\"/%s\"",
"%",
"val",
"[",
"'id'",
"]",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")",
")",
"elif",
"k",
"==",
"\"tables\"",
":",
"for",
"val",
"in",
"v",
":",
"return_dict",
"[",
"'tables'",
"]",
".",
"append",
"(",
"TableLayer",
"(",
"url",
"=",
"self",
".",
"_url",
"+",
"\"/%s\"",
"%",
"val",
"[",
"'id'",
"]",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")",
")",
"del",
"k",
",",
"v",
"return",
"return_dict"
] | returns all layers for the service | [
"returns",
"all",
"layers",
"for",
"the",
"service"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/ags/mapservice.py#L445-L477 | train |
Esri/ArcREST | src/arcrest/ags/mapservice.py | MapService.find | def find(self, searchText, layers,
contains=True, searchFields="",
sr="", layerDefs="",
returnGeometry=True, maxAllowableOffset="",
geometryPrecision="", dynamicLayers="",
returnZ=False, returnM=False, gdbVersion=""):
""" performs the map service find operation """
url = self._url + "/find"
#print url
params = {
"f" : "json",
"searchText" : searchText,
"contains" : self._convert_boolean(contains),
"searchFields": searchFields,
"sr" : sr,
"layerDefs" : layerDefs,
"returnGeometry" : self._convert_boolean(returnGeometry),
"maxAllowableOffset" : maxAllowableOffset,
"geometryPrecision" : geometryPrecision,
"dynamicLayers" : dynamicLayers,
"returnZ" : self._convert_boolean(returnZ),
"returnM" : self._convert_boolean(returnM),
"gdbVersion" : gdbVersion,
"layers" : layers
}
res = self._get(url, params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port)
qResults = []
for r in res['results']:
qResults.append(Feature(r))
return qResults | python | def find(self, searchText, layers,
contains=True, searchFields="",
sr="", layerDefs="",
returnGeometry=True, maxAllowableOffset="",
geometryPrecision="", dynamicLayers="",
returnZ=False, returnM=False, gdbVersion=""):
""" performs the map service find operation """
url = self._url + "/find"
#print url
params = {
"f" : "json",
"searchText" : searchText,
"contains" : self._convert_boolean(contains),
"searchFields": searchFields,
"sr" : sr,
"layerDefs" : layerDefs,
"returnGeometry" : self._convert_boolean(returnGeometry),
"maxAllowableOffset" : maxAllowableOffset,
"geometryPrecision" : geometryPrecision,
"dynamicLayers" : dynamicLayers,
"returnZ" : self._convert_boolean(returnZ),
"returnM" : self._convert_boolean(returnM),
"gdbVersion" : gdbVersion,
"layers" : layers
}
res = self._get(url, params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port)
qResults = []
for r in res['results']:
qResults.append(Feature(r))
return qResults | [
"def",
"find",
"(",
"self",
",",
"searchText",
",",
"layers",
",",
"contains",
"=",
"True",
",",
"searchFields",
"=",
"\"\"",
",",
"sr",
"=",
"\"\"",
",",
"layerDefs",
"=",
"\"\"",
",",
"returnGeometry",
"=",
"True",
",",
"maxAllowableOffset",
"=",
"\"\"",
",",
"geometryPrecision",
"=",
"\"\"",
",",
"dynamicLayers",
"=",
"\"\"",
",",
"returnZ",
"=",
"False",
",",
"returnM",
"=",
"False",
",",
"gdbVersion",
"=",
"\"\"",
")",
":",
"url",
"=",
"self",
".",
"_url",
"+",
"\"/find\"",
"#print url",
"params",
"=",
"{",
"\"f\"",
":",
"\"json\"",
",",
"\"searchText\"",
":",
"searchText",
",",
"\"contains\"",
":",
"self",
".",
"_convert_boolean",
"(",
"contains",
")",
",",
"\"searchFields\"",
":",
"searchFields",
",",
"\"sr\"",
":",
"sr",
",",
"\"layerDefs\"",
":",
"layerDefs",
",",
"\"returnGeometry\"",
":",
"self",
".",
"_convert_boolean",
"(",
"returnGeometry",
")",
",",
"\"maxAllowableOffset\"",
":",
"maxAllowableOffset",
",",
"\"geometryPrecision\"",
":",
"geometryPrecision",
",",
"\"dynamicLayers\"",
":",
"dynamicLayers",
",",
"\"returnZ\"",
":",
"self",
".",
"_convert_boolean",
"(",
"returnZ",
")",
",",
"\"returnM\"",
":",
"self",
".",
"_convert_boolean",
"(",
"returnM",
")",
",",
"\"gdbVersion\"",
":",
"gdbVersion",
",",
"\"layers\"",
":",
"layers",
"}",
"res",
"=",
"self",
".",
"_get",
"(",
"url",
",",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")",
"qResults",
"=",
"[",
"]",
"for",
"r",
"in",
"res",
"[",
"'results'",
"]",
":",
"qResults",
".",
"append",
"(",
"Feature",
"(",
"r",
")",
")",
"return",
"qResults"
] | performs the map service find operation | [
"performs",
"the",
"map",
"service",
"find",
"operation"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/ags/mapservice.py#L479-L511 | train |
Esri/ArcREST | src/arcrest/ags/mapservice.py | MapService.getFeatureDynamicLayer | def getFeatureDynamicLayer(self, oid, dynamicLayer,
returnZ=False, returnM=False):
""" The feature resource represents a single feature in a dynamic
layer in a map service
"""
url = self._url + "/dynamicLayer/%s" % oid
params = {
"f": "json",
"returnZ": returnZ,
"returnM" : returnM,
"layer": {
"id": 101,
"source" : dynamicLayer.asDictionary
}
}
return Feature(
json_string=self._get(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_port=self._proxy_port,
proxy_url=self._proxy_url)
) | python | def getFeatureDynamicLayer(self, oid, dynamicLayer,
returnZ=False, returnM=False):
""" The feature resource represents a single feature in a dynamic
layer in a map service
"""
url = self._url + "/dynamicLayer/%s" % oid
params = {
"f": "json",
"returnZ": returnZ,
"returnM" : returnM,
"layer": {
"id": 101,
"source" : dynamicLayer.asDictionary
}
}
return Feature(
json_string=self._get(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_port=self._proxy_port,
proxy_url=self._proxy_url)
) | [
"def",
"getFeatureDynamicLayer",
"(",
"self",
",",
"oid",
",",
"dynamicLayer",
",",
"returnZ",
"=",
"False",
",",
"returnM",
"=",
"False",
")",
":",
"url",
"=",
"self",
".",
"_url",
"+",
"\"/dynamicLayer/%s\"",
"%",
"oid",
"params",
"=",
"{",
"\"f\"",
":",
"\"json\"",
",",
"\"returnZ\"",
":",
"returnZ",
",",
"\"returnM\"",
":",
"returnM",
",",
"\"layer\"",
":",
"{",
"\"id\"",
":",
"101",
",",
"\"source\"",
":",
"dynamicLayer",
".",
"asDictionary",
"}",
"}",
"return",
"Feature",
"(",
"json_string",
"=",
"self",
".",
"_get",
"(",
"url",
"=",
"url",
",",
"param_dict",
"=",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
")",
")"
] | The feature resource represents a single feature in a dynamic
layer in a map service | [
"The",
"feature",
"resource",
"represents",
"a",
"single",
"feature",
"in",
"a",
"dynamic",
"layer",
"in",
"a",
"map",
"service"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/ags/mapservice.py#L524-L545 | train |
Esri/ArcREST | src/arcrest/ags/mapservice.py | MapService.identify | def identify(self,
geometry,
mapExtent,
imageDisplay,
tolerance,
geometryType="esriGeometryPoint",
sr=None,
layerDefs=None,
time=None,
layerTimeOptions=None,
layers="top",
returnGeometry=True,
maxAllowableOffset=None,
geometryPrecision=None,
dynamicLayers=None,
returnZ=False,
returnM=False,
gdbVersion=None):
"""
The identify operation is performed on a map service resource
to discover features at a geographic location. The result of this
operation is an identify results resource. Each identified result
includes its name, layer ID, layer name, geometry and geometry type,
and other attributes of that result as name-value pairs.
Inputs:
geometry - The geometry to identify on. The type of the geometry is
specified by the geometryType parameter. The structure of
the geometries is same as the structure of the JSON geometry
objects returned by the ArcGIS REST API. In addition to the
JSON structures, for points and envelopes, you can specify
the geometries with a simpler comma-separated syntax.
Syntax:
JSON structures:
<geometryType>&geometry={ geometry}
Point simple syntax:
esriGeometryPoint&geometry=<x>,<y>
Envelope simple syntax:
esriGeometryEnvelope&geometry=<xmin>,<ymin>,<xmax>,<ymax>
geometryType - The type of geometry specified by the geometry parameter.
The geometry type could be a point, line, polygon, or
an envelope.
Values:
esriGeometryPoint | esriGeometryMultipoint |
esriGeometryPolyline | esriGeometryPolygon |
esriGeometryEnvelope
sr - The well-known ID of the spatial reference of the input and
output geometries as well as the mapExtent. If sr is not specified,
the geometry and the mapExtent are assumed to be in the spatial
reference of the map, and the output geometries are also in the
spatial reference of the map.
layerDefs - Allows you to filter the features of individual layers in
the exported map by specifying definition expressions for
those layers. Definition expression for a layer that is
published with the service will be always honored.
time - The time instant or the time extent of the features to be
identified.
layerTimeOptions - The time options per layer. Users can indicate
whether or not the layer should use the time extent
specified by the time parameter or not, whether to
draw the layer features cumulatively or not and the
time offsets for the layer.
layers - The layers to perform the identify operation on. There are
three ways to specify which layers to identify on:
top: Only the top-most layer at the specified location.
visible: All visible layers at the specified location.
all: All layers at the specified location.
tolerance - The distance in screen pixels from the specified geometry
within which the identify should be performed. The value for
the tolerance is an integer.
mapExtent - The extent or bounding box of the map currently being viewed.
Unless the sr parameter has been specified, the mapExtent is
assumed to be in the spatial reference of the map.
Syntax: <xmin>, <ymin>, <xmax>, <ymax>
The mapExtent and the imageDisplay parameters are used by the
server to determine the layers visible in the current extent.
They are also used to calculate the distance on the map to
search based on the tolerance in screen pixels.
imageDisplay - The screen image display parameters (width, height, and DPI)
of the map being currently viewed. The mapExtent and the
imageDisplay parameters are used by the server to determine
the layers visible in the current extent. They are also used
to calculate the distance on the map to search based on the
tolerance in screen pixels.
Syntax: <width>, <height>, <dpi>
returnGeometry - If true, the resultset will include the geometries
associated with each result. The default is true.
maxAllowableOffset - This option can be used to specify the maximum allowable
offset to be used for generalizing geometries returned by
the identify operation. The maxAllowableOffset is in the units
of the sr. If sr is not specified, maxAllowableOffset is
assumed to be in the unit of the spatial reference of the map.
geometryPrecision - This option can be used to specify the number of decimal places
in the response geometries returned by the identify operation.
This applies to X and Y values only (not m or z-values).
dynamicLayers - Use dynamicLayers property to reorder layers and change the layer
data source. dynamicLayers can also be used to add new layer that
was not defined in the map used to create the map service. The new
layer should have its source pointing to one of the registered
workspaces that was defined at the time the map service was created.
The order of dynamicLayers array defines the layer drawing order.
The first element of the dynamicLayers is stacked on top of all
other layers. When defining a dynamic layer, source is required.
returnZ - If true, Z values will be included in the results if the features have
Z values. Otherwise, Z values are not returned. The default is false.
This parameter only applies if returnGeometry=true.
returnM - If true, M values will be included in the results if the features have
M values. Otherwise, M values are not returned. The default is false.
This parameter only applies if returnGeometry=true.
gdbVersion - Switch map layers to point to an alternate geodatabase version.
"""
params= {'f': 'json',
'geometry': geometry,
'geometryType': geometryType,
'tolerance': tolerance,
'mapExtent': mapExtent,
'imageDisplay': imageDisplay
}
if layerDefs is not None:
params['layerDefs'] = layerDefs
if layers is not None:
params['layers'] = layers
if sr is not None:
params['sr'] = sr
if time is not None:
params['time'] = time
if layerTimeOptions is not None:
params['layerTimeOptions'] = layerTimeOptions
if maxAllowableOffset is not None:
params['maxAllowableOffset'] = maxAllowableOffset
if geometryPrecision is not None:
params['geometryPrecision'] = geometryPrecision
if dynamicLayers is not None:
params['dynamicLayers'] = dynamicLayers
if gdbVersion is not None:
params['gdbVersion'] = gdbVersion
identifyURL = self._url + "/identify"
return self._get(url=identifyURL,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | python | def identify(self,
geometry,
mapExtent,
imageDisplay,
tolerance,
geometryType="esriGeometryPoint",
sr=None,
layerDefs=None,
time=None,
layerTimeOptions=None,
layers="top",
returnGeometry=True,
maxAllowableOffset=None,
geometryPrecision=None,
dynamicLayers=None,
returnZ=False,
returnM=False,
gdbVersion=None):
"""
The identify operation is performed on a map service resource
to discover features at a geographic location. The result of this
operation is an identify results resource. Each identified result
includes its name, layer ID, layer name, geometry and geometry type,
and other attributes of that result as name-value pairs.
Inputs:
geometry - The geometry to identify on. The type of the geometry is
specified by the geometryType parameter. The structure of
the geometries is same as the structure of the JSON geometry
objects returned by the ArcGIS REST API. In addition to the
JSON structures, for points and envelopes, you can specify
the geometries with a simpler comma-separated syntax.
Syntax:
JSON structures:
<geometryType>&geometry={ geometry}
Point simple syntax:
esriGeometryPoint&geometry=<x>,<y>
Envelope simple syntax:
esriGeometryEnvelope&geometry=<xmin>,<ymin>,<xmax>,<ymax>
geometryType - The type of geometry specified by the geometry parameter.
The geometry type could be a point, line, polygon, or
an envelope.
Values:
esriGeometryPoint | esriGeometryMultipoint |
esriGeometryPolyline | esriGeometryPolygon |
esriGeometryEnvelope
sr - The well-known ID of the spatial reference of the input and
output geometries as well as the mapExtent. If sr is not specified,
the geometry and the mapExtent are assumed to be in the spatial
reference of the map, and the output geometries are also in the
spatial reference of the map.
layerDefs - Allows you to filter the features of individual layers in
the exported map by specifying definition expressions for
those layers. Definition expression for a layer that is
published with the service will be always honored.
time - The time instant or the time extent of the features to be
identified.
layerTimeOptions - The time options per layer. Users can indicate
whether or not the layer should use the time extent
specified by the time parameter or not, whether to
draw the layer features cumulatively or not and the
time offsets for the layer.
layers - The layers to perform the identify operation on. There are
three ways to specify which layers to identify on:
top: Only the top-most layer at the specified location.
visible: All visible layers at the specified location.
all: All layers at the specified location.
tolerance - The distance in screen pixels from the specified geometry
within which the identify should be performed. The value for
the tolerance is an integer.
mapExtent - The extent or bounding box of the map currently being viewed.
Unless the sr parameter has been specified, the mapExtent is
assumed to be in the spatial reference of the map.
Syntax: <xmin>, <ymin>, <xmax>, <ymax>
The mapExtent and the imageDisplay parameters are used by the
server to determine the layers visible in the current extent.
They are also used to calculate the distance on the map to
search based on the tolerance in screen pixels.
imageDisplay - The screen image display parameters (width, height, and DPI)
of the map being currently viewed. The mapExtent and the
imageDisplay parameters are used by the server to determine
the layers visible in the current extent. They are also used
to calculate the distance on the map to search based on the
tolerance in screen pixels.
Syntax: <width>, <height>, <dpi>
returnGeometry - If true, the resultset will include the geometries
associated with each result. The default is true.
maxAllowableOffset - This option can be used to specify the maximum allowable
offset to be used for generalizing geometries returned by
the identify operation. The maxAllowableOffset is in the units
of the sr. If sr is not specified, maxAllowableOffset is
assumed to be in the unit of the spatial reference of the map.
geometryPrecision - This option can be used to specify the number of decimal places
in the response geometries returned by the identify operation.
This applies to X and Y values only (not m or z-values).
dynamicLayers - Use dynamicLayers property to reorder layers and change the layer
data source. dynamicLayers can also be used to add new layer that
was not defined in the map used to create the map service. The new
layer should have its source pointing to one of the registered
workspaces that was defined at the time the map service was created.
The order of dynamicLayers array defines the layer drawing order.
The first element of the dynamicLayers is stacked on top of all
other layers. When defining a dynamic layer, source is required.
returnZ - If true, Z values will be included in the results if the features have
Z values. Otherwise, Z values are not returned. The default is false.
This parameter only applies if returnGeometry=true.
returnM - If true, M values will be included in the results if the features have
M values. Otherwise, M values are not returned. The default is false.
This parameter only applies if returnGeometry=true.
gdbVersion - Switch map layers to point to an alternate geodatabase version.
"""
params= {'f': 'json',
'geometry': geometry,
'geometryType': geometryType,
'tolerance': tolerance,
'mapExtent': mapExtent,
'imageDisplay': imageDisplay
}
if layerDefs is not None:
params['layerDefs'] = layerDefs
if layers is not None:
params['layers'] = layers
if sr is not None:
params['sr'] = sr
if time is not None:
params['time'] = time
if layerTimeOptions is not None:
params['layerTimeOptions'] = layerTimeOptions
if maxAllowableOffset is not None:
params['maxAllowableOffset'] = maxAllowableOffset
if geometryPrecision is not None:
params['geometryPrecision'] = geometryPrecision
if dynamicLayers is not None:
params['dynamicLayers'] = dynamicLayers
if gdbVersion is not None:
params['gdbVersion'] = gdbVersion
identifyURL = self._url + "/identify"
return self._get(url=identifyURL,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | [
"def",
"identify",
"(",
"self",
",",
"geometry",
",",
"mapExtent",
",",
"imageDisplay",
",",
"tolerance",
",",
"geometryType",
"=",
"\"esriGeometryPoint\"",
",",
"sr",
"=",
"None",
",",
"layerDefs",
"=",
"None",
",",
"time",
"=",
"None",
",",
"layerTimeOptions",
"=",
"None",
",",
"layers",
"=",
"\"top\"",
",",
"returnGeometry",
"=",
"True",
",",
"maxAllowableOffset",
"=",
"None",
",",
"geometryPrecision",
"=",
"None",
",",
"dynamicLayers",
"=",
"None",
",",
"returnZ",
"=",
"False",
",",
"returnM",
"=",
"False",
",",
"gdbVersion",
"=",
"None",
")",
":",
"params",
"=",
"{",
"'f'",
":",
"'json'",
",",
"'geometry'",
":",
"geometry",
",",
"'geometryType'",
":",
"geometryType",
",",
"'tolerance'",
":",
"tolerance",
",",
"'mapExtent'",
":",
"mapExtent",
",",
"'imageDisplay'",
":",
"imageDisplay",
"}",
"if",
"layerDefs",
"is",
"not",
"None",
":",
"params",
"[",
"'layerDefs'",
"]",
"=",
"layerDefs",
"if",
"layers",
"is",
"not",
"None",
":",
"params",
"[",
"'layers'",
"]",
"=",
"layers",
"if",
"sr",
"is",
"not",
"None",
":",
"params",
"[",
"'sr'",
"]",
"=",
"sr",
"if",
"time",
"is",
"not",
"None",
":",
"params",
"[",
"'time'",
"]",
"=",
"time",
"if",
"layerTimeOptions",
"is",
"not",
"None",
":",
"params",
"[",
"'layerTimeOptions'",
"]",
"=",
"layerTimeOptions",
"if",
"maxAllowableOffset",
"is",
"not",
"None",
":",
"params",
"[",
"'maxAllowableOffset'",
"]",
"=",
"maxAllowableOffset",
"if",
"geometryPrecision",
"is",
"not",
"None",
":",
"params",
"[",
"'geometryPrecision'",
"]",
"=",
"geometryPrecision",
"if",
"dynamicLayers",
"is",
"not",
"None",
":",
"params",
"[",
"'dynamicLayers'",
"]",
"=",
"dynamicLayers",
"if",
"gdbVersion",
"is",
"not",
"None",
":",
"params",
"[",
"'gdbVersion'",
"]",
"=",
"gdbVersion",
"identifyURL",
"=",
"self",
".",
"_url",
"+",
"\"/identify\"",
"return",
"self",
".",
"_get",
"(",
"url",
"=",
"identifyURL",
",",
"param_dict",
"=",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")"
] | The identify operation is performed on a map service resource
to discover features at a geographic location. The result of this
operation is an identify results resource. Each identified result
includes its name, layer ID, layer name, geometry and geometry type,
and other attributes of that result as name-value pairs.
Inputs:
geometry - The geometry to identify on. The type of the geometry is
specified by the geometryType parameter. The structure of
the geometries is same as the structure of the JSON geometry
objects returned by the ArcGIS REST API. In addition to the
JSON structures, for points and envelopes, you can specify
the geometries with a simpler comma-separated syntax.
Syntax:
JSON structures:
<geometryType>&geometry={ geometry}
Point simple syntax:
esriGeometryPoint&geometry=<x>,<y>
Envelope simple syntax:
esriGeometryEnvelope&geometry=<xmin>,<ymin>,<xmax>,<ymax>
geometryType - The type of geometry specified by the geometry parameter.
The geometry type could be a point, line, polygon, or
an envelope.
Values:
esriGeometryPoint | esriGeometryMultipoint |
esriGeometryPolyline | esriGeometryPolygon |
esriGeometryEnvelope
sr - The well-known ID of the spatial reference of the input and
output geometries as well as the mapExtent. If sr is not specified,
the geometry and the mapExtent are assumed to be in the spatial
reference of the map, and the output geometries are also in the
spatial reference of the map.
layerDefs - Allows you to filter the features of individual layers in
the exported map by specifying definition expressions for
those layers. Definition expression for a layer that is
published with the service will be always honored.
time - The time instant or the time extent of the features to be
identified.
layerTimeOptions - The time options per layer. Users can indicate
whether or not the layer should use the time extent
specified by the time parameter or not, whether to
draw the layer features cumulatively or not and the
time offsets for the layer.
layers - The layers to perform the identify operation on. There are
three ways to specify which layers to identify on:
top: Only the top-most layer at the specified location.
visible: All visible layers at the specified location.
all: All layers at the specified location.
tolerance - The distance in screen pixels from the specified geometry
within which the identify should be performed. The value for
the tolerance is an integer.
mapExtent - The extent or bounding box of the map currently being viewed.
Unless the sr parameter has been specified, the mapExtent is
assumed to be in the spatial reference of the map.
Syntax: <xmin>, <ymin>, <xmax>, <ymax>
The mapExtent and the imageDisplay parameters are used by the
server to determine the layers visible in the current extent.
They are also used to calculate the distance on the map to
search based on the tolerance in screen pixels.
imageDisplay - The screen image display parameters (width, height, and DPI)
of the map being currently viewed. The mapExtent and the
imageDisplay parameters are used by the server to determine
the layers visible in the current extent. They are also used
to calculate the distance on the map to search based on the
tolerance in screen pixels.
Syntax: <width>, <height>, <dpi>
returnGeometry - If true, the resultset will include the geometries
associated with each result. The default is true.
maxAllowableOffset - This option can be used to specify the maximum allowable
offset to be used for generalizing geometries returned by
the identify operation. The maxAllowableOffset is in the units
of the sr. If sr is not specified, maxAllowableOffset is
assumed to be in the unit of the spatial reference of the map.
geometryPrecision - This option can be used to specify the number of decimal places
in the response geometries returned by the identify operation.
This applies to X and Y values only (not m or z-values).
dynamicLayers - Use dynamicLayers property to reorder layers and change the layer
data source. dynamicLayers can also be used to add new layer that
was not defined in the map used to create the map service. The new
layer should have its source pointing to one of the registered
workspaces that was defined at the time the map service was created.
The order of dynamicLayers array defines the layer drawing order.
The first element of the dynamicLayers is stacked on top of all
other layers. When defining a dynamic layer, source is required.
returnZ - If true, Z values will be included in the results if the features have
Z values. Otherwise, Z values are not returned. The default is false.
This parameter only applies if returnGeometry=true.
returnM - If true, M values will be included in the results if the features have
M values. Otherwise, M values are not returned. The default is false.
This parameter only applies if returnGeometry=true.
gdbVersion - Switch map layers to point to an alternate geodatabase version. | [
"The",
"identify",
"operation",
"is",
"performed",
"on",
"a",
"map",
"service",
"resource",
"to",
"discover",
"features",
"at",
"a",
"geographic",
"location",
".",
"The",
"result",
"of",
"this",
"operation",
"is",
"an",
"identify",
"results",
"resource",
".",
"Each",
"identified",
"result",
"includes",
"its",
"name",
"layer",
"ID",
"layer",
"name",
"geometry",
"and",
"geometry",
"type",
"and",
"other",
"attributes",
"of",
"that",
"result",
"as",
"name",
"-",
"value",
"pairs",
"."
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/ags/mapservice.py#L547-L708 | train |
Esri/ArcREST | src/arcrest/manageags/parameters.py | Extension.fromJSON | def fromJSON(value):
"""returns the object from json string or dictionary"""
if isinstance(value, str):
value = json.loads(value)
elif isinstance(value, dict): pass
else:
raise AttributeError("Invalid input")
return Extension(typeName=value['typeName'],
capabilities=value['capabilities'],
enabled=value['enabled'] == "true",
maxUploadFileSize=value['maxUploadFileSize'],
allowedUploadFileType=value['allowedUploadFileTypes'],
properties=value['properties']) | python | def fromJSON(value):
"""returns the object from json string or dictionary"""
if isinstance(value, str):
value = json.loads(value)
elif isinstance(value, dict): pass
else:
raise AttributeError("Invalid input")
return Extension(typeName=value['typeName'],
capabilities=value['capabilities'],
enabled=value['enabled'] == "true",
maxUploadFileSize=value['maxUploadFileSize'],
allowedUploadFileType=value['allowedUploadFileTypes'],
properties=value['properties']) | [
"def",
"fromJSON",
"(",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"str",
")",
":",
"value",
"=",
"json",
".",
"loads",
"(",
"value",
")",
"elif",
"isinstance",
"(",
"value",
",",
"dict",
")",
":",
"pass",
"else",
":",
"raise",
"AttributeError",
"(",
"\"Invalid input\"",
")",
"return",
"Extension",
"(",
"typeName",
"=",
"value",
"[",
"'typeName'",
"]",
",",
"capabilities",
"=",
"value",
"[",
"'capabilities'",
"]",
",",
"enabled",
"=",
"value",
"[",
"'enabled'",
"]",
"==",
"\"true\"",
",",
"maxUploadFileSize",
"=",
"value",
"[",
"'maxUploadFileSize'",
"]",
",",
"allowedUploadFileType",
"=",
"value",
"[",
"'allowedUploadFileTypes'",
"]",
",",
"properties",
"=",
"value",
"[",
"'properties'",
"]",
")"
] | returns the object from json string or dictionary | [
"returns",
"the",
"object",
"from",
"json",
"string",
"or",
"dictionary"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageags/parameters.py#L110-L122 | train |
Esri/ArcREST | src/arcrest/webmap/symbols.py | Color.asList | def asList(self):
""" returns the value as the list object"""
return [self._red, self._green, self._blue, self._alpha] | python | def asList(self):
""" returns the value as the list object"""
return [self._red, self._green, self._blue, self._alpha] | [
"def",
"asList",
"(",
"self",
")",
":",
"return",
"[",
"self",
".",
"_red",
",",
"self",
".",
"_green",
",",
"self",
".",
"_blue",
",",
"self",
".",
"_alpha",
"]"
] | returns the value as the list object | [
"returns",
"the",
"value",
"as",
"the",
"list",
"object"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/webmap/symbols.py#L77-L79 | train |
Esri/ArcREST | src/arcrest/webmap/symbols.py | SimpleMarkerSymbol.color | def color(self, value):
""" sets the color """
if isinstance(value, (list, Color)):
if value is list:
self._color = value
else:
self._color = value.asList | python | def color(self, value):
""" sets the color """
if isinstance(value, (list, Color)):
if value is list:
self._color = value
else:
self._color = value.asList | [
"def",
"color",
"(",
"self",
",",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"(",
"list",
",",
"Color",
")",
")",
":",
"if",
"value",
"is",
"list",
":",
"self",
".",
"_color",
"=",
"value",
"else",
":",
"self",
".",
"_color",
"=",
"value",
".",
"asList"
] | sets the color | [
"sets",
"the",
"color"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/webmap/symbols.py#L157-L163 | train |
Esri/ArcREST | src/arcrest/webmap/symbols.py | SimpleMarkerSymbol.outlineColor | def outlineColor(self, value):
""" sets the outline color """
if isinstance(value, (list, Color)):
if value is list:
self._outlineColor = value
else:
self._outlineColor = value.asList | python | def outlineColor(self, value):
""" sets the outline color """
if isinstance(value, (list, Color)):
if value is list:
self._outlineColor = value
else:
self._outlineColor = value.asList | [
"def",
"outlineColor",
"(",
"self",
",",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"(",
"list",
",",
"Color",
")",
")",
":",
"if",
"value",
"is",
"list",
":",
"self",
".",
"_outlineColor",
"=",
"value",
"else",
":",
"self",
".",
"_outlineColor",
"=",
"value",
".",
"asList"
] | sets the outline color | [
"sets",
"the",
"outline",
"color"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/webmap/symbols.py#L229-L235 | train |
Esri/ArcREST | src/arcrest/webmap/symbols.py | SimpleFillSymbol.outline | def outline(self, value):
""" sets the outline """
if isinstance(value, SimpleLineSymbol):
self._outline = value.asDictionary | python | def outline(self, value):
""" sets the outline """
if isinstance(value, SimpleLineSymbol):
self._outline = value.asDictionary | [
"def",
"outline",
"(",
"self",
",",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"SimpleLineSymbol",
")",
":",
"self",
".",
"_outline",
"=",
"value",
".",
"asDictionary"
] | sets the outline | [
"sets",
"the",
"outline"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/webmap/symbols.py#L389-L392 | train |
Esri/ArcREST | src/arcrest/webmap/symbols.py | PictureMarkerSymbol.base64ToImage | def base64ToImage(imgData, out_path, out_file):
""" converts a base64 string to a file """
fh = open(os.path.join(out_path, out_file), "wb")
fh.write(imgData.decode('base64'))
fh.close()
del fh
return os.path.join(out_path, out_file) | python | def base64ToImage(imgData, out_path, out_file):
""" converts a base64 string to a file """
fh = open(os.path.join(out_path, out_file), "wb")
fh.write(imgData.decode('base64'))
fh.close()
del fh
return os.path.join(out_path, out_file) | [
"def",
"base64ToImage",
"(",
"imgData",
",",
"out_path",
",",
"out_file",
")",
":",
"fh",
"=",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"out_path",
",",
"out_file",
")",
",",
"\"wb\"",
")",
"fh",
".",
"write",
"(",
"imgData",
".",
"decode",
"(",
"'base64'",
")",
")",
"fh",
".",
"close",
"(",
")",
"del",
"fh",
"return",
"os",
".",
"path",
".",
"join",
"(",
"out_path",
",",
"out_file",
")"
] | converts a base64 string to a file | [
"converts",
"a",
"base64",
"string",
"to",
"a",
"file"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/webmap/symbols.py#L448-L454 | train |
Esri/ArcREST | src/arcrest/ags/_geocodeservice.py | GeocodeService.find | def find(self,
text,
magicKey=None,
sourceCountry=None,
bbox=None,
location=None,
distance=3218.69,
outSR=102100,
category=None,
outFields="*",
maxLocations=20,
forStorage=False):
"""
The find operation geocodes one location per request; the input
address is specified in a single parameter.
Inputs:
text - Specifies the location to be geocoded. This can be a
street address, place name, postal code, or POI.
magicKey - The find operation retrieves results quicker when you
pass in valid text and magicKey values than when you don't pass
in magicKey. However, to get these advantages, you need to make
a prior request to suggest, which provides a magicKey. This may
or may not be relevant to your workflow.
sourceCountry - A value representing the country. Providing this
value increases geocoding speed. Acceptable values include the
full country name in English or the official language of the
country, the ISO 3166-1 2-digit country code, or the
ISO 3166-1 3-digit country code.
bbox - A set of bounding box coordinates that limit the search
area to a specific region. This is especially useful for
applications in which a user will search for places and
addresses only within the current map extent.
location - Defines an origin point location that is used with
the distance parameter to sort geocoding candidates based upon
their proximity to the location. The distance parameter
specifies the radial distance from the location in meters. The
priority of candidates within this radius is boosted relative
to those outside the radius.
distance - Specifies the radius of an area around a point
location which is used to boost the rank of geocoding
candidates so that candidates closest to the location are
returned first. The distance value is in meters.
outSR - The spatial reference of the x/y coordinates returned by
a geocode request. This is useful for applications using a map
with a spatial reference different than that of the geocode
service.
category - A place or address type which can be used to filter
find results. The parameter supports input of single category
values or multiple comma-separated values. The category
parameter can be passed in a request with or without the text
parameter.
outFields - The list of fields to be returned in the response.
maxLocation - The maximum number of locations to be returned by
a search, up to the maximum number allowed by the service. If
not specified, then one location will be returned.
forStorage - Specifies whether the results of the operation will
be persisted. The default value is false, which indicates the
results of the operation can't be stored, but they can be
temporarily displayed on a map for instance. If you store the
results, in a database for example, you need to set this
parameter to true.
"""
if isinstance(self._securityHandler, (AGOLTokenSecurityHandler, OAuthSecurityHandler)):
url = self._url + "/find"
params = {
"f" : "json",
"text" : text,
#"token" : self._securityHandler.token
}
if not magicKey is None:
params['magicKey'] = magicKey
if not sourceCountry is None:
params['sourceCountry'] = sourceCountry
if not bbox is None:
params['bbox'] = bbox
if not location is None:
if isinstance(location, Point):
params['location'] = location.asDictionary
if isinstance(location, list):
params['location'] = "%s,%s" % (location[0], location[1])
if not distance is None:
params['distance'] = distance
if not outSR is None:
params['outSR'] = outSR
if not category is None:
params['category'] = category
if outFields is None:
params['outFields'] = "*"
else:
params['outFields'] = outFields
if not maxLocations is None:
params['maxLocations'] = maxLocations
if not forStorage is None:
params['forStorage'] = forStorage
return self._post(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port)
else:
raise Exception("This function works on the ArcGIS Online World Geocoder") | python | def find(self,
text,
magicKey=None,
sourceCountry=None,
bbox=None,
location=None,
distance=3218.69,
outSR=102100,
category=None,
outFields="*",
maxLocations=20,
forStorage=False):
"""
The find operation geocodes one location per request; the input
address is specified in a single parameter.
Inputs:
text - Specifies the location to be geocoded. This can be a
street address, place name, postal code, or POI.
magicKey - The find operation retrieves results quicker when you
pass in valid text and magicKey values than when you don't pass
in magicKey. However, to get these advantages, you need to make
a prior request to suggest, which provides a magicKey. This may
or may not be relevant to your workflow.
sourceCountry - A value representing the country. Providing this
value increases geocoding speed. Acceptable values include the
full country name in English or the official language of the
country, the ISO 3166-1 2-digit country code, or the
ISO 3166-1 3-digit country code.
bbox - A set of bounding box coordinates that limit the search
area to a specific region. This is especially useful for
applications in which a user will search for places and
addresses only within the current map extent.
location - Defines an origin point location that is used with
the distance parameter to sort geocoding candidates based upon
their proximity to the location. The distance parameter
specifies the radial distance from the location in meters. The
priority of candidates within this radius is boosted relative
to those outside the radius.
distance - Specifies the radius of an area around a point
location which is used to boost the rank of geocoding
candidates so that candidates closest to the location are
returned first. The distance value is in meters.
outSR - The spatial reference of the x/y coordinates returned by
a geocode request. This is useful for applications using a map
with a spatial reference different than that of the geocode
service.
category - A place or address type which can be used to filter
find results. The parameter supports input of single category
values or multiple comma-separated values. The category
parameter can be passed in a request with or without the text
parameter.
outFields - The list of fields to be returned in the response.
maxLocation - The maximum number of locations to be returned by
a search, up to the maximum number allowed by the service. If
not specified, then one location will be returned.
forStorage - Specifies whether the results of the operation will
be persisted. The default value is false, which indicates the
results of the operation can't be stored, but they can be
temporarily displayed on a map for instance. If you store the
results, in a database for example, you need to set this
parameter to true.
"""
if isinstance(self._securityHandler, (AGOLTokenSecurityHandler, OAuthSecurityHandler)):
url = self._url + "/find"
params = {
"f" : "json",
"text" : text,
#"token" : self._securityHandler.token
}
if not magicKey is None:
params['magicKey'] = magicKey
if not sourceCountry is None:
params['sourceCountry'] = sourceCountry
if not bbox is None:
params['bbox'] = bbox
if not location is None:
if isinstance(location, Point):
params['location'] = location.asDictionary
if isinstance(location, list):
params['location'] = "%s,%s" % (location[0], location[1])
if not distance is None:
params['distance'] = distance
if not outSR is None:
params['outSR'] = outSR
if not category is None:
params['category'] = category
if outFields is None:
params['outFields'] = "*"
else:
params['outFields'] = outFields
if not maxLocations is None:
params['maxLocations'] = maxLocations
if not forStorage is None:
params['forStorage'] = forStorage
return self._post(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port)
else:
raise Exception("This function works on the ArcGIS Online World Geocoder") | [
"def",
"find",
"(",
"self",
",",
"text",
",",
"magicKey",
"=",
"None",
",",
"sourceCountry",
"=",
"None",
",",
"bbox",
"=",
"None",
",",
"location",
"=",
"None",
",",
"distance",
"=",
"3218.69",
",",
"outSR",
"=",
"102100",
",",
"category",
"=",
"None",
",",
"outFields",
"=",
"\"*\"",
",",
"maxLocations",
"=",
"20",
",",
"forStorage",
"=",
"False",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"_securityHandler",
",",
"(",
"AGOLTokenSecurityHandler",
",",
"OAuthSecurityHandler",
")",
")",
":",
"url",
"=",
"self",
".",
"_url",
"+",
"\"/find\"",
"params",
"=",
"{",
"\"f\"",
":",
"\"json\"",
",",
"\"text\"",
":",
"text",
",",
"#\"token\" : self._securityHandler.token",
"}",
"if",
"not",
"magicKey",
"is",
"None",
":",
"params",
"[",
"'magicKey'",
"]",
"=",
"magicKey",
"if",
"not",
"sourceCountry",
"is",
"None",
":",
"params",
"[",
"'sourceCountry'",
"]",
"=",
"sourceCountry",
"if",
"not",
"bbox",
"is",
"None",
":",
"params",
"[",
"'bbox'",
"]",
"=",
"bbox",
"if",
"not",
"location",
"is",
"None",
":",
"if",
"isinstance",
"(",
"location",
",",
"Point",
")",
":",
"params",
"[",
"'location'",
"]",
"=",
"location",
".",
"asDictionary",
"if",
"isinstance",
"(",
"location",
",",
"list",
")",
":",
"params",
"[",
"'location'",
"]",
"=",
"\"%s,%s\"",
"%",
"(",
"location",
"[",
"0",
"]",
",",
"location",
"[",
"1",
"]",
")",
"if",
"not",
"distance",
"is",
"None",
":",
"params",
"[",
"'distance'",
"]",
"=",
"distance",
"if",
"not",
"outSR",
"is",
"None",
":",
"params",
"[",
"'outSR'",
"]",
"=",
"outSR",
"if",
"not",
"category",
"is",
"None",
":",
"params",
"[",
"'category'",
"]",
"=",
"category",
"if",
"outFields",
"is",
"None",
":",
"params",
"[",
"'outFields'",
"]",
"=",
"\"*\"",
"else",
":",
"params",
"[",
"'outFields'",
"]",
"=",
"outFields",
"if",
"not",
"maxLocations",
"is",
"None",
":",
"params",
"[",
"'maxLocations'",
"]",
"=",
"maxLocations",
"if",
"not",
"forStorage",
"is",
"None",
":",
"params",
"[",
"'forStorage'",
"]",
"=",
"forStorage",
"return",
"self",
".",
"_post",
"(",
"url",
"=",
"url",
",",
"param_dict",
"=",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")",
"else",
":",
"raise",
"Exception",
"(",
"\"This function works on the ArcGIS Online World Geocoder\"",
")"
] | The find operation geocodes one location per request; the input
address is specified in a single parameter.
Inputs:
text - Specifies the location to be geocoded. This can be a
street address, place name, postal code, or POI.
magicKey - The find operation retrieves results quicker when you
pass in valid text and magicKey values than when you don't pass
in magicKey. However, to get these advantages, you need to make
a prior request to suggest, which provides a magicKey. This may
or may not be relevant to your workflow.
sourceCountry - A value representing the country. Providing this
value increases geocoding speed. Acceptable values include the
full country name in English or the official language of the
country, the ISO 3166-1 2-digit country code, or the
ISO 3166-1 3-digit country code.
bbox - A set of bounding box coordinates that limit the search
area to a specific region. This is especially useful for
applications in which a user will search for places and
addresses only within the current map extent.
location - Defines an origin point location that is used with
the distance parameter to sort geocoding candidates based upon
their proximity to the location. The distance parameter
specifies the radial distance from the location in meters. The
priority of candidates within this radius is boosted relative
to those outside the radius.
distance - Specifies the radius of an area around a point
location which is used to boost the rank of geocoding
candidates so that candidates closest to the location are
returned first. The distance value is in meters.
outSR - The spatial reference of the x/y coordinates returned by
a geocode request. This is useful for applications using a map
with a spatial reference different than that of the geocode
service.
category - A place or address type which can be used to filter
find results. The parameter supports input of single category
values or multiple comma-separated values. The category
parameter can be passed in a request with or without the text
parameter.
outFields - The list of fields to be returned in the response.
maxLocation - The maximum number of locations to be returned by
a search, up to the maximum number allowed by the service. If
not specified, then one location will be returned.
forStorage - Specifies whether the results of the operation will
be persisted. The default value is false, which indicates the
results of the operation can't be stored, but they can be
temporarily displayed on a map for instance. If you store the
results, in a database for example, you need to set this
parameter to true. | [
"The",
"find",
"operation",
"geocodes",
"one",
"location",
"per",
"request",
";",
"the",
"input",
"address",
"is",
"specified",
"in",
"a",
"single",
"parameter",
"."
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/ags/_geocodeservice.py#L160-L261 | train |
Esri/ArcREST | src/arcrest/ags/_geocodeservice.py | GeocodeService.geocodeAddresses | def geocodeAddresses(self,
addresses,
outSR=4326,
sourceCountry=None,
category=None):
"""
The geocodeAddresses operation is performed on a Geocode Service
resource. The result of this operation is a resource representing
the list of geocoded addresses. This resource provides information
about the addresses including the address, location, score, and
other geocode service-specific attributes.You can provide arguments
to the geocodeAddresses operation as query parameters defined in
the following parameters table.
Inputs:
addresses - A record set representing the addresses to be
geocoded. Each record must include an OBJECTID attribute with a
unique value, as well as various address fields accepted by the
corresponding geocode service. The field names that should be
used can be found in the JSON representation of the geocode
service resource under the addressFields property, for multiple
input field geocoding, or the singleLineAddressField property,
for single input field geocoding. The OBJECTID specified in the
request is reflected as ResultID in the response.
The maximum number of addresses that can be geocoded in a
single request is limited to the SuggestedBatchSize property of
the locator.
Syntax:
{
"records" : [
{
"attributes" : {"<OBJECTID>" : "<OID11>",
"<field1>" : "<value11>",
"<field2>" : "<value12>",
"<field3>" : "<value13>"
}
},
{
"attributes" : {"<OBJECTID>" : "<OID12>",
"<field1>" : "<value11>",
"<field2>" : "<value12>",
"<field3>" : "<value13>"
}
}
]
}
outSR - The well-known ID of the spatial reference, or a spatial
reference json object for the returned addresses. For a list of
valid WKID values, see Projected coordinate systems and
Geographic coordinate systems.
sourceCountry - The sourceCountry parameter is only supported by
geocode services published using StreetMap Premium locators.
Added at 10.3 and only supported by geocode services published
with ArcGIS 10.3 for Server and later versions.
category - The category parameter is only supported by geocode
services published using StreetMap Premium locators.
"""
params = {
"f" : "json"
}
url = self._url + "/geocodeAddresses"
params['outSR'] = outSR
params['sourceCountry'] = sourceCountry
params['category'] = category
params['addresses'] = addresses
return self._post(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | python | def geocodeAddresses(self,
addresses,
outSR=4326,
sourceCountry=None,
category=None):
"""
The geocodeAddresses operation is performed on a Geocode Service
resource. The result of this operation is a resource representing
the list of geocoded addresses. This resource provides information
about the addresses including the address, location, score, and
other geocode service-specific attributes.You can provide arguments
to the geocodeAddresses operation as query parameters defined in
the following parameters table.
Inputs:
addresses - A record set representing the addresses to be
geocoded. Each record must include an OBJECTID attribute with a
unique value, as well as various address fields accepted by the
corresponding geocode service. The field names that should be
used can be found in the JSON representation of the geocode
service resource under the addressFields property, for multiple
input field geocoding, or the singleLineAddressField property,
for single input field geocoding. The OBJECTID specified in the
request is reflected as ResultID in the response.
The maximum number of addresses that can be geocoded in a
single request is limited to the SuggestedBatchSize property of
the locator.
Syntax:
{
"records" : [
{
"attributes" : {"<OBJECTID>" : "<OID11>",
"<field1>" : "<value11>",
"<field2>" : "<value12>",
"<field3>" : "<value13>"
}
},
{
"attributes" : {"<OBJECTID>" : "<OID12>",
"<field1>" : "<value11>",
"<field2>" : "<value12>",
"<field3>" : "<value13>"
}
}
]
}
outSR - The well-known ID of the spatial reference, or a spatial
reference json object for the returned addresses. For a list of
valid WKID values, see Projected coordinate systems and
Geographic coordinate systems.
sourceCountry - The sourceCountry parameter is only supported by
geocode services published using StreetMap Premium locators.
Added at 10.3 and only supported by geocode services published
with ArcGIS 10.3 for Server and later versions.
category - The category parameter is only supported by geocode
services published using StreetMap Premium locators.
"""
params = {
"f" : "json"
}
url = self._url + "/geocodeAddresses"
params['outSR'] = outSR
params['sourceCountry'] = sourceCountry
params['category'] = category
params['addresses'] = addresses
return self._post(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | [
"def",
"geocodeAddresses",
"(",
"self",
",",
"addresses",
",",
"outSR",
"=",
"4326",
",",
"sourceCountry",
"=",
"None",
",",
"category",
"=",
"None",
")",
":",
"params",
"=",
"{",
"\"f\"",
":",
"\"json\"",
"}",
"url",
"=",
"self",
".",
"_url",
"+",
"\"/geocodeAddresses\"",
"params",
"[",
"'outSR'",
"]",
"=",
"outSR",
"params",
"[",
"'sourceCountry'",
"]",
"=",
"sourceCountry",
"params",
"[",
"'category'",
"]",
"=",
"category",
"params",
"[",
"'addresses'",
"]",
"=",
"addresses",
"return",
"self",
".",
"_post",
"(",
"url",
"=",
"url",
",",
"param_dict",
"=",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")"
] | The geocodeAddresses operation is performed on a Geocode Service
resource. The result of this operation is a resource representing
the list of geocoded addresses. This resource provides information
about the addresses including the address, location, score, and
other geocode service-specific attributes.You can provide arguments
to the geocodeAddresses operation as query parameters defined in
the following parameters table.
Inputs:
addresses - A record set representing the addresses to be
geocoded. Each record must include an OBJECTID attribute with a
unique value, as well as various address fields accepted by the
corresponding geocode service. The field names that should be
used can be found in the JSON representation of the geocode
service resource under the addressFields property, for multiple
input field geocoding, or the singleLineAddressField property,
for single input field geocoding. The OBJECTID specified in the
request is reflected as ResultID in the response.
The maximum number of addresses that can be geocoded in a
single request is limited to the SuggestedBatchSize property of
the locator.
Syntax:
{
"records" : [
{
"attributes" : {"<OBJECTID>" : "<OID11>",
"<field1>" : "<value11>",
"<field2>" : "<value12>",
"<field3>" : "<value13>"
}
},
{
"attributes" : {"<OBJECTID>" : "<OID12>",
"<field1>" : "<value11>",
"<field2>" : "<value12>",
"<field3>" : "<value13>"
}
}
]
}
outSR - The well-known ID of the spatial reference, or a spatial
reference json object for the returned addresses. For a list of
valid WKID values, see Projected coordinate systems and
Geographic coordinate systems.
sourceCountry - The sourceCountry parameter is only supported by
geocode services published using StreetMap Premium locators.
Added at 10.3 and only supported by geocode services published
with ArcGIS 10.3 for Server and later versions.
category - The category parameter is only supported by geocode
services published using StreetMap Premium locators. | [
"The",
"geocodeAddresses",
"operation",
"is",
"performed",
"on",
"a",
"Geocode",
"Service",
"resource",
".",
"The",
"result",
"of",
"this",
"operation",
"is",
"a",
"resource",
"representing",
"the",
"list",
"of",
"geocoded",
"addresses",
".",
"This",
"resource",
"provides",
"information",
"about",
"the",
"addresses",
"including",
"the",
"address",
"location",
"score",
"and",
"other",
"geocode",
"service",
"-",
"specific",
"attributes",
".",
"You",
"can",
"provide",
"arguments",
"to",
"the",
"geocodeAddresses",
"operation",
"as",
"query",
"parameters",
"defined",
"in",
"the",
"following",
"parameters",
"table",
"."
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/ags/_geocodeservice.py#L422-L491 | train |
Esri/ArcREST | src/arcrest/ags/_networkservice.py | NetworkService.__init | def __init(self):
""" initializes the properties """
params = {
"f" : "json",
}
json_dict = self._get(self._url, params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port)
self._json_dict = json_dict
self._json = json.dumps(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():
if k in attributes:
if k == "routeLayers" and json_dict[k]:
self._routeLayers = []
for rl in v:
self._routeLayers.append(
RouteNetworkLayer(url=self._url + "/%s" % rl,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port,
initialize=False))
elif k == "serviceAreaLayers" and json_dict[k]:
self._serviceAreaLayers = []
for sal in v:
self._serviceAreaLayers.append(
ServiceAreaNetworkLayer(url=self._url + "/%s" % sal,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port,
initialize=False))
elif k == "closestFacilityLayers" and json_dict[k]:
self._closestFacilityLayers = []
for cf in v:
self._closestFacilityLayers.append(
ClosestFacilityNetworkLayer(url=self._url + "/%s" % cf,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port,
initialize=False))
else:
setattr(self, "_"+ k, v)
else:
print ("attribute %s is not implemented." % k) | python | def __init(self):
""" initializes the properties """
params = {
"f" : "json",
}
json_dict = self._get(self._url, params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port)
self._json_dict = json_dict
self._json = json.dumps(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():
if k in attributes:
if k == "routeLayers" and json_dict[k]:
self._routeLayers = []
for rl in v:
self._routeLayers.append(
RouteNetworkLayer(url=self._url + "/%s" % rl,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port,
initialize=False))
elif k == "serviceAreaLayers" and json_dict[k]:
self._serviceAreaLayers = []
for sal in v:
self._serviceAreaLayers.append(
ServiceAreaNetworkLayer(url=self._url + "/%s" % sal,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port,
initialize=False))
elif k == "closestFacilityLayers" and json_dict[k]:
self._closestFacilityLayers = []
for cf in v:
self._closestFacilityLayers.append(
ClosestFacilityNetworkLayer(url=self._url + "/%s" % cf,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port,
initialize=False))
else:
setattr(self, "_"+ k, v)
else:
print ("attribute %s is not implemented." % k) | [
"def",
"__init",
"(",
"self",
")",
":",
"params",
"=",
"{",
"\"f\"",
":",
"\"json\"",
",",
"}",
"json_dict",
"=",
"self",
".",
"_get",
"(",
"self",
".",
"_url",
",",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")",
"self",
".",
"_json_dict",
"=",
"json_dict",
"self",
".",
"_json",
"=",
"json",
".",
"dumps",
"(",
"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",
"(",
")",
":",
"if",
"k",
"in",
"attributes",
":",
"if",
"k",
"==",
"\"routeLayers\"",
"and",
"json_dict",
"[",
"k",
"]",
":",
"self",
".",
"_routeLayers",
"=",
"[",
"]",
"for",
"rl",
"in",
"v",
":",
"self",
".",
"_routeLayers",
".",
"append",
"(",
"RouteNetworkLayer",
"(",
"url",
"=",
"self",
".",
"_url",
"+",
"\"/%s\"",
"%",
"rl",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
",",
"initialize",
"=",
"False",
")",
")",
"elif",
"k",
"==",
"\"serviceAreaLayers\"",
"and",
"json_dict",
"[",
"k",
"]",
":",
"self",
".",
"_serviceAreaLayers",
"=",
"[",
"]",
"for",
"sal",
"in",
"v",
":",
"self",
".",
"_serviceAreaLayers",
".",
"append",
"(",
"ServiceAreaNetworkLayer",
"(",
"url",
"=",
"self",
".",
"_url",
"+",
"\"/%s\"",
"%",
"sal",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
",",
"initialize",
"=",
"False",
")",
")",
"elif",
"k",
"==",
"\"closestFacilityLayers\"",
"and",
"json_dict",
"[",
"k",
"]",
":",
"self",
".",
"_closestFacilityLayers",
"=",
"[",
"]",
"for",
"cf",
"in",
"v",
":",
"self",
".",
"_closestFacilityLayers",
".",
"append",
"(",
"ClosestFacilityNetworkLayer",
"(",
"url",
"=",
"self",
".",
"_url",
"+",
"\"/%s\"",
"%",
"cf",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
",",
"initialize",
"=",
"False",
")",
")",
"else",
":",
"setattr",
"(",
"self",
",",
"\"_\"",
"+",
"k",
",",
"v",
")",
"else",
":",
"print",
"(",
"\"attribute %s is not implemented.\"",
"%",
"k",
")"
] | initializes the properties | [
"initializes",
"the",
"properties"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/ags/_networkservice.py#L47-L96 | train |
Esri/ArcREST | src/arcrest/ags/_networkservice.py | RouteNetworkLayer.__init | def __init(self):
""" initializes all the properties """
params = {
"f" : "json"
}
json_dict = self._get(url=self._url, param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port)
attributes = [attr for attr in dir(self)
if not attr.startswith('__') and \
not attr.startswith('_')]
for k,v in json_dict.items():
if k in attributes:
setattr(self, "_"+ k, json_dict[k])
else:
print( k, " - attribute not implemented in RouteNetworkLayer.")
del k,v | python | def __init(self):
""" initializes all the properties """
params = {
"f" : "json"
}
json_dict = self._get(url=self._url, param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port)
attributes = [attr for attr in dir(self)
if not attr.startswith('__') and \
not attr.startswith('_')]
for k,v in json_dict.items():
if k in attributes:
setattr(self, "_"+ k, json_dict[k])
else:
print( k, " - attribute not implemented in RouteNetworkLayer.")
del k,v | [
"def",
"__init",
"(",
"self",
")",
":",
"params",
"=",
"{",
"\"f\"",
":",
"\"json\"",
"}",
"json_dict",
"=",
"self",
".",
"_get",
"(",
"url",
"=",
"self",
".",
"_url",
",",
"param_dict",
"=",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")",
"attributes",
"=",
"[",
"attr",
"for",
"attr",
"in",
"dir",
"(",
"self",
")",
"if",
"not",
"attr",
".",
"startswith",
"(",
"'__'",
")",
"and",
"not",
"attr",
".",
"startswith",
"(",
"'_'",
")",
"]",
"for",
"k",
",",
"v",
"in",
"json_dict",
".",
"items",
"(",
")",
":",
"if",
"k",
"in",
"attributes",
":",
"setattr",
"(",
"self",
",",
"\"_\"",
"+",
"k",
",",
"json_dict",
"[",
"k",
"]",
")",
"else",
":",
"print",
"(",
"k",
",",
"\" - attribute not implemented in RouteNetworkLayer.\"",
")",
"del",
"k",
",",
"v"
] | initializes all the properties | [
"initializes",
"all",
"the",
"properties"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/ags/_networkservice.py#L440-L457 | train |
Esri/ArcREST | src/arcrest/ags/_uploads.py | Uploads.download | def download(self, itemID, savePath):
"""
downloads an item to local disk
Inputs:
itemID - unique id of item to download
savePath - folder to save the file in
"""
if os.path.isdir(savePath) == False:
os.makedirs(savePath)
url = self._url + "/%s/download" % itemID
params = {
}
if len(params.keys()):
url = url + "?%s" % urlencode(params)
return self._get(url=url,
param_dict=params,
out_folder=savePath,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | python | def download(self, itemID, savePath):
"""
downloads an item to local disk
Inputs:
itemID - unique id of item to download
savePath - folder to save the file in
"""
if os.path.isdir(savePath) == False:
os.makedirs(savePath)
url = self._url + "/%s/download" % itemID
params = {
}
if len(params.keys()):
url = url + "?%s" % urlencode(params)
return self._get(url=url,
param_dict=params,
out_folder=savePath,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | [
"def",
"download",
"(",
"self",
",",
"itemID",
",",
"savePath",
")",
":",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"savePath",
")",
"==",
"False",
":",
"os",
".",
"makedirs",
"(",
"savePath",
")",
"url",
"=",
"self",
".",
"_url",
"+",
"\"/%s/download\"",
"%",
"itemID",
"params",
"=",
"{",
"}",
"if",
"len",
"(",
"params",
".",
"keys",
"(",
")",
")",
":",
"url",
"=",
"url",
"+",
"\"?%s\"",
"%",
"urlencode",
"(",
"params",
")",
"return",
"self",
".",
"_get",
"(",
"url",
"=",
"url",
",",
"param_dict",
"=",
"params",
",",
"out_folder",
"=",
"savePath",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")"
] | downloads an item to local disk
Inputs:
itemID - unique id of item to download
savePath - folder to save the file in | [
"downloads",
"an",
"item",
"to",
"local",
"disk"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/ags/_uploads.py#L109-L129 | train |
Esri/ArcREST | src/arcrest/manageags/_usagereports.py | UsageReports.reports | def reports(self):
"""returns a list of reports on the server"""
if self._metrics is None:
self.__init()
self._reports = []
for r in self._metrics:
url = self._url + "/%s" % six.moves.urllib.parse.quote_plus(r['reportname'])
self._reports.append(UsageReport(url=url,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port,
initialize=True))
del url
return self._reports | python | def reports(self):
"""returns a list of reports on the server"""
if self._metrics is None:
self.__init()
self._reports = []
for r in self._metrics:
url = self._url + "/%s" % six.moves.urllib.parse.quote_plus(r['reportname'])
self._reports.append(UsageReport(url=url,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port,
initialize=True))
del url
return self._reports | [
"def",
"reports",
"(",
"self",
")",
":",
"if",
"self",
".",
"_metrics",
"is",
"None",
":",
"self",
".",
"__init",
"(",
")",
"self",
".",
"_reports",
"=",
"[",
"]",
"for",
"r",
"in",
"self",
".",
"_metrics",
":",
"url",
"=",
"self",
".",
"_url",
"+",
"\"/%s\"",
"%",
"six",
".",
"moves",
".",
"urllib",
".",
"parse",
".",
"quote_plus",
"(",
"r",
"[",
"'reportname'",
"]",
")",
"self",
".",
"_reports",
".",
"append",
"(",
"UsageReport",
"(",
"url",
"=",
"url",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
",",
"initialize",
"=",
"True",
")",
")",
"del",
"url",
"return",
"self",
".",
"_reports"
] | returns a list of reports on the server | [
"returns",
"a",
"list",
"of",
"reports",
"on",
"the",
"server"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageags/_usagereports.py#L70-L83 | train |
Esri/ArcREST | src/arcrest/manageags/_usagereports.py | UsageReports.editUsageReportSettings | def editUsageReportSettings(self, samplingInterval,
enabled=True, maxHistory=0):
"""
The usage reports settings are applied to the entire site. A POST
request updates the usage reports settings.
Inputs:
samplingInterval - Defines the duration (in minutes) for which
the usage statistics are aggregated or sampled, in-memory,
before being written out to the statistics database.
enabled - default True - Can be true or false. When usage
reports are enabled, service usage statistics are collected
and persisted to a statistics database. When usage reports are
disabled, the statistics are not collected.
maxHistory - default 0 - Represents the number of days after
which usage statistics are deleted after the statistics
database. If the maxHistory parameter is set to 0, the
statistics are persisted forever.
"""
params = {
"f" : "json",
"maxHistory" : maxHistory,
"enabled" : enabled,
"samplingInterval" : samplingInterval
}
url = self._url + "/settings/edit"
return self._post(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | python | def editUsageReportSettings(self, samplingInterval,
enabled=True, maxHistory=0):
"""
The usage reports settings are applied to the entire site. A POST
request updates the usage reports settings.
Inputs:
samplingInterval - Defines the duration (in minutes) for which
the usage statistics are aggregated or sampled, in-memory,
before being written out to the statistics database.
enabled - default True - Can be true or false. When usage
reports are enabled, service usage statistics are collected
and persisted to a statistics database. When usage reports are
disabled, the statistics are not collected.
maxHistory - default 0 - Represents the number of days after
which usage statistics are deleted after the statistics
database. If the maxHistory parameter is set to 0, the
statistics are persisted forever.
"""
params = {
"f" : "json",
"maxHistory" : maxHistory,
"enabled" : enabled,
"samplingInterval" : samplingInterval
}
url = self._url + "/settings/edit"
return self._post(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | [
"def",
"editUsageReportSettings",
"(",
"self",
",",
"samplingInterval",
",",
"enabled",
"=",
"True",
",",
"maxHistory",
"=",
"0",
")",
":",
"params",
"=",
"{",
"\"f\"",
":",
"\"json\"",
",",
"\"maxHistory\"",
":",
"maxHistory",
",",
"\"enabled\"",
":",
"enabled",
",",
"\"samplingInterval\"",
":",
"samplingInterval",
"}",
"url",
"=",
"self",
".",
"_url",
"+",
"\"/settings/edit\"",
"return",
"self",
".",
"_post",
"(",
"url",
"=",
"url",
",",
"param_dict",
"=",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")"
] | The usage reports settings are applied to the entire site. A POST
request updates the usage reports settings.
Inputs:
samplingInterval - Defines the duration (in minutes) for which
the usage statistics are aggregated or sampled, in-memory,
before being written out to the statistics database.
enabled - default True - Can be true or false. When usage
reports are enabled, service usage statistics are collected
and persisted to a statistics database. When usage reports are
disabled, the statistics are not collected.
maxHistory - default 0 - Represents the number of days after
which usage statistics are deleted after the statistics
database. If the maxHistory parameter is set to 0, the
statistics are persisted forever. | [
"The",
"usage",
"reports",
"settings",
"are",
"applied",
"to",
"the",
"entire",
"site",
".",
"A",
"POST",
"request",
"updates",
"the",
"usage",
"reports",
"settings",
"."
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageags/_usagereports.py#L110-L140 | train |
Esri/ArcREST | src/arcrest/manageags/_usagereports.py | UsageReports.createUsageReport | def createUsageReport(self,
reportname,
queries,
metadata,
since="LAST_DAY",
fromValue=None,
toValue=None,
aggregationInterval=None
):
"""
Creates a new usage report. A usage report is created by submitting
a JSON representation of the usage report to this operation.
Inputs:
reportname - the unique name of the report
since - the time duration of the report. The supported values
are: LAST_DAY, LAST_WEEK, LAST_MONTH, LAST_YEAR, CUSTOM
LAST_DAY represents a time range spanning the previous 24
hours.
LAST_WEEK represents a time range spanning the previous 7
days.
LAST_MONTH represents a time range spanning the previous 30
days.
LAST_YEAR represents a time range spanning the previous 365
days.
CUSTOM represents a time range that is specified using the
from and to parameters.
fromValue - optional value - The timestamp (milliseconds since
UNIX epoch, namely January 1, 1970, 00:00:00 GMT) for the
beginning period of the report. Only valid when since is
CUSTOM
toValue - optional value - The timestamp (milliseconds since
UNIX epoch, namely January 1, 1970, 00:00:00 GMT) for the
ending period of the report.Only valid when since is
CUSTOM.
aggregationInterval - Optional. Aggregation interval in minutes.
Server metrics are aggregated and returned for time slices
aggregated using the specified aggregation interval. The time
range for the report, specified using the since parameter
(and from and to when since is CUSTOM) is split into multiple
slices, each covering an aggregation interval. Server metrics
are then aggregated for each time slice and returned as data
points in the report data.
When the aggregationInterval is not specified, the following
defaults are used:
LAST_DAY: 30 minutes
LAST_WEEK: 4 hours
LAST_MONTH: 24 hours
LAST_YEAR: 1 week
CUSTOM: 30 minutes up to 1 day, 4 hours up to 1 week, 1
day up to 30 days, and 1 week for longer periods.
If the samplingInterval specified in Usage Reports Settings is
more than the aggregationInterval, the samplingInterval is
used instead.
queries - A list of queries for which to generate the report.
You need to specify the list as an array of JSON objects
representing the queries. Each query specifies the list of
metrics to be queries for a given set of resourceURIs.
The queries parameter has the following sub-parameters:
resourceURIs - Comma separated list of resource URIs for
which to report metrics. Specifies services or folders
for which to gather metrics.
The resourceURI is formatted as below:
services/ - Entire Site
services/Folder/ - Folder within a Site. Reports
metrics aggregated across all services within that
Folder and Sub-Folders.
services/Folder/ServiceName.ServiceType - Service in
a specified folder, for example:
services/Map_bv_999.MapServer.
services/ServiceName.ServiceType - Service in the
root folder, for example: Map_bv_999.MapServer.
metrics - Comma separated list of metrics to be reported.
Supported metrics are:
RequestCount - the number of requests received
RequestsFailed - the number of requests that failed
RequestsTimedOut - the number of requests that timed out
RequestMaxResponseTime - the maximum response time
RequestAvgResponseTime - the average response time
ServiceActiveInstances - the maximum number of active
(running) service instances sampled at 1 minute
intervals, for a specified service
metadata - Can be any JSON Object. Typically used for storing
presentation tier data for the usage report, such as report
title, colors, line-styles, etc. Also used to denote
visibility in ArcGIS Server Manager for reports created with
the Administrator Directory. To make any report created in
the Administrator Directory visible to Manager, include
"managerReport":true in the metadata JSON object. When this
value is not set (default), reports are not visible in
Manager. This behavior can be extended to any client that
wants to interact with the Administrator Directory. Any
user-created value will need to be processed by the client.
Example:
>>> queryObj = [{
"resourceURIs": ["services/Map_bv_999.MapServer"],
"metrics": ["RequestCount"]
}]
>>> obj.createReport(
reportname="SampleReport",
queries=queryObj,
metadata="This could be any String or JSON Object.",
since="LAST_DAY"
)
"""
url = self._url + "/add"
params = {
"f" : "json",
"usagereport": {
"reportname" : reportname,
"since" : since,
"metadata" : metadata}
}
if isinstance(queries, dict):
params["usagereport"]["queries"] = [queries]
elif isinstance(queries, list):
params["usagereport"]["queries"] = queries
if aggregationInterval is not None:
params["usagereport"]['aggregationInterval'] = aggregationInterval
if since.lower() == "custom":
params["usagereport"]['to'] = toValue
params["usagereport"]['from'] = fromValue
res = self._post(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_port=self._proxy_port,
proxy_url=self._proxy_url)
# Refresh the metrics object
self.__init()
return res | python | def createUsageReport(self,
reportname,
queries,
metadata,
since="LAST_DAY",
fromValue=None,
toValue=None,
aggregationInterval=None
):
"""
Creates a new usage report. A usage report is created by submitting
a JSON representation of the usage report to this operation.
Inputs:
reportname - the unique name of the report
since - the time duration of the report. The supported values
are: LAST_DAY, LAST_WEEK, LAST_MONTH, LAST_YEAR, CUSTOM
LAST_DAY represents a time range spanning the previous 24
hours.
LAST_WEEK represents a time range spanning the previous 7
days.
LAST_MONTH represents a time range spanning the previous 30
days.
LAST_YEAR represents a time range spanning the previous 365
days.
CUSTOM represents a time range that is specified using the
from and to parameters.
fromValue - optional value - The timestamp (milliseconds since
UNIX epoch, namely January 1, 1970, 00:00:00 GMT) for the
beginning period of the report. Only valid when since is
CUSTOM
toValue - optional value - The timestamp (milliseconds since
UNIX epoch, namely January 1, 1970, 00:00:00 GMT) for the
ending period of the report.Only valid when since is
CUSTOM.
aggregationInterval - Optional. Aggregation interval in minutes.
Server metrics are aggregated and returned for time slices
aggregated using the specified aggregation interval. The time
range for the report, specified using the since parameter
(and from and to when since is CUSTOM) is split into multiple
slices, each covering an aggregation interval. Server metrics
are then aggregated for each time slice and returned as data
points in the report data.
When the aggregationInterval is not specified, the following
defaults are used:
LAST_DAY: 30 minutes
LAST_WEEK: 4 hours
LAST_MONTH: 24 hours
LAST_YEAR: 1 week
CUSTOM: 30 minutes up to 1 day, 4 hours up to 1 week, 1
day up to 30 days, and 1 week for longer periods.
If the samplingInterval specified in Usage Reports Settings is
more than the aggregationInterval, the samplingInterval is
used instead.
queries - A list of queries for which to generate the report.
You need to specify the list as an array of JSON objects
representing the queries. Each query specifies the list of
metrics to be queries for a given set of resourceURIs.
The queries parameter has the following sub-parameters:
resourceURIs - Comma separated list of resource URIs for
which to report metrics. Specifies services or folders
for which to gather metrics.
The resourceURI is formatted as below:
services/ - Entire Site
services/Folder/ - Folder within a Site. Reports
metrics aggregated across all services within that
Folder and Sub-Folders.
services/Folder/ServiceName.ServiceType - Service in
a specified folder, for example:
services/Map_bv_999.MapServer.
services/ServiceName.ServiceType - Service in the
root folder, for example: Map_bv_999.MapServer.
metrics - Comma separated list of metrics to be reported.
Supported metrics are:
RequestCount - the number of requests received
RequestsFailed - the number of requests that failed
RequestsTimedOut - the number of requests that timed out
RequestMaxResponseTime - the maximum response time
RequestAvgResponseTime - the average response time
ServiceActiveInstances - the maximum number of active
(running) service instances sampled at 1 minute
intervals, for a specified service
metadata - Can be any JSON Object. Typically used for storing
presentation tier data for the usage report, such as report
title, colors, line-styles, etc. Also used to denote
visibility in ArcGIS Server Manager for reports created with
the Administrator Directory. To make any report created in
the Administrator Directory visible to Manager, include
"managerReport":true in the metadata JSON object. When this
value is not set (default), reports are not visible in
Manager. This behavior can be extended to any client that
wants to interact with the Administrator Directory. Any
user-created value will need to be processed by the client.
Example:
>>> queryObj = [{
"resourceURIs": ["services/Map_bv_999.MapServer"],
"metrics": ["RequestCount"]
}]
>>> obj.createReport(
reportname="SampleReport",
queries=queryObj,
metadata="This could be any String or JSON Object.",
since="LAST_DAY"
)
"""
url = self._url + "/add"
params = {
"f" : "json",
"usagereport": {
"reportname" : reportname,
"since" : since,
"metadata" : metadata}
}
if isinstance(queries, dict):
params["usagereport"]["queries"] = [queries]
elif isinstance(queries, list):
params["usagereport"]["queries"] = queries
if aggregationInterval is not None:
params["usagereport"]['aggregationInterval'] = aggregationInterval
if since.lower() == "custom":
params["usagereport"]['to'] = toValue
params["usagereport"]['from'] = fromValue
res = self._post(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_port=self._proxy_port,
proxy_url=self._proxy_url)
# Refresh the metrics object
self.__init()
return res | [
"def",
"createUsageReport",
"(",
"self",
",",
"reportname",
",",
"queries",
",",
"metadata",
",",
"since",
"=",
"\"LAST_DAY\"",
",",
"fromValue",
"=",
"None",
",",
"toValue",
"=",
"None",
",",
"aggregationInterval",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"_url",
"+",
"\"/add\"",
"params",
"=",
"{",
"\"f\"",
":",
"\"json\"",
",",
"\"usagereport\"",
":",
"{",
"\"reportname\"",
":",
"reportname",
",",
"\"since\"",
":",
"since",
",",
"\"metadata\"",
":",
"metadata",
"}",
"}",
"if",
"isinstance",
"(",
"queries",
",",
"dict",
")",
":",
"params",
"[",
"\"usagereport\"",
"]",
"[",
"\"queries\"",
"]",
"=",
"[",
"queries",
"]",
"elif",
"isinstance",
"(",
"queries",
",",
"list",
")",
":",
"params",
"[",
"\"usagereport\"",
"]",
"[",
"\"queries\"",
"]",
"=",
"queries",
"if",
"aggregationInterval",
"is",
"not",
"None",
":",
"params",
"[",
"\"usagereport\"",
"]",
"[",
"'aggregationInterval'",
"]",
"=",
"aggregationInterval",
"if",
"since",
".",
"lower",
"(",
")",
"==",
"\"custom\"",
":",
"params",
"[",
"\"usagereport\"",
"]",
"[",
"'to'",
"]",
"=",
"toValue",
"params",
"[",
"\"usagereport\"",
"]",
"[",
"'from'",
"]",
"=",
"fromValue",
"res",
"=",
"self",
".",
"_post",
"(",
"url",
"=",
"url",
",",
"param_dict",
"=",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
")",
"# Refresh the metrics object",
"self",
".",
"__init",
"(",
")",
"return",
"res"
] | Creates a new usage report. A usage report is created by submitting
a JSON representation of the usage report to this operation.
Inputs:
reportname - the unique name of the report
since - the time duration of the report. The supported values
are: LAST_DAY, LAST_WEEK, LAST_MONTH, LAST_YEAR, CUSTOM
LAST_DAY represents a time range spanning the previous 24
hours.
LAST_WEEK represents a time range spanning the previous 7
days.
LAST_MONTH represents a time range spanning the previous 30
days.
LAST_YEAR represents a time range spanning the previous 365
days.
CUSTOM represents a time range that is specified using the
from and to parameters.
fromValue - optional value - The timestamp (milliseconds since
UNIX epoch, namely January 1, 1970, 00:00:00 GMT) for the
beginning period of the report. Only valid when since is
CUSTOM
toValue - optional value - The timestamp (milliseconds since
UNIX epoch, namely January 1, 1970, 00:00:00 GMT) for the
ending period of the report.Only valid when since is
CUSTOM.
aggregationInterval - Optional. Aggregation interval in minutes.
Server metrics are aggregated and returned for time slices
aggregated using the specified aggregation interval. The time
range for the report, specified using the since parameter
(and from and to when since is CUSTOM) is split into multiple
slices, each covering an aggregation interval. Server metrics
are then aggregated for each time slice and returned as data
points in the report data.
When the aggregationInterval is not specified, the following
defaults are used:
LAST_DAY: 30 minutes
LAST_WEEK: 4 hours
LAST_MONTH: 24 hours
LAST_YEAR: 1 week
CUSTOM: 30 minutes up to 1 day, 4 hours up to 1 week, 1
day up to 30 days, and 1 week for longer periods.
If the samplingInterval specified in Usage Reports Settings is
more than the aggregationInterval, the samplingInterval is
used instead.
queries - A list of queries for which to generate the report.
You need to specify the list as an array of JSON objects
representing the queries. Each query specifies the list of
metrics to be queries for a given set of resourceURIs.
The queries parameter has the following sub-parameters:
resourceURIs - Comma separated list of resource URIs for
which to report metrics. Specifies services or folders
for which to gather metrics.
The resourceURI is formatted as below:
services/ - Entire Site
services/Folder/ - Folder within a Site. Reports
metrics aggregated across all services within that
Folder and Sub-Folders.
services/Folder/ServiceName.ServiceType - Service in
a specified folder, for example:
services/Map_bv_999.MapServer.
services/ServiceName.ServiceType - Service in the
root folder, for example: Map_bv_999.MapServer.
metrics - Comma separated list of metrics to be reported.
Supported metrics are:
RequestCount - the number of requests received
RequestsFailed - the number of requests that failed
RequestsTimedOut - the number of requests that timed out
RequestMaxResponseTime - the maximum response time
RequestAvgResponseTime - the average response time
ServiceActiveInstances - the maximum number of active
(running) service instances sampled at 1 minute
intervals, for a specified service
metadata - Can be any JSON Object. Typically used for storing
presentation tier data for the usage report, such as report
title, colors, line-styles, etc. Also used to denote
visibility in ArcGIS Server Manager for reports created with
the Administrator Directory. To make any report created in
the Administrator Directory visible to Manager, include
"managerReport":true in the metadata JSON object. When this
value is not set (default), reports are not visible in
Manager. This behavior can be extended to any client that
wants to interact with the Administrator Directory. Any
user-created value will need to be processed by the client.
Example:
>>> queryObj = [{
"resourceURIs": ["services/Map_bv_999.MapServer"],
"metrics": ["RequestCount"]
}]
>>> obj.createReport(
reportname="SampleReport",
queries=queryObj,
metadata="This could be any String or JSON Object.",
since="LAST_DAY"
) | [
"Creates",
"a",
"new",
"usage",
"report",
".",
"A",
"usage",
"report",
"is",
"created",
"by",
"submitting",
"a",
"JSON",
"representation",
"of",
"the",
"usage",
"report",
"to",
"this",
"operation",
"."
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageags/_usagereports.py#L142-L273 | train |
Esri/ArcREST | src/arcrest/manageags/_usagereports.py | UsageReport.edit | def edit(self):
"""
Edits the usage report. To edit a usage report, you need to submit
the complete JSON representation of the usage report which
includes updates to the usage report properties. The name of the
report cannot be changed when editing the usage report.
Values are changed in the class, to edit a property like
metrics, pass in a new value. Changed values to not take until the
edit() is called.
Inputs:
None
"""
usagereport_dict = {
"reportname": self.reportname,
"queries": self._queries,
"since": self.since,
"metadata": self._metadata,
"to" : self._to,
"from" : self._from,
"aggregationInterval" : self._aggregationInterval
}
params = {
"f" : "json",
"usagereport" : json.dumps(usagereport_dict)
}
url = self._url + "/edit"
return self._post(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | python | def edit(self):
"""
Edits the usage report. To edit a usage report, you need to submit
the complete JSON representation of the usage report which
includes updates to the usage report properties. The name of the
report cannot be changed when editing the usage report.
Values are changed in the class, to edit a property like
metrics, pass in a new value. Changed values to not take until the
edit() is called.
Inputs:
None
"""
usagereport_dict = {
"reportname": self.reportname,
"queries": self._queries,
"since": self.since,
"metadata": self._metadata,
"to" : self._to,
"from" : self._from,
"aggregationInterval" : self._aggregationInterval
}
params = {
"f" : "json",
"usagereport" : json.dumps(usagereport_dict)
}
url = self._url + "/edit"
return self._post(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | [
"def",
"edit",
"(",
"self",
")",
":",
"usagereport_dict",
"=",
"{",
"\"reportname\"",
":",
"self",
".",
"reportname",
",",
"\"queries\"",
":",
"self",
".",
"_queries",
",",
"\"since\"",
":",
"self",
".",
"since",
",",
"\"metadata\"",
":",
"self",
".",
"_metadata",
",",
"\"to\"",
":",
"self",
".",
"_to",
",",
"\"from\"",
":",
"self",
".",
"_from",
",",
"\"aggregationInterval\"",
":",
"self",
".",
"_aggregationInterval",
"}",
"params",
"=",
"{",
"\"f\"",
":",
"\"json\"",
",",
"\"usagereport\"",
":",
"json",
".",
"dumps",
"(",
"usagereport_dict",
")",
"}",
"url",
"=",
"self",
".",
"_url",
"+",
"\"/edit\"",
"return",
"self",
".",
"_post",
"(",
"url",
"=",
"url",
",",
"param_dict",
"=",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")"
] | Edits the usage report. To edit a usage report, you need to submit
the complete JSON representation of the usage report which
includes updates to the usage report properties. The name of the
report cannot be changed when editing the usage report.
Values are changed in the class, to edit a property like
metrics, pass in a new value. Changed values to not take until the
edit() is called.
Inputs:
None | [
"Edits",
"the",
"usage",
"report",
".",
"To",
"edit",
"a",
"usage",
"report",
"you",
"need",
"to",
"submit",
"the",
"complete",
"JSON",
"representation",
"of",
"the",
"usage",
"report",
"which",
"includes",
"updates",
"to",
"the",
"usage",
"report",
"properties",
".",
"The",
"name",
"of",
"the",
"report",
"cannot",
"be",
"changed",
"when",
"editing",
"the",
"usage",
"report",
"."
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageags/_usagereports.py#L419-L452 | train |
Esri/ArcREST | src/arcrest/ags/_geodataservice.py | GeoDataService.__init | def __init(self):
""" inializes the properties """
params = {
"f" : "json",
}
json_dict = self._get(self._url, params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port)
self._json_dict = json_dict
self._json = json.dumps(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():
if k in attributes:
if k == "versions" and json_dict[k]:
self._versions = []
for version in v:
self._versions.append(
Version(url=self._url + "/versions/%s" % version,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port,
initialize=False))
elif k == "replicas" and json_dict[k]:
self._replicas = []
for version in v:
self._replicas.append(
Replica(url=self._url + "/replicas/%s" % version,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port,
initialize=False))
else:
setattr(self, "_"+ k, v)
else:
print (k, " - attribute not implemented for GeoData Service") | python | def __init(self):
""" inializes the properties """
params = {
"f" : "json",
}
json_dict = self._get(self._url, params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port)
self._json_dict = json_dict
self._json = json.dumps(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():
if k in attributes:
if k == "versions" and json_dict[k]:
self._versions = []
for version in v:
self._versions.append(
Version(url=self._url + "/versions/%s" % version,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port,
initialize=False))
elif k == "replicas" and json_dict[k]:
self._replicas = []
for version in v:
self._replicas.append(
Replica(url=self._url + "/replicas/%s" % version,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port,
initialize=False))
else:
setattr(self, "_"+ k, v)
else:
print (k, " - attribute not implemented for GeoData Service") | [
"def",
"__init",
"(",
"self",
")",
":",
"params",
"=",
"{",
"\"f\"",
":",
"\"json\"",
",",
"}",
"json_dict",
"=",
"self",
".",
"_get",
"(",
"self",
".",
"_url",
",",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")",
"self",
".",
"_json_dict",
"=",
"json_dict",
"self",
".",
"_json",
"=",
"json",
".",
"dumps",
"(",
"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",
"(",
")",
":",
"if",
"k",
"in",
"attributes",
":",
"if",
"k",
"==",
"\"versions\"",
"and",
"json_dict",
"[",
"k",
"]",
":",
"self",
".",
"_versions",
"=",
"[",
"]",
"for",
"version",
"in",
"v",
":",
"self",
".",
"_versions",
".",
"append",
"(",
"Version",
"(",
"url",
"=",
"self",
".",
"_url",
"+",
"\"/versions/%s\"",
"%",
"version",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
",",
"initialize",
"=",
"False",
")",
")",
"elif",
"k",
"==",
"\"replicas\"",
"and",
"json_dict",
"[",
"k",
"]",
":",
"self",
".",
"_replicas",
"=",
"[",
"]",
"for",
"version",
"in",
"v",
":",
"self",
".",
"_replicas",
".",
"append",
"(",
"Replica",
"(",
"url",
"=",
"self",
".",
"_url",
"+",
"\"/replicas/%s\"",
"%",
"version",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
",",
"initialize",
"=",
"False",
")",
")",
"else",
":",
"setattr",
"(",
"self",
",",
"\"_\"",
"+",
"k",
",",
"v",
")",
"else",
":",
"print",
"(",
"k",
",",
"\" - attribute not implemented for GeoData Service\"",
")"
] | inializes the properties | [
"inializes",
"the",
"properties"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/ags/_geodataservice.py#L36-L73 | train |
Esri/ArcREST | src/arcrest/ags/_geodataservice.py | GeoDataService.replicasResource | def replicasResource(self):
"""returns a list of replices"""
if self._replicasResource is None:
self._replicasResource = {}
for replica in self.replicas:
self._replicasResource["replicaName"] = replica.name
self._replicasResource["replicaID"] = replica.guid
return self._replicasResource | python | def replicasResource(self):
"""returns a list of replices"""
if self._replicasResource is None:
self._replicasResource = {}
for replica in self.replicas:
self._replicasResource["replicaName"] = replica.name
self._replicasResource["replicaID"] = replica.guid
return self._replicasResource | [
"def",
"replicasResource",
"(",
"self",
")",
":",
"if",
"self",
".",
"_replicasResource",
"is",
"None",
":",
"self",
".",
"_replicasResource",
"=",
"{",
"}",
"for",
"replica",
"in",
"self",
".",
"replicas",
":",
"self",
".",
"_replicasResource",
"[",
"\"replicaName\"",
"]",
"=",
"replica",
".",
"name",
"self",
".",
"_replicasResource",
"[",
"\"replicaID\"",
"]",
"=",
"replica",
".",
"guid",
"return",
"self",
".",
"_replicasResource"
] | returns a list of replices | [
"returns",
"a",
"list",
"of",
"replices"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/ags/_geodataservice.py#L111-L118 | train |
Esri/ArcREST | src/arcrest/hostedservice/service.py | Services.services | def services(self):
""" returns all the service objects in the admin service's page """
self._services = []
params = {"f": "json"}
if not self._url.endswith('/services'):
uURL = self._url + "/services"
else:
uURL = self._url
res = self._get(url=uURL, param_dict=params,
securityHandler=self._securityHandler,
proxy_port=self._proxy_port,
proxy_url=self._proxy_url)
for k, v in res.items():
if k == "foldersDetail":
for item in v:
if 'isDefault' in item and item['isDefault'] == False:
fURL = self._url + "/services/" + item['folderName']
resFolder = self._get(url=fURL, param_dict=params,
securityHandler=self._securityHandler,
proxy_port=self._proxy_port,
proxy_url=self._proxy_url)
for k1, v1 in resFolder.items():
if k1 == "services":
self._checkservice(k1,v1,fURL)
elif k == "services":
self._checkservice(k,v,uURL)
return self._services | python | def services(self):
""" returns all the service objects in the admin service's page """
self._services = []
params = {"f": "json"}
if not self._url.endswith('/services'):
uURL = self._url + "/services"
else:
uURL = self._url
res = self._get(url=uURL, param_dict=params,
securityHandler=self._securityHandler,
proxy_port=self._proxy_port,
proxy_url=self._proxy_url)
for k, v in res.items():
if k == "foldersDetail":
for item in v:
if 'isDefault' in item and item['isDefault'] == False:
fURL = self._url + "/services/" + item['folderName']
resFolder = self._get(url=fURL, param_dict=params,
securityHandler=self._securityHandler,
proxy_port=self._proxy_port,
proxy_url=self._proxy_url)
for k1, v1 in resFolder.items():
if k1 == "services":
self._checkservice(k1,v1,fURL)
elif k == "services":
self._checkservice(k,v,uURL)
return self._services | [
"def",
"services",
"(",
"self",
")",
":",
"self",
".",
"_services",
"=",
"[",
"]",
"params",
"=",
"{",
"\"f\"",
":",
"\"json\"",
"}",
"if",
"not",
"self",
".",
"_url",
".",
"endswith",
"(",
"'/services'",
")",
":",
"uURL",
"=",
"self",
".",
"_url",
"+",
"\"/services\"",
"else",
":",
"uURL",
"=",
"self",
".",
"_url",
"res",
"=",
"self",
".",
"_get",
"(",
"url",
"=",
"uURL",
",",
"param_dict",
"=",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
")",
"for",
"k",
",",
"v",
"in",
"res",
".",
"items",
"(",
")",
":",
"if",
"k",
"==",
"\"foldersDetail\"",
":",
"for",
"item",
"in",
"v",
":",
"if",
"'isDefault'",
"in",
"item",
"and",
"item",
"[",
"'isDefault'",
"]",
"==",
"False",
":",
"fURL",
"=",
"self",
".",
"_url",
"+",
"\"/services/\"",
"+",
"item",
"[",
"'folderName'",
"]",
"resFolder",
"=",
"self",
".",
"_get",
"(",
"url",
"=",
"fURL",
",",
"param_dict",
"=",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
")",
"for",
"k1",
",",
"v1",
"in",
"resFolder",
".",
"items",
"(",
")",
":",
"if",
"k1",
"==",
"\"services\"",
":",
"self",
".",
"_checkservice",
"(",
"k1",
",",
"v1",
",",
"fURL",
")",
"elif",
"k",
"==",
"\"services\"",
":",
"self",
".",
"_checkservice",
"(",
"k",
",",
"v",
",",
"uURL",
")",
"return",
"self",
".",
"_services"
] | returns all the service objects in the admin service's page | [
"returns",
"all",
"the",
"service",
"objects",
"in",
"the",
"admin",
"service",
"s",
"page"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/hostedservice/service.py#L144-L170 | train |
Esri/ArcREST | src/arcrest/hostedservice/service.py | AdminMapService.refresh | def refresh(self, serviceDefinition=True):
"""
The refresh operation refreshes a service, which clears the web
server cache for the service.
"""
url = self._url + "/MapServer/refresh"
params = {
"f" : "json",
"serviceDefinition" : serviceDefinition
}
res = self._post(url=self._url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port)
self.__init()
return res | python | def refresh(self, serviceDefinition=True):
"""
The refresh operation refreshes a service, which clears the web
server cache for the service.
"""
url = self._url + "/MapServer/refresh"
params = {
"f" : "json",
"serviceDefinition" : serviceDefinition
}
res = self._post(url=self._url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port)
self.__init()
return res | [
"def",
"refresh",
"(",
"self",
",",
"serviceDefinition",
"=",
"True",
")",
":",
"url",
"=",
"self",
".",
"_url",
"+",
"\"/MapServer/refresh\"",
"params",
"=",
"{",
"\"f\"",
":",
"\"json\"",
",",
"\"serviceDefinition\"",
":",
"serviceDefinition",
"}",
"res",
"=",
"self",
".",
"_post",
"(",
"url",
"=",
"self",
".",
"_url",
",",
"param_dict",
"=",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")",
"self",
".",
"__init",
"(",
")",
"return",
"res"
] | The refresh operation refreshes a service, which clears the web
server cache for the service. | [
"The",
"refresh",
"operation",
"refreshes",
"a",
"service",
"which",
"clears",
"the",
"web",
"server",
"cache",
"for",
"the",
"service",
"."
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/hostedservice/service.py#L535-L552 | train |
Esri/ArcREST | src/arcrest/hostedservice/service.py | AdminMapService.editTileService | def editTileService(self,
serviceDefinition=None,
minScale=None,
maxScale=None,
sourceItemId=None,
exportTilesAllowed=False,
maxExportTileCount=100000):
"""
This post operation updates a Tile Service's properties
Inputs:
serviceDefinition - updates a service definition
minScale - sets the services minimum scale for caching
maxScale - sets the service's maximum scale for caching
sourceItemId - The Source Item ID is the GeoWarehouse Item ID of the map service
exportTilesAllowed - sets the value to let users export tiles
maxExportTileCount - sets the maximum amount of tiles to be exported
from a single call.
"""
params = {
"f" : "json",
}
if not serviceDefinition is None:
params["serviceDefinition"] = serviceDefinition
if not minScale is None:
params['minScale'] = float(minScale)
if not maxScale is None:
params['maxScale'] = float(maxScale)
if not sourceItemId is None:
params["sourceItemId"] = sourceItemId
if not exportTilesAllowed is None:
params["exportTilesAllowed"] = exportTilesAllowed
if not maxExportTileCount is None:
params["maxExportTileCount"] = int(maxExportTileCount)
url = self._url + "/edit"
return self._post(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._securityHandler.proxy_url,
proxy_port=self._securityHandler.proxy_port) | python | def editTileService(self,
serviceDefinition=None,
minScale=None,
maxScale=None,
sourceItemId=None,
exportTilesAllowed=False,
maxExportTileCount=100000):
"""
This post operation updates a Tile Service's properties
Inputs:
serviceDefinition - updates a service definition
minScale - sets the services minimum scale for caching
maxScale - sets the service's maximum scale for caching
sourceItemId - The Source Item ID is the GeoWarehouse Item ID of the map service
exportTilesAllowed - sets the value to let users export tiles
maxExportTileCount - sets the maximum amount of tiles to be exported
from a single call.
"""
params = {
"f" : "json",
}
if not serviceDefinition is None:
params["serviceDefinition"] = serviceDefinition
if not minScale is None:
params['minScale'] = float(minScale)
if not maxScale is None:
params['maxScale'] = float(maxScale)
if not sourceItemId is None:
params["sourceItemId"] = sourceItemId
if not exportTilesAllowed is None:
params["exportTilesAllowed"] = exportTilesAllowed
if not maxExportTileCount is None:
params["maxExportTileCount"] = int(maxExportTileCount)
url = self._url + "/edit"
return self._post(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._securityHandler.proxy_url,
proxy_port=self._securityHandler.proxy_port) | [
"def",
"editTileService",
"(",
"self",
",",
"serviceDefinition",
"=",
"None",
",",
"minScale",
"=",
"None",
",",
"maxScale",
"=",
"None",
",",
"sourceItemId",
"=",
"None",
",",
"exportTilesAllowed",
"=",
"False",
",",
"maxExportTileCount",
"=",
"100000",
")",
":",
"params",
"=",
"{",
"\"f\"",
":",
"\"json\"",
",",
"}",
"if",
"not",
"serviceDefinition",
"is",
"None",
":",
"params",
"[",
"\"serviceDefinition\"",
"]",
"=",
"serviceDefinition",
"if",
"not",
"minScale",
"is",
"None",
":",
"params",
"[",
"'minScale'",
"]",
"=",
"float",
"(",
"minScale",
")",
"if",
"not",
"maxScale",
"is",
"None",
":",
"params",
"[",
"'maxScale'",
"]",
"=",
"float",
"(",
"maxScale",
")",
"if",
"not",
"sourceItemId",
"is",
"None",
":",
"params",
"[",
"\"sourceItemId\"",
"]",
"=",
"sourceItemId",
"if",
"not",
"exportTilesAllowed",
"is",
"None",
":",
"params",
"[",
"\"exportTilesAllowed\"",
"]",
"=",
"exportTilesAllowed",
"if",
"not",
"maxExportTileCount",
"is",
"None",
":",
"params",
"[",
"\"maxExportTileCount\"",
"]",
"=",
"int",
"(",
"maxExportTileCount",
")",
"url",
"=",
"self",
".",
"_url",
"+",
"\"/edit\"",
"return",
"self",
".",
"_post",
"(",
"url",
"=",
"url",
",",
"param_dict",
"=",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_securityHandler",
".",
"proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_securityHandler",
".",
"proxy_port",
")"
] | This post operation updates a Tile Service's properties
Inputs:
serviceDefinition - updates a service definition
minScale - sets the services minimum scale for caching
maxScale - sets the service's maximum scale for caching
sourceItemId - The Source Item ID is the GeoWarehouse Item ID of the map service
exportTilesAllowed - sets the value to let users export tiles
maxExportTileCount - sets the maximum amount of tiles to be exported
from a single call. | [
"This",
"post",
"operation",
"updates",
"a",
"Tile",
"Service",
"s",
"properties"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/hostedservice/service.py#L591-L630 | train |
Esri/ArcREST | src/arcrest/hostedservice/service.py | AdminFeatureService.refresh | def refresh(self):
""" refreshes a service """
params = {"f": "json"}
uURL = self._url + "/refresh"
res = self._get(url=uURL, param_dict=params,
securityHandler=self._securityHandler,
proxy_port=self._proxy_port,
proxy_url=self._proxy_url)
self.__init()
return res | python | def refresh(self):
""" refreshes a service """
params = {"f": "json"}
uURL = self._url + "/refresh"
res = self._get(url=uURL, param_dict=params,
securityHandler=self._securityHandler,
proxy_port=self._proxy_port,
proxy_url=self._proxy_url)
self.__init()
return res | [
"def",
"refresh",
"(",
"self",
")",
":",
"params",
"=",
"{",
"\"f\"",
":",
"\"json\"",
"}",
"uURL",
"=",
"self",
".",
"_url",
"+",
"\"/refresh\"",
"res",
"=",
"self",
".",
"_get",
"(",
"url",
"=",
"uURL",
",",
"param_dict",
"=",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
")",
"self",
".",
"__init",
"(",
")",
"return",
"res"
] | refreshes a service | [
"refreshes",
"a",
"service"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/hostedservice/service.py#L822-L831 | train |
Esri/ArcREST | src/arcrest/hostedservice/service.py | AdminFeatureService.addToDefinition | def addToDefinition(self, json_dict):
"""
The addToDefinition operation supports adding a definition
property to a hosted feature service. The result of this
operation is a response indicating success or failure with error
code and description.
This function will allow users to change add additional values
to an already published service.
Input:
json_dict - part to add to host service. The part format can
be derived from the asDictionary property. For
layer level modifications, run updates on each
individual feature service layer object.
Output:
JSON message as dictionary
"""
params = {
"f" : "json",
"addToDefinition" : json.dumps(json_dict),
"async" : False
}
uURL = self._url + "/addToDefinition"
res = self._post(url=uURL, param_dict=params,
securityHandler=self._securityHandler,
proxy_port=self._proxy_port,
proxy_url=self._proxy_url)
self.refresh()
return res | python | def addToDefinition(self, json_dict):
"""
The addToDefinition operation supports adding a definition
property to a hosted feature service. The result of this
operation is a response indicating success or failure with error
code and description.
This function will allow users to change add additional values
to an already published service.
Input:
json_dict - part to add to host service. The part format can
be derived from the asDictionary property. For
layer level modifications, run updates on each
individual feature service layer object.
Output:
JSON message as dictionary
"""
params = {
"f" : "json",
"addToDefinition" : json.dumps(json_dict),
"async" : False
}
uURL = self._url + "/addToDefinition"
res = self._post(url=uURL, param_dict=params,
securityHandler=self._securityHandler,
proxy_port=self._proxy_port,
proxy_url=self._proxy_url)
self.refresh()
return res | [
"def",
"addToDefinition",
"(",
"self",
",",
"json_dict",
")",
":",
"params",
"=",
"{",
"\"f\"",
":",
"\"json\"",
",",
"\"addToDefinition\"",
":",
"json",
".",
"dumps",
"(",
"json_dict",
")",
",",
"\"async\"",
":",
"False",
"}",
"uURL",
"=",
"self",
".",
"_url",
"+",
"\"/addToDefinition\"",
"res",
"=",
"self",
".",
"_post",
"(",
"url",
"=",
"uURL",
",",
"param_dict",
"=",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
")",
"self",
".",
"refresh",
"(",
")",
"return",
"res"
] | The addToDefinition operation supports adding a definition
property to a hosted feature service. The result of this
operation is a response indicating success or failure with error
code and description.
This function will allow users to change add additional values
to an already published service.
Input:
json_dict - part to add to host service. The part format can
be derived from the asDictionary property. For
layer level modifications, run updates on each
individual feature service layer object.
Output:
JSON message as dictionary | [
"The",
"addToDefinition",
"operation",
"supports",
"adding",
"a",
"definition",
"property",
"to",
"a",
"hosted",
"feature",
"service",
".",
"The",
"result",
"of",
"this",
"operation",
"is",
"a",
"response",
"indicating",
"success",
"or",
"failure",
"with",
"error",
"code",
"and",
"description",
"."
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/hostedservice/service.py#L1025-L1054 | train |
Esri/ArcREST | src/arcrest/hostedservice/service.py | AdminFeatureService.updateDefinition | def updateDefinition(self, json_dict):
"""
The updateDefinition operation supports updating a definition
property in a hosted feature service. The result of this
operation is a response indicating success or failure with error
code and description.
Input:
json_dict - part to add to host service. The part format can
be derived from the asDictionary property. For
layer level modifications, run updates on each
individual feature service layer object.
Output:
JSON Message as dictionary
"""
definition = None
if json_dict is not None:
if isinstance(json_dict,collections.OrderedDict) == True:
definition = json_dict
else:
definition = collections.OrderedDict()
if 'hasStaticData' in json_dict:
definition['hasStaticData'] = json_dict['hasStaticData']
if 'allowGeometryUpdates' in json_dict:
definition['allowGeometryUpdates'] = json_dict['allowGeometryUpdates']
if 'capabilities' in json_dict:
definition['capabilities'] = json_dict['capabilities']
if 'editorTrackingInfo' in json_dict:
definition['editorTrackingInfo'] = collections.OrderedDict()
if 'enableEditorTracking' in json_dict['editorTrackingInfo']:
definition['editorTrackingInfo']['enableEditorTracking'] = json_dict['editorTrackingInfo']['enableEditorTracking']
if 'enableOwnershipAccessControl' in json_dict['editorTrackingInfo']:
definition['editorTrackingInfo']['enableOwnershipAccessControl'] = json_dict['editorTrackingInfo']['enableOwnershipAccessControl']
if 'allowOthersToUpdate' in json_dict['editorTrackingInfo']:
definition['editorTrackingInfo']['allowOthersToUpdate'] = json_dict['editorTrackingInfo']['allowOthersToUpdate']
if 'allowOthersToDelete' in json_dict['editorTrackingInfo']:
definition['editorTrackingInfo']['allowOthersToDelete'] = json_dict['editorTrackingInfo']['allowOthersToDelete']
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():
if k not in definition['editorTrackingInfo']:
definition['editorTrackingInfo'][k] = v
if isinstance(json_dict,dict):
for k,v in json_dict.items():
if k not in definition:
definition[k] = v
params = {
"f" : "json",
"updateDefinition" : json.dumps(obj=definition,separators=(',', ':')),
"async" : False
}
uURL = self._url + "/updateDefinition"
res = self._post(url=uURL, param_dict=params,
securityHandler=self._securityHandler,
proxy_port=self._proxy_port,
proxy_url=self._proxy_url)
self.refresh()
return res | python | def updateDefinition(self, json_dict):
"""
The updateDefinition operation supports updating a definition
property in a hosted feature service. The result of this
operation is a response indicating success or failure with error
code and description.
Input:
json_dict - part to add to host service. The part format can
be derived from the asDictionary property. For
layer level modifications, run updates on each
individual feature service layer object.
Output:
JSON Message as dictionary
"""
definition = None
if json_dict is not None:
if isinstance(json_dict,collections.OrderedDict) == True:
definition = json_dict
else:
definition = collections.OrderedDict()
if 'hasStaticData' in json_dict:
definition['hasStaticData'] = json_dict['hasStaticData']
if 'allowGeometryUpdates' in json_dict:
definition['allowGeometryUpdates'] = json_dict['allowGeometryUpdates']
if 'capabilities' in json_dict:
definition['capabilities'] = json_dict['capabilities']
if 'editorTrackingInfo' in json_dict:
definition['editorTrackingInfo'] = collections.OrderedDict()
if 'enableEditorTracking' in json_dict['editorTrackingInfo']:
definition['editorTrackingInfo']['enableEditorTracking'] = json_dict['editorTrackingInfo']['enableEditorTracking']
if 'enableOwnershipAccessControl' in json_dict['editorTrackingInfo']:
definition['editorTrackingInfo']['enableOwnershipAccessControl'] = json_dict['editorTrackingInfo']['enableOwnershipAccessControl']
if 'allowOthersToUpdate' in json_dict['editorTrackingInfo']:
definition['editorTrackingInfo']['allowOthersToUpdate'] = json_dict['editorTrackingInfo']['allowOthersToUpdate']
if 'allowOthersToDelete' in json_dict['editorTrackingInfo']:
definition['editorTrackingInfo']['allowOthersToDelete'] = json_dict['editorTrackingInfo']['allowOthersToDelete']
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():
if k not in definition['editorTrackingInfo']:
definition['editorTrackingInfo'][k] = v
if isinstance(json_dict,dict):
for k,v in json_dict.items():
if k not in definition:
definition[k] = v
params = {
"f" : "json",
"updateDefinition" : json.dumps(obj=definition,separators=(',', ':')),
"async" : False
}
uURL = self._url + "/updateDefinition"
res = self._post(url=uURL, param_dict=params,
securityHandler=self._securityHandler,
proxy_port=self._proxy_port,
proxy_url=self._proxy_url)
self.refresh()
return res | [
"def",
"updateDefinition",
"(",
"self",
",",
"json_dict",
")",
":",
"definition",
"=",
"None",
"if",
"json_dict",
"is",
"not",
"None",
":",
"if",
"isinstance",
"(",
"json_dict",
",",
"collections",
".",
"OrderedDict",
")",
"==",
"True",
":",
"definition",
"=",
"json_dict",
"else",
":",
"definition",
"=",
"collections",
".",
"OrderedDict",
"(",
")",
"if",
"'hasStaticData'",
"in",
"json_dict",
":",
"definition",
"[",
"'hasStaticData'",
"]",
"=",
"json_dict",
"[",
"'hasStaticData'",
"]",
"if",
"'allowGeometryUpdates'",
"in",
"json_dict",
":",
"definition",
"[",
"'allowGeometryUpdates'",
"]",
"=",
"json_dict",
"[",
"'allowGeometryUpdates'",
"]",
"if",
"'capabilities'",
"in",
"json_dict",
":",
"definition",
"[",
"'capabilities'",
"]",
"=",
"json_dict",
"[",
"'capabilities'",
"]",
"if",
"'editorTrackingInfo'",
"in",
"json_dict",
":",
"definition",
"[",
"'editorTrackingInfo'",
"]",
"=",
"collections",
".",
"OrderedDict",
"(",
")",
"if",
"'enableEditorTracking'",
"in",
"json_dict",
"[",
"'editorTrackingInfo'",
"]",
":",
"definition",
"[",
"'editorTrackingInfo'",
"]",
"[",
"'enableEditorTracking'",
"]",
"=",
"json_dict",
"[",
"'editorTrackingInfo'",
"]",
"[",
"'enableEditorTracking'",
"]",
"if",
"'enableOwnershipAccessControl'",
"in",
"json_dict",
"[",
"'editorTrackingInfo'",
"]",
":",
"definition",
"[",
"'editorTrackingInfo'",
"]",
"[",
"'enableOwnershipAccessControl'",
"]",
"=",
"json_dict",
"[",
"'editorTrackingInfo'",
"]",
"[",
"'enableOwnershipAccessControl'",
"]",
"if",
"'allowOthersToUpdate'",
"in",
"json_dict",
"[",
"'editorTrackingInfo'",
"]",
":",
"definition",
"[",
"'editorTrackingInfo'",
"]",
"[",
"'allowOthersToUpdate'",
"]",
"=",
"json_dict",
"[",
"'editorTrackingInfo'",
"]",
"[",
"'allowOthersToUpdate'",
"]",
"if",
"'allowOthersToDelete'",
"in",
"json_dict",
"[",
"'editorTrackingInfo'",
"]",
":",
"definition",
"[",
"'editorTrackingInfo'",
"]",
"[",
"'allowOthersToDelete'",
"]",
"=",
"json_dict",
"[",
"'editorTrackingInfo'",
"]",
"[",
"'allowOthersToDelete'",
"]",
"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",
"(",
")",
":",
"if",
"k",
"not",
"in",
"definition",
"[",
"'editorTrackingInfo'",
"]",
":",
"definition",
"[",
"'editorTrackingInfo'",
"]",
"[",
"k",
"]",
"=",
"v",
"if",
"isinstance",
"(",
"json_dict",
",",
"dict",
")",
":",
"for",
"k",
",",
"v",
"in",
"json_dict",
".",
"items",
"(",
")",
":",
"if",
"k",
"not",
"in",
"definition",
":",
"definition",
"[",
"k",
"]",
"=",
"v",
"params",
"=",
"{",
"\"f\"",
":",
"\"json\"",
",",
"\"updateDefinition\"",
":",
"json",
".",
"dumps",
"(",
"obj",
"=",
"definition",
",",
"separators",
"=",
"(",
"','",
",",
"':'",
")",
")",
",",
"\"async\"",
":",
"False",
"}",
"uURL",
"=",
"self",
".",
"_url",
"+",
"\"/updateDefinition\"",
"res",
"=",
"self",
".",
"_post",
"(",
"url",
"=",
"uURL",
",",
"param_dict",
"=",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
")",
"self",
".",
"refresh",
"(",
")",
"return",
"res"
] | The updateDefinition operation supports updating a definition
property in a hosted feature service. The result of this
operation is a response indicating success or failure with error
code and description.
Input:
json_dict - part to add to host service. The part format can
be derived from the asDictionary property. For
layer level modifications, run updates on each
individual feature service layer object.
Output:
JSON Message as dictionary | [
"The",
"updateDefinition",
"operation",
"supports",
"updating",
"a",
"definition",
"property",
"in",
"a",
"hosted",
"feature",
"service",
".",
"The",
"result",
"of",
"this",
"operation",
"is",
"a",
"response",
"indicating",
"success",
"or",
"failure",
"with",
"error",
"code",
"and",
"description",
"."
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/hostedservice/service.py#L1056-L1120 | train |
Esri/ArcREST | src/arcrest/packages/ntlm3/ntlm.py | calc_resp | def calc_resp(password_hash, server_challenge):
"""calc_resp generates the LM response given a 16-byte password hash and the
challenge from the Type-2 message.
@param password_hash
16-byte password hash
@param server_challenge
8-byte challenge from Type-2 message
returns
24-byte buffer to contain the LM response upon return
"""
# padding with zeros to make the hash 21 bytes long
password_hash += b'\0' * (21 - len(password_hash))
res = b''
dobj = des.DES(password_hash[0:7])
res = res + dobj.encrypt(server_challenge[0:8])
dobj = des.DES(password_hash[7:14])
res = res + dobj.encrypt(server_challenge[0:8])
dobj = des.DES(password_hash[14:21])
res = res + dobj.encrypt(server_challenge[0:8])
return res | python | def calc_resp(password_hash, server_challenge):
"""calc_resp generates the LM response given a 16-byte password hash and the
challenge from the Type-2 message.
@param password_hash
16-byte password hash
@param server_challenge
8-byte challenge from Type-2 message
returns
24-byte buffer to contain the LM response upon return
"""
# padding with zeros to make the hash 21 bytes long
password_hash += b'\0' * (21 - len(password_hash))
res = b''
dobj = des.DES(password_hash[0:7])
res = res + dobj.encrypt(server_challenge[0:8])
dobj = des.DES(password_hash[7:14])
res = res + dobj.encrypt(server_challenge[0:8])
dobj = des.DES(password_hash[14:21])
res = res + dobj.encrypt(server_challenge[0:8])
return res | [
"def",
"calc_resp",
"(",
"password_hash",
",",
"server_challenge",
")",
":",
"# padding with zeros to make the hash 21 bytes long",
"password_hash",
"+=",
"b'\\0'",
"*",
"(",
"21",
"-",
"len",
"(",
"password_hash",
")",
")",
"res",
"=",
"b''",
"dobj",
"=",
"des",
".",
"DES",
"(",
"password_hash",
"[",
"0",
":",
"7",
"]",
")",
"res",
"=",
"res",
"+",
"dobj",
".",
"encrypt",
"(",
"server_challenge",
"[",
"0",
":",
"8",
"]",
")",
"dobj",
"=",
"des",
".",
"DES",
"(",
"password_hash",
"[",
"7",
":",
"14",
"]",
")",
"res",
"=",
"res",
"+",
"dobj",
".",
"encrypt",
"(",
"server_challenge",
"[",
"0",
":",
"8",
"]",
")",
"dobj",
"=",
"des",
".",
"DES",
"(",
"password_hash",
"[",
"14",
":",
"21",
"]",
")",
"res",
"=",
"res",
"+",
"dobj",
".",
"encrypt",
"(",
"server_challenge",
"[",
"0",
":",
"8",
"]",
")",
"return",
"res"
] | calc_resp generates the LM response given a 16-byte password hash and the
challenge from the Type-2 message.
@param password_hash
16-byte password hash
@param server_challenge
8-byte challenge from Type-2 message
returns
24-byte buffer to contain the LM response upon return | [
"calc_resp",
"generates",
"the",
"LM",
"response",
"given",
"a",
"16",
"-",
"byte",
"password",
"hash",
"and",
"the",
"challenge",
"from",
"the",
"Type",
"-",
"2",
"message",
"."
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/packages/ntlm3/ntlm.py#L323-L345 | train |
Esri/ArcREST | src/arcrest/packages/ntlm3/ntlm.py | create_LM_hashed_password_v1 | def create_LM_hashed_password_v1(passwd):
"""create LanManager hashed password"""
# if the passwd provided is already a hash, we just return the first half
if re.match(r'^[\w]{32}:[\w]{32}$', passwd):
return binascii.unhexlify(passwd.split(':')[0])
# fix the password length to 14 bytes
passwd = passwd.upper()
lm_pw = passwd + '\0' * (14 - len(passwd))
lm_pw = passwd[0:14]
# do hash
magic_str = b"KGS!@#$%" # page 57 in [MS-NLMP]
res = b''
dobj = des.DES(lm_pw[0:7])
res = res + dobj.encrypt(magic_str)
dobj = des.DES(lm_pw[7:14])
res = res + dobj.encrypt(magic_str)
return res | python | def create_LM_hashed_password_v1(passwd):
"""create LanManager hashed password"""
# if the passwd provided is already a hash, we just return the first half
if re.match(r'^[\w]{32}:[\w]{32}$', passwd):
return binascii.unhexlify(passwd.split(':')[0])
# fix the password length to 14 bytes
passwd = passwd.upper()
lm_pw = passwd + '\0' * (14 - len(passwd))
lm_pw = passwd[0:14]
# do hash
magic_str = b"KGS!@#$%" # page 57 in [MS-NLMP]
res = b''
dobj = des.DES(lm_pw[0:7])
res = res + dobj.encrypt(magic_str)
dobj = des.DES(lm_pw[7:14])
res = res + dobj.encrypt(magic_str)
return res | [
"def",
"create_LM_hashed_password_v1",
"(",
"passwd",
")",
":",
"# if the passwd provided is already a hash, we just return the first half",
"if",
"re",
".",
"match",
"(",
"r'^[\\w]{32}:[\\w]{32}$'",
",",
"passwd",
")",
":",
"return",
"binascii",
".",
"unhexlify",
"(",
"passwd",
".",
"split",
"(",
"':'",
")",
"[",
"0",
"]",
")",
"# fix the password length to 14 bytes",
"passwd",
"=",
"passwd",
".",
"upper",
"(",
")",
"lm_pw",
"=",
"passwd",
"+",
"'\\0'",
"*",
"(",
"14",
"-",
"len",
"(",
"passwd",
")",
")",
"lm_pw",
"=",
"passwd",
"[",
"0",
":",
"14",
"]",
"# do hash",
"magic_str",
"=",
"b\"KGS!@#$%\"",
"# page 57 in [MS-NLMP]",
"res",
"=",
"b''",
"dobj",
"=",
"des",
".",
"DES",
"(",
"lm_pw",
"[",
"0",
":",
"7",
"]",
")",
"res",
"=",
"res",
"+",
"dobj",
".",
"encrypt",
"(",
"magic_str",
")",
"dobj",
"=",
"des",
".",
"DES",
"(",
"lm_pw",
"[",
"7",
":",
"14",
"]",
")",
"res",
"=",
"res",
"+",
"dobj",
".",
"encrypt",
"(",
"magic_str",
")",
"return",
"res"
] | create LanManager hashed password | [
"create",
"LanManager",
"hashed",
"password"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/packages/ntlm3/ntlm.py#L372-L394 | train |
Esri/ArcREST | src/arcrest/enrichment/_geoenrichment.py | GeoEnrichment._readcsv | def _readcsv(self, path_to_csv):
"""reads a csv column"""
return np.genfromtxt(path_to_csv,
dtype=None,
delimiter=',',
names=True) | python | def _readcsv(self, path_to_csv):
"""reads a csv column"""
return np.genfromtxt(path_to_csv,
dtype=None,
delimiter=',',
names=True) | [
"def",
"_readcsv",
"(",
"self",
",",
"path_to_csv",
")",
":",
"return",
"np",
".",
"genfromtxt",
"(",
"path_to_csv",
",",
"dtype",
"=",
"None",
",",
"delimiter",
"=",
"','",
",",
"names",
"=",
"True",
")"
] | reads a csv column | [
"reads",
"a",
"csv",
"column"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/enrichment/_geoenrichment.py#L56-L61 | train |
Esri/ArcREST | src/arcrest/enrichment/_geoenrichment.py | GeoEnrichment.queryDataCollectionByName | def queryDataCollectionByName(self, countryName):
"""
returns a list of available data collections for a given country
name.
Inputs:
countryName - name of the country to file the data collection.
Output:
list or None. None implies could not find the countryName
"""
var = self._dataCollectionCodes
try:
return [x[0] for x in var[var['Countries'] == countryName]]
except:
return None | python | def queryDataCollectionByName(self, countryName):
"""
returns a list of available data collections for a given country
name.
Inputs:
countryName - name of the country to file the data collection.
Output:
list or None. None implies could not find the countryName
"""
var = self._dataCollectionCodes
try:
return [x[0] for x in var[var['Countries'] == countryName]]
except:
return None | [
"def",
"queryDataCollectionByName",
"(",
"self",
",",
"countryName",
")",
":",
"var",
"=",
"self",
".",
"_dataCollectionCodes",
"try",
":",
"return",
"[",
"x",
"[",
"0",
"]",
"for",
"x",
"in",
"var",
"[",
"var",
"[",
"'Countries'",
"]",
"==",
"countryName",
"]",
"]",
"except",
":",
"return",
"None"
] | returns a list of available data collections for a given country
name.
Inputs:
countryName - name of the country to file the data collection.
Output:
list or None. None implies could not find the countryName | [
"returns",
"a",
"list",
"of",
"available",
"data",
"collections",
"for",
"a",
"given",
"country",
"name",
"."
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/enrichment/_geoenrichment.py#L83-L97 | train |
Esri/ArcREST | src/arcrest/enrichment/_geoenrichment.py | GeoEnrichment.__geometryToDict | def __geometryToDict(self, geom):
"""converts a geometry object to a dictionary"""
if isinstance(geom, dict):
return geom
elif isinstance(geom, Point):
pt = geom.asDictionary
return {"geometry": {"x" : pt['x'], "y" : pt['y']}}
elif isinstance(geom, Polygon):
poly = geom.asDictionary
return {
"geometry" : {
"rings" : poly['rings'],
'spatialReference' : poly['spatialReference']
}
}
elif isinstance(geom, list):
return [self.__geometryToDict(g) for g in geom] | python | def __geometryToDict(self, geom):
"""converts a geometry object to a dictionary"""
if isinstance(geom, dict):
return geom
elif isinstance(geom, Point):
pt = geom.asDictionary
return {"geometry": {"x" : pt['x'], "y" : pt['y']}}
elif isinstance(geom, Polygon):
poly = geom.asDictionary
return {
"geometry" : {
"rings" : poly['rings'],
'spatialReference' : poly['spatialReference']
}
}
elif isinstance(geom, list):
return [self.__geometryToDict(g) for g in geom] | [
"def",
"__geometryToDict",
"(",
"self",
",",
"geom",
")",
":",
"if",
"isinstance",
"(",
"geom",
",",
"dict",
")",
":",
"return",
"geom",
"elif",
"isinstance",
"(",
"geom",
",",
"Point",
")",
":",
"pt",
"=",
"geom",
".",
"asDictionary",
"return",
"{",
"\"geometry\"",
":",
"{",
"\"x\"",
":",
"pt",
"[",
"'x'",
"]",
",",
"\"y\"",
":",
"pt",
"[",
"'y'",
"]",
"}",
"}",
"elif",
"isinstance",
"(",
"geom",
",",
"Polygon",
")",
":",
"poly",
"=",
"geom",
".",
"asDictionary",
"return",
"{",
"\"geometry\"",
":",
"{",
"\"rings\"",
":",
"poly",
"[",
"'rings'",
"]",
",",
"'spatialReference'",
":",
"poly",
"[",
"'spatialReference'",
"]",
"}",
"}",
"elif",
"isinstance",
"(",
"geom",
",",
"list",
")",
":",
"return",
"[",
"self",
".",
"__geometryToDict",
"(",
"g",
")",
"for",
"g",
"in",
"geom",
"]"
] | converts a geometry object to a dictionary | [
"converts",
"a",
"geometry",
"object",
"to",
"a",
"dictionary"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/enrichment/_geoenrichment.py#L129-L145 | train |
Esri/ArcREST | src/arcrest/enrichment/_geoenrichment.py | GeoEnrichment.lookUpReportsByCountry | def lookUpReportsByCountry(self, countryName):
"""
looks up a country by it's name
Inputs
countryName - name of the country to get reports list.
"""
code = self.findCountryTwoDigitCode(countryName)
if code is None:
raise Exception("Invalid country name.")
url = self._base_url + self._url_list_reports + "/%s" % code
params = {
"f" : "json",
}
return self._post(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | python | def lookUpReportsByCountry(self, countryName):
"""
looks up a country by it's name
Inputs
countryName - name of the country to get reports list.
"""
code = self.findCountryTwoDigitCode(countryName)
if code is None:
raise Exception("Invalid country name.")
url = self._base_url + self._url_list_reports + "/%s" % code
params = {
"f" : "json",
}
return self._post(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | [
"def",
"lookUpReportsByCountry",
"(",
"self",
",",
"countryName",
")",
":",
"code",
"=",
"self",
".",
"findCountryTwoDigitCode",
"(",
"countryName",
")",
"if",
"code",
"is",
"None",
":",
"raise",
"Exception",
"(",
"\"Invalid country name.\"",
")",
"url",
"=",
"self",
".",
"_base_url",
"+",
"self",
".",
"_url_list_reports",
"+",
"\"/%s\"",
"%",
"code",
"params",
"=",
"{",
"\"f\"",
":",
"\"json\"",
",",
"}",
"return",
"self",
".",
"_post",
"(",
"url",
"=",
"url",
",",
"param_dict",
"=",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")"
] | looks up a country by it's name
Inputs
countryName - name of the country to get reports list. | [
"looks",
"up",
"a",
"country",
"by",
"it",
"s",
"name",
"Inputs",
"countryName",
"-",
"name",
"of",
"the",
"country",
"to",
"get",
"reports",
"list",
"."
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/enrichment/_geoenrichment.py#L147-L166 | train |
Esri/ArcREST | src/arcrest/enrichment/_geoenrichment.py | GeoEnrichment.createReport | def createReport(self,
out_file_path,
studyAreas,
report=None,
format="PDF",
reportFields=None,
studyAreasOptions=None,
useData=None,
inSR=4326,
):
"""
The GeoEnrichment Create Report method uses the concept of a study
area to define the location of the point or area that you want to
enrich with generated reports. This method allows you to create
many types of high-quality reports for a variety of use cases
describing the input area. If a point is used as a study area, the
service will create a 1-mile ring buffer around the point to
collect and append enrichment data. Optionally, you can create a
buffer ring or drive-time service area around the points to prepare
PDF or Excel reports for the study areas.
Note:
For full examples for each input, please review the following:
http://resources.arcgis.com/en/help/arcgis-rest-api/#/Create_report/02r30000022q000000/
Inputs:
out_file_path - save location of the report
studyAreas - Required parameter to specify a list of input
features to be enriched. The input can be a Point, Polygon,
Adress, or named administrative boundary. The locations can be
passed in as a single object or as a list of objects.
report - Default report to generate.
format - specify the generated report. Options are: XLSX or PDF
reportFields - Optional parameter specifies additional choices to
customize reports. See the URL above to see all the options.
studyAreasOptions - Optional parameter to specify enrichment
behavior. For points described as map coordinates, a 1-mile
ring area centered on each site will be used by default. You
can use this parameter to change these default settings.
With this parameter, the caller can override the default
behavior describing how the enrichment attributes are appended
to the input features described in studyAreas. For example,
you can change the output ring buffer to 5 miles, change the
number of output buffers created around each point, and also
change the output buffer type to a drive-time service area
rather than a simple ring buffer.
useData - By default, the service will automatically determine
the country or dataset that is associated with each location or
area submitted in the studyAreas parameter; however, there is
an associated computational cost which may lengthen the time it
takes to return a response. To skip this intermediate step and
potentially improve the speed and performance of the service,
the caller can specify the country or dataset information up
front through this parameter.
inSR - parameter to define the input geometries in the studyAreas
parameter in a specified spatial reference system.
"""
url = self._base_url + self._url_create_report
if isinstance(studyAreas, list) == False:
studyAreas = [studyAreas]
studyAreas = self.__geometryToDict(studyAreas)
params = {
"f" : "bin",
"studyAreas" : studyAreas,
"inSR" : inSR,
}
if not report is None:
params['report'] = report
if format is None:
format = "pdf"
elif format.lower() in ['pdf', 'xlsx']:
params['format'] = format.lower()
else:
raise AttributeError("Invalid format value.")
if not reportFields is None:
params['reportFields'] = reportFields
if not studyAreasOptions is None:
params['studyAreasOptions'] = studyAreasOptions
if not useData is None:
params['useData'] = useData
result = self._get(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port,
out_folder=os.path.dirname(out_file_path))
return result | python | def createReport(self,
out_file_path,
studyAreas,
report=None,
format="PDF",
reportFields=None,
studyAreasOptions=None,
useData=None,
inSR=4326,
):
"""
The GeoEnrichment Create Report method uses the concept of a study
area to define the location of the point or area that you want to
enrich with generated reports. This method allows you to create
many types of high-quality reports for a variety of use cases
describing the input area. If a point is used as a study area, the
service will create a 1-mile ring buffer around the point to
collect and append enrichment data. Optionally, you can create a
buffer ring or drive-time service area around the points to prepare
PDF or Excel reports for the study areas.
Note:
For full examples for each input, please review the following:
http://resources.arcgis.com/en/help/arcgis-rest-api/#/Create_report/02r30000022q000000/
Inputs:
out_file_path - save location of the report
studyAreas - Required parameter to specify a list of input
features to be enriched. The input can be a Point, Polygon,
Adress, or named administrative boundary. The locations can be
passed in as a single object or as a list of objects.
report - Default report to generate.
format - specify the generated report. Options are: XLSX or PDF
reportFields - Optional parameter specifies additional choices to
customize reports. See the URL above to see all the options.
studyAreasOptions - Optional parameter to specify enrichment
behavior. For points described as map coordinates, a 1-mile
ring area centered on each site will be used by default. You
can use this parameter to change these default settings.
With this parameter, the caller can override the default
behavior describing how the enrichment attributes are appended
to the input features described in studyAreas. For example,
you can change the output ring buffer to 5 miles, change the
number of output buffers created around each point, and also
change the output buffer type to a drive-time service area
rather than a simple ring buffer.
useData - By default, the service will automatically determine
the country or dataset that is associated with each location or
area submitted in the studyAreas parameter; however, there is
an associated computational cost which may lengthen the time it
takes to return a response. To skip this intermediate step and
potentially improve the speed and performance of the service,
the caller can specify the country or dataset information up
front through this parameter.
inSR - parameter to define the input geometries in the studyAreas
parameter in a specified spatial reference system.
"""
url = self._base_url + self._url_create_report
if isinstance(studyAreas, list) == False:
studyAreas = [studyAreas]
studyAreas = self.__geometryToDict(studyAreas)
params = {
"f" : "bin",
"studyAreas" : studyAreas,
"inSR" : inSR,
}
if not report is None:
params['report'] = report
if format is None:
format = "pdf"
elif format.lower() in ['pdf', 'xlsx']:
params['format'] = format.lower()
else:
raise AttributeError("Invalid format value.")
if not reportFields is None:
params['reportFields'] = reportFields
if not studyAreasOptions is None:
params['studyAreasOptions'] = studyAreasOptions
if not useData is None:
params['useData'] = useData
result = self._get(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port,
out_folder=os.path.dirname(out_file_path))
return result | [
"def",
"createReport",
"(",
"self",
",",
"out_file_path",
",",
"studyAreas",
",",
"report",
"=",
"None",
",",
"format",
"=",
"\"PDF\"",
",",
"reportFields",
"=",
"None",
",",
"studyAreasOptions",
"=",
"None",
",",
"useData",
"=",
"None",
",",
"inSR",
"=",
"4326",
",",
")",
":",
"url",
"=",
"self",
".",
"_base_url",
"+",
"self",
".",
"_url_create_report",
"if",
"isinstance",
"(",
"studyAreas",
",",
"list",
")",
"==",
"False",
":",
"studyAreas",
"=",
"[",
"studyAreas",
"]",
"studyAreas",
"=",
"self",
".",
"__geometryToDict",
"(",
"studyAreas",
")",
"params",
"=",
"{",
"\"f\"",
":",
"\"bin\"",
",",
"\"studyAreas\"",
":",
"studyAreas",
",",
"\"inSR\"",
":",
"inSR",
",",
"}",
"if",
"not",
"report",
"is",
"None",
":",
"params",
"[",
"'report'",
"]",
"=",
"report",
"if",
"format",
"is",
"None",
":",
"format",
"=",
"\"pdf\"",
"elif",
"format",
".",
"lower",
"(",
")",
"in",
"[",
"'pdf'",
",",
"'xlsx'",
"]",
":",
"params",
"[",
"'format'",
"]",
"=",
"format",
".",
"lower",
"(",
")",
"else",
":",
"raise",
"AttributeError",
"(",
"\"Invalid format value.\"",
")",
"if",
"not",
"reportFields",
"is",
"None",
":",
"params",
"[",
"'reportFields'",
"]",
"=",
"reportFields",
"if",
"not",
"studyAreasOptions",
"is",
"None",
":",
"params",
"[",
"'studyAreasOptions'",
"]",
"=",
"studyAreasOptions",
"if",
"not",
"useData",
"is",
"None",
":",
"params",
"[",
"'useData'",
"]",
"=",
"useData",
"result",
"=",
"self",
".",
"_get",
"(",
"url",
"=",
"url",
",",
"param_dict",
"=",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
",",
"out_folder",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"out_file_path",
")",
")",
"return",
"result"
] | The GeoEnrichment Create Report method uses the concept of a study
area to define the location of the point or area that you want to
enrich with generated reports. This method allows you to create
many types of high-quality reports for a variety of use cases
describing the input area. If a point is used as a study area, the
service will create a 1-mile ring buffer around the point to
collect and append enrichment data. Optionally, you can create a
buffer ring or drive-time service area around the points to prepare
PDF or Excel reports for the study areas.
Note:
For full examples for each input, please review the following:
http://resources.arcgis.com/en/help/arcgis-rest-api/#/Create_report/02r30000022q000000/
Inputs:
out_file_path - save location of the report
studyAreas - Required parameter to specify a list of input
features to be enriched. The input can be a Point, Polygon,
Adress, or named administrative boundary. The locations can be
passed in as a single object or as a list of objects.
report - Default report to generate.
format - specify the generated report. Options are: XLSX or PDF
reportFields - Optional parameter specifies additional choices to
customize reports. See the URL above to see all the options.
studyAreasOptions - Optional parameter to specify enrichment
behavior. For points described as map coordinates, a 1-mile
ring area centered on each site will be used by default. You
can use this parameter to change these default settings.
With this parameter, the caller can override the default
behavior describing how the enrichment attributes are appended
to the input features described in studyAreas. For example,
you can change the output ring buffer to 5 miles, change the
number of output buffers created around each point, and also
change the output buffer type to a drive-time service area
rather than a simple ring buffer.
useData - By default, the service will automatically determine
the country or dataset that is associated with each location or
area submitted in the studyAreas parameter; however, there is
an associated computational cost which may lengthen the time it
takes to return a response. To skip this intermediate step and
potentially improve the speed and performance of the service,
the caller can specify the country or dataset information up
front through this parameter.
inSR - parameter to define the input geometries in the studyAreas
parameter in a specified spatial reference system. | [
"The",
"GeoEnrichment",
"Create",
"Report",
"method",
"uses",
"the",
"concept",
"of",
"a",
"study",
"area",
"to",
"define",
"the",
"location",
"of",
"the",
"point",
"or",
"area",
"that",
"you",
"want",
"to",
"enrich",
"with",
"generated",
"reports",
".",
"This",
"method",
"allows",
"you",
"to",
"create",
"many",
"types",
"of",
"high",
"-",
"quality",
"reports",
"for",
"a",
"variety",
"of",
"use",
"cases",
"describing",
"the",
"input",
"area",
".",
"If",
"a",
"point",
"is",
"used",
"as",
"a",
"study",
"area",
"the",
"service",
"will",
"create",
"a",
"1",
"-",
"mile",
"ring",
"buffer",
"around",
"the",
"point",
"to",
"collect",
"and",
"append",
"enrichment",
"data",
".",
"Optionally",
"you",
"can",
"create",
"a",
"buffer",
"ring",
"or",
"drive",
"-",
"time",
"service",
"area",
"around",
"the",
"points",
"to",
"prepare",
"PDF",
"or",
"Excel",
"reports",
"for",
"the",
"study",
"areas",
"."
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/enrichment/_geoenrichment.py#L293-L380 | train |
Esri/ArcREST | src/arcrest/enrichment/_geoenrichment.py | GeoEnrichment.getVariables | def getVariables(self,
sourceCountry,
optionalCountryDataset=None,
searchText=None):
r"""
The GeoEnrichment GetVariables helper method allows you to search
the data collections for variables that contain specific keywords.
To see the comprehensive set of global Esri Demographics data that
are available, use the interactive data browser:
http://resources.arcgis.com/en/help/arcgis-rest-api/02r3/02r300000266000000.htm#GUID-2D66F7F8-83A9-4EAA-B5E2-F09D629939CE
Inputs:
sourceCountry - specify the source country for the search. Use this
parameter to limit the search and query of standard geographic
features to one country. This parameter supports both the
two-digit and three-digit country codes illustrated in the
coverage table.
Examples
Example 1 - Set source country to the United States:
sourceCountry=US
Example 2 - Set source country to the Canada:
sourceCountry=CA
Additional notes
Currently, the service is available for Canada, the
United States and a number of European countries. Other
countries will be added in the near future.
The list of available countries and their associated
IDS are listed in the coverage section.
optionalCountryDataset - Optional parameter to specify a specific
dataset within a defined country. This parameter will not be used
in the Beta release. In the future, some countries may have two or
more datasets that may have different vintages and standard
geography areas. For example, in the United States, there may be
an optional dataset with historic census data from previous years.
Examples
optionalCountryDataset=USA_ESRI_2013
Additional notes
Most countries only have a single dataset.
The United States has multiple datasets.
searchText - Optional parameter to specify the text to query and
search the data collections for the country and datasets
specified. You can use this parameter to query and find specific
keywords that are contained in a data collection.
Default value
(null or empty)
Examples
Example 1 - Return all the data collections and variabels that contain the word furniture:
searchText=furniture
Search terms
A query is broken up into terms and operators. There are two types of terms: Single Terms and Phrases.
A Single Term is a single word such as "Income" or "Households".
A Phrase is a group of words surrounded by double quotes such as "Household Income".
Multiple terms can be combined together with Boolean operators to form a more complex query (see below).
Fields
Geography search supports fielded data. When performing a search, you can either specify a field or use search through all fields.
You can search any field by typing the field name followed by a colon ":" then the term you are looking for.
For example, to search for "Income" in the Alias field:
Alias:Income
The search supports single and multiple character wildcard searches within single terms (not within phrase queries).
To perform a single character wildcard search, use the "?" symbol.
To perform a multiple character wildcard search, use the "*" symbol.
The single character wildcard search looks for terms that match that with the single character replaced. For example, to search for "San" or "Sen" you can use the search:
Fuzzy searches
Fuzzy searches are based on the Levenshtein Distance or Edit Distance algorithm. To perform a fuzzy search, you can explicitly set a fuzzy search by using the tilde symbol "~" at the end of a Single Term.
For example, a term similar in spelling to "Hous" uses the fuzzy search:
Hous~
An additional (optional) numeric parameter can be specified after the tilde symbol ("~") to set the similarity tolerance. The value is between 0 and 1; with a value closer to 1, only terms with a higher similarity will be matched.
For example, if you only want to match terms with a similarity of 0.0 or higher, you can set the fuzzy search as follows:
hous~0.8
The default that is used if the optional similarity number is not provided is 0.5.
Boolean operators
Boolean operators allow terms to be combined through logic operators. The search supports AND, "+", OR, NOT and "-" as Boolean operators. Boolean operators must be ALL CAPS.
In searchText , the AND operator is the default conjunction operator. This means that if there is no Boolean operator between two or more terms, the AND operator is used. The AND operator matches items where both terms exist anywhere in the list of standard geography features. The symbol "&" can be used in place of the word AND.
The OR operator links two terms and finds a matching variable if either of the terms exist. This is equivalent to a union with using sets. The symbol "||" can be used in place of the word OR.
To search for features that contain either "Income" or "Wealth" use the following query:
Income OR Wealth
The "+" or required operator requires that the term after the "+" symbol exist somewhere in the attributes of a variable.
To search for features that must contain "Income" and may contain "Household" use the following query:
+Income OR Household
Escaping Special Characters
Search supports escaping special characters that are part of the query syntax. The available special characters are as follows:
+ - && || ! ( ) { } [ ] ^ " ~ * ? : \
To escape these characters, use the \ before the character.
"""
url = self._base_url + self._url_getVariables
params = {
"f" : "json",
"sourceCountry" : sourceCountry
}
if not searchText is None:
params["searchText"] = searchText
if not optionalCountryDataset is None:
params['optionalCountryDataset'] = optionalCountryDataset
return self._post(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | python | def getVariables(self,
sourceCountry,
optionalCountryDataset=None,
searchText=None):
r"""
The GeoEnrichment GetVariables helper method allows you to search
the data collections for variables that contain specific keywords.
To see the comprehensive set of global Esri Demographics data that
are available, use the interactive data browser:
http://resources.arcgis.com/en/help/arcgis-rest-api/02r3/02r300000266000000.htm#GUID-2D66F7F8-83A9-4EAA-B5E2-F09D629939CE
Inputs:
sourceCountry - specify the source country for the search. Use this
parameter to limit the search and query of standard geographic
features to one country. This parameter supports both the
two-digit and three-digit country codes illustrated in the
coverage table.
Examples
Example 1 - Set source country to the United States:
sourceCountry=US
Example 2 - Set source country to the Canada:
sourceCountry=CA
Additional notes
Currently, the service is available for Canada, the
United States and a number of European countries. Other
countries will be added in the near future.
The list of available countries and their associated
IDS are listed in the coverage section.
optionalCountryDataset - Optional parameter to specify a specific
dataset within a defined country. This parameter will not be used
in the Beta release. In the future, some countries may have two or
more datasets that may have different vintages and standard
geography areas. For example, in the United States, there may be
an optional dataset with historic census data from previous years.
Examples
optionalCountryDataset=USA_ESRI_2013
Additional notes
Most countries only have a single dataset.
The United States has multiple datasets.
searchText - Optional parameter to specify the text to query and
search the data collections for the country and datasets
specified. You can use this parameter to query and find specific
keywords that are contained in a data collection.
Default value
(null or empty)
Examples
Example 1 - Return all the data collections and variabels that contain the word furniture:
searchText=furniture
Search terms
A query is broken up into terms and operators. There are two types of terms: Single Terms and Phrases.
A Single Term is a single word such as "Income" or "Households".
A Phrase is a group of words surrounded by double quotes such as "Household Income".
Multiple terms can be combined together with Boolean operators to form a more complex query (see below).
Fields
Geography search supports fielded data. When performing a search, you can either specify a field or use search through all fields.
You can search any field by typing the field name followed by a colon ":" then the term you are looking for.
For example, to search for "Income" in the Alias field:
Alias:Income
The search supports single and multiple character wildcard searches within single terms (not within phrase queries).
To perform a single character wildcard search, use the "?" symbol.
To perform a multiple character wildcard search, use the "*" symbol.
The single character wildcard search looks for terms that match that with the single character replaced. For example, to search for "San" or "Sen" you can use the search:
Fuzzy searches
Fuzzy searches are based on the Levenshtein Distance or Edit Distance algorithm. To perform a fuzzy search, you can explicitly set a fuzzy search by using the tilde symbol "~" at the end of a Single Term.
For example, a term similar in spelling to "Hous" uses the fuzzy search:
Hous~
An additional (optional) numeric parameter can be specified after the tilde symbol ("~") to set the similarity tolerance. The value is between 0 and 1; with a value closer to 1, only terms with a higher similarity will be matched.
For example, if you only want to match terms with a similarity of 0.0 or higher, you can set the fuzzy search as follows:
hous~0.8
The default that is used if the optional similarity number is not provided is 0.5.
Boolean operators
Boolean operators allow terms to be combined through logic operators. The search supports AND, "+", OR, NOT and "-" as Boolean operators. Boolean operators must be ALL CAPS.
In searchText , the AND operator is the default conjunction operator. This means that if there is no Boolean operator between two or more terms, the AND operator is used. The AND operator matches items where both terms exist anywhere in the list of standard geography features. The symbol "&" can be used in place of the word AND.
The OR operator links two terms and finds a matching variable if either of the terms exist. This is equivalent to a union with using sets. The symbol "||" can be used in place of the word OR.
To search for features that contain either "Income" or "Wealth" use the following query:
Income OR Wealth
The "+" or required operator requires that the term after the "+" symbol exist somewhere in the attributes of a variable.
To search for features that must contain "Income" and may contain "Household" use the following query:
+Income OR Household
Escaping Special Characters
Search supports escaping special characters that are part of the query syntax. The available special characters are as follows:
+ - && || ! ( ) { } [ ] ^ " ~ * ? : \
To escape these characters, use the \ before the character.
"""
url = self._base_url + self._url_getVariables
params = {
"f" : "json",
"sourceCountry" : sourceCountry
}
if not searchText is None:
params["searchText"] = searchText
if not optionalCountryDataset is None:
params['optionalCountryDataset'] = optionalCountryDataset
return self._post(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | [
"def",
"getVariables",
"(",
"self",
",",
"sourceCountry",
",",
"optionalCountryDataset",
"=",
"None",
",",
"searchText",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"_base_url",
"+",
"self",
".",
"_url_getVariables",
"params",
"=",
"{",
"\"f\"",
":",
"\"json\"",
",",
"\"sourceCountry\"",
":",
"sourceCountry",
"}",
"if",
"not",
"searchText",
"is",
"None",
":",
"params",
"[",
"\"searchText\"",
"]",
"=",
"searchText",
"if",
"not",
"optionalCountryDataset",
"is",
"None",
":",
"params",
"[",
"'optionalCountryDataset'",
"]",
"=",
"optionalCountryDataset",
"return",
"self",
".",
"_post",
"(",
"url",
"=",
"url",
",",
"param_dict",
"=",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")"
] | r"""
The GeoEnrichment GetVariables helper method allows you to search
the data collections for variables that contain specific keywords.
To see the comprehensive set of global Esri Demographics data that
are available, use the interactive data browser:
http://resources.arcgis.com/en/help/arcgis-rest-api/02r3/02r300000266000000.htm#GUID-2D66F7F8-83A9-4EAA-B5E2-F09D629939CE
Inputs:
sourceCountry - specify the source country for the search. Use this
parameter to limit the search and query of standard geographic
features to one country. This parameter supports both the
two-digit and three-digit country codes illustrated in the
coverage table.
Examples
Example 1 - Set source country to the United States:
sourceCountry=US
Example 2 - Set source country to the Canada:
sourceCountry=CA
Additional notes
Currently, the service is available for Canada, the
United States and a number of European countries. Other
countries will be added in the near future.
The list of available countries and their associated
IDS are listed in the coverage section.
optionalCountryDataset - Optional parameter to specify a specific
dataset within a defined country. This parameter will not be used
in the Beta release. In the future, some countries may have two or
more datasets that may have different vintages and standard
geography areas. For example, in the United States, there may be
an optional dataset with historic census data from previous years.
Examples
optionalCountryDataset=USA_ESRI_2013
Additional notes
Most countries only have a single dataset.
The United States has multiple datasets.
searchText - Optional parameter to specify the text to query and
search the data collections for the country and datasets
specified. You can use this parameter to query and find specific
keywords that are contained in a data collection.
Default value
(null or empty)
Examples
Example 1 - Return all the data collections and variabels that contain the word furniture:
searchText=furniture
Search terms
A query is broken up into terms and operators. There are two types of terms: Single Terms and Phrases.
A Single Term is a single word such as "Income" or "Households".
A Phrase is a group of words surrounded by double quotes such as "Household Income".
Multiple terms can be combined together with Boolean operators to form a more complex query (see below).
Fields
Geography search supports fielded data. When performing a search, you can either specify a field or use search through all fields.
You can search any field by typing the field name followed by a colon ":" then the term you are looking for.
For example, to search for "Income" in the Alias field:
Alias:Income
The search supports single and multiple character wildcard searches within single terms (not within phrase queries).
To perform a single character wildcard search, use the "?" symbol.
To perform a multiple character wildcard search, use the "*" symbol.
The single character wildcard search looks for terms that match that with the single character replaced. For example, to search for "San" or "Sen" you can use the search:
Fuzzy searches
Fuzzy searches are based on the Levenshtein Distance or Edit Distance algorithm. To perform a fuzzy search, you can explicitly set a fuzzy search by using the tilde symbol "~" at the end of a Single Term.
For example, a term similar in spelling to "Hous" uses the fuzzy search:
Hous~
An additional (optional) numeric parameter can be specified after the tilde symbol ("~") to set the similarity tolerance. The value is between 0 and 1; with a value closer to 1, only terms with a higher similarity will be matched.
For example, if you only want to match terms with a similarity of 0.0 or higher, you can set the fuzzy search as follows:
hous~0.8
The default that is used if the optional similarity number is not provided is 0.5.
Boolean operators
Boolean operators allow terms to be combined through logic operators. The search supports AND, "+", OR, NOT and "-" as Boolean operators. Boolean operators must be ALL CAPS.
In searchText , the AND operator is the default conjunction operator. This means that if there is no Boolean operator between two or more terms, the AND operator is used. The AND operator matches items where both terms exist anywhere in the list of standard geography features. The symbol "&" can be used in place of the word AND.
The OR operator links two terms and finds a matching variable if either of the terms exist. This is equivalent to a union with using sets. The symbol "||" can be used in place of the word OR.
To search for features that contain either "Income" or "Wealth" use the following query:
Income OR Wealth
The "+" or required operator requires that the term after the "+" symbol exist somewhere in the attributes of a variable.
To search for features that must contain "Income" and may contain "Household" use the following query:
+Income OR Household
Escaping Special Characters
Search supports escaping special characters that are part of the query syntax. The available special characters are as follows:
+ - && || ! ( ) { } [ ] ^ " ~ * ? : \
To escape these characters, use the \ before the character. | [
"r",
"The",
"GeoEnrichment",
"GetVariables",
"helper",
"method",
"allows",
"you",
"to",
"search",
"the",
"data",
"collections",
"for",
"variables",
"that",
"contain",
"specific",
"keywords",
"."
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/enrichment/_geoenrichment.py#L445-L546 | train |
Esri/ArcREST | src/arcrest/manageags/_services.py | Services.folders | def folders(self):
""" returns a list of all folders """
if self._folders is None:
self.__init()
if "/" not in self._folders:
self._folders.append("/")
return self._folders | python | def folders(self):
""" returns a list of all folders """
if self._folders is None:
self.__init()
if "/" not in self._folders:
self._folders.append("/")
return self._folders | [
"def",
"folders",
"(",
"self",
")",
":",
"if",
"self",
".",
"_folders",
"is",
"None",
":",
"self",
".",
"__init",
"(",
")",
"if",
"\"/\"",
"not",
"in",
"self",
".",
"_folders",
":",
"self",
".",
"_folders",
".",
"append",
"(",
"\"/\"",
")",
"return",
"self",
".",
"_folders"
] | returns a list of all folders | [
"returns",
"a",
"list",
"of",
"all",
"folders"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageags/_services.py#L109-L115 | train |
Esri/ArcREST | src/arcrest/manageags/_services.py | Services.services | def services(self):
""" returns the services in the current folder """
self._services = []
params = {
"f" : "json"
}
json_dict = self._get(url=self._currentURL,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port)
if "services" in json_dict.keys():
for s in json_dict['services']:
uURL = self._currentURL + "/%s.%s" % (s['serviceName'], s['type'])
self._services.append(
AGSService(url=uURL,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port)
)
return self._services | python | def services(self):
""" returns the services in the current folder """
self._services = []
params = {
"f" : "json"
}
json_dict = self._get(url=self._currentURL,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port)
if "services" in json_dict.keys():
for s in json_dict['services']:
uURL = self._currentURL + "/%s.%s" % (s['serviceName'], s['type'])
self._services.append(
AGSService(url=uURL,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port)
)
return self._services | [
"def",
"services",
"(",
"self",
")",
":",
"self",
".",
"_services",
"=",
"[",
"]",
"params",
"=",
"{",
"\"f\"",
":",
"\"json\"",
"}",
"json_dict",
"=",
"self",
".",
"_get",
"(",
"url",
"=",
"self",
".",
"_currentURL",
",",
"param_dict",
"=",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")",
"if",
"\"services\"",
"in",
"json_dict",
".",
"keys",
"(",
")",
":",
"for",
"s",
"in",
"json_dict",
"[",
"'services'",
"]",
":",
"uURL",
"=",
"self",
".",
"_currentURL",
"+",
"\"/%s.%s\"",
"%",
"(",
"s",
"[",
"'serviceName'",
"]",
",",
"s",
"[",
"'type'",
"]",
")",
"self",
".",
"_services",
".",
"append",
"(",
"AGSService",
"(",
"url",
"=",
"uURL",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")",
")",
"return",
"self",
".",
"_services"
] | returns the services in the current folder | [
"returns",
"the",
"services",
"in",
"the",
"current",
"folder"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageags/_services.py#L139-L159 | train |
Esri/ArcREST | src/arcrest/manageags/_services.py | Services.createService | def createService(self, service):
"""
Creates a new GIS service in the folder. A service is created by
submitting a JSON representation of the service to this operation.
"""
url = self._url + "/createService"
params = {
"f" : "json"
}
if isinstance(service, str):
params['service'] = service
elif isinstance(service, dict):
params['service'] = json.dumps(service)
return self._post(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | python | def createService(self, service):
"""
Creates a new GIS service in the folder. A service is created by
submitting a JSON representation of the service to this operation.
"""
url = self._url + "/createService"
params = {
"f" : "json"
}
if isinstance(service, str):
params['service'] = service
elif isinstance(service, dict):
params['service'] = json.dumps(service)
return self._post(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | [
"def",
"createService",
"(",
"self",
",",
"service",
")",
":",
"url",
"=",
"self",
".",
"_url",
"+",
"\"/createService\"",
"params",
"=",
"{",
"\"f\"",
":",
"\"json\"",
"}",
"if",
"isinstance",
"(",
"service",
",",
"str",
")",
":",
"params",
"[",
"'service'",
"]",
"=",
"service",
"elif",
"isinstance",
"(",
"service",
",",
"dict",
")",
":",
"params",
"[",
"'service'",
"]",
"=",
"json",
".",
"dumps",
"(",
"service",
")",
"return",
"self",
".",
"_post",
"(",
"url",
"=",
"url",
",",
"param_dict",
"=",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")"
] | Creates a new GIS service in the folder. A service is created by
submitting a JSON representation of the service to this operation. | [
"Creates",
"a",
"new",
"GIS",
"service",
"in",
"the",
"folder",
".",
"A",
"service",
"is",
"created",
"by",
"submitting",
"a",
"JSON",
"representation",
"of",
"the",
"service",
"to",
"this",
"operation",
"."
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageags/_services.py#L401-L418 | train |
Esri/ArcREST | src/arcrest/manageags/_services.py | Services.exists | def exists(self, folderName, serviceName=None, serviceType=None):
"""
This operation allows you to check whether a folder or a service
exists. To test if a folder exists, supply only a folderName. To
test if a service exists in a root folder, supply both serviceName
and serviceType with folderName=None. To test if a service exists
in a folder, supply all three parameters.
Inputs:
folderName - a folder name
serviceName - a service name
serviceType - a service type. Allowed values:
"GPSERVER", "GLOBESERVER", "MAPSERVER",
"GEOMETRYSERVER", "IMAGESERVER", "SEARCHSERVER",
"GEODATASERVER", "GEOCODESERVER"
"""
url = self._url + "/exists"
params = {
"f" : "json",
"folderName" : folderName,
"serviceName" : serviceName,
"type" : serviceType
}
return self._post(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | python | def exists(self, folderName, serviceName=None, serviceType=None):
"""
This operation allows you to check whether a folder or a service
exists. To test if a folder exists, supply only a folderName. To
test if a service exists in a root folder, supply both serviceName
and serviceType with folderName=None. To test if a service exists
in a folder, supply all three parameters.
Inputs:
folderName - a folder name
serviceName - a service name
serviceType - a service type. Allowed values:
"GPSERVER", "GLOBESERVER", "MAPSERVER",
"GEOMETRYSERVER", "IMAGESERVER", "SEARCHSERVER",
"GEODATASERVER", "GEOCODESERVER"
"""
url = self._url + "/exists"
params = {
"f" : "json",
"folderName" : folderName,
"serviceName" : serviceName,
"type" : serviceType
}
return self._post(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | [
"def",
"exists",
"(",
"self",
",",
"folderName",
",",
"serviceName",
"=",
"None",
",",
"serviceType",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"_url",
"+",
"\"/exists\"",
"params",
"=",
"{",
"\"f\"",
":",
"\"json\"",
",",
"\"folderName\"",
":",
"folderName",
",",
"\"serviceName\"",
":",
"serviceName",
",",
"\"type\"",
":",
"serviceType",
"}",
"return",
"self",
".",
"_post",
"(",
"url",
"=",
"url",
",",
"param_dict",
"=",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")"
] | This operation allows you to check whether a folder or a service
exists. To test if a folder exists, supply only a folderName. To
test if a service exists in a root folder, supply both serviceName
and serviceType with folderName=None. To test if a service exists
in a folder, supply all three parameters.
Inputs:
folderName - a folder name
serviceName - a service name
serviceType - a service type. Allowed values:
"GPSERVER", "GLOBESERVER", "MAPSERVER",
"GEOMETRYSERVER", "IMAGESERVER", "SEARCHSERVER",
"GEODATASERVER", "GEOCODESERVER" | [
"This",
"operation",
"allows",
"you",
"to",
"check",
"whether",
"a",
"folder",
"or",
"a",
"service",
"exists",
".",
"To",
"test",
"if",
"a",
"folder",
"exists",
"supply",
"only",
"a",
"folderName",
".",
"To",
"test",
"if",
"a",
"service",
"exists",
"in",
"a",
"root",
"folder",
"supply",
"both",
"serviceName",
"and",
"serviceType",
"with",
"folderName",
"=",
"None",
".",
"To",
"test",
"if",
"a",
"service",
"exists",
"in",
"a",
"folder",
"supply",
"all",
"three",
"parameters",
"."
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageags/_services.py#L524-L552 | train |
Esri/ArcREST | src/arcrest/manageags/_services.py | AGSService.__init | def __init(self):
""" populates server admin information """
params = {
"f" : "json"
}
json_dict = self._get(url=self._currentURL,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port)
self._json = json.dumps(json_dict)
self._json_dict = json_dict
attributes = [attr for attr in dir(self)
if not attr.startswith('__') and \
not attr.startswith('_')]
for k,v in json_dict.items():
if k.lower() == "extensions":
self._extensions = []
for ext in v:
self._extensions.append(Extension.fromJSON(ext))
del ext
elif k in attributes:
setattr(self, "_"+ k, json_dict[k])
else:
print( k, " - attribute not implemented in manageags.AGSService.")
del k
del v | python | def __init(self):
""" populates server admin information """
params = {
"f" : "json"
}
json_dict = self._get(url=self._currentURL,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port)
self._json = json.dumps(json_dict)
self._json_dict = json_dict
attributes = [attr for attr in dir(self)
if not attr.startswith('__') and \
not attr.startswith('_')]
for k,v in json_dict.items():
if k.lower() == "extensions":
self._extensions = []
for ext in v:
self._extensions.append(Extension.fromJSON(ext))
del ext
elif k in attributes:
setattr(self, "_"+ k, json_dict[k])
else:
print( k, " - attribute not implemented in manageags.AGSService.")
del k
del v | [
"def",
"__init",
"(",
"self",
")",
":",
"params",
"=",
"{",
"\"f\"",
":",
"\"json\"",
"}",
"json_dict",
"=",
"self",
".",
"_get",
"(",
"url",
"=",
"self",
".",
"_currentURL",
",",
"param_dict",
"=",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")",
"self",
".",
"_json",
"=",
"json",
".",
"dumps",
"(",
"json_dict",
")",
"self",
".",
"_json_dict",
"=",
"json_dict",
"attributes",
"=",
"[",
"attr",
"for",
"attr",
"in",
"dir",
"(",
"self",
")",
"if",
"not",
"attr",
".",
"startswith",
"(",
"'__'",
")",
"and",
"not",
"attr",
".",
"startswith",
"(",
"'_'",
")",
"]",
"for",
"k",
",",
"v",
"in",
"json_dict",
".",
"items",
"(",
")",
":",
"if",
"k",
".",
"lower",
"(",
")",
"==",
"\"extensions\"",
":",
"self",
".",
"_extensions",
"=",
"[",
"]",
"for",
"ext",
"in",
"v",
":",
"self",
".",
"_extensions",
".",
"append",
"(",
"Extension",
".",
"fromJSON",
"(",
"ext",
")",
")",
"del",
"ext",
"elif",
"k",
"in",
"attributes",
":",
"setattr",
"(",
"self",
",",
"\"_\"",
"+",
"k",
",",
"json_dict",
"[",
"k",
"]",
")",
"else",
":",
"print",
"(",
"k",
",",
"\" - attribute not implemented in manageags.AGSService.\"",
")",
"del",
"k",
"del",
"v"
] | populates server admin information | [
"populates",
"server",
"admin",
"information"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageags/_services.py#L615-L641 | train |
Esri/ArcREST | src/arcrest/manageags/_services.py | AGSService.serviceManifest | def serviceManifest(self, fileType="json"):
"""
The service manifest resource documents the data and other
resources that define the service origins and power the service.
This resource will tell you underlying databases and their location
along with other supplementary files that make up the service.
Inputs:
fileType - this can be json or xml. json returns the
manifest.json file. xml returns the manifest.xml file. These
files are stored at \arcgisserver\directories\arcgissystem\
arcgisinput\%servicename%.%servicetype%\extracted folder.
Outputs:
Python dictionary if fileType is json and Python object of
xml.etree.ElementTree.ElementTree type if fileType is xml.
"""
url = self._url + "/iteminfo/manifest/manifest.%s" % fileType
params = {}
f = self._get(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port,
out_folder=tempfile.gettempdir(),
file_name=os.path.basename(url))
if fileType == 'json':
return f
if fileType == 'xml':
return ET.ElementTree(ET.fromstring(f)) | python | def serviceManifest(self, fileType="json"):
"""
The service manifest resource documents the data and other
resources that define the service origins and power the service.
This resource will tell you underlying databases and their location
along with other supplementary files that make up the service.
Inputs:
fileType - this can be json or xml. json returns the
manifest.json file. xml returns the manifest.xml file. These
files are stored at \arcgisserver\directories\arcgissystem\
arcgisinput\%servicename%.%servicetype%\extracted folder.
Outputs:
Python dictionary if fileType is json and Python object of
xml.etree.ElementTree.ElementTree type if fileType is xml.
"""
url = self._url + "/iteminfo/manifest/manifest.%s" % fileType
params = {}
f = self._get(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port,
out_folder=tempfile.gettempdir(),
file_name=os.path.basename(url))
if fileType == 'json':
return f
if fileType == 'xml':
return ET.ElementTree(ET.fromstring(f)) | [
"def",
"serviceManifest",
"(",
"self",
",",
"fileType",
"=",
"\"json\"",
")",
":",
"url",
"=",
"self",
".",
"_url",
"+",
"\"/iteminfo/manifest/manifest.%s\"",
"%",
"fileType",
"params",
"=",
"{",
"}",
"f",
"=",
"self",
".",
"_get",
"(",
"url",
"=",
"url",
",",
"param_dict",
"=",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
",",
"out_folder",
"=",
"tempfile",
".",
"gettempdir",
"(",
")",
",",
"file_name",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"url",
")",
")",
"if",
"fileType",
"==",
"'json'",
":",
"return",
"f",
"if",
"fileType",
"==",
"'xml'",
":",
"return",
"ET",
".",
"ElementTree",
"(",
"ET",
".",
"fromstring",
"(",
"f",
")",
")"
] | The service manifest resource documents the data and other
resources that define the service origins and power the service.
This resource will tell you underlying databases and their location
along with other supplementary files that make up the service.
Inputs:
fileType - this can be json or xml. json returns the
manifest.json file. xml returns the manifest.xml file. These
files are stored at \arcgisserver\directories\arcgissystem\
arcgisinput\%servicename%.%servicetype%\extracted folder.
Outputs:
Python dictionary if fileType is json and Python object of
xml.etree.ElementTree.ElementTree type if fileType is xml. | [
"The",
"service",
"manifest",
"resource",
"documents",
"the",
"data",
"and",
"other",
"resources",
"that",
"define",
"the",
"service",
"origins",
"and",
"power",
"the",
"service",
".",
"This",
"resource",
"will",
"tell",
"you",
"underlying",
"databases",
"and",
"their",
"location",
"along",
"with",
"other",
"supplementary",
"files",
"that",
"make",
"up",
"the",
"service",
"."
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageags/_services.py#L1023-L1053 | train |
Esri/ArcREST | src/arcrest/manageags/_data.py | Data.startDataStoreMachine | def startDataStoreMachine(self, dataStoreItemName, machineName):
"""
Starts the database instance running on the Data Store machine.
Inputs:
dataStoreItemName - name of the item to start
machineName - name of the machine to start on
"""
url = self._url + "/items/enterpriseDatabases/%s/machines/%s/start" % (dataStoreItemName, machineName)
params = {
"f": "json"
}
return self._post(url=url, param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | python | def startDataStoreMachine(self, dataStoreItemName, machineName):
"""
Starts the database instance running on the Data Store machine.
Inputs:
dataStoreItemName - name of the item to start
machineName - name of the machine to start on
"""
url = self._url + "/items/enterpriseDatabases/%s/machines/%s/start" % (dataStoreItemName, machineName)
params = {
"f": "json"
}
return self._post(url=url, param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | [
"def",
"startDataStoreMachine",
"(",
"self",
",",
"dataStoreItemName",
",",
"machineName",
")",
":",
"url",
"=",
"self",
".",
"_url",
"+",
"\"/items/enterpriseDatabases/%s/machines/%s/start\"",
"%",
"(",
"dataStoreItemName",
",",
"machineName",
")",
"params",
"=",
"{",
"\"f\"",
":",
"\"json\"",
"}",
"return",
"self",
".",
"_post",
"(",
"url",
"=",
"url",
",",
"param_dict",
"=",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")"
] | Starts the database instance running on the Data Store machine.
Inputs:
dataStoreItemName - name of the item to start
machineName - name of the machine to start on | [
"Starts",
"the",
"database",
"instance",
"running",
"on",
"the",
"Data",
"Store",
"machine",
"."
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageags/_data.py#L236-L251 | train |
Esri/ArcREST | src/arcrest/manageags/_data.py | Data.unregisterDataItem | def unregisterDataItem(self, path):
"""
Unregisters a data item that has been previously registered with
the server's data store.
Inputs:
path - path to share folder
Example:
path = r"/fileShares/folder_share"
print data.unregisterDataItem(path)
"""
url = self._url + "/unregisterItem"
params = {
"f" : "json",
"itempath" : path,
"force":"true"
}
return self._post(url, param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | python | def unregisterDataItem(self, path):
"""
Unregisters a data item that has been previously registered with
the server's data store.
Inputs:
path - path to share folder
Example:
path = r"/fileShares/folder_share"
print data.unregisterDataItem(path)
"""
url = self._url + "/unregisterItem"
params = {
"f" : "json",
"itempath" : path,
"force":"true"
}
return self._post(url, param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | [
"def",
"unregisterDataItem",
"(",
"self",
",",
"path",
")",
":",
"url",
"=",
"self",
".",
"_url",
"+",
"\"/unregisterItem\"",
"params",
"=",
"{",
"\"f\"",
":",
"\"json\"",
",",
"\"itempath\"",
":",
"path",
",",
"\"force\"",
":",
"\"true\"",
"}",
"return",
"self",
".",
"_post",
"(",
"url",
",",
"param_dict",
"=",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")"
] | Unregisters a data item that has been previously registered with
the server's data store.
Inputs:
path - path to share folder
Example:
path = r"/fileShares/folder_share"
print data.unregisterDataItem(path) | [
"Unregisters",
"a",
"data",
"item",
"that",
"has",
"been",
"previously",
"registered",
"with",
"the",
"server",
"s",
"data",
"store",
"."
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageags/_data.py#L270-L291 | train |
Esri/ArcREST | src/arcrest/manageags/_data.py | Data.validateDataStore | def validateDataStore(self, dataStoreName, machineName):
"""
Checks the status of ArcGIS Data Store and provides a health check
response.
Inputs:
dataStoreName - name of the datastore
machineName - name of the machine
"""
url = self._url + "/items/enterpriseDatabases/%s/machines/%s/validate" % (dataStoreName, machineName)
params = {
"f" : "json"
}
return self._post(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | python | def validateDataStore(self, dataStoreName, machineName):
"""
Checks the status of ArcGIS Data Store and provides a health check
response.
Inputs:
dataStoreName - name of the datastore
machineName - name of the machine
"""
url = self._url + "/items/enterpriseDatabases/%s/machines/%s/validate" % (dataStoreName, machineName)
params = {
"f" : "json"
}
return self._post(url=url,
param_dict=params,
securityHandler=self._securityHandler,
proxy_url=self._proxy_url,
proxy_port=self._proxy_port) | [
"def",
"validateDataStore",
"(",
"self",
",",
"dataStoreName",
",",
"machineName",
")",
":",
"url",
"=",
"self",
".",
"_url",
"+",
"\"/items/enterpriseDatabases/%s/machines/%s/validate\"",
"%",
"(",
"dataStoreName",
",",
"machineName",
")",
"params",
"=",
"{",
"\"f\"",
":",
"\"json\"",
"}",
"return",
"self",
".",
"_post",
"(",
"url",
"=",
"url",
",",
"param_dict",
"=",
"params",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
")"
] | Checks the status of ArcGIS Data Store and provides a health check
response.
Inputs:
dataStoreName - name of the datastore
machineName - name of the machine | [
"Checks",
"the",
"status",
"of",
"ArcGIS",
"Data",
"Store",
"and",
"provides",
"a",
"health",
"check",
"response",
"."
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageags/_data.py#L293-L310 | train |
Esri/ArcREST | src/arcrest/ags/_globeservice.py | GlobeService.layers | def layers(self):
"""gets the globe service layers"""
if self._layers is None:
self.__init()
lyrs = []
for lyr in self._layers:
lyr['object'] = GlobeServiceLayer(url=self._url + "/%s" % lyr['id'],
securityHandler=self._securityHandler,
proxy_port=self._proxy_port,
proxy_url=self._proxy_url)
lyrs.append(lyr)
return lyrs | python | def layers(self):
"""gets the globe service layers"""
if self._layers is None:
self.__init()
lyrs = []
for lyr in self._layers:
lyr['object'] = GlobeServiceLayer(url=self._url + "/%s" % lyr['id'],
securityHandler=self._securityHandler,
proxy_port=self._proxy_port,
proxy_url=self._proxy_url)
lyrs.append(lyr)
return lyrs | [
"def",
"layers",
"(",
"self",
")",
":",
"if",
"self",
".",
"_layers",
"is",
"None",
":",
"self",
".",
"__init",
"(",
")",
"lyrs",
"=",
"[",
"]",
"for",
"lyr",
"in",
"self",
".",
"_layers",
":",
"lyr",
"[",
"'object'",
"]",
"=",
"GlobeServiceLayer",
"(",
"url",
"=",
"self",
".",
"_url",
"+",
"\"/%s\"",
"%",
"lyr",
"[",
"'id'",
"]",
",",
"securityHandler",
"=",
"self",
".",
"_securityHandler",
",",
"proxy_port",
"=",
"self",
".",
"_proxy_port",
",",
"proxy_url",
"=",
"self",
".",
"_proxy_url",
")",
"lyrs",
".",
"append",
"(",
"lyr",
")",
"return",
"lyrs"
] | gets the globe service layers | [
"gets",
"the",
"globe",
"service",
"layers"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/ags/_globeservice.py#L288-L300 | train |
Esri/ArcREST | src/arcrest/ags/_gpobjects.py | GPFeatureRecordSetLayer.loadFeatures | def loadFeatures(self, path_to_fc):
"""
loads a feature class features to the object
"""
from ..common.spatial import featureclass_to_json
v = json.loads(featureclass_to_json(path_to_fc))
self.value = v | python | def loadFeatures(self, path_to_fc):
"""
loads a feature class features to the object
"""
from ..common.spatial import featureclass_to_json
v = json.loads(featureclass_to_json(path_to_fc))
self.value = v | [
"def",
"loadFeatures",
"(",
"self",
",",
"path_to_fc",
")",
":",
"from",
".",
".",
"common",
".",
"spatial",
"import",
"featureclass_to_json",
"v",
"=",
"json",
".",
"loads",
"(",
"featureclass_to_json",
"(",
"path_to_fc",
")",
")",
"self",
".",
"value",
"=",
"v"
] | loads a feature class features to the object | [
"loads",
"a",
"feature",
"class",
"features",
"to",
"the",
"object"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/ags/_gpobjects.py#L184-L190 | train |
Esri/ArcREST | src/arcrest/ags/_gpobjects.py | GPFeatureRecordSetLayer.fromFeatureClass | def fromFeatureClass(fc, paramName):
"""
returns a GPFeatureRecordSetLayer object from a feature class
Input:
fc - path to a feature class
paramName - name of the parameter
"""
from ..common.spatial import featureclass_to_json
val = json.loads(featureclass_to_json(fc))
v = GPFeatureRecordSetLayer()
v.value = val
v.paramName = paramName
return v | python | def fromFeatureClass(fc, paramName):
"""
returns a GPFeatureRecordSetLayer object from a feature class
Input:
fc - path to a feature class
paramName - name of the parameter
"""
from ..common.spatial import featureclass_to_json
val = json.loads(featureclass_to_json(fc))
v = GPFeatureRecordSetLayer()
v.value = val
v.paramName = paramName
return v | [
"def",
"fromFeatureClass",
"(",
"fc",
",",
"paramName",
")",
":",
"from",
".",
".",
"common",
".",
"spatial",
"import",
"featureclass_to_json",
"val",
"=",
"json",
".",
"loads",
"(",
"featureclass_to_json",
"(",
"fc",
")",
")",
"v",
"=",
"GPFeatureRecordSetLayer",
"(",
")",
"v",
".",
"value",
"=",
"val",
"v",
".",
"paramName",
"=",
"paramName",
"return",
"v"
] | returns a GPFeatureRecordSetLayer object from a feature class
Input:
fc - path to a feature class
paramName - name of the parameter | [
"returns",
"a",
"GPFeatureRecordSetLayer",
"object",
"from",
"a",
"feature",
"class"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/ags/_gpobjects.py#L207-L220 | train |
Esri/ArcREST | src/arcrest/webmap/renderer.py | SimpleRenderer.asDictionary | def asDictionary(self):
""" provides a dictionary representation of the object """
template = {
"type" : "simple",
"symbol" : self._symbol.asDictionary,
"label" : self._label,
"description" : self._description,
"rotationType": self._rotationType,
"rotationExpression": self._rotationExpression
}
return template | python | def asDictionary(self):
""" provides a dictionary representation of the object """
template = {
"type" : "simple",
"symbol" : self._symbol.asDictionary,
"label" : self._label,
"description" : self._description,
"rotationType": self._rotationType,
"rotationExpression": self._rotationExpression
}
return template | [
"def",
"asDictionary",
"(",
"self",
")",
":",
"template",
"=",
"{",
"\"type\"",
":",
"\"simple\"",
",",
"\"symbol\"",
":",
"self",
".",
"_symbol",
".",
"asDictionary",
",",
"\"label\"",
":",
"self",
".",
"_label",
",",
"\"description\"",
":",
"self",
".",
"_description",
",",
"\"rotationType\"",
":",
"self",
".",
"_rotationType",
",",
"\"rotationExpression\"",
":",
"self",
".",
"_rotationExpression",
"}",
"return",
"template"
] | provides a dictionary representation of the object | [
"provides",
"a",
"dictionary",
"representation",
"of",
"the",
"object"
] | ab240fde2b0200f61d4a5f6df033516e53f2f416 | https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/webmap/renderer.py#L32-L42 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.