idx
int64
0
251k
question
stringlengths
53
3.53k
target
stringlengths
5
1.23k
len_question
int64
20
893
len_target
int64
3
238
244,800
def _3 ( self ) : boundary = self . boundary buf = BytesIO ( ) textwriter = io . TextIOWrapper ( buf , 'utf8' , newline = '' , write_through = True ) for ( key , value ) in self . form_fields : textwriter . write ( '--{boundary}\r\n' 'Content-Disposition: form-data; name="{key}"\r\n\r\n' '{value}\r\n' . format ( bounda...
python 3 method
312
3
244,801
def _get_file_name ( self , contentDisposition , url , ext = ".unknown" ) : if self . PY2 : if contentDisposition is not None : return re . findall ( r'filename[^;=\n]*=(([\'"]).*?\2|[^;\n]*)' , contentDisposition . strip ( ) . replace ( '"' , '' ) ) [ 0 ] [ 0 ] elif os . path . basename ( url ) . find ( '.' ) > - 1 : ...
gets the file name from the header or url if possible
264
11
244,802
def _mainType ( self , resp ) : if self . PY2 : return resp . headers . maintype elif self . PY3 : return resp . headers . get_content_maintype ( ) else : return None
gets the main type from the response object
49
8
244,803
def _chunk ( self , response , size = 4096 ) : method = response . headers . get ( "content-encoding" ) if method == "gzip" : d = zlib . decompressobj ( 16 + zlib . MAX_WBITS ) b = response . read ( size ) while b : data = d . decompress ( b ) yield data b = response . read ( size ) del data else : while True : chunk =...
downloads a web response in pieces
109
7
244,804
def _asString ( self , value ) : if sys . version_info [ 0 ] == 3 : if isinstance ( value , str ) : return value elif isinstance ( value , bytes ) : return value . decode ( 'utf-8' ) elif sys . version_info [ 0 ] == 2 : return value . encode ( 'ascii' )
converts the value as a string
78
7
244,805
def machines ( self ) : if self . _resources is None : self . __init ( ) if "machines" in self . _resources : url = self . _url + "/machines" return _machines . Machines ( url , securityHandler = self . _securityHandler , initialize = False , proxy_url = self . _proxy_url , proxy_port = self . _proxy_port ) else : retu...
gets a reference to the machines object
93
7
244,806
def data ( self ) : if self . _resources is None : self . __init ( ) if "data" in self . _resources : url = self . _url + "/data" return _data . Data ( url = url , securityHandler = self . _securityHandler , initialize = True , proxy_url = self . _proxy_url , proxy_port = self . _proxy_port ) else : return None
returns the reference to the data functions as a class
89
11
244,807
def info ( self ) : if self . _resources is None : self . __init ( ) url = self . _url + "/info" return _info . Info ( url = url , securityHandler = self . _securityHandler , proxy_url = self . _proxy_url , proxy_port = self . _proxy_port , initialize = True )
A read - only resource that returns meta information about the server
75
12
244,808
def clusters ( self ) : if self . _resources is None : self . __init ( ) if "clusters" in self . _resources : url = self . _url + "/clusters" return _clusters . Cluster ( url = url , securityHandler = self . _securityHandler , proxy_url = self . _proxy_url , proxy_port = self . _proxy_port , initialize = True ) else : ...
returns the clusters functions if supported in resources
92
9
244,809
def services ( self ) : if self . _resources is None : self . __init ( ) if "services" in self . _resources : url = self . _url + "/services" return _services . Services ( url = url , securityHandler = self . _securityHandler , proxy_url = self . _proxy_url , proxy_port = self . _proxy_port , initialize = True ) else :...
Gets the services object which will provide the ArcGIS Server s admin information about services and folders .
89
21
244,810
def usagereports ( self ) : if self . _resources is None : self . __init ( ) if "usagereports" in self . _resources : url = self . _url + "/usagereports" return _usagereports . UsageReports ( url = url , securityHandler = self . _securityHandler , proxy_url = self . _proxy_url , proxy_port = self . _proxy_port , initia...
Gets the services object which will provide the ArcGIS Server s admin information about the usagereports .
94
21
244,811
def kml ( self ) : url = self . _url + "/kml" return _kml . KML ( url = url , securityHandler = self . _securityHandler , proxy_url = self . _proxy_url , proxy_port = self . _proxy_port , initialize = True )
returns the kml functions for server
65
8
244,812
def logs ( self ) : if self . _resources is None : self . __init ( ) if "logs" in self . _resources : url = self . _url + "/logs" return _logs . Log ( url = url , securityHandler = self . _securityHandler , proxy_url = self . _proxy_url , proxy_port = self . _proxy_port , initialize = True ) else : return None
returns an object to work with the site logs
92
10
244,813
def mode ( self ) : if self . _resources is None : self . __init ( ) if "mode" in self . _resources : url = self . _url + "/mode" return _mode . Mode ( url = url , securityHandler = self . _securityHandler , proxy_url = self . _proxy_url , proxy_port = self . _proxy_port , initialize = True ) else : return None
returns an object to work with the site mode
89
10
244,814
def security ( self ) : if self . _resources is None : self . __init ( ) if "security" in self . _resources : url = self . _url + "/security" return _security . Security ( url = url , securityHandler = self . _securityHandler , proxy_url = self . _proxy_url , proxy_port = self . _proxy_port , initialize = True ) else :...
returns an object to work with the site security
89
10
244,815
def system ( self ) : if self . _resources is None : self . __init ( ) if "system" in self . _resources : url = self . _url + "/system" return _system . System ( url = url , securityHandler = self . _securityHandler , proxy_url = self . _proxy_url , proxy_port = self . _proxy_port , initialize = True ) else : return No...
returns an object to work with the site system
89
10
244,816
def uploads ( self ) : if self . _resources is None : self . __init ( ) if "uploads" in self . _resources : url = self . _url + "/uploads" return _uploads . Uploads ( url = url , securityHandler = self . _securityHandler , proxy_url = self . _proxy_url , proxy_port = self . _proxy_port , initialize = True ) else : retu...
returns an object to work with the site uploads
91
11
244,817
def getGroupIDs ( self , groupNames , communityInfo = None ) : group_ids = [ ] if communityInfo is None : communityInfo = self . communitySelf if isinstance ( groupNames , list ) : groupNames = map ( str . upper , groupNames ) else : groupNames = groupNames . upper ( ) if 'groups' in communityInfo : for gp in community...
This function retrieves the group IDs
125
7
244,818
def groups ( self ) : return Groups ( url = "%s/groups" % self . root , securityHandler = self . _securityHandler , proxy_url = self . _proxy_url , proxy_port = self . _proxy_port , initalize = False )
returns the group object
58
5
244,819
def group ( self , groupId ) : url = "%s/%s" % ( self . root , groupId ) return Group ( url = url , securityHandler = self . _securityHandler , proxy_url = self . _proxy_url , proxy_port = self . _proxy_port , initalize = False )
gets a group based on it s ID
70
8
244,820
def invite ( self , users , role , expiration = 1440 ) : params = { "f" : "json" , "users" : users , "role" : role , "expiration" : expiration } return self . _post ( url = self . _url + "/invite" , securityHandler = self . _securityHandler , param_dict = params , proxy_url = self . _proxy_url , proxy_port = self . _pr...
A group administrator can invite users to join their group using the Invite to Group operation . This creates a new user invitation which the users accept or decline . The role of the user and the invitation expiration date can be set in the invitation . A notification is created for the user indicating that they were ...
99
71
244,821
def applications ( self ) : url = self . _url + "/applications" params = { "f" : "json" } res = self . _get ( url = url , param_dict = params , proxy_url = self . _proxy_url , proxy_port = self . _proxy_port ) items = [ ] if "applications" in res . keys ( ) : for apps in res [ 'applications' ] : items . append ( self ....
returns all the group applications to join
162
8
244,822
def search ( self , q , start = 1 , num = 10 , sortField = "username" , sortOrder = "asc" ) : params = { "f" : "json" , "q" : q , "start" : start , "num" : num , "sortField" : sortField , "sortOrder" : sortOrder } url = self . _url return self . _get ( url = url , param_dict = params , securityHandler = self . _securit...
The User Search operation searches for users in the portal . The search index is updated whenever users are created updated or deleted . There can be a lag between the time that the user is updated and the time when it s reflected in the search results . The results only contain users that the calling user has permissi...
128
77
244,823
def __getUsername ( self ) : if self . _securityHandler is not None and not self . _securityHandler . _username is None : return self . _securityHandler . _username elif self . _securityHandler is not None and hasattr ( self . _securityHandler , "org_url" ) and self . _securityHandler . org_url is not None : from . adm...
tries to parse the user name from various objects
227
10
244,824
def user ( self , username = None ) : if username is None : username = self . __getUsername ( ) parsedUsername = urlparse . quote ( username ) url = self . root + "/%s" % parsedUsername return User ( url = url , securityHandler = self . _securityHandler , proxy_url = self . _proxy_url , proxy_port = self . _proxy_port ...
A user resource that represents a registered user in the portal .
92
12
244,825
def userContent ( self ) : replace_start = self . _url . lower ( ) . find ( "/community/" ) len_replace = len ( "/community/" ) url = self . _url . replace ( self . _url [ replace_start : replace_start + len_replace ] , '/content/' ) from . _content import User as UserContent return UserContent ( url = url , securityHa...
allows access into the individual user s content to get at the items owned by the current user
116
18
244,826
def invitations ( self ) : url = "%s/invitations" % self . root return Invitations ( url = url , securityHandler = self . _securityHandler , proxy_url = self . _proxy_url , proxy_port = self . _proxy_port )
returns a class to access the current user s invitations
57
11
244,827
def notifications ( self ) : params = { "f" : "json" } url = "%s/notifications" % self . root return Notifications ( url = url , securityHandler = self . _securityHandler , proxy_url = self . _proxy_url , proxy_port = self . _proxy_port )
The notifications that are available for the given user . Notifications are events that need the user s attention - application for joining a group administered by the user acceptance of a group membership application and so on . A notification is initially marked as new . The user can mark it as read or delete the not...
68
60
244,828
def resetPassword ( self , email = True ) : url = self . root + "/reset" params = { "f" : "json" , "email" : email } return self . _post ( url = url , param_dict = params , securityHandler = self . _securityHandler , proxy_url = self . _proxy_url , proxy_port = self . _proxy_port )
resets a users password for an account . The password will be randomly generated and emailed by the system .
84
21
244,829
def expirePassword ( self , hours = "now" ) : params = { "f" : "json" } expiration = - 1 if isinstance ( hours , str ) : if expiration == "now" : expiration = - 1 elif expiration == "never" : expiration = 0 else : expiration = - 1 elif isinstance ( expiration , ( int , long ) ) : dt = datetime . now ( ) + timedelta ( h...
sets a time when a user must reset their password
187
10
244,830
def userInvitations ( self ) : self . __init ( ) items = [ ] for n in self . _userInvitations : if "id" in n : url = "%s/%s" % ( self . root , n [ 'id' ] ) items . append ( self . Invitation ( url = url , securityHandler = self . _securityHandler , proxy_url = self . _proxy_url , proxy_port = self . _proxy_port , initi...
gets all user invitations
107
4
244,831
def notifications ( self ) : self . __init ( ) items = [ ] for n in self . _notifications : if "id" in n : url = "%s/%s" % ( self . root , n [ 'id' ] ) items . append ( self . Notification ( url = url , securityHandler = self . _securityHandler , proxy_url = self . _proxy_url , proxy_port = self . _proxy_port ) ) retur...
gets the user s notifications
99
5
244,832
def add ( self , statisticType , onStatisticField , outStatisticFieldName = None ) : val = { "statisticType" : statisticType , "onStatisticField" : onStatisticField , "outStatisticFieldName" : outStatisticFieldName } if outStatisticFieldName is None : del val [ 'outStatisticFieldName' ] self . _array . append ( val )
Adds the statistics group to the filter .
89
8
244,833
def addFilter ( self , layer_id , where = None , outFields = "*" ) : import copy f = copy . deepcopy ( self . _filterTemplate ) f [ 'layerId' ] = layer_id f [ 'outFields' ] = outFields if where is not None : f [ 'where' ] = where if f not in self . _filter : self . _filter . append ( f )
adds a layer definition filter
93
6
244,834
def removeFilter ( self , filter_index ) : f = self . _filter [ filter_index ] self . _filter . remove ( f )
removes a layer filter based on position in filter list
31
11
244,835
def geometry ( self , geometry ) : if isinstance ( geometry , AbstractGeometry ) : self . _geomObject = geometry self . _geomType = geometry . type elif arcpyFound : wkid = None wkt = None if ( hasattr ( geometry , 'spatialReference' ) and geometry . spatialReference is not None ) : if ( hasattr ( geometry . spatialRef...
sets the geometry value
390
4
244,836
def layers ( self ) : if self . _layers is None : self . __init ( ) lyrs = [ ] for lyr in self . _layers : url = self . _url + "/%s" % lyr [ 'id' ] lyr [ 'object' ] = MobileServiceLayer ( url = url , securityHandler = self . _securityHandler , proxy_url = self . _proxy_url , proxy_port = self . _proxy_port , initialize...
gets the service layers
109
4
244,837
def clusters ( self ) : if self . _clusters is not None : self . __init ( ) Cs = [ ] for c in self . _clusters : url = self . _url + "/%s" % c [ 'clusterName' ] Cs . append ( Cluster ( url = url , securityHandler = self . _securityHandler , proxy_url = self . _proxy_url , proxy_port = self . _proxy_port , initialize = ...
returns the cluster object for each server
117
8
244,838
def editProtocol ( self , clusterProtocolObj ) : if isinstance ( clusterProtocolObj , ClusterProtocol ) : pass else : raise AttributeError ( "Invalid Input, must be a ClusterProtocal Object" ) url = self . _url + "/editProtocol" params = { "f" : "json" , "tcpClusterPort" : str ( clusterProtocolObj . value [ 'tcpCluster...
Updates the Cluster Protocol . This will cause the cluster to be restarted with updated protocol configuration .
145
20
244,839
def parameters ( self ) : if self . _parameters is None : self . __init ( ) for param in self . _parameters : if not isinstance ( param [ 'defaultValue' ] , BaseGPObject ) : if param [ 'dataType' ] == "GPFeatureRecordSetLayer" : param [ 'defaultValue' ] = GPFeatureRecordSetLayer . fromJSON ( json . dumps ( param ) ) el...
returns the default parameters
529
5
244,840
def getJob ( self , jobID ) : url = self . _url + "/jobs/%s" % ( jobID ) return GPJob ( url = url , securityHandler = self . _securityHandler , proxy_port = self . _proxy_port , proxy_url = self . _proxy_url )
returns the results or status of a job
67
9
244,841
def executeTask ( self , inputs , outSR = None , processSR = None , returnZ = False , returnM = False , f = "json" , method = "POST" ) : params = { "f" : f } url = self . _url + "/execute" params = { "f" : "json" } if not outSR is None : params [ 'env:outSR' ] = outSR if not processSR is None : params [ 'end:processSR'...
performs the execute task method
265
6
244,842
def _get_json ( self , urlpart ) : url = self . _url + "/%s" % urlpart params = { "f" : "json" , } return self . _get ( url = url , param_dict = params , securityHandler = self . _securityHandler , proxy_url = self . _proxy_url , proxy_port = self . proxy_port )
gets the result object dictionary
84
5
244,843
def results ( self ) : self . __init ( ) for k , v in self . _results . items ( ) : param = self . _get_json ( v [ 'paramUrl' ] ) if param [ 'dataType' ] == "GPFeatureRecordSetLayer" : self . _results [ k ] = GPFeatureRecordSetLayer . fromJSON ( json . dumps ( param ) ) elif param [ 'dataType' ] . lower ( ) . find ( 'g...
returns the results
575
4
244,844
def getParameterValue ( self , parameterName ) : if self . _results is None : self . __init ( ) parameter = self . _results [ parameterName ] return parameter
gets a parameter value
37
4
244,845
def parentLayer ( self ) : if self . _parentLayer is None : from . . agol . services import FeatureService self . __init ( ) url = os . path . dirname ( self . _url ) self . _parentLayer = FeatureService ( url = url , securityHandler = self . _securityHandler , proxy_url = self . _proxy_url , proxy_port = self . _proxy...
returns information about the parent
96
6
244,846
def _chunks ( self , l , n ) : l . sort ( ) newn = int ( 1.0 * len ( l ) / n + 0.5 ) for i in range ( 0 , n - 1 ) : yield l [ i * newn : i * newn + newn ] yield l [ n * newn - newn : ]
Yield n successive chunks from a list l .
77
10
244,847
def calculate ( self , where , calcExpression , sqlFormat = "standard" ) : url = self . _url + "/calculate" params = { "f" : "json" , "where" : where , } if isinstance ( calcExpression , dict ) : params [ "calcExpression" ] = json . dumps ( [ calcExpression ] , default = _date_handler ) elif isinstance ( calcExpression...
The calculate operation is performed on a feature service layer resource . It updates the values of one or more fields in an existing feature service layer based on SQL expressions or scalar values . The calculate operation can only be used if the supportsCalculate property of the layer is true . Neither the Shape fiel...
216
89
244,848
def validateSQL ( self , sql , sqlType = "where" ) : url = self . _url + "/validateSQL" if not sqlType . lower ( ) in [ 'where' , 'expression' , 'statement' ] : raise Exception ( "Invalid Input for sqlType: %s" % sqlType ) params = { "f" : "json" , "sql" : sql , "sqlType" : sqlType } return self . _post ( url = url , p...
The validateSQL operation validates an SQL - 92 expression or WHERE clause . The validateSQL operation ensures that an SQL - 92 expression such as one written by a user through a user interface is correct before performing another operation that uses the expression . For example validateSQL can be used to validate info...
140
107
244,849
def asDictionary ( self ) : template = { "type" : self . _type , "mapLayerId" : self . _mapLayerId } if not self . _gdbVersion is None and self . _gdbVersion != "" : template [ 'gdbVersion' ] = self . _gdbVersion return template
converts the object to a dictionary
70
7
244,850
def asDictionary ( self ) : template = { "type" : "dataLayer" , "dataSource" : self . _dataSource } if not self . _fields is None : template [ 'fields' ] = self . _fields return template
returns the value as a dictionary
53
7
244,851
def dataSource ( self , value ) : if isinstance ( value , DataSource ) : self . _dataSource = value else : raise TypeError ( "value must be a DataSource object" )
sets the datasource object
42
5
244,852
def fields ( self , value ) : if type ( value ) is list : self . _fields = value else : raise TypeError ( "Input must be a list" )
sets the fields variable
36
4
244,853
def addCodedValue ( self , name , code ) : i = { "name" : name , "code" : code } if i not in self . _codedValues : self . _codedValues . append ( i )
adds a coded value to the domain
48
8
244,854
def removeCodedValue ( self , name ) : for i in self . _codedValues : if i [ 'name' ] == name : self . _codedValues . remove ( i ) return True return False
removes a codedValue by name
44
7
244,855
def value ( self ) : return { "type" : self . _type , "name" : self . _name , "range" : [ self . _rangeMin , self . _rangeMax ] }
gets the value as a dictionary
44
6
244,856
def measure ( self , fromGeometry , toGeometry , measureOperation , geometryType = "esriGeometryPoint" , pixelSize = None , mosaicRule = None , linearUnit = None , angularUnit = None , areaUnit = None ) : url = self . _url + "/measure" params = { "f" : "json" , "fromGeometry" : fromGeometry , "toGeometry" : toGeometry ...
The measure operation is performed on an image service resource . It lets a user measure distance direction area perimeter and height from an image service . The result of this operation includes the name of the raster dataset being used sensor name and measured values .
247
48
244,857
def computeStatisticsHistograms ( self , geometry , geometryType , mosaicRule = None , renderingRule = None , pixelSize = None ) : url = self . _url + "/computeStatisticsHistograms" params = { "f" : "json" , "geometry" : geometry , "geometryType" : geometryType } if not mosaicRule is None : params [ "mosaicRule" ] = mo...
The computeStatisticsHistograms operation is performed on an image service resource . This operation is supported by any image service published with mosaic datasets or a raster dataset . The result of this operation contains both statistics and histograms computed from the given extent .
171
49
244,858
def uploadByParts ( self , registerID , filePath , commit = True ) : url = self . _url + "/%s/uploadPart" % registerID params = { "f" : "json" } with open ( filePath , 'rb' ) as f : mm = mmap . mmap ( f . fileno ( ) , 0 , access = mmap . ACCESS_READ ) size = 1000000 steps = int ( os . fstat ( f . fileno ( ) ) . st_size...
loads the data by small parts . If commit is set to true then parts will be merged together . If commit is false the function will return the registerID so a manual commit can occur .
326
38
244,859
def uploads ( self ) : if self . syncEnabled == True : return Uploads ( url = self . _url + "/uploads" , securityHandler = self . _securityHandler , proxy_url = self . _proxy_url , proxy_port = self . _proxy_port ) return None
returns the class to perform the upload function . it will only return the uploads class if syncEnabled is True .
63
24
244,860
def administration ( self ) : url = self . _url res = search ( "/rest/" , url ) . span ( ) addText = "admin/" part1 = url [ : res [ 1 ] ] part2 = url [ res [ 1 ] : ] adminURL = "%s%s%s" % ( part1 , addText , part2 ) res = AdminFeatureService ( url = url , securityHandler = self . _securityHandler , proxy_url = self . _...
returns the hostservice object to manage the back - end functions
122
13
244,861
def replicas ( self ) : params = { "f" : "json" , } url = self . _url + "/replicas" return self . _get ( url , params , securityHandler = self . _securityHandler , proxy_url = self . _proxy_url , proxy_port = self . _proxy_port )
returns all the replicas for a feature service
71
10
244,862
def createReplica ( self , replicaName , layers , layerQueries = None , geometryFilter = None , replicaSR = None , transportType = "esriTransportTypeUrl" , returnAttachments = False , returnAttachmentsDatabyURL = False , async = False , attachmentsSyncDirection = "none" , syncModel = "none" , dataFormat = "json" , repl...
The createReplica operation is performed on a feature service resource . This operation creates the replica between the feature service and a client based on a client - supplied replica definition . It requires the Sync capability . See Sync overview for more information on sync . The response for createReplica include...
757
142
244,863
def replicaStatus ( self , url ) : params = { "f" : "json" } url = url + "/status" return self . _get ( url = url , param_dict = params , securityHandler = self . _securityHandler , proxy_port = self . _proxy_port , proxy_url = self . _proxy_url )
gets the replica status when exported async set to True
74
10
244,864
def listAttachments ( self , oid ) : url = self . _url + "/%s/attachments" % oid params = { "f" : "json" } return self . _get ( url , params , securityHandler = self . _securityHandler , proxy_port = self . _proxy_port , proxy_url = self . _proxy_url )
list attachements for a given OBJECT ID
80
10
244,865
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" ...
downloads a feature s attachment .
156
7
244,866
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
84
9
244,867
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' ] =...
creates a feature template
115
5
244,868
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
53
6
244,869
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
48
6
244,870
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
45
13
244,871
def X ( self , value ) : if isinstance ( value , ( int , float , long , types . NoneType ) ) : self . _x = value
sets the X coordinate
34
4
244,872
def Y ( self , value ) : if isinstance ( value , ( int , float , long , types . NoneType ) ) : self . _y = value
sets the Y coordinate
34
4
244,873
def Z ( self , value ) : if isinstance ( value , ( int , float , long , types . NoneType ) ) : self . _z = value
sets the Z coordinate
34
4
244,874
def wkid ( self , value ) : if isinstance ( value , ( int , long ) ) : self . _wkid = value
sets the wkid
29
4
244,875
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...
returns the envelope as a dictionary
158
7
244,876
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 (...
returns the Envelope as an ESRI arcpy . Polygon object
162
16
244,877
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 . hea...
processes the response object
375
5
244,878
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 . _prox...
Assigns a role to multiple users
106
8
244,879
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
59
10
244,880
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 . ...
returns the server directory object in a list
154
9
244,881
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
58
4
244,882
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
57
9
244,883
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 [ 'edi...
Enables editing capabilities on a feature service .
266
9
244,884
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 ...
Enables Sync capability for an AGOL feature service .
148
11
244,885
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 . _securityHand...
Obtains a feature service by item ID .
254
9
244,886
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...
Obtains a layer from a feature service by URL reference .
154
12
244,887
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 i...
Obtains a layer from a feature service by feature service reference .
295
13
244,888
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 'objectI...
Removes features from a hosted feature service layer by SQL query .
587
13
244,889
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...
Performs an SQL query against a hosted feature service layer and returns all features regardless of service limit .
558
20
244,890
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 . _...
gets the contribution status of a user
127
7
244,891
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
88
4
244,892
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
65
6
244,893
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 ...
sets an attribute value for a given field name
296
9
244,894
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
80
9
244,895
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' ]...
returns the feature as a dictionary
153
7
244,896
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...
returns the feature geometry
115
5
244,897
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
65
7
244,898
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
56
7
244,899
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" : sel...
gets the mosaic rule object as a dictionary
516
8