id
int32
0
252k
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
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
13,000
Esri/ArcREST
src/arcrest/agol/services.py
FeatureLayer.getAttachment
def getAttachment(self, oid, attachment_id, out_folder=None): """ downloads a feature's attachment. Inputs: oid - object id of the feature attachment_id - ID of the attachment. Should be an integer. out_folder - save path of the file Output: string - full path of the file """ attachments = self.listAttachments(oid=oid) if "attachmentInfos" in attachments: for attachment in attachments['attachmentInfos']: if "id" in attachment and \ attachment['id'] == attachment_id: url = self._url + "/%s/attachments/%s" % (oid, attachment_id) return self._get(url=url, param_dict={"f":'json'}, securityHandler=self._securityHandler, out_folder=out_folder, file_name=attachment['name']) return None
python
def getAttachment(self, oid, attachment_id, out_folder=None): """ downloads a feature's attachment. Inputs: oid - object id of the feature attachment_id - ID of the attachment. Should be an integer. out_folder - save path of the file Output: string - full path of the file """ attachments = self.listAttachments(oid=oid) if "attachmentInfos" in attachments: for attachment in attachments['attachmentInfos']: if "id" in attachment and \ attachment['id'] == attachment_id: url = self._url + "/%s/attachments/%s" % (oid, attachment_id) return self._get(url=url, param_dict={"f":'json'}, securityHandler=self._securityHandler, out_folder=out_folder, file_name=attachment['name']) return None
[ "def", "getAttachment", "(", "self", ",", "oid", ",", "attachment_id", ",", "out_folder", "=", "None", ")", ":", "attachments", "=", "self", ".", "listAttachments", "(", "oid", "=", "oid", ")", "if", "\"attachmentInfos\"", "in", "attachments", ":", "for", "attachment", "in", "attachments", "[", "'attachmentInfos'", "]", ":", "if", "\"id\"", "in", "attachment", "and", "attachment", "[", "'id'", "]", "==", "attachment_id", ":", "url", "=", "self", ".", "_url", "+", "\"/%s/attachments/%s\"", "%", "(", "oid", ",", "attachment_id", ")", "return", "self", ".", "_get", "(", "url", "=", "url", ",", "param_dict", "=", "{", "\"f\"", ":", "'json'", "}", ",", "securityHandler", "=", "self", ".", "_securityHandler", ",", "out_folder", "=", "out_folder", ",", "file_name", "=", "attachment", "[", "'name'", "]", ")", "return", "None" ]
downloads a feature's attachment. Inputs: oid - object id of the feature attachment_id - ID of the attachment. Should be an integer. out_folder - save path of the file Output: string - full path of the file
[ "downloads", "a", "feature", "s", "attachment", "." ]
ab240fde2b0200f61d4a5f6df033516e53f2f416
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/agol/services.py#L1550-L1571
13,001
Esri/ArcREST
src/arcrest/agol/services.py
FeatureLayer.create_fc_template
def create_fc_template(self, out_path, out_name): """creates a featureclass template on local disk""" fields = self.fields objectIdField = self.objectIdField geomType = self.geometryType wkid = self.parentLayer.spatialReference['wkid'] return create_feature_class(out_path, out_name, geomType, wkid, fields, objectIdField)
python
def create_fc_template(self, out_path, out_name): """creates a featureclass template on local disk""" fields = self.fields objectIdField = self.objectIdField geomType = self.geometryType wkid = self.parentLayer.spatialReference['wkid'] return create_feature_class(out_path, out_name, geomType, wkid, fields, objectIdField)
[ "def", "create_fc_template", "(", "self", ",", "out_path", ",", "out_name", ")", ":", "fields", "=", "self", ".", "fields", "objectIdField", "=", "self", ".", "objectIdField", "geomType", "=", "self", ".", "geometryType", "wkid", "=", "self", ".", "parentLayer", ".", "spatialReference", "[", "'wkid'", "]", "return", "create_feature_class", "(", "out_path", ",", "out_name", ",", "geomType", ",", "wkid", ",", "fields", ",", "objectIdField", ")" ]
creates a featureclass template on local disk
[ "creates", "a", "featureclass", "template", "on", "local", "disk" ]
ab240fde2b0200f61d4a5f6df033516e53f2f416
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/agol/services.py#L1573-L1584
13,002
Esri/ArcREST
src/arcrest/agol/services.py
FeatureLayer.create_feature_template
def create_feature_template(self): """creates a feature template""" fields = self.fields feat_schema = {} att = {} for fld in fields: self._globalIdField if not fld['name'] == self._objectIdField and not fld['name'] == self._globalIdField: att[fld['name']] = '' feat_schema['attributes'] = att feat_schema['geometry'] = '' return Feature(feat_schema)
python
def create_feature_template(self): """creates a feature template""" fields = self.fields feat_schema = {} att = {} for fld in fields: self._globalIdField if not fld['name'] == self._objectIdField and not fld['name'] == self._globalIdField: att[fld['name']] = '' feat_schema['attributes'] = att feat_schema['geometry'] = '' return Feature(feat_schema)
[ "def", "create_feature_template", "(", "self", ")", ":", "fields", "=", "self", ".", "fields", "feat_schema", "=", "{", "}", "att", "=", "{", "}", "for", "fld", "in", "fields", ":", "self", ".", "_globalIdField", "if", "not", "fld", "[", "'name'", "]", "==", "self", ".", "_objectIdField", "and", "not", "fld", "[", "'name'", "]", "==", "self", ".", "_globalIdField", ":", "att", "[", "fld", "[", "'name'", "]", "]", "=", "''", "feat_schema", "[", "'attributes'", "]", "=", "att", "feat_schema", "[", "'geometry'", "]", "=", "''", "return", "Feature", "(", "feat_schema", ")" ]
creates a feature template
[ "creates", "a", "feature", "template" ]
ab240fde2b0200f61d4a5f6df033516e53f2f416
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/agol/services.py#L1585-L1598
13,003
Esri/ArcREST
src/arcrest/common/geometry.py
Point.spatialReference
def spatialReference(self): """returns the geometry spatial reference""" if self._wkid == None and self._wkt is not None: return {"wkt": self._wkt} else: return {"wkid": self._wkid}
python
def spatialReference(self): """returns the geometry spatial reference""" if self._wkid == None and self._wkt is not None: return {"wkt": self._wkt} else: return {"wkid": self._wkid}
[ "def", "spatialReference", "(", "self", ")", ":", "if", "self", ".", "_wkid", "==", "None", "and", "self", ".", "_wkt", "is", "not", "None", ":", "return", "{", "\"wkt\"", ":", "self", ".", "_wkt", "}", "else", ":", "return", "{", "\"wkid\"", ":", "self", ".", "_wkid", "}" ]
returns the geometry spatial reference
[ "returns", "the", "geometry", "spatial", "reference" ]
ab240fde2b0200f61d4a5f6df033516e53f2f416
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/common/geometry.py#L107-L112
13,004
Esri/ArcREST
src/arcrest/common/geometry.py
Point.asJSON
def asJSON(self): """ returns a geometry as JSON """ value = self._json if value is None: value = json.dumps(self.asDictionary, default=_date_handler) self._json = value return self._json
python
def asJSON(self): """ returns a geometry as JSON """ value = self._json if value is None: value = json.dumps(self.asDictionary, default=_date_handler) self._json = value return self._json
[ "def", "asJSON", "(", "self", ")", ":", "value", "=", "self", ".", "_json", "if", "value", "is", "None", ":", "value", "=", "json", ".", "dumps", "(", "self", ".", "asDictionary", ",", "default", "=", "_date_handler", ")", "self", ".", "_json", "=", "value", "return", "self", ".", "_json" ]
returns a geometry as JSON
[ "returns", "a", "geometry", "as", "JSON" ]
ab240fde2b0200f61d4a5f6df033516e53f2f416
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/common/geometry.py#L120-L127
13,005
Esri/ArcREST
src/arcrest/common/geometry.py
Point.asArcPyObject
def asArcPyObject(self): """ returns the Point as an ESRI arcpy.Point object """ if arcpyFound == False: raise Exception("ArcPy is required to use this function") return arcpy.AsShape(self.asDictionary, True)
python
def asArcPyObject(self): """ returns the Point as an ESRI arcpy.Point object """ if arcpyFound == False: raise Exception("ArcPy is required to use this function") return arcpy.AsShape(self.asDictionary, True)
[ "def", "asArcPyObject", "(", "self", ")", ":", "if", "arcpyFound", "==", "False", ":", "raise", "Exception", "(", "\"ArcPy is required to use this function\"", ")", "return", "arcpy", ".", "AsShape", "(", "self", ".", "asDictionary", ",", "True", ")" ]
returns the Point as an ESRI arcpy.Point object
[ "returns", "the", "Point", "as", "an", "ESRI", "arcpy", ".", "Point", "object" ]
ab240fde2b0200f61d4a5f6df033516e53f2f416
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/common/geometry.py#L130-L134
13,006
Esri/ArcREST
src/arcrest/common/geometry.py
Point.X
def X(self, value): """sets the X coordinate""" if isinstance(value, (int, float, long, types.NoneType)): self._x = value
python
def X(self, value): """sets the X coordinate""" if isinstance(value, (int, float, long, types.NoneType)): self._x = value
[ "def", "X", "(", "self", ",", "value", ")", ":", "if", "isinstance", "(", "value", ",", "(", "int", ",", "float", ",", "long", ",", "types", ".", "NoneType", ")", ")", ":", "self", ".", "_x", "=", "value" ]
sets the X coordinate
[ "sets", "the", "X", "coordinate" ]
ab240fde2b0200f61d4a5f6df033516e53f2f416
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/common/geometry.py#L166-L170
13,007
Esri/ArcREST
src/arcrest/common/geometry.py
Point.Y
def Y(self, value): """ sets the Y coordinate """ if isinstance(value, (int, float, long, types.NoneType)): self._y = value
python
def Y(self, value): """ sets the Y coordinate """ if isinstance(value, (int, float, long, types.NoneType)): self._y = value
[ "def", "Y", "(", "self", ",", "value", ")", ":", "if", "isinstance", "(", "value", ",", "(", "int", ",", "float", ",", "long", ",", "types", ".", "NoneType", ")", ")", ":", "self", ".", "_y", "=", "value" ]
sets the Y coordinate
[ "sets", "the", "Y", "coordinate" ]
ab240fde2b0200f61d4a5f6df033516e53f2f416
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/common/geometry.py#L178-L182
13,008
Esri/ArcREST
src/arcrest/common/geometry.py
Point.Z
def Z(self, value): """ sets the Z coordinate """ if isinstance(value, (int, float, long, types.NoneType)): self._z = value
python
def Z(self, value): """ sets the Z coordinate """ if isinstance(value, (int, float, long, types.NoneType)): self._z = value
[ "def", "Z", "(", "self", ",", "value", ")", ":", "if", "isinstance", "(", "value", ",", "(", "int", ",", "float", ",", "long", ",", "types", ".", "NoneType", ")", ")", ":", "self", ".", "_z", "=", "value" ]
sets the Z coordinate
[ "sets", "the", "Z", "coordinate" ]
ab240fde2b0200f61d4a5f6df033516e53f2f416
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/common/geometry.py#L190-L194
13,009
Esri/ArcREST
src/arcrest/common/geometry.py
Point.wkid
def wkid(self, value): """ sets the wkid """ if isinstance(value, (int, long)): self._wkid = value
python
def wkid(self, value): """ sets the wkid """ if isinstance(value, (int, long)): self._wkid = value
[ "def", "wkid", "(", "self", ",", "value", ")", ":", "if", "isinstance", "(", "value", ",", "(", "int", ",", "long", ")", ")", ":", "self", ".", "_wkid", "=", "value" ]
sets the wkid
[ "sets", "the", "wkid" ]
ab240fde2b0200f61d4a5f6df033516e53f2f416
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/common/geometry.py#L202-L206
13,010
Esri/ArcREST
src/arcrest/common/geometry.py
Envelope.asDictionary
def asDictionary(self): """ returns the envelope as a dictionary """ template = { "xmin" : self._xmin, "ymin" : self._ymin, "xmax" : self._xmax, "ymax" : self._ymax, "spatialReference" : self.spatialReference } if self._zmax is not None and \ self._zmin is not None: template['zmin'] = self._zmin template['zmax'] = self._zmax if self._mmin is not None and \ self._mmax is not None: template['mmax'] = self._mmax template['mmin'] = self._mmin return template
python
def asDictionary(self): """ returns the envelope as a dictionary """ template = { "xmin" : self._xmin, "ymin" : self._ymin, "xmax" : self._xmax, "ymax" : self._ymax, "spatialReference" : self.spatialReference } if self._zmax is not None and \ self._zmin is not None: template['zmin'] = self._zmin template['zmax'] = self._zmax if self._mmin is not None and \ self._mmax is not None: template['mmax'] = self._mmax template['mmin'] = self._mmin return template
[ "def", "asDictionary", "(", "self", ")", ":", "template", "=", "{", "\"xmin\"", ":", "self", ".", "_xmin", ",", "\"ymin\"", ":", "self", ".", "_ymin", ",", "\"xmax\"", ":", "self", ".", "_xmax", ",", "\"ymax\"", ":", "self", ".", "_ymax", ",", "\"spatialReference\"", ":", "self", ".", "spatialReference", "}", "if", "self", ".", "_zmax", "is", "not", "None", "and", "self", ".", "_zmin", "is", "not", "None", ":", "template", "[", "'zmin'", "]", "=", "self", ".", "_zmin", "template", "[", "'zmax'", "]", "=", "self", ".", "_zmax", "if", "self", ".", "_mmin", "is", "not", "None", "and", "self", ".", "_mmax", "is", "not", "None", ":", "template", "[", "'mmax'", "]", "=", "self", ".", "_mmax", "template", "[", "'mmin'", "]", "=", "self", ".", "_mmin", "return", "template" ]
returns the envelope as a dictionary
[ "returns", "the", "envelope", "as", "a", "dictionary" ]
ab240fde2b0200f61d4a5f6df033516e53f2f416
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/common/geometry.py#L563-L582
13,011
Esri/ArcREST
src/arcrest/common/geometry.py
Envelope.asArcPyObject
def asArcPyObject(self): """ returns the Envelope as an ESRI arcpy.Polygon object """ env = self.asDictionary ring = [[ Point(env['xmin'], env['ymin'], self._wkid), Point(env['xmax'], env['ymin'], self._wkid), Point(env['xmax'], env['ymax'], self._wkid), Point(env['xmin'], env['ymax'], self._wkid) ]] return Polygon(rings=ring, wkid=self._wkid, wkt=self._wkid, hasZ=False, hasM=False).asArcPyObject
python
def asArcPyObject(self): """ returns the Envelope as an ESRI arcpy.Polygon object """ env = self.asDictionary ring = [[ Point(env['xmin'], env['ymin'], self._wkid), Point(env['xmax'], env['ymin'], self._wkid), Point(env['xmax'], env['ymax'], self._wkid), Point(env['xmin'], env['ymax'], self._wkid) ]] return Polygon(rings=ring, wkid=self._wkid, wkt=self._wkid, hasZ=False, hasM=False).asArcPyObject
[ "def", "asArcPyObject", "(", "self", ")", ":", "env", "=", "self", ".", "asDictionary", "ring", "=", "[", "[", "Point", "(", "env", "[", "'xmin'", "]", ",", "env", "[", "'ymin'", "]", ",", "self", ".", "_wkid", ")", ",", "Point", "(", "env", "[", "'xmax'", "]", ",", "env", "[", "'ymin'", "]", ",", "self", ".", "_wkid", ")", ",", "Point", "(", "env", "[", "'xmax'", "]", ",", "env", "[", "'ymax'", "]", ",", "self", ".", "_wkid", ")", ",", "Point", "(", "env", "[", "'xmin'", "]", ",", "env", "[", "'ymax'", "]", ",", "self", ".", "_wkid", ")", "]", "]", "return", "Polygon", "(", "rings", "=", "ring", ",", "wkid", "=", "self", ".", "_wkid", ",", "wkt", "=", "self", ".", "_wkid", ",", "hasZ", "=", "False", ",", "hasM", "=", "False", ")", ".", "asArcPyObject" ]
returns the Envelope as an ESRI arcpy.Polygon object
[ "returns", "the", "Envelope", "as", "an", "ESRI", "arcpy", ".", "Polygon", "object" ]
ab240fde2b0200f61d4a5f6df033516e53f2f416
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/common/geometry.py#L621-L634
13,012
Esri/ArcREST
src/arcrest/opendata/_web.py
WebOperations._process_response
def _process_response(self, resp, out_folder=None): """ processes the response object""" CHUNK = 4056 maintype = self._mainType(resp) contentDisposition = resp.headers.get('content-disposition') contentEncoding = resp.headers.get('content-encoding') contentType = resp.headers.get('content-type') contentLength = resp.headers.get('content-length') if maintype.lower() in ('image', 'application/x-zip-compressed') or \ contentType == 'application/x-zip-compressed' or \ (contentDisposition is not None and \ contentDisposition.lower().find('attachment;') > -1): fname = self._get_file_name( contentDisposition=contentDisposition, url=resp.geturl()) if out_folder is None: out_folder = tempfile.gettempdir() if contentLength is not None: max_length = int(contentLength) if max_length < CHUNK: CHUNK = max_length file_name = os.path.join(out_folder, fname) with open(file_name, 'wb') as writer: for data in self._chunk(response=resp): writer.write(data) del data del writer return file_name else: read = "" for data in self._chunk(response=resp, size=4096): if self.PY3 == True: read += data.decode('utf-8') else: read += data del data try: return json.loads(read.strip()) except: return read return None
python
def _process_response(self, resp, out_folder=None): """ processes the response object""" CHUNK = 4056 maintype = self._mainType(resp) contentDisposition = resp.headers.get('content-disposition') contentEncoding = resp.headers.get('content-encoding') contentType = resp.headers.get('content-type') contentLength = resp.headers.get('content-length') if maintype.lower() in ('image', 'application/x-zip-compressed') or \ contentType == 'application/x-zip-compressed' or \ (contentDisposition is not None and \ contentDisposition.lower().find('attachment;') > -1): fname = self._get_file_name( contentDisposition=contentDisposition, url=resp.geturl()) if out_folder is None: out_folder = tempfile.gettempdir() if contentLength is not None: max_length = int(contentLength) if max_length < CHUNK: CHUNK = max_length file_name = os.path.join(out_folder, fname) with open(file_name, 'wb') as writer: for data in self._chunk(response=resp): writer.write(data) del data del writer return file_name else: read = "" for data in self._chunk(response=resp, size=4096): if self.PY3 == True: read += data.decode('utf-8') else: read += data del data try: return json.loads(read.strip()) except: return read return None
[ "def", "_process_response", "(", "self", ",", "resp", ",", "out_folder", "=", "None", ")", ":", "CHUNK", "=", "4056", "maintype", "=", "self", ".", "_mainType", "(", "resp", ")", "contentDisposition", "=", "resp", ".", "headers", ".", "get", "(", "'content-disposition'", ")", "contentEncoding", "=", "resp", ".", "headers", ".", "get", "(", "'content-encoding'", ")", "contentType", "=", "resp", ".", "headers", ".", "get", "(", "'content-type'", ")", "contentLength", "=", "resp", ".", "headers", ".", "get", "(", "'content-length'", ")", "if", "maintype", ".", "lower", "(", ")", "in", "(", "'image'", ",", "'application/x-zip-compressed'", ")", "or", "contentType", "==", "'application/x-zip-compressed'", "or", "(", "contentDisposition", "is", "not", "None", "and", "contentDisposition", ".", "lower", "(", ")", ".", "find", "(", "'attachment;'", ")", ">", "-", "1", ")", ":", "fname", "=", "self", ".", "_get_file_name", "(", "contentDisposition", "=", "contentDisposition", ",", "url", "=", "resp", ".", "geturl", "(", ")", ")", "if", "out_folder", "is", "None", ":", "out_folder", "=", "tempfile", ".", "gettempdir", "(", ")", "if", "contentLength", "is", "not", "None", ":", "max_length", "=", "int", "(", "contentLength", ")", "if", "max_length", "<", "CHUNK", ":", "CHUNK", "=", "max_length", "file_name", "=", "os", ".", "path", ".", "join", "(", "out_folder", ",", "fname", ")", "with", "open", "(", "file_name", ",", "'wb'", ")", "as", "writer", ":", "for", "data", "in", "self", ".", "_chunk", "(", "response", "=", "resp", ")", ":", "writer", ".", "write", "(", "data", ")", "del", "data", "del", "writer", "return", "file_name", "else", ":", "read", "=", "\"\"", "for", "data", "in", "self", ".", "_chunk", "(", "response", "=", "resp", ",", "size", "=", "4096", ")", ":", "if", "self", ".", "PY3", "==", "True", ":", "read", "+=", "data", ".", "decode", "(", "'utf-8'", ")", "else", ":", "read", "+=", "data", "del", "data", "try", ":", "return", "json", ".", "loads", "(", "read", ".", "strip", "(", ")", ")", "except", ":", "return", "read", "return", "None" ]
processes the response object
[ "processes", "the", "response", "object" ]
ab240fde2b0200f61d4a5f6df033516e53f2f416
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/opendata/_web.py#L238-L279
13,013
Esri/ArcREST
src/arcrest/manageags/_security.py
Security.addUsersToRole
def addUsersToRole(self, rolename, users): """ Assigns a role to multiple users """ params = { "f" : "json", "rolename" : rolename, "users" : users } rURL = self._url + "/roles/addUsersToRole" return self._post(url=rURL, param_dict=params, securityHandler=self._securityHandler, proxy_url=self._proxy_url, proxy_port=self._proxy_port)
python
def addUsersToRole(self, rolename, users): """ Assigns a role to multiple users """ params = { "f" : "json", "rolename" : rolename, "users" : users } rURL = self._url + "/roles/addUsersToRole" return self._post(url=rURL, param_dict=params, securityHandler=self._securityHandler, proxy_url=self._proxy_url, proxy_port=self._proxy_port)
[ "def", "addUsersToRole", "(", "self", ",", "rolename", ",", "users", ")", ":", "params", "=", "{", "\"f\"", ":", "\"json\"", ",", "\"rolename\"", ":", "rolename", ",", "\"users\"", ":", "users", "}", "rURL", "=", "self", ".", "_url", "+", "\"/roles/addUsersToRole\"", "return", "self", ".", "_post", "(", "url", "=", "rURL", ",", "param_dict", "=", "params", ",", "securityHandler", "=", "self", ".", "_securityHandler", ",", "proxy_url", "=", "self", ".", "_proxy_url", ",", "proxy_port", "=", "self", ".", "_proxy_port", ")" ]
Assigns a role to multiple users
[ "Assigns", "a", "role", "to", "multiple", "users" ]
ab240fde2b0200f61d4a5f6df033516e53f2f416
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageags/_security.py#L156-L167
13,014
Esri/ArcREST
src/arcrest/manageags/_system.py
System.serverProperties
def serverProperties(self): """gets the server properties for the site as an object""" return ServerProperties(url=self._url + "/properties", securityHandler=self._securityHandler, proxy_url=self._proxy_url, proxy_port=self._proxy_port, initialize=True)
python
def serverProperties(self): """gets the server properties for the site as an object""" return ServerProperties(url=self._url + "/properties", securityHandler=self._securityHandler, proxy_url=self._proxy_url, proxy_port=self._proxy_port, initialize=True)
[ "def", "serverProperties", "(", "self", ")", ":", "return", "ServerProperties", "(", "url", "=", "self", ".", "_url", "+", "\"/properties\"", ",", "securityHandler", "=", "self", ".", "_securityHandler", ",", "proxy_url", "=", "self", ".", "_proxy_url", ",", "proxy_port", "=", "self", ".", "_proxy_port", ",", "initialize", "=", "True", ")" ]
gets the server properties for the site as an object
[ "gets", "the", "server", "properties", "for", "the", "site", "as", "an", "object" ]
ab240fde2b0200f61d4a5f6df033516e53f2f416
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageags/_system.py#L69-L75
13,015
Esri/ArcREST
src/arcrest/manageags/_system.py
System.serverDirectories
def serverDirectories(self): """returns the server directory object in a list""" directs = [] url = self._url + "/directories" params = { "f" : "json" } res = self._get(url=url, param_dict=params, securityHandler=self._securityHandler, proxy_url=self._proxy_url, proxy_port=self._proxy_port) for direct in res['directories']: directs.append( ServerDirectory(url=url + "/%s" % direct["name"], securityHandler=self._securityHandler, proxy_url=self._proxy_url, proxy_port=self._proxy_port, initialize=True)) return directs
python
def serverDirectories(self): """returns the server directory object in a list""" directs = [] url = self._url + "/directories" params = { "f" : "json" } res = self._get(url=url, param_dict=params, securityHandler=self._securityHandler, proxy_url=self._proxy_url, proxy_port=self._proxy_port) for direct in res['directories']: directs.append( ServerDirectory(url=url + "/%s" % direct["name"], securityHandler=self._securityHandler, proxy_url=self._proxy_url, proxy_port=self._proxy_port, initialize=True)) return directs
[ "def", "serverDirectories", "(", "self", ")", ":", "directs", "=", "[", "]", "url", "=", "self", ".", "_url", "+", "\"/directories\"", "params", "=", "{", "\"f\"", ":", "\"json\"", "}", "res", "=", "self", ".", "_get", "(", "url", "=", "url", ",", "param_dict", "=", "params", ",", "securityHandler", "=", "self", ".", "_securityHandler", ",", "proxy_url", "=", "self", ".", "_proxy_url", ",", "proxy_port", "=", "self", ".", "_proxy_port", ")", "for", "direct", "in", "res", "[", "'directories'", "]", ":", "directs", ".", "append", "(", "ServerDirectory", "(", "url", "=", "url", "+", "\"/%s\"", "%", "direct", "[", "\"name\"", "]", ",", "securityHandler", "=", "self", ".", "_securityHandler", ",", "proxy_url", "=", "self", ".", "_proxy_url", ",", "proxy_port", "=", "self", ".", "_proxy_port", ",", "initialize", "=", "True", ")", ")", "return", "directs" ]
returns the server directory object in a list
[ "returns", "the", "server", "directory", "object", "in", "a", "list" ]
ab240fde2b0200f61d4a5f6df033516e53f2f416
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageags/_system.py#L78-L97
13,016
Esri/ArcREST
src/arcrest/manageags/_system.py
System.Jobs
def Jobs(self): """get the Jobs object""" url = self._url + "/jobs" return Jobs(url=url, securityHandler=self._securityHandler, proxy_url=self._proxy_url, proxy_port=self._proxy_port, initialize=True)
python
def Jobs(self): """get the Jobs object""" url = self._url + "/jobs" return Jobs(url=url, securityHandler=self._securityHandler, proxy_url=self._proxy_url, proxy_port=self._proxy_port, initialize=True)
[ "def", "Jobs", "(", "self", ")", ":", "url", "=", "self", ".", "_url", "+", "\"/jobs\"", "return", "Jobs", "(", "url", "=", "url", ",", "securityHandler", "=", "self", ".", "_securityHandler", ",", "proxy_url", "=", "self", ".", "_proxy_url", ",", "proxy_port", "=", "self", ".", "_proxy_port", ",", "initialize", "=", "True", ")" ]
get the Jobs object
[ "get", "the", "Jobs", "object" ]
ab240fde2b0200f61d4a5f6df033516e53f2f416
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageags/_system.py#L218-L225
13,017
Esri/ArcREST
src/arcrest/manageags/_system.py
System.configurationStore
def configurationStore(self): """returns the ConfigurationStore object for this site""" url = self._url + "/configstore" return ConfigurationStore(url=url, securityHandler=self._securityHandler, proxy_url=self._proxy_url, proxy_port=self._proxy_port)
python
def configurationStore(self): """returns the ConfigurationStore object for this site""" url = self._url + "/configstore" return ConfigurationStore(url=url, securityHandler=self._securityHandler, proxy_url=self._proxy_url, proxy_port=self._proxy_port)
[ "def", "configurationStore", "(", "self", ")", ":", "url", "=", "self", ".", "_url", "+", "\"/configstore\"", "return", "ConfigurationStore", "(", "url", "=", "url", ",", "securityHandler", "=", "self", ".", "_securityHandler", ",", "proxy_url", "=", "self", ".", "_proxy_url", ",", "proxy_port", "=", "self", ".", "_proxy_port", ")" ]
returns the ConfigurationStore object for this site
[ "returns", "the", "ConfigurationStore", "object", "for", "this", "site" ]
ab240fde2b0200f61d4a5f6df033516e53f2f416
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageags/_system.py#L351-L358
13,018
Esri/ArcREST
src/arcresthelper/featureservicetools.py
featureservicetools.EnableEditingOnService
def EnableEditingOnService(self, url, definition = None): """Enables editing capabilities on a feature service. Args: url (str): The URL of the feature service. definition (dict): A dictionary containing valid definition values. Defaults to ``None``. Returns: dict: The existing feature service definition capabilities. When ``definition`` is not provided (``None``), the following values are used by default: +------------------------------+------------------------------------------+ | Key | Value | +------------------------------+------------------------------------------+ | hasStaticData | ``False`` | +------------------------------+------------------------------------------+ | allowGeometryUpdates | ``True`` | +------------------------------+------------------------------------------+ | enableEditorTracking | ``False`` | +------------------------------+------------------------------------------+ | enableOwnershipAccessControl | ``False`` | +------------------------------+------------------------------------------+ | allowOthersToUpdate | ``True`` | +------------------------------+------------------------------------------+ | allowOthersToDelete | ``True`` | +------------------------------+------------------------------------------+ | capabilities | ``"Query,Editing,Create,Update,Delete"`` | +------------------------------+------------------------------------------+ """ adminFS = AdminFeatureService(url=url, securityHandler=self._securityHandler) if definition is None: definition = collections.OrderedDict() definition['hasStaticData'] = False definition['allowGeometryUpdates'] = True definition['editorTrackingInfo'] = {} definition['editorTrackingInfo']['enableEditorTracking'] = False definition['editorTrackingInfo']['enableOwnershipAccessControl'] = False definition['editorTrackingInfo']['allowOthersToUpdate'] = True definition['editorTrackingInfo']['allowOthersToDelete'] = True definition['capabilities'] = "Query,Editing,Create,Update,Delete" existingDef = {} existingDef['capabilities'] = adminFS.capabilities existingDef['allowGeometryUpdates'] = adminFS.allowGeometryUpdates enableResults = adminFS.updateDefinition(json_dict=definition) if 'error' in enableResults: return enableResults['error'] adminFS = None del adminFS print (enableResults) return existingDef
python
def EnableEditingOnService(self, url, definition = None): """Enables editing capabilities on a feature service. Args: url (str): The URL of the feature service. definition (dict): A dictionary containing valid definition values. Defaults to ``None``. Returns: dict: The existing feature service definition capabilities. When ``definition`` is not provided (``None``), the following values are used by default: +------------------------------+------------------------------------------+ | Key | Value | +------------------------------+------------------------------------------+ | hasStaticData | ``False`` | +------------------------------+------------------------------------------+ | allowGeometryUpdates | ``True`` | +------------------------------+------------------------------------------+ | enableEditorTracking | ``False`` | +------------------------------+------------------------------------------+ | enableOwnershipAccessControl | ``False`` | +------------------------------+------------------------------------------+ | allowOthersToUpdate | ``True`` | +------------------------------+------------------------------------------+ | allowOthersToDelete | ``True`` | +------------------------------+------------------------------------------+ | capabilities | ``"Query,Editing,Create,Update,Delete"`` | +------------------------------+------------------------------------------+ """ adminFS = AdminFeatureService(url=url, securityHandler=self._securityHandler) if definition is None: definition = collections.OrderedDict() definition['hasStaticData'] = False definition['allowGeometryUpdates'] = True definition['editorTrackingInfo'] = {} definition['editorTrackingInfo']['enableEditorTracking'] = False definition['editorTrackingInfo']['enableOwnershipAccessControl'] = False definition['editorTrackingInfo']['allowOthersToUpdate'] = True definition['editorTrackingInfo']['allowOthersToDelete'] = True definition['capabilities'] = "Query,Editing,Create,Update,Delete" existingDef = {} existingDef['capabilities'] = adminFS.capabilities existingDef['allowGeometryUpdates'] = adminFS.allowGeometryUpdates enableResults = adminFS.updateDefinition(json_dict=definition) if 'error' in enableResults: return enableResults['error'] adminFS = None del adminFS print (enableResults) return existingDef
[ "def", "EnableEditingOnService", "(", "self", ",", "url", ",", "definition", "=", "None", ")", ":", "adminFS", "=", "AdminFeatureService", "(", "url", "=", "url", ",", "securityHandler", "=", "self", ".", "_securityHandler", ")", "if", "definition", "is", "None", ":", "definition", "=", "collections", ".", "OrderedDict", "(", ")", "definition", "[", "'hasStaticData'", "]", "=", "False", "definition", "[", "'allowGeometryUpdates'", "]", "=", "True", "definition", "[", "'editorTrackingInfo'", "]", "=", "{", "}", "definition", "[", "'editorTrackingInfo'", "]", "[", "'enableEditorTracking'", "]", "=", "False", "definition", "[", "'editorTrackingInfo'", "]", "[", "'enableOwnershipAccessControl'", "]", "=", "False", "definition", "[", "'editorTrackingInfo'", "]", "[", "'allowOthersToUpdate'", "]", "=", "True", "definition", "[", "'editorTrackingInfo'", "]", "[", "'allowOthersToDelete'", "]", "=", "True", "definition", "[", "'capabilities'", "]", "=", "\"Query,Editing,Create,Update,Delete\"", "existingDef", "=", "{", "}", "existingDef", "[", "'capabilities'", "]", "=", "adminFS", ".", "capabilities", "existingDef", "[", "'allowGeometryUpdates'", "]", "=", "adminFS", ".", "allowGeometryUpdates", "enableResults", "=", "adminFS", ".", "updateDefinition", "(", "json_dict", "=", "definition", ")", "if", "'error'", "in", "enableResults", ":", "return", "enableResults", "[", "'error'", "]", "adminFS", "=", "None", "del", "adminFS", "print", "(", "enableResults", ")", "return", "existingDef" ]
Enables editing capabilities on a feature service. Args: url (str): The URL of the feature service. definition (dict): A dictionary containing valid definition values. Defaults to ``None``. Returns: dict: The existing feature service definition capabilities. When ``definition`` is not provided (``None``), the following values are used by default: +------------------------------+------------------------------------------+ | Key | Value | +------------------------------+------------------------------------------+ | hasStaticData | ``False`` | +------------------------------+------------------------------------------+ | allowGeometryUpdates | ``True`` | +------------------------------+------------------------------------------+ | enableEditorTracking | ``False`` | +------------------------------+------------------------------------------+ | enableOwnershipAccessControl | ``False`` | +------------------------------+------------------------------------------+ | allowOthersToUpdate | ``True`` | +------------------------------+------------------------------------------+ | allowOthersToDelete | ``True`` | +------------------------------+------------------------------------------+ | capabilities | ``"Query,Editing,Create,Update,Delete"`` | +------------------------------+------------------------------------------+
[ "Enables", "editing", "capabilities", "on", "a", "feature", "service", "." ]
ab240fde2b0200f61d4a5f6df033516e53f2f416
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcresthelper/featureservicetools.py#L197-L252
13,019
Esri/ArcREST
src/arcresthelper/featureservicetools.py
featureservicetools.enableSync
def enableSync(self, url, definition = None): """Enables Sync capability for an AGOL feature service. Args: url (str): The URL of the feature service. definition (dict): A dictionary containing valid definition values. Defaults to ``None``. Returns: dict: The result from :py:func:`arcrest.hostedservice.service.AdminFeatureService.updateDefinition`. """ adminFS = AdminFeatureService(url=url, securityHandler=self._securityHandler) cap = str(adminFS.capabilities) existingDef = {} enableResults = 'skipped' if 'Sync' in cap: return "Sync is already enabled" else: capItems = cap.split(',') capItems.append('Sync') existingDef['capabilities'] = ','.join(capItems) enableResults = adminFS.updateDefinition(json_dict=existingDef) if 'error' in enableResults: return enableResults['error'] adminFS = None del adminFS return enableResults
python
def enableSync(self, url, definition = None): """Enables Sync capability for an AGOL feature service. Args: url (str): The URL of the feature service. definition (dict): A dictionary containing valid definition values. Defaults to ``None``. Returns: dict: The result from :py:func:`arcrest.hostedservice.service.AdminFeatureService.updateDefinition`. """ adminFS = AdminFeatureService(url=url, securityHandler=self._securityHandler) cap = str(adminFS.capabilities) existingDef = {} enableResults = 'skipped' if 'Sync' in cap: return "Sync is already enabled" else: capItems = cap.split(',') capItems.append('Sync') existingDef['capabilities'] = ','.join(capItems) enableResults = adminFS.updateDefinition(json_dict=existingDef) if 'error' in enableResults: return enableResults['error'] adminFS = None del adminFS return enableResults
[ "def", "enableSync", "(", "self", ",", "url", ",", "definition", "=", "None", ")", ":", "adminFS", "=", "AdminFeatureService", "(", "url", "=", "url", ",", "securityHandler", "=", "self", ".", "_securityHandler", ")", "cap", "=", "str", "(", "adminFS", ".", "capabilities", ")", "existingDef", "=", "{", "}", "enableResults", "=", "'skipped'", "if", "'Sync'", "in", "cap", ":", "return", "\"Sync is already enabled\"", "else", ":", "capItems", "=", "cap", ".", "split", "(", "','", ")", "capItems", ".", "append", "(", "'Sync'", ")", "existingDef", "[", "'capabilities'", "]", "=", "','", ".", "join", "(", "capItems", ")", "enableResults", "=", "adminFS", ".", "updateDefinition", "(", "json_dict", "=", "existingDef", ")", "if", "'error'", "in", "enableResults", ":", "return", "enableResults", "[", "'error'", "]", "adminFS", "=", "None", "del", "adminFS", "return", "enableResults" ]
Enables Sync capability for an AGOL feature service. Args: url (str): The URL of the feature service. definition (dict): A dictionary containing valid definition values. Defaults to ``None``. Returns: dict: The result from :py:func:`arcrest.hostedservice.service.AdminFeatureService.updateDefinition`.
[ "Enables", "Sync", "capability", "for", "an", "AGOL", "feature", "service", "." ]
ab240fde2b0200f61d4a5f6df033516e53f2f416
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcresthelper/featureservicetools.py#L254-L281
13,020
Esri/ArcREST
src/arcresthelper/featureservicetools.py
featureservicetools.GetFeatureService
def GetFeatureService(self, itemId, returnURLOnly=False): """Obtains a feature service by item ID. Args: itemId (str): The feature service's item ID. returnURLOnly (bool): A boolean value to return the URL of the feature service. Defaults to ``False``. Returns: When ``returnURLOnly`` is ``True``, the URL of the feature service is returned. When ``False``, the result from :py:func:`arcrest.agol.services.FeatureService` or :py:func:`arcrest.ags.services.FeatureService`. """ admin = None item = None try: admin = arcrest.manageorg.Administration(securityHandler=self._securityHandler) if self._securityHandler.valid == False: self._valid = self._securityHandler.valid self._message = self._securityHandler.message return None item = admin.content.getItem(itemId=itemId) if item.type == "Feature Service": if returnURLOnly: return item.url else: fs = arcrest.agol.FeatureService( url=item.url, securityHandler=self._securityHandler) if fs.layers is None or len(fs.layers) == 0 : fs = arcrest.ags.FeatureService( url=item.url) return fs return None except: line, filename, synerror = trace() raise common.ArcRestHelperError({ "function": "GetFeatureService", "line": line, "filename": filename, "synerror": synerror, } ) finally: admin = None item = None del item del admin gc.collect()
python
def GetFeatureService(self, itemId, returnURLOnly=False): """Obtains a feature service by item ID. Args: itemId (str): The feature service's item ID. returnURLOnly (bool): A boolean value to return the URL of the feature service. Defaults to ``False``. Returns: When ``returnURLOnly`` is ``True``, the URL of the feature service is returned. When ``False``, the result from :py:func:`arcrest.agol.services.FeatureService` or :py:func:`arcrest.ags.services.FeatureService`. """ admin = None item = None try: admin = arcrest.manageorg.Administration(securityHandler=self._securityHandler) if self._securityHandler.valid == False: self._valid = self._securityHandler.valid self._message = self._securityHandler.message return None item = admin.content.getItem(itemId=itemId) if item.type == "Feature Service": if returnURLOnly: return item.url else: fs = arcrest.agol.FeatureService( url=item.url, securityHandler=self._securityHandler) if fs.layers is None or len(fs.layers) == 0 : fs = arcrest.ags.FeatureService( url=item.url) return fs return None except: line, filename, synerror = trace() raise common.ArcRestHelperError({ "function": "GetFeatureService", "line": line, "filename": filename, "synerror": synerror, } ) finally: admin = None item = None del item del admin gc.collect()
[ "def", "GetFeatureService", "(", "self", ",", "itemId", ",", "returnURLOnly", "=", "False", ")", ":", "admin", "=", "None", "item", "=", "None", "try", ":", "admin", "=", "arcrest", ".", "manageorg", ".", "Administration", "(", "securityHandler", "=", "self", ".", "_securityHandler", ")", "if", "self", ".", "_securityHandler", ".", "valid", "==", "False", ":", "self", ".", "_valid", "=", "self", ".", "_securityHandler", ".", "valid", "self", ".", "_message", "=", "self", ".", "_securityHandler", ".", "message", "return", "None", "item", "=", "admin", ".", "content", ".", "getItem", "(", "itemId", "=", "itemId", ")", "if", "item", ".", "type", "==", "\"Feature Service\"", ":", "if", "returnURLOnly", ":", "return", "item", ".", "url", "else", ":", "fs", "=", "arcrest", ".", "agol", ".", "FeatureService", "(", "url", "=", "item", ".", "url", ",", "securityHandler", "=", "self", ".", "_securityHandler", ")", "if", "fs", ".", "layers", "is", "None", "or", "len", "(", "fs", ".", "layers", ")", "==", "0", ":", "fs", "=", "arcrest", ".", "ags", ".", "FeatureService", "(", "url", "=", "item", ".", "url", ")", "return", "fs", "return", "None", "except", ":", "line", ",", "filename", ",", "synerror", "=", "trace", "(", ")", "raise", "common", ".", "ArcRestHelperError", "(", "{", "\"function\"", ":", "\"GetFeatureService\"", ",", "\"line\"", ":", "line", ",", "\"filename\"", ":", "filename", ",", "\"synerror\"", ":", "synerror", ",", "}", ")", "finally", ":", "admin", "=", "None", "item", "=", "None", "del", "item", "del", "admin", "gc", ".", "collect", "(", ")" ]
Obtains a feature service by item ID. Args: itemId (str): The feature service's item ID. returnURLOnly (bool): A boolean value to return the URL of the feature service. Defaults to ``False``. Returns: When ``returnURLOnly`` is ``True``, the URL of the feature service is returned. When ``False``, the result from :py:func:`arcrest.agol.services.FeatureService` or :py:func:`arcrest.ags.services.FeatureService`.
[ "Obtains", "a", "feature", "service", "by", "item", "ID", "." ]
ab240fde2b0200f61d4a5f6df033516e53f2f416
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcresthelper/featureservicetools.py#L313-L362
13,021
Esri/ArcREST
src/arcresthelper/featureservicetools.py
featureservicetools.GetLayerFromFeatureServiceByURL
def GetLayerFromFeatureServiceByURL(self, url, layerName="", returnURLOnly=False): """Obtains a layer from a feature service by URL reference. Args: url (str): The URL of the feature service. layerName (str): The name of the layer. Defaults to ``""``. returnURLOnly (bool): A boolean value to return the URL of the layer. Defaults to ``False``. Returns: When ``returnURLOnly`` is ``True``, the URL of the layer is returned. When ``False``, the result from :py:func:`arcrest.agol.services.FeatureService` or :py:func:`arcrest.ags.services.FeatureService`. """ fs = None try: fs = arcrest.agol.FeatureService( url=url, securityHandler=self._securityHandler) return self.GetLayerFromFeatureService(fs=fs,layerName=layerName,returnURLOnly=returnURLOnly) except: line, filename, synerror = trace() raise common.ArcRestHelperError({ "function": "GetLayerFromFeatureServiceByURL", "line": line, "filename": filename, "synerror": synerror, } ) finally: fs = None del fs gc.collect()
python
def GetLayerFromFeatureServiceByURL(self, url, layerName="", returnURLOnly=False): """Obtains a layer from a feature service by URL reference. Args: url (str): The URL of the feature service. layerName (str): The name of the layer. Defaults to ``""``. returnURLOnly (bool): A boolean value to return the URL of the layer. Defaults to ``False``. Returns: When ``returnURLOnly`` is ``True``, the URL of the layer is returned. When ``False``, the result from :py:func:`arcrest.agol.services.FeatureService` or :py:func:`arcrest.ags.services.FeatureService`. """ fs = None try: fs = arcrest.agol.FeatureService( url=url, securityHandler=self._securityHandler) return self.GetLayerFromFeatureService(fs=fs,layerName=layerName,returnURLOnly=returnURLOnly) except: line, filename, synerror = trace() raise common.ArcRestHelperError({ "function": "GetLayerFromFeatureServiceByURL", "line": line, "filename": filename, "synerror": synerror, } ) finally: fs = None del fs gc.collect()
[ "def", "GetLayerFromFeatureServiceByURL", "(", "self", ",", "url", ",", "layerName", "=", "\"\"", ",", "returnURLOnly", "=", "False", ")", ":", "fs", "=", "None", "try", ":", "fs", "=", "arcrest", ".", "agol", ".", "FeatureService", "(", "url", "=", "url", ",", "securityHandler", "=", "self", ".", "_securityHandler", ")", "return", "self", ".", "GetLayerFromFeatureService", "(", "fs", "=", "fs", ",", "layerName", "=", "layerName", ",", "returnURLOnly", "=", "returnURLOnly", ")", "except", ":", "line", ",", "filename", ",", "synerror", "=", "trace", "(", ")", "raise", "common", ".", "ArcRestHelperError", "(", "{", "\"function\"", ":", "\"GetLayerFromFeatureServiceByURL\"", ",", "\"line\"", ":", "line", ",", "\"filename\"", ":", "filename", ",", "\"synerror\"", ":", "synerror", ",", "}", ")", "finally", ":", "fs", "=", "None", "del", "fs", "gc", ".", "collect", "(", ")" ]
Obtains a layer from a feature service by URL reference. Args: url (str): The URL of the feature service. layerName (str): The name of the layer. Defaults to ``""``. returnURLOnly (bool): A boolean value to return the URL of the layer. Defaults to ``False``. Returns: When ``returnURLOnly`` is ``True``, the URL of the layer is returned. When ``False``, the result from :py:func:`arcrest.agol.services.FeatureService` or :py:func:`arcrest.ags.services.FeatureService`.
[ "Obtains", "a", "layer", "from", "a", "feature", "service", "by", "URL", "reference", "." ]
ab240fde2b0200f61d4a5f6df033516e53f2f416
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcresthelper/featureservicetools.py#L364-L397
13,022
Esri/ArcREST
src/arcresthelper/featureservicetools.py
featureservicetools.GetLayerFromFeatureService
def GetLayerFromFeatureService(self, fs, layerName="", returnURLOnly=False): """Obtains a layer from a feature service by feature service reference. Args: fs (FeatureService): The feature service from which to obtain the layer. layerName (str): The name of the layer. Defaults to ``""``. returnURLOnly (bool): A boolean value to return the URL of the layer. Defaults to ``False``. Returns: When ``returnURLOnly`` is ``True``, the URL of the layer is returned. When ``False``, the result from :py:func:`arcrest.agol.services.FeatureService` or :py:func:`arcrest.ags.services.FeatureService`. """ layers = None table = None layer = None sublayer = None try: layers = fs.layers if (layers is None or len(layers) == 0) and fs.url is not None: fs = arcrest.ags.FeatureService( url=fs.url) layers = fs.layers if layers is not None: for layer in layers: if layer.name == layerName: if returnURLOnly: return fs.url + '/' + str(layer.id) else: return layer elif not layer.subLayers is None: for sublayer in layer.subLayers: if sublayer == layerName: return sublayer if fs.tables is not None: for table in fs.tables: if table.name == layerName: if returnURLOnly: return fs.url + '/' + str(layer.id) else: return table return None except: line, filename, synerror = trace() raise common.ArcRestHelperError({ "function": "GetLayerFromFeatureService", "line": line, "filename": filename, "synerror": synerror, } ) finally: layers = None table = None layer = None sublayer = None del layers del table del layer del sublayer gc.collect()
python
def GetLayerFromFeatureService(self, fs, layerName="", returnURLOnly=False): """Obtains a layer from a feature service by feature service reference. Args: fs (FeatureService): The feature service from which to obtain the layer. layerName (str): The name of the layer. Defaults to ``""``. returnURLOnly (bool): A boolean value to return the URL of the layer. Defaults to ``False``. Returns: When ``returnURLOnly`` is ``True``, the URL of the layer is returned. When ``False``, the result from :py:func:`arcrest.agol.services.FeatureService` or :py:func:`arcrest.ags.services.FeatureService`. """ layers = None table = None layer = None sublayer = None try: layers = fs.layers if (layers is None or len(layers) == 0) and fs.url is not None: fs = arcrest.ags.FeatureService( url=fs.url) layers = fs.layers if layers is not None: for layer in layers: if layer.name == layerName: if returnURLOnly: return fs.url + '/' + str(layer.id) else: return layer elif not layer.subLayers is None: for sublayer in layer.subLayers: if sublayer == layerName: return sublayer if fs.tables is not None: for table in fs.tables: if table.name == layerName: if returnURLOnly: return fs.url + '/' + str(layer.id) else: return table return None except: line, filename, synerror = trace() raise common.ArcRestHelperError({ "function": "GetLayerFromFeatureService", "line": line, "filename": filename, "synerror": synerror, } ) finally: layers = None table = None layer = None sublayer = None del layers del table del layer del sublayer gc.collect()
[ "def", "GetLayerFromFeatureService", "(", "self", ",", "fs", ",", "layerName", "=", "\"\"", ",", "returnURLOnly", "=", "False", ")", ":", "layers", "=", "None", "table", "=", "None", "layer", "=", "None", "sublayer", "=", "None", "try", ":", "layers", "=", "fs", ".", "layers", "if", "(", "layers", "is", "None", "or", "len", "(", "layers", ")", "==", "0", ")", "and", "fs", ".", "url", "is", "not", "None", ":", "fs", "=", "arcrest", ".", "ags", ".", "FeatureService", "(", "url", "=", "fs", ".", "url", ")", "layers", "=", "fs", ".", "layers", "if", "layers", "is", "not", "None", ":", "for", "layer", "in", "layers", ":", "if", "layer", ".", "name", "==", "layerName", ":", "if", "returnURLOnly", ":", "return", "fs", ".", "url", "+", "'/'", "+", "str", "(", "layer", ".", "id", ")", "else", ":", "return", "layer", "elif", "not", "layer", ".", "subLayers", "is", "None", ":", "for", "sublayer", "in", "layer", ".", "subLayers", ":", "if", "sublayer", "==", "layerName", ":", "return", "sublayer", "if", "fs", ".", "tables", "is", "not", "None", ":", "for", "table", "in", "fs", ".", "tables", ":", "if", "table", ".", "name", "==", "layerName", ":", "if", "returnURLOnly", ":", "return", "fs", ".", "url", "+", "'/'", "+", "str", "(", "layer", ".", "id", ")", "else", ":", "return", "table", "return", "None", "except", ":", "line", ",", "filename", ",", "synerror", "=", "trace", "(", ")", "raise", "common", ".", "ArcRestHelperError", "(", "{", "\"function\"", ":", "\"GetLayerFromFeatureService\"", ",", "\"line\"", ":", "line", ",", "\"filename\"", ":", "filename", ",", "\"synerror\"", ":", "synerror", ",", "}", ")", "finally", ":", "layers", "=", "None", "table", "=", "None", "layer", "=", "None", "sublayer", "=", "None", "del", "layers", "del", "table", "del", "layer", "del", "sublayer", "gc", ".", "collect", "(", ")" ]
Obtains a layer from a feature service by feature service reference. Args: fs (FeatureService): The feature service from which to obtain the layer. layerName (str): The name of the layer. Defaults to ``""``. returnURLOnly (bool): A boolean value to return the URL of the layer. Defaults to ``False``. Returns: When ``returnURLOnly`` is ``True``, the URL of the layer is returned. When ``False``, the result from :py:func:`arcrest.agol.services.FeatureService` or :py:func:`arcrest.ags.services.FeatureService`.
[ "Obtains", "a", "layer", "from", "a", "feature", "service", "by", "feature", "service", "reference", "." ]
ab240fde2b0200f61d4a5f6df033516e53f2f416
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcresthelper/featureservicetools.py#L399-L461
13,023
Esri/ArcREST
src/arcresthelper/featureservicetools.py
featureservicetools.DeleteFeaturesFromFeatureLayer
def DeleteFeaturesFromFeatureLayer(self, url, sql, chunksize=0): """Removes features from a hosted feature service layer by SQL query. Args: url (str): The URL of the feature service layer. sql (str): The SQL query to apply against the feature service. Those features that satisfy the query will be deleted. chunksize (int): The maximum amount of features to remove at a time. Defaults to 0. Returns: The result from :py:func:`arcrest.agol.services.FeatureLayer.deleteFeatures`. Notes: If you want to delete all features, it is suggested to use the SQL query ``"1=1"``. """ fl = None try: fl = FeatureLayer( url=url, securityHandler=self._securityHandler) totalDeleted = 0 if chunksize > 0: qRes = fl.query(where=sql, returnIDsOnly=True) if 'error' in qRes: print (qRes) return qRes elif 'objectIds' in qRes: oids = qRes['objectIds'] total = len(oids) if total == 0: return {'success':True,'message': "No features matched the query"} i = 0 print ("%s features to be deleted" % total) while(i <= len(oids)): oidsDelete = ','.join(str(e) for e in oids[i:i+chunksize]) if oidsDelete == '': continue else: results = fl.deleteFeatures(objectIds=oidsDelete) if 'deleteResults' in results: totalDeleted += len(results['deleteResults']) print ("%s%% Completed: %s/%s " % (int(totalDeleted / float(total) *100), totalDeleted, total)) i += chunksize else: print (results) return {'success':True,'message': "%s deleted" % totalDeleted} qRes = fl.query(where=sql, returnIDsOnly=True) if 'objectIds' in qRes: oids = qRes['objectIds'] if len(oids)> 0 : print ("%s features to be deleted" % len(oids)) results = fl.deleteFeatures(where=sql) if 'deleteResults' in results: totalDeleted += len(results['deleteResults']) return {'success':True,'message': "%s deleted" % totalDeleted} else: return results return {'success':True,'message': "%s deleted" % totalDeleted} else: print (qRes) else: results = fl.deleteFeatures(where=sql) if results is not None: if 'deleteResults' in results: return {'success':True,'message': totalDeleted + len(results['deleteResults'])} else: return results except: line, filename, synerror = trace() raise common.ArcRestHelperError({ "function": "DeleteFeaturesFromFeatureLayer", "line": line, "filename": filename, "synerror": synerror, } ) finally: fl = None del fl gc.collect()
python
def DeleteFeaturesFromFeatureLayer(self, url, sql, chunksize=0): """Removes features from a hosted feature service layer by SQL query. Args: url (str): The URL of the feature service layer. sql (str): The SQL query to apply against the feature service. Those features that satisfy the query will be deleted. chunksize (int): The maximum amount of features to remove at a time. Defaults to 0. Returns: The result from :py:func:`arcrest.agol.services.FeatureLayer.deleteFeatures`. Notes: If you want to delete all features, it is suggested to use the SQL query ``"1=1"``. """ fl = None try: fl = FeatureLayer( url=url, securityHandler=self._securityHandler) totalDeleted = 0 if chunksize > 0: qRes = fl.query(where=sql, returnIDsOnly=True) if 'error' in qRes: print (qRes) return qRes elif 'objectIds' in qRes: oids = qRes['objectIds'] total = len(oids) if total == 0: return {'success':True,'message': "No features matched the query"} i = 0 print ("%s features to be deleted" % total) while(i <= len(oids)): oidsDelete = ','.join(str(e) for e in oids[i:i+chunksize]) if oidsDelete == '': continue else: results = fl.deleteFeatures(objectIds=oidsDelete) if 'deleteResults' in results: totalDeleted += len(results['deleteResults']) print ("%s%% Completed: %s/%s " % (int(totalDeleted / float(total) *100), totalDeleted, total)) i += chunksize else: print (results) return {'success':True,'message': "%s deleted" % totalDeleted} qRes = fl.query(where=sql, returnIDsOnly=True) if 'objectIds' in qRes: oids = qRes['objectIds'] if len(oids)> 0 : print ("%s features to be deleted" % len(oids)) results = fl.deleteFeatures(where=sql) if 'deleteResults' in results: totalDeleted += len(results['deleteResults']) return {'success':True,'message': "%s deleted" % totalDeleted} else: return results return {'success':True,'message': "%s deleted" % totalDeleted} else: print (qRes) else: results = fl.deleteFeatures(where=sql) if results is not None: if 'deleteResults' in results: return {'success':True,'message': totalDeleted + len(results['deleteResults'])} else: return results except: line, filename, synerror = trace() raise common.ArcRestHelperError({ "function": "DeleteFeaturesFromFeatureLayer", "line": line, "filename": filename, "synerror": synerror, } ) finally: fl = None del fl gc.collect()
[ "def", "DeleteFeaturesFromFeatureLayer", "(", "self", ",", "url", ",", "sql", ",", "chunksize", "=", "0", ")", ":", "fl", "=", "None", "try", ":", "fl", "=", "FeatureLayer", "(", "url", "=", "url", ",", "securityHandler", "=", "self", ".", "_securityHandler", ")", "totalDeleted", "=", "0", "if", "chunksize", ">", "0", ":", "qRes", "=", "fl", ".", "query", "(", "where", "=", "sql", ",", "returnIDsOnly", "=", "True", ")", "if", "'error'", "in", "qRes", ":", "print", "(", "qRes", ")", "return", "qRes", "elif", "'objectIds'", "in", "qRes", ":", "oids", "=", "qRes", "[", "'objectIds'", "]", "total", "=", "len", "(", "oids", ")", "if", "total", "==", "0", ":", "return", "{", "'success'", ":", "True", ",", "'message'", ":", "\"No features matched the query\"", "}", "i", "=", "0", "print", "(", "\"%s features to be deleted\"", "%", "total", ")", "while", "(", "i", "<=", "len", "(", "oids", ")", ")", ":", "oidsDelete", "=", "','", ".", "join", "(", "str", "(", "e", ")", "for", "e", "in", "oids", "[", "i", ":", "i", "+", "chunksize", "]", ")", "if", "oidsDelete", "==", "''", ":", "continue", "else", ":", "results", "=", "fl", ".", "deleteFeatures", "(", "objectIds", "=", "oidsDelete", ")", "if", "'deleteResults'", "in", "results", ":", "totalDeleted", "+=", "len", "(", "results", "[", "'deleteResults'", "]", ")", "print", "(", "\"%s%% Completed: %s/%s \"", "%", "(", "int", "(", "totalDeleted", "/", "float", "(", "total", ")", "*", "100", ")", ",", "totalDeleted", ",", "total", ")", ")", "i", "+=", "chunksize", "else", ":", "print", "(", "results", ")", "return", "{", "'success'", ":", "True", ",", "'message'", ":", "\"%s deleted\"", "%", "totalDeleted", "}", "qRes", "=", "fl", ".", "query", "(", "where", "=", "sql", ",", "returnIDsOnly", "=", "True", ")", "if", "'objectIds'", "in", "qRes", ":", "oids", "=", "qRes", "[", "'objectIds'", "]", "if", "len", "(", "oids", ")", ">", "0", ":", "print", "(", "\"%s features to be deleted\"", "%", "len", "(", "oids", ")", ")", "results", "=", "fl", ".", "deleteFeatures", "(", "where", "=", "sql", ")", "if", "'deleteResults'", "in", "results", ":", "totalDeleted", "+=", "len", "(", "results", "[", "'deleteResults'", "]", ")", "return", "{", "'success'", ":", "True", ",", "'message'", ":", "\"%s deleted\"", "%", "totalDeleted", "}", "else", ":", "return", "results", "return", "{", "'success'", ":", "True", ",", "'message'", ":", "\"%s deleted\"", "%", "totalDeleted", "}", "else", ":", "print", "(", "qRes", ")", "else", ":", "results", "=", "fl", ".", "deleteFeatures", "(", "where", "=", "sql", ")", "if", "results", "is", "not", "None", ":", "if", "'deleteResults'", "in", "results", ":", "return", "{", "'success'", ":", "True", ",", "'message'", ":", "totalDeleted", "+", "len", "(", "results", "[", "'deleteResults'", "]", ")", "}", "else", ":", "return", "results", "except", ":", "line", ",", "filename", ",", "synerror", "=", "trace", "(", ")", "raise", "common", ".", "ArcRestHelperError", "(", "{", "\"function\"", ":", "\"DeleteFeaturesFromFeatureLayer\"", ",", "\"line\"", ":", "line", ",", "\"filename\"", ":", "filename", ",", "\"synerror\"", ":", "synerror", ",", "}", ")", "finally", ":", "fl", "=", "None", "del", "fl", "gc", ".", "collect", "(", ")" ]
Removes features from a hosted feature service layer by SQL query. Args: url (str): The URL of the feature service layer. sql (str): The SQL query to apply against the feature service. Those features that satisfy the query will be deleted. chunksize (int): The maximum amount of features to remove at a time. Defaults to 0. Returns: The result from :py:func:`arcrest.agol.services.FeatureLayer.deleteFeatures`. Notes: If you want to delete all features, it is suggested to use the SQL query ``"1=1"``.
[ "Removes", "features", "from", "a", "hosted", "feature", "service", "layer", "by", "SQL", "query", "." ]
ab240fde2b0200f61d4a5f6df033516e53f2f416
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcresthelper/featureservicetools.py#L570-L648
13,024
Esri/ArcREST
src/arcresthelper/featureservicetools.py
featureservicetools.QueryAllFeatures
def QueryAllFeatures(self, url=None, where="1=1", out_fields="*", timeFilter=None, geometryFilter=None, returnFeatureClass=False, out_fc=None, outSR=None, chunksize=1000, printIndent=""): """Performs an SQL query against a hosted feature service layer and returns all features regardless of service limit. Args: url (str): The URL of the feature service layer. where - the selection sql statement out_fields - the attribute fields to return timeFilter - a TimeFilter object where either the start time or start and end time are defined to limit the search results for a given time. The values in the timeFilter should be as UTC timestampes in milliseconds. No checking occurs to see if they are in the right format. geometryFilter - a GeometryFilter object to parse down a given query by another spatial dataset. returnFeatureClass - Default False. If true, query will be returned as feature class chunksize (int): The maximum amount of features to query at a time. Defaults to 1000. out_fc - only valid if returnFeatureClass is set to True. Output location of query. Output: A list of Feature Objects (default) or a path to the output featureclass if returnFeatureClass is set to True. """ if (url is None): return fl = None try: fl = FeatureLayer(url=url, securityHandler=self._securityHandler) qRes = fl.query(where=where, returnIDsOnly=True, timeFilter=timeFilter, geometryFilter=geometryFilter) if 'error' in qRes: print (printIndent + qRes) return [] elif 'objectIds' in qRes: oids = qRes['objectIds'] total = len(oids) if total == 0: return fl.query(where=where, returnGeometry=True, out_fields=out_fields, timeFilter=timeFilter, geometryFilter=geometryFilter, outSR=outSR) print (printIndent + "%s features to be downloaded" % total) chunksize = min(chunksize, fl.maxRecordCount) combinedResults = None totalQueried = 0 for chunk in chunklist(l=oids, n=chunksize): oidsQuery = ",".join(map(str, chunk)) if not oidsQuery: continue else: results = fl.query(objectIds=oidsQuery, returnGeometry=True, out_fields=out_fields, timeFilter=timeFilter, geometryFilter=geometryFilter, outSR=outSR) if isinstance(results,FeatureSet): if combinedResults is None: combinedResults = results else: for feature in results.features: combinedResults.features.append(feature) totalQueried += len(results.features) print(printIndent + "{:.0%} Completed: {}/{}".format(totalQueried / float(total), totalQueried, total)) else: print (printIndent + results) if returnFeatureClass == True: return combinedResults.save(*os.path.split(out_fc)) else: return combinedResults else: print (printIndent + qRes) except: line, filename, synerror = trace() raise common.ArcRestHelperError({ "function": "QueryAllFeatures", "line": line, "filename": filename, "synerror": synerror, } ) finally: fl = None del fl gc.collect()
python
def QueryAllFeatures(self, url=None, where="1=1", out_fields="*", timeFilter=None, geometryFilter=None, returnFeatureClass=False, out_fc=None, outSR=None, chunksize=1000, printIndent=""): """Performs an SQL query against a hosted feature service layer and returns all features regardless of service limit. Args: url (str): The URL of the feature service layer. where - the selection sql statement out_fields - the attribute fields to return timeFilter - a TimeFilter object where either the start time or start and end time are defined to limit the search results for a given time. The values in the timeFilter should be as UTC timestampes in milliseconds. No checking occurs to see if they are in the right format. geometryFilter - a GeometryFilter object to parse down a given query by another spatial dataset. returnFeatureClass - Default False. If true, query will be returned as feature class chunksize (int): The maximum amount of features to query at a time. Defaults to 1000. out_fc - only valid if returnFeatureClass is set to True. Output location of query. Output: A list of Feature Objects (default) or a path to the output featureclass if returnFeatureClass is set to True. """ if (url is None): return fl = None try: fl = FeatureLayer(url=url, securityHandler=self._securityHandler) qRes = fl.query(where=where, returnIDsOnly=True, timeFilter=timeFilter, geometryFilter=geometryFilter) if 'error' in qRes: print (printIndent + qRes) return [] elif 'objectIds' in qRes: oids = qRes['objectIds'] total = len(oids) if total == 0: return fl.query(where=where, returnGeometry=True, out_fields=out_fields, timeFilter=timeFilter, geometryFilter=geometryFilter, outSR=outSR) print (printIndent + "%s features to be downloaded" % total) chunksize = min(chunksize, fl.maxRecordCount) combinedResults = None totalQueried = 0 for chunk in chunklist(l=oids, n=chunksize): oidsQuery = ",".join(map(str, chunk)) if not oidsQuery: continue else: results = fl.query(objectIds=oidsQuery, returnGeometry=True, out_fields=out_fields, timeFilter=timeFilter, geometryFilter=geometryFilter, outSR=outSR) if isinstance(results,FeatureSet): if combinedResults is None: combinedResults = results else: for feature in results.features: combinedResults.features.append(feature) totalQueried += len(results.features) print(printIndent + "{:.0%} Completed: {}/{}".format(totalQueried / float(total), totalQueried, total)) else: print (printIndent + results) if returnFeatureClass == True: return combinedResults.save(*os.path.split(out_fc)) else: return combinedResults else: print (printIndent + qRes) except: line, filename, synerror = trace() raise common.ArcRestHelperError({ "function": "QueryAllFeatures", "line": line, "filename": filename, "synerror": synerror, } ) finally: fl = None del fl gc.collect()
[ "def", "QueryAllFeatures", "(", "self", ",", "url", "=", "None", ",", "where", "=", "\"1=1\"", ",", "out_fields", "=", "\"*\"", ",", "timeFilter", "=", "None", ",", "geometryFilter", "=", "None", ",", "returnFeatureClass", "=", "False", ",", "out_fc", "=", "None", ",", "outSR", "=", "None", ",", "chunksize", "=", "1000", ",", "printIndent", "=", "\"\"", ")", ":", "if", "(", "url", "is", "None", ")", ":", "return", "fl", "=", "None", "try", ":", "fl", "=", "FeatureLayer", "(", "url", "=", "url", ",", "securityHandler", "=", "self", ".", "_securityHandler", ")", "qRes", "=", "fl", ".", "query", "(", "where", "=", "where", ",", "returnIDsOnly", "=", "True", ",", "timeFilter", "=", "timeFilter", ",", "geometryFilter", "=", "geometryFilter", ")", "if", "'error'", "in", "qRes", ":", "print", "(", "printIndent", "+", "qRes", ")", "return", "[", "]", "elif", "'objectIds'", "in", "qRes", ":", "oids", "=", "qRes", "[", "'objectIds'", "]", "total", "=", "len", "(", "oids", ")", "if", "total", "==", "0", ":", "return", "fl", ".", "query", "(", "where", "=", "where", ",", "returnGeometry", "=", "True", ",", "out_fields", "=", "out_fields", ",", "timeFilter", "=", "timeFilter", ",", "geometryFilter", "=", "geometryFilter", ",", "outSR", "=", "outSR", ")", "print", "(", "printIndent", "+", "\"%s features to be downloaded\"", "%", "total", ")", "chunksize", "=", "min", "(", "chunksize", ",", "fl", ".", "maxRecordCount", ")", "combinedResults", "=", "None", "totalQueried", "=", "0", "for", "chunk", "in", "chunklist", "(", "l", "=", "oids", ",", "n", "=", "chunksize", ")", ":", "oidsQuery", "=", "\",\"", ".", "join", "(", "map", "(", "str", ",", "chunk", ")", ")", "if", "not", "oidsQuery", ":", "continue", "else", ":", "results", "=", "fl", ".", "query", "(", "objectIds", "=", "oidsQuery", ",", "returnGeometry", "=", "True", ",", "out_fields", "=", "out_fields", ",", "timeFilter", "=", "timeFilter", ",", "geometryFilter", "=", "geometryFilter", ",", "outSR", "=", "outSR", ")", "if", "isinstance", "(", "results", ",", "FeatureSet", ")", ":", "if", "combinedResults", "is", "None", ":", "combinedResults", "=", "results", "else", ":", "for", "feature", "in", "results", ".", "features", ":", "combinedResults", ".", "features", ".", "append", "(", "feature", ")", "totalQueried", "+=", "len", "(", "results", ".", "features", ")", "print", "(", "printIndent", "+", "\"{:.0%} Completed: {}/{}\"", ".", "format", "(", "totalQueried", "/", "float", "(", "total", ")", ",", "totalQueried", ",", "total", ")", ")", "else", ":", "print", "(", "printIndent", "+", "results", ")", "if", "returnFeatureClass", "==", "True", ":", "return", "combinedResults", ".", "save", "(", "*", "os", ".", "path", ".", "split", "(", "out_fc", ")", ")", "else", ":", "return", "combinedResults", "else", ":", "print", "(", "printIndent", "+", "qRes", ")", "except", ":", "line", ",", "filename", ",", "synerror", "=", "trace", "(", ")", "raise", "common", ".", "ArcRestHelperError", "(", "{", "\"function\"", ":", "\"QueryAllFeatures\"", ",", "\"line\"", ":", "line", ",", "\"filename\"", ":", "filename", ",", "\"synerror\"", ":", "synerror", ",", "}", ")", "finally", ":", "fl", "=", "None", "del", "fl", "gc", ".", "collect", "(", ")" ]
Performs an SQL query against a hosted feature service layer and returns all features regardless of service limit. Args: url (str): The URL of the feature service layer. where - the selection sql statement out_fields - the attribute fields to return timeFilter - a TimeFilter object where either the start time or start and end time are defined to limit the search results for a given time. The values in the timeFilter should be as UTC timestampes in milliseconds. No checking occurs to see if they are in the right format. geometryFilter - a GeometryFilter object to parse down a given query by another spatial dataset. returnFeatureClass - Default False. If true, query will be returned as feature class chunksize (int): The maximum amount of features to query at a time. Defaults to 1000. out_fc - only valid if returnFeatureClass is set to True. Output location of query. Output: A list of Feature Objects (default) or a path to the output featureclass if returnFeatureClass is set to True.
[ "Performs", "an", "SQL", "query", "against", "a", "hosted", "feature", "service", "layer", "and", "returns", "all", "features", "regardless", "of", "service", "limit", "." ]
ab240fde2b0200f61d4a5f6df033516e53f2f416
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcresthelper/featureservicetools.py#L650-L756
13,025
Esri/ArcREST
src/arcrest/cmp/community.py
CommunityMapsProgram.contributionStatus
def contributionStatus(self): """gets the contribution status of a user""" import time url = "%s/contributors/%s/activeContribution" % (self.root, quote(self.contributorUID)) params = { "agolUserToken" : self._agolSH.token, "f" : "json" } res = self._get(url=url, param_dict=params, proxy_url=self._proxy_url, proxy_port=self._proxy_port) if'Status' in res and \ res['Status'] == 'start': return True return False
python
def contributionStatus(self): """gets the contribution status of a user""" import time url = "%s/contributors/%s/activeContribution" % (self.root, quote(self.contributorUID)) params = { "agolUserToken" : self._agolSH.token, "f" : "json" } res = self._get(url=url, param_dict=params, proxy_url=self._proxy_url, proxy_port=self._proxy_port) if'Status' in res and \ res['Status'] == 'start': return True return False
[ "def", "contributionStatus", "(", "self", ")", ":", "import", "time", "url", "=", "\"%s/contributors/%s/activeContribution\"", "%", "(", "self", ".", "root", ",", "quote", "(", "self", ".", "contributorUID", ")", ")", "params", "=", "{", "\"agolUserToken\"", ":", "self", ".", "_agolSH", ".", "token", ",", "\"f\"", ":", "\"json\"", "}", "res", "=", "self", ".", "_get", "(", "url", "=", "url", ",", "param_dict", "=", "params", ",", "proxy_url", "=", "self", ".", "_proxy_url", ",", "proxy_port", "=", "self", ".", "_proxy_port", ")", "if", "'Status'", "in", "res", "and", "res", "[", "'Status'", "]", "==", "'start'", ":", "return", "True", "return", "False" ]
gets the contribution status of a user
[ "gets", "the", "contribution", "status", "of", "a", "user" ]
ab240fde2b0200f61d4a5f6df033516e53f2f416
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/cmp/community.py#L62-L77
13,026
Esri/ArcREST
src/arcrest/cmp/community.py
CommunityMapsProgram.user
def user(self): """gets the user properties""" if self._user is None: url = "%s/users/%s" % (self.root, self._username) self._user = CMPUser(url=url, securityHandler=self._securityHandler, proxy_port=self._proxy_port, proxy_url=self._proxy_url, initialize=False) return self._user
python
def user(self): """gets the user properties""" if self._user is None: url = "%s/users/%s" % (self.root, self._username) self._user = CMPUser(url=url, securityHandler=self._securityHandler, proxy_port=self._proxy_port, proxy_url=self._proxy_url, initialize=False) return self._user
[ "def", "user", "(", "self", ")", ":", "if", "self", ".", "_user", "is", "None", ":", "url", "=", "\"%s/users/%s\"", "%", "(", "self", ".", "root", ",", "self", ".", "_username", ")", "self", ".", "_user", "=", "CMPUser", "(", "url", "=", "url", ",", "securityHandler", "=", "self", ".", "_securityHandler", ",", "proxy_port", "=", "self", ".", "_proxy_port", ",", "proxy_url", "=", "self", ".", "_proxy_url", ",", "initialize", "=", "False", ")", "return", "self", ".", "_user" ]
gets the user properties
[ "gets", "the", "user", "properties" ]
ab240fde2b0200f61d4a5f6df033516e53f2f416
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/cmp/community.py#L84-L93
13,027
Esri/ArcREST
src/arcrest/cmp/community.py
CommunityMapsProgram.metadataContributer
def metadataContributer(self): """gets the metadata featurelayer object""" if self._metaFL is None: fl = FeatureService(url=self._metadataURL, proxy_url=self._proxy_url, proxy_port=self._proxy_port) self._metaFS = fl return self._metaFS
python
def metadataContributer(self): """gets the metadata featurelayer object""" if self._metaFL is None: fl = FeatureService(url=self._metadataURL, proxy_url=self._proxy_url, proxy_port=self._proxy_port) self._metaFS = fl return self._metaFS
[ "def", "metadataContributer", "(", "self", ")", ":", "if", "self", ".", "_metaFL", "is", "None", ":", "fl", "=", "FeatureService", "(", "url", "=", "self", ".", "_metadataURL", ",", "proxy_url", "=", "self", ".", "_proxy_url", ",", "proxy_port", "=", "self", ".", "_proxy_port", ")", "self", ".", "_metaFS", "=", "fl", "return", "self", ".", "_metaFS" ]
gets the metadata featurelayer object
[ "gets", "the", "metadata", "featurelayer", "object" ]
ab240fde2b0200f61d4a5f6df033516e53f2f416
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/cmp/community.py#L108-L115
13,028
Esri/ArcREST
src/arcrest/common/general.py
Feature.set_value
def set_value(self, field_name, value): """ sets an attribute value for a given field name """ if field_name in self.fields: if not value is None: self._dict['attributes'][field_name] = _unicode_convert(value) else: pass elif field_name.upper() in ['SHAPE', 'SHAPE@', "GEOMETRY"]: if isinstance(value, dict): if 'geometry' in value: self._dict['geometry'] = value['geometry'] elif any(k in value.keys() for k in ['x','y','points','paths','rings', 'spatialReference']): self._dict['geometry'] = value elif isinstance(value, AbstractGeometry): self._dict['geometry'] = value.asDictionary elif arcpyFound: if isinstance(value, arcpy.Geometry) and \ value.type == self.geometryType: self._dict['geometry']=json.loads(value.JSON) self._geom = None self._geom = self.geometry else: return False self._json = json.dumps(self._dict, default=_date_handler) return True
python
def set_value(self, field_name, value): """ sets an attribute value for a given field name """ if field_name in self.fields: if not value is None: self._dict['attributes'][field_name] = _unicode_convert(value) else: pass elif field_name.upper() in ['SHAPE', 'SHAPE@', "GEOMETRY"]: if isinstance(value, dict): if 'geometry' in value: self._dict['geometry'] = value['geometry'] elif any(k in value.keys() for k in ['x','y','points','paths','rings', 'spatialReference']): self._dict['geometry'] = value elif isinstance(value, AbstractGeometry): self._dict['geometry'] = value.asDictionary elif arcpyFound: if isinstance(value, arcpy.Geometry) and \ value.type == self.geometryType: self._dict['geometry']=json.loads(value.JSON) self._geom = None self._geom = self.geometry else: return False self._json = json.dumps(self._dict, default=_date_handler) return True
[ "def", "set_value", "(", "self", ",", "field_name", ",", "value", ")", ":", "if", "field_name", "in", "self", ".", "fields", ":", "if", "not", "value", "is", "None", ":", "self", ".", "_dict", "[", "'attributes'", "]", "[", "field_name", "]", "=", "_unicode_convert", "(", "value", ")", "else", ":", "pass", "elif", "field_name", ".", "upper", "(", ")", "in", "[", "'SHAPE'", ",", "'SHAPE@'", ",", "\"GEOMETRY\"", "]", ":", "if", "isinstance", "(", "value", ",", "dict", ")", ":", "if", "'geometry'", "in", "value", ":", "self", ".", "_dict", "[", "'geometry'", "]", "=", "value", "[", "'geometry'", "]", "elif", "any", "(", "k", "in", "value", ".", "keys", "(", ")", "for", "k", "in", "[", "'x'", ",", "'y'", ",", "'points'", ",", "'paths'", ",", "'rings'", ",", "'spatialReference'", "]", ")", ":", "self", ".", "_dict", "[", "'geometry'", "]", "=", "value", "elif", "isinstance", "(", "value", ",", "AbstractGeometry", ")", ":", "self", ".", "_dict", "[", "'geometry'", "]", "=", "value", ".", "asDictionary", "elif", "arcpyFound", ":", "if", "isinstance", "(", "value", ",", "arcpy", ".", "Geometry", ")", "and", "value", ".", "type", "==", "self", ".", "geometryType", ":", "self", ".", "_dict", "[", "'geometry'", "]", "=", "json", ".", "loads", "(", "value", ".", "JSON", ")", "self", ".", "_geom", "=", "None", "self", ".", "_geom", "=", "self", ".", "geometry", "else", ":", "return", "False", "self", ".", "_json", "=", "json", ".", "dumps", "(", "self", ".", "_dict", ",", "default", "=", "_date_handler", ")", "return", "True" ]
sets an attribute value for a given field name
[ "sets", "an", "attribute", "value", "for", "a", "given", "field", "name" ]
ab240fde2b0200f61d4a5f6df033516e53f2f416
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/common/general.py#L136-L160
13,029
Esri/ArcREST
src/arcrest/common/general.py
Feature.get_value
def get_value(self, field_name): """ returns a value for a given field name """ if field_name in self.fields: return self._dict['attributes'][field_name] elif field_name.upper() in ['SHAPE', 'SHAPE@', "GEOMETRY"]: return self._dict['geometry'] return None
python
def get_value(self, field_name): """ returns a value for a given field name """ if field_name in self.fields: return self._dict['attributes'][field_name] elif field_name.upper() in ['SHAPE', 'SHAPE@', "GEOMETRY"]: return self._dict['geometry'] return None
[ "def", "get_value", "(", "self", ",", "field_name", ")", ":", "if", "field_name", "in", "self", ".", "fields", ":", "return", "self", ".", "_dict", "[", "'attributes'", "]", "[", "field_name", "]", "elif", "field_name", ".", "upper", "(", ")", "in", "[", "'SHAPE'", ",", "'SHAPE@'", ",", "\"GEOMETRY\"", "]", ":", "return", "self", ".", "_dict", "[", "'geometry'", "]", "return", "None" ]
returns a value for a given field name
[ "returns", "a", "value", "for", "a", "given", "field", "name" ]
ab240fde2b0200f61d4a5f6df033516e53f2f416
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/common/general.py#L162-L168
13,030
Esri/ArcREST
src/arcrest/common/general.py
Feature.asDictionary
def asDictionary(self): """returns the feature as a dictionary""" feat_dict = {} if self._geom is not None: if 'feature' in self._dict: feat_dict['geometry'] = self._dict['feature']['geometry'] elif 'geometry' in self._dict: feat_dict['geometry'] = self._dict['geometry'] if 'feature' in self._dict: feat_dict['attributes'] = self._dict['feature']['attributes'] else: feat_dict['attributes'] = self._dict['attributes'] return self._dict
python
def asDictionary(self): """returns the feature as a dictionary""" feat_dict = {} if self._geom is not None: if 'feature' in self._dict: feat_dict['geometry'] = self._dict['feature']['geometry'] elif 'geometry' in self._dict: feat_dict['geometry'] = self._dict['geometry'] if 'feature' in self._dict: feat_dict['attributes'] = self._dict['feature']['attributes'] else: feat_dict['attributes'] = self._dict['attributes'] return self._dict
[ "def", "asDictionary", "(", "self", ")", ":", "feat_dict", "=", "{", "}", "if", "self", ".", "_geom", "is", "not", "None", ":", "if", "'feature'", "in", "self", ".", "_dict", ":", "feat_dict", "[", "'geometry'", "]", "=", "self", ".", "_dict", "[", "'feature'", "]", "[", "'geometry'", "]", "elif", "'geometry'", "in", "self", ".", "_dict", ":", "feat_dict", "[", "'geometry'", "]", "=", "self", ".", "_dict", "[", "'geometry'", "]", "if", "'feature'", "in", "self", ".", "_dict", ":", "feat_dict", "[", "'attributes'", "]", "=", "self", ".", "_dict", "[", "'feature'", "]", "[", "'attributes'", "]", "else", ":", "feat_dict", "[", "'attributes'", "]", "=", "self", ".", "_dict", "[", "'attributes'", "]", "return", "self", ".", "_dict" ]
returns the feature as a dictionary
[ "returns", "the", "feature", "as", "a", "dictionary" ]
ab240fde2b0200f61d4a5f6df033516e53f2f416
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/common/general.py#L171-L183
13,031
Esri/ArcREST
src/arcrest/common/general.py
Feature.geometry
def geometry(self): """returns the feature geometry""" if arcpyFound: if self._geom is None: if 'feature' in self._dict: self._geom = arcpy.AsShape(self._dict['feature']['geometry'], esri_json=True) elif 'geometry' in self._dict: self._geom = arcpy.AsShape(self._dict['geometry'], esri_json=True) return self._geom return None
python
def geometry(self): """returns the feature geometry""" if arcpyFound: if self._geom is None: if 'feature' in self._dict: self._geom = arcpy.AsShape(self._dict['feature']['geometry'], esri_json=True) elif 'geometry' in self._dict: self._geom = arcpy.AsShape(self._dict['geometry'], esri_json=True) return self._geom return None
[ "def", "geometry", "(", "self", ")", ":", "if", "arcpyFound", ":", "if", "self", ".", "_geom", "is", "None", ":", "if", "'feature'", "in", "self", ".", "_dict", ":", "self", ".", "_geom", "=", "arcpy", ".", "AsShape", "(", "self", ".", "_dict", "[", "'feature'", "]", "[", "'geometry'", "]", ",", "esri_json", "=", "True", ")", "elif", "'geometry'", "in", "self", ".", "_dict", ":", "self", ".", "_geom", "=", "arcpy", ".", "AsShape", "(", "self", ".", "_dict", "[", "'geometry'", "]", ",", "esri_json", "=", "True", ")", "return", "self", ".", "_geom", "return", "None" ]
returns the feature geometry
[ "returns", "the", "feature", "geometry" ]
ab240fde2b0200f61d4a5f6df033516e53f2f416
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/common/general.py#L204-L213
13,032
Esri/ArcREST
src/arcrest/common/general.py
Feature.fields
def fields(self): """ returns a list of feature fields """ if 'feature' in self._dict: self._attributes = self._dict['feature']['attributes'] else: self._attributes = self._dict['attributes'] return self._attributes.keys()
python
def fields(self): """ returns a list of feature fields """ if 'feature' in self._dict: self._attributes = self._dict['feature']['attributes'] else: self._attributes = self._dict['attributes'] return self._attributes.keys()
[ "def", "fields", "(", "self", ")", ":", "if", "'feature'", "in", "self", ".", "_dict", ":", "self", ".", "_attributes", "=", "self", ".", "_dict", "[", "'feature'", "]", "[", "'attributes'", "]", "else", ":", "self", ".", "_attributes", "=", "self", ".", "_dict", "[", "'attributes'", "]", "return", "self", ".", "_attributes", ".", "keys", "(", ")" ]
returns a list of feature fields
[ "returns", "a", "list", "of", "feature", "fields" ]
ab240fde2b0200f61d4a5f6df033516e53f2f416
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/common/general.py#L228-L234
13,033
Esri/ArcREST
src/arcrest/common/general.py
Feature.geometryType
def geometryType(self): """ returns the feature's geometry type """ if self._geomType is None: if self.geometry is not None: self._geomType = self.geometry.type else: self._geomType = "Table" return self._geomType
python
def geometryType(self): """ returns the feature's geometry type """ if self._geomType is None: if self.geometry is not None: self._geomType = self.geometry.type else: self._geomType = "Table" return self._geomType
[ "def", "geometryType", "(", "self", ")", ":", "if", "self", ".", "_geomType", "is", "None", ":", "if", "self", ".", "geometry", "is", "not", "None", ":", "self", ".", "_geomType", "=", "self", ".", "geometry", ".", "type", "else", ":", "self", ".", "_geomType", "=", "\"Table\"", "return", "self", ".", "_geomType" ]
returns the feature's geometry type
[ "returns", "the", "feature", "s", "geometry", "type" ]
ab240fde2b0200f61d4a5f6df033516e53f2f416
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/common/general.py#L237-L244
13,034
Esri/ArcREST
src/arcrest/common/general.py
MosaicRuleObject.value
def value(self): """ gets the mosaic rule object as a dictionary """ if self.mosaicMethod == "esriMosaicNone" or\ self.mosaicMethod == "esriMosaicCenter" or \ self.mosaicMethod == "esriMosaicNorthwest" or \ self.mosaicMethod == "esriMosaicNadir": return { "mosaicMethod" : "esriMosaicNone", "where" : self._where, "ascending" : self._ascending, "fids" : self.fids, "mosaicOperation" : self._mosaicOperation } elif self.mosaicMethod == "esriMosaicViewpoint": return { "mosaicMethod" : "esriMosaicViewpoint", "viewpoint" : self._viewpoint.asDictionary, "where" : self._where, "ascending" : self._ascending, "fids" : self._fids, "mosaicOperation" : self._mosaicOperation } elif self.mosaicMethod == "esriMosaicAttribute": return { "mosaicMethod" : "esriMosaicAttribute", "sortField" : self._sortField, "sortValue" : self._sortValue, "ascending" : self._ascending, "where" : self._where, "fids" : self._fids, "mosaicOperation" : self._mosaicOperation } elif self.mosaicMethod == "esriMosaicLockRaster": return { "mosaicMethod" : "esriMosaicLockRaster", "lockRasterIds" : self._localRasterIds, "where" : self._where, "ascending" : self._ascending, "fids" : self._fids, "mosaicOperation" : self._mosaicOperation } elif self.mosaicMethod == "esriMosaicSeamline": return { "mosaicMethod" : "esriMosaicSeamline", "where" : self._where, "fids" : self._fids, "mosaicOperation" : self._mosaicOperation } else: raise AttributeError("Invalid Mosaic Method")
python
def value(self): """ gets the mosaic rule object as a dictionary """ if self.mosaicMethod == "esriMosaicNone" or\ self.mosaicMethod == "esriMosaicCenter" or \ self.mosaicMethod == "esriMosaicNorthwest" or \ self.mosaicMethod == "esriMosaicNadir": return { "mosaicMethod" : "esriMosaicNone", "where" : self._where, "ascending" : self._ascending, "fids" : self.fids, "mosaicOperation" : self._mosaicOperation } elif self.mosaicMethod == "esriMosaicViewpoint": return { "mosaicMethod" : "esriMosaicViewpoint", "viewpoint" : self._viewpoint.asDictionary, "where" : self._where, "ascending" : self._ascending, "fids" : self._fids, "mosaicOperation" : self._mosaicOperation } elif self.mosaicMethod == "esriMosaicAttribute": return { "mosaicMethod" : "esriMosaicAttribute", "sortField" : self._sortField, "sortValue" : self._sortValue, "ascending" : self._ascending, "where" : self._where, "fids" : self._fids, "mosaicOperation" : self._mosaicOperation } elif self.mosaicMethod == "esriMosaicLockRaster": return { "mosaicMethod" : "esriMosaicLockRaster", "lockRasterIds" : self._localRasterIds, "where" : self._where, "ascending" : self._ascending, "fids" : self._fids, "mosaicOperation" : self._mosaicOperation } elif self.mosaicMethod == "esriMosaicSeamline": return { "mosaicMethod" : "esriMosaicSeamline", "where" : self._where, "fids" : self._fids, "mosaicOperation" : self._mosaicOperation } else: raise AttributeError("Invalid Mosaic Method")
[ "def", "value", "(", "self", ")", ":", "if", "self", ".", "mosaicMethod", "==", "\"esriMosaicNone\"", "or", "self", ".", "mosaicMethod", "==", "\"esriMosaicCenter\"", "or", "self", ".", "mosaicMethod", "==", "\"esriMosaicNorthwest\"", "or", "self", ".", "mosaicMethod", "==", "\"esriMosaicNadir\"", ":", "return", "{", "\"mosaicMethod\"", ":", "\"esriMosaicNone\"", ",", "\"where\"", ":", "self", ".", "_where", ",", "\"ascending\"", ":", "self", ".", "_ascending", ",", "\"fids\"", ":", "self", ".", "fids", ",", "\"mosaicOperation\"", ":", "self", ".", "_mosaicOperation", "}", "elif", "self", ".", "mosaicMethod", "==", "\"esriMosaicViewpoint\"", ":", "return", "{", "\"mosaicMethod\"", ":", "\"esriMosaicViewpoint\"", ",", "\"viewpoint\"", ":", "self", ".", "_viewpoint", ".", "asDictionary", ",", "\"where\"", ":", "self", ".", "_where", ",", "\"ascending\"", ":", "self", ".", "_ascending", ",", "\"fids\"", ":", "self", ".", "_fids", ",", "\"mosaicOperation\"", ":", "self", ".", "_mosaicOperation", "}", "elif", "self", ".", "mosaicMethod", "==", "\"esriMosaicAttribute\"", ":", "return", "{", "\"mosaicMethod\"", ":", "\"esriMosaicAttribute\"", ",", "\"sortField\"", ":", "self", ".", "_sortField", ",", "\"sortValue\"", ":", "self", ".", "_sortValue", ",", "\"ascending\"", ":", "self", ".", "_ascending", ",", "\"where\"", ":", "self", ".", "_where", ",", "\"fids\"", ":", "self", ".", "_fids", ",", "\"mosaicOperation\"", ":", "self", ".", "_mosaicOperation", "}", "elif", "self", ".", "mosaicMethod", "==", "\"esriMosaicLockRaster\"", ":", "return", "{", "\"mosaicMethod\"", ":", "\"esriMosaicLockRaster\"", ",", "\"lockRasterIds\"", ":", "self", ".", "_localRasterIds", ",", "\"where\"", ":", "self", ".", "_where", ",", "\"ascending\"", ":", "self", ".", "_ascending", ",", "\"fids\"", ":", "self", ".", "_fids", ",", "\"mosaicOperation\"", ":", "self", ".", "_mosaicOperation", "}", "elif", "self", ".", "mosaicMethod", "==", "\"esriMosaicSeamline\"", ":", "return", "{", "\"mosaicMethod\"", ":", "\"esriMosaicSeamline\"", ",", "\"where\"", ":", "self", ".", "_where", ",", "\"fids\"", ":", "self", ".", "_fids", ",", "\"mosaicOperation\"", ":", "self", ".", "_mosaicOperation", "}", "else", ":", "raise", "AttributeError", "(", "\"Invalid Mosaic Method\"", ")" ]
gets the mosaic rule object as a dictionary
[ "gets", "the", "mosaic", "rule", "object", "as", "a", "dictionary" ]
ab240fde2b0200f61d4a5f6df033516e53f2f416
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/common/general.py#L478-L529
13,035
Esri/ArcREST
src/arcrest/common/general.py
FeatureSet.fromJSON
def fromJSON(jsonValue): """returns a featureset from a JSON string""" jd = json.loads(jsonValue) features = [] if 'fields' in jd: fields = jd['fields'] else: fields = {'fields':[]} if 'features' in jd: for feat in jd['features']: wkid = None spatialReference =None if 'spatialReference' in jd: spatialReference = jd['spatialReference'] if 'wkid' in jd['spatialReference']: wkid = jd['spatialReference']['wkid'] elif 'latestWkid' in jd['spatialReference']: # kept for compatibility wkid = jd['spatialReference']['latestWkid'] features.append(Feature(json_string=feat, wkid=wkid, spatialReference=spatialReference)) return FeatureSet(fields, features, hasZ=jd['hasZ'] if 'hasZ' in jd else False, hasM=jd['hasM'] if 'hasM' in jd else False, geometryType=jd['geometryType'] if 'geometryType' in jd else None, objectIdFieldName=jd['objectIdFieldName'] if 'objectIdFieldName' in jd else None, globalIdFieldName=jd['globalIdFieldName'] if 'globalIdFieldName' in jd else None, displayFieldName=jd['displayFieldName'] if 'displayFieldName' in jd else None, spatialReference=jd['spatialReference'] if 'spatialReference' in jd else None)
python
def fromJSON(jsonValue): """returns a featureset from a JSON string""" jd = json.loads(jsonValue) features = [] if 'fields' in jd: fields = jd['fields'] else: fields = {'fields':[]} if 'features' in jd: for feat in jd['features']: wkid = None spatialReference =None if 'spatialReference' in jd: spatialReference = jd['spatialReference'] if 'wkid' in jd['spatialReference']: wkid = jd['spatialReference']['wkid'] elif 'latestWkid' in jd['spatialReference']: # kept for compatibility wkid = jd['spatialReference']['latestWkid'] features.append(Feature(json_string=feat, wkid=wkid, spatialReference=spatialReference)) return FeatureSet(fields, features, hasZ=jd['hasZ'] if 'hasZ' in jd else False, hasM=jd['hasM'] if 'hasM' in jd else False, geometryType=jd['geometryType'] if 'geometryType' in jd else None, objectIdFieldName=jd['objectIdFieldName'] if 'objectIdFieldName' in jd else None, globalIdFieldName=jd['globalIdFieldName'] if 'globalIdFieldName' in jd else None, displayFieldName=jd['displayFieldName'] if 'displayFieldName' in jd else None, spatialReference=jd['spatialReference'] if 'spatialReference' in jd else None)
[ "def", "fromJSON", "(", "jsonValue", ")", ":", "jd", "=", "json", ".", "loads", "(", "jsonValue", ")", "features", "=", "[", "]", "if", "'fields'", "in", "jd", ":", "fields", "=", "jd", "[", "'fields'", "]", "else", ":", "fields", "=", "{", "'fields'", ":", "[", "]", "}", "if", "'features'", "in", "jd", ":", "for", "feat", "in", "jd", "[", "'features'", "]", ":", "wkid", "=", "None", "spatialReference", "=", "None", "if", "'spatialReference'", "in", "jd", ":", "spatialReference", "=", "jd", "[", "'spatialReference'", "]", "if", "'wkid'", "in", "jd", "[", "'spatialReference'", "]", ":", "wkid", "=", "jd", "[", "'spatialReference'", "]", "[", "'wkid'", "]", "elif", "'latestWkid'", "in", "jd", "[", "'spatialReference'", "]", ":", "# kept for compatibility", "wkid", "=", "jd", "[", "'spatialReference'", "]", "[", "'latestWkid'", "]", "features", ".", "append", "(", "Feature", "(", "json_string", "=", "feat", ",", "wkid", "=", "wkid", ",", "spatialReference", "=", "spatialReference", ")", ")", "return", "FeatureSet", "(", "fields", ",", "features", ",", "hasZ", "=", "jd", "[", "'hasZ'", "]", "if", "'hasZ'", "in", "jd", "else", "False", ",", "hasM", "=", "jd", "[", "'hasM'", "]", "if", "'hasM'", "in", "jd", "else", "False", ",", "geometryType", "=", "jd", "[", "'geometryType'", "]", "if", "'geometryType'", "in", "jd", "else", "None", ",", "objectIdFieldName", "=", "jd", "[", "'objectIdFieldName'", "]", "if", "'objectIdFieldName'", "in", "jd", "else", "None", ",", "globalIdFieldName", "=", "jd", "[", "'globalIdFieldName'", "]", "if", "'globalIdFieldName'", "in", "jd", "else", "None", ",", "displayFieldName", "=", "jd", "[", "'displayFieldName'", "]", "if", "'displayFieldName'", "in", "jd", "else", "None", ",", "spatialReference", "=", "jd", "[", "'spatialReference'", "]", "if", "'spatialReference'", "in", "jd", "else", "None", ")" ]
returns a featureset from a JSON string
[ "returns", "a", "featureset", "from", "a", "JSON", "string" ]
ab240fde2b0200f61d4a5f6df033516e53f2f416
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/common/general.py#L609-L636
13,036
Esri/ArcREST
src/arcrest/common/general.py
FeatureSet.spatialReference
def spatialReference(self, value): """sets the featureset's spatial reference""" if isinstance(value, SpatialReference): self._spatialReference = value elif isinstance(value, int): self._spatialReference = SpatialReference(wkid=value) elif isinstance(value, str) and \ str(value).isdigit(): self._spatialReference = SpatialReference(wkid=int(value)) elif isinstance(value, dict): wkid = None wkt = None if 'wkid' in value and \ str(value['wkid']).isdigit(): wkid = int(value['wkid']) if 'latestWkid' in value and \ str(value['latestWkid']).isdigit(): wkid = int(value['latestWkid']) if 'wkt' in value: wkt = value['wkt'] self._spatialReference = SpatialReference(wkid=wkid,wkt=wkt)
python
def spatialReference(self, value): """sets the featureset's spatial reference""" if isinstance(value, SpatialReference): self._spatialReference = value elif isinstance(value, int): self._spatialReference = SpatialReference(wkid=value) elif isinstance(value, str) and \ str(value).isdigit(): self._spatialReference = SpatialReference(wkid=int(value)) elif isinstance(value, dict): wkid = None wkt = None if 'wkid' in value and \ str(value['wkid']).isdigit(): wkid = int(value['wkid']) if 'latestWkid' in value and \ str(value['latestWkid']).isdigit(): wkid = int(value['latestWkid']) if 'wkt' in value: wkt = value['wkt'] self._spatialReference = SpatialReference(wkid=wkid,wkt=wkt)
[ "def", "spatialReference", "(", "self", ",", "value", ")", ":", "if", "isinstance", "(", "value", ",", "SpatialReference", ")", ":", "self", ".", "_spatialReference", "=", "value", "elif", "isinstance", "(", "value", ",", "int", ")", ":", "self", ".", "_spatialReference", "=", "SpatialReference", "(", "wkid", "=", "value", ")", "elif", "isinstance", "(", "value", ",", "str", ")", "and", "str", "(", "value", ")", ".", "isdigit", "(", ")", ":", "self", ".", "_spatialReference", "=", "SpatialReference", "(", "wkid", "=", "int", "(", "value", ")", ")", "elif", "isinstance", "(", "value", ",", "dict", ")", ":", "wkid", "=", "None", "wkt", "=", "None", "if", "'wkid'", "in", "value", "and", "str", "(", "value", "[", "'wkid'", "]", ")", ".", "isdigit", "(", ")", ":", "wkid", "=", "int", "(", "value", "[", "'wkid'", "]", ")", "if", "'latestWkid'", "in", "value", "and", "str", "(", "value", "[", "'latestWkid'", "]", ")", ".", "isdigit", "(", ")", ":", "wkid", "=", "int", "(", "value", "[", "'latestWkid'", "]", ")", "if", "'wkt'", "in", "value", ":", "wkt", "=", "value", "[", "'wkt'", "]", "self", ".", "_spatialReference", "=", "SpatialReference", "(", "wkid", "=", "wkid", ",", "wkt", "=", "wkt", ")" ]
sets the featureset's spatial reference
[ "sets", "the", "featureset", "s", "spatial", "reference" ]
ab240fde2b0200f61d4a5f6df033516e53f2f416
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/common/general.py#L649-L669
13,037
Esri/ArcREST
src/arcrest/manageorg/_portals.py
Portals.regions
def regions(self): """gets the regions value""" url = "%s/regions" % self.root params = {"f": "json"} return self._get(url=url, param_dict=params, proxy_url=self._proxy_url, proxy_port=self._proxy_port)
python
def regions(self): """gets the regions value""" url = "%s/regions" % self.root params = {"f": "json"} return self._get(url=url, param_dict=params, proxy_url=self._proxy_url, proxy_port=self._proxy_port)
[ "def", "regions", "(", "self", ")", ":", "url", "=", "\"%s/regions\"", "%", "self", ".", "root", "params", "=", "{", "\"f\"", ":", "\"json\"", "}", "return", "self", ".", "_get", "(", "url", "=", "url", ",", "param_dict", "=", "params", ",", "proxy_url", "=", "self", ".", "_proxy_url", ",", "proxy_port", "=", "self", ".", "_proxy_port", ")" ]
gets the regions value
[ "gets", "the", "regions", "value" ]
ab240fde2b0200f61d4a5f6df033516e53f2f416
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_portals.py#L50-L57
13,038
Esri/ArcREST
src/arcrest/manageorg/_portals.py
Portals.portalSelf
def portalSelf(self): """The portal to which the current user belongs. This is an organizational portal if the user belongs to an organization or the default portal if the user does not belong to one""" url = "%s/self" % self.root return Portal(url=url, securityHandler=self._securityHandler, proxy_url=self._proxy_url, proxy_port=self._proxy_port, )
python
def portalSelf(self): """The portal to which the current user belongs. This is an organizational portal if the user belongs to an organization or the default portal if the user does not belong to one""" url = "%s/self" % self.root return Portal(url=url, securityHandler=self._securityHandler, proxy_url=self._proxy_url, proxy_port=self._proxy_port, )
[ "def", "portalSelf", "(", "self", ")", ":", "url", "=", "\"%s/self\"", "%", "self", ".", "root", "return", "Portal", "(", "url", "=", "url", ",", "securityHandler", "=", "self", ".", "_securityHandler", ",", "proxy_url", "=", "self", ".", "_proxy_url", ",", "proxy_port", "=", "self", ".", "_proxy_port", ",", ")" ]
The portal to which the current user belongs. This is an organizational portal if the user belongs to an organization or the default portal if the user does not belong to one
[ "The", "portal", "to", "which", "the", "current", "user", "belongs", ".", "This", "is", "an", "organizational", "portal", "if", "the", "user", "belongs", "to", "an", "organization", "or", "the", "default", "portal", "if", "the", "user", "does", "not", "belong", "to", "one" ]
ab240fde2b0200f61d4a5f6df033516e53f2f416
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_portals.py#L80-L89
13,039
Esri/ArcREST
src/arcrest/manageorg/_portals.py
Portals.portal
def portal(self, portalID=None): """returns a specific reference to a portal""" if portalID is None: portalID = self.portalSelf.id url = "%s/%s" % (self.root, portalID) return Portal(url=url, securityHandler=self._securityHandler, proxy_url=self._proxy_url, proxy_port=self._proxy_port, initalize=True)
python
def portal(self, portalID=None): """returns a specific reference to a portal""" if portalID is None: portalID = self.portalSelf.id url = "%s/%s" % (self.root, portalID) return Portal(url=url, securityHandler=self._securityHandler, proxy_url=self._proxy_url, proxy_port=self._proxy_port, initalize=True)
[ "def", "portal", "(", "self", ",", "portalID", "=", "None", ")", ":", "if", "portalID", "is", "None", ":", "portalID", "=", "self", ".", "portalSelf", ".", "id", "url", "=", "\"%s/%s\"", "%", "(", "self", ".", "root", ",", "portalID", ")", "return", "Portal", "(", "url", "=", "url", ",", "securityHandler", "=", "self", ".", "_securityHandler", ",", "proxy_url", "=", "self", ".", "_proxy_url", ",", "proxy_port", "=", "self", ".", "_proxy_port", ",", "initalize", "=", "True", ")" ]
returns a specific reference to a portal
[ "returns", "a", "specific", "reference", "to", "a", "portal" ]
ab240fde2b0200f61d4a5f6df033516e53f2f416
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_portals.py#L91-L100
13,040
Esri/ArcREST
src/arcrest/manageorg/_portals.py
Portal._findPortalId
def _findPortalId(self): """gets the portal id for a site if not known.""" if not self.root.lower().endswith("/self"): url = self.root + "/self" else: url = self.root params = { "f" : "json" } res = self._get(url=url, param_dict=params, securityHandler=self._securityHandler, proxy_port=self._proxy_port, proxy_url=self._proxy_url) if 'id' in res: return res['id'] return None
python
def _findPortalId(self): """gets the portal id for a site if not known.""" if not self.root.lower().endswith("/self"): url = self.root + "/self" else: url = self.root params = { "f" : "json" } res = self._get(url=url, param_dict=params, securityHandler=self._securityHandler, proxy_port=self._proxy_port, proxy_url=self._proxy_url) if 'id' in res: return res['id'] return None
[ "def", "_findPortalId", "(", "self", ")", ":", "if", "not", "self", ".", "root", ".", "lower", "(", ")", ".", "endswith", "(", "\"/self\"", ")", ":", "url", "=", "self", ".", "root", "+", "\"/self\"", "else", ":", "url", "=", "self", ".", "root", "params", "=", "{", "\"f\"", ":", "\"json\"", "}", "res", "=", "self", ".", "_get", "(", "url", "=", "url", ",", "param_dict", "=", "params", ",", "securityHandler", "=", "self", ".", "_securityHandler", ",", "proxy_port", "=", "self", ".", "_proxy_port", ",", "proxy_url", "=", "self", ".", "_proxy_url", ")", "if", "'id'", "in", "res", ":", "return", "res", "[", "'id'", "]", "return", "None" ]
gets the portal id for a site if not known.
[ "gets", "the", "portal", "id", "for", "a", "site", "if", "not", "known", "." ]
ab240fde2b0200f61d4a5f6df033516e53f2f416
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_portals.py#L248-L263
13,041
Esri/ArcREST
src/arcrest/manageorg/_portals.py
Portal.portalId
def portalId(self): """gets the portal Id""" if self._portalId is None: self._portalId = self._findPortalId() return self._portalId
python
def portalId(self): """gets the portal Id""" if self._portalId is None: self._portalId = self._findPortalId() return self._portalId
[ "def", "portalId", "(", "self", ")", ":", "if", "self", ".", "_portalId", "is", "None", ":", "self", ".", "_portalId", "=", "self", ".", "_findPortalId", "(", ")", "return", "self", ".", "_portalId" ]
gets the portal Id
[ "gets", "the", "portal", "Id" ]
ab240fde2b0200f61d4a5f6df033516e53f2f416
https://github.com/Esri/ArcREST/blob/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/manageorg/_portals.py#L384-L388
13,042
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
13,043
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
13,044
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
13,045
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
13,046
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
13,047
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
13,048
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
13,049
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
13,050
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
13,051
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
13,052
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
13,053
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
13,054
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
13,055
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
13,056
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
13,057
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
13,058
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
13,059
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
13,060
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
13,061
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
13,062
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
13,063
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
13,064
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
13,065
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
13,066
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
13,067
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
13,068
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
13,069
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
13,070
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
13,071
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
13,072
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
13,073
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
13,074
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
13,075
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
13,076
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
13,077
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
13,078
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
13,079
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
13,080
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
13,081
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
13,082
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
13,083
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
13,084
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
13,085
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
13,086
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
13,087
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
13,088
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
13,089
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
13,090
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
13,091
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
13,092
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
13,093
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
13,094
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
13,095
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
13,096
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
13,097
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
13,098
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
13,099
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