<commit_before>import requests, json

class GeodesignHubClient():

	def __init__(self, url, token, project_id):
		self.projectid = project_id
		self.token = token
		self.securl = url if url else 'https://www.geodesignhub.com/api/v1/'

	def get_diagram_geoms(self, diagid):
		''' Create a requests object with correct headers and creds. '''
		securl = self.securl+ 'projects'+ '/' + self.projectid + '/' +'diagrams' + '/'+ str(diagid) +'/'
		headers = {'Authorization': 'Token '+ self.token}
		r = requests.get(securl, headers=headers)
		return r

	def get_constraints_geoms(self):
		''' Create a requests object with correct headers and creds. '''
		securl = self.securl+ 'projects'+ '/' + self.projectid + '/' +'constraints' + '/'
		headers = {'Authorization': 'Token '+ self.token}
		r = requests.get(securl, headers=headers)
		return r

	def post_as_diagram(self,geoms, projectorpolicy, featuretype, description, reqid ):
		''' Create a requests object with correct headers and creds. '''
		securl = self.securl+ 'projects'+ '/' + self.projectid + '/' +'requirements'+'/'+ str(reqid) + '/'+ 'add' +'/' + projectorpolicy +'/'
		headers = {'Authorization': 'Token '+ self.token, 'content-type': 'application/json'}
		postdata = {'geometry':geoms, 'description':description, 'featuretype':featuretype}
		r = requests.post(securl, headers= headers, data = json.dumps(postdata))
		return r

	def post_as_ealuation_JSON(self, geoms, reqid, username=None):
		''' Create a requests object with correct headers and creds. '''
		securl = self.securl+ 'projects'+ '/' + self.projectid + '/' +'requirements'+'/'+ str(reqid) + '/e/map/json/'
		if username:
			securl += username +'/'
		headers = {'Authorization': 'Token '+ self.token, 'content-type': 'application/json'}

		r = requests.post(securl, headers= headers, data = json.dumps(geoms))
		return r

	def post_as_impact_JSON(self, geoms, reqid, username=None):
		''' Create a requests object with correct headers and creds. '''

		securl = self.securl+ 'projects'+ '/' + self.projectid + '/' +'requirements'+'/'+ str(reqid) + '/i/map/json/'
		if username:
			securl += username +'/'

		headers = {'Authorization': 'Token '+ self.token, 'content-type': 'application/json'}
		r = requests.post(securl, headers= headers, data = json.dumps(geoms))
		return r

	def post_as_evaluation_GBF(self, geoms, reqid, username=None):
		''' Create a requests object with correct headers and creds. '''
		securl = self.securl+ 'projects'+ '/' + self.projectid + '/' +'requirements'+'/'+ str(reqid) + '/e/map/gbf/'
		if username:
			securl += username +'/'
		headers = {'Authorization': 'Token '+ self.token}

		r = requests.post(securl, headers= headers, files = {'geoms.gbf':geoms})
		return r

	def post_as_impact_GBF(self, geoms, reqid, username=None):
		''' Create a requests object with correct headers and creds. '''

		securl = self.securl+ 'projects'+ '/' + self.projectid + '/' +'requirements'+'/'+ str(reqid) + '/i/map/gbf/'
		if username:
			securl += username +'/'
		headers = {'Authorization': 'Token '+ self.token}
		r = requests.post(securl, headers= headers, files = {'geoms.gbf':geoms})
		return r<commit_msg>updated gdh client<commit_after>import requests, json

class GeodesignHubClient():

	def __init__(self, url, token, project_id):
		self.projectid = project_id
		self.token = token
		self.securl = url if url else 'https://www.geodesignhub.com/api/v1/'

	def get_diagram_geoms(self, diagid):
		''' Create a requests object with correct headers and creds. '''
		securl = self.securl+ 'projects'+ '/' + self.projectid + '/' +'diagrams' + '/'+ str(diagid) +'/'
		headers = {'Authorization': 'Token '+ self.token}
		r = requests.get(securl, headers=headers)
		return r

	def post_as_diagram(self,geometry, projectorpolicy, featuretype, description, reqid ):
		''' Create a requests object with correct headers and creds. '''
		securl = self.securl+ 'projects'+ '/' + self.projectid + '/' +'requirements'+'/'+ str(reqid) + '/'+ 'add' +'/' + projectorpolicy +'/'
		headers = {'Authorization': 'Token '+ self.token, 'content-type': 'application/json'}
		postdata = {'geometry':geometry, 'description':description, 'featuretype':featuretype}
		r = requests.post(securl, headers= headers, data = json.dumps(postdata))
		return r

	def post_as_ealuation_JSON(self, geometry, reqid, username=None):
		''' Create a requests object with correct headers and creds. '''
		securl = self.securl+ 'projects'+ '/' + self.projectid + '/' +'requirements'+'/'+ str(reqid) + '/e/map/json/'
		if username:
			securl += username +'/'
		headers = {'Authorization': 'Token '+ self.token, 'content-type': 'application/json'}

		r = requests.post(securl, headers= headers, data = json.dumps(geometry))
		return r

	def post_as_impact_JSON(self, geometry, reqid, username=None):
		''' Create a requests object with correct headers and creds. '''

		securl = self.securl+ 'projects'+ '/' + self.projectid + '/' +'requirements'+'/'+ str(reqid) + '/i/map/json/'
		if username:
			securl += username +'/'

		headers = {'Authorization': 'Token '+ self.token, 'content-type': 'application/json'}
		r = requests.post(securl, headers= headers, data = json.dumps(geometry))
		return r

	def post_as_evaluation_GBF(self, geometry, reqid, username=None):
		''' Create a requests object with correct headers and creds. '''
		securl = self.securl+ 'projects'+ '/' + self.projectid + '/' +'requirements'+'/'+ str(reqid) + '/e/map/gbf/'
		if username:
			securl += username +'/'
		headers = {'Authorization': 'Token '+ self.token}

		r = requests.post(securl, headers= headers, files = {'geoms.gbf':geometry})
		return r

	def post_as_impact_GBF(self, geometry, reqid, username=None):
		''' Create a requests object with correct headers and creds. '''

		securl = self.securl+ 'projects'+ '/' + self.projectid + '/' +'requirements'+'/'+ str(reqid) + '/i/map/gbf/'
		if username:
			securl += username +'/'
		headers = {'Authorization': 'Token '+ self.token}
		r = requests.post(securl, headers= headers, files = {'geoms.gbf':geometry})
		return r
{'fraction_non_alphanumeric': 0.1737120211360634, 'fraction_numerical': 0.00033025099075297226, 'mean_word_length': 4.408035714285714, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5674721', 'n_tokens_mistral': 2162, 'n_tokens_neox': 1968, 'n_words': 506}