Skip to content

MAPI service MorpheeResults

To get MorpheeResults service use:

result_service = MAPIServices.instance.get_service("MorpheeResults")

MorpheeResultsServiceProxy

Bases: MAPIService

MORPHEEResults MAPI service allows to get MORPHEE result files

Source code in restmapi\restmapi\services.py
class MorpheeResultsServiceProxy(MAPIService):
	"""MORPHEEResults MAPI service allows to get MORPHEE result files"""
	def __init__(self, url=None):
		"""DO NOT create MorpheeResultsServiceProxy by yourself. Always use MAPIServices.get_service("MorpheeResults") method to create it.

		Parameters
		----------
		url : string
			Base URL to create of the REST service.
		"""
		super().__init__(url)

	def list(self, filter, skip, count):
		"""Get the MorpheeResultProxy list of MORPHEE testrun results.

		Parameters
		----------
		filter : string
			Use filter to filter the list of URLs. We get only result folder that starts with filter. Note that filter must be the complete name of a subfolder with \ separator (e.g. master\TESTRESULTS) 
		skip : int
			0 based start page index
		count : int
			Number of testrun grouped by page

		Returns
		-------
		MorpheeResultProxy array
			List of MorpheeResultProxy. Each MorpheeResultProxy manages result files of a MORPHEE testrun.
		"""
		return [MorpheeResultProxy(url) for url in self.invoke_web_get_request(f"List?skip={skip}&count={count}&filter={filter}")]

__init__(url=None)

DO NOT create MorpheeResultsServiceProxy by yourself. Always use MAPIServices.get_service("MorpheeResults") method to create it.

Parameters:

  • url (string, default: None ) –
    Base URL to create of the REST service.
    
Source code in restmapi\restmapi\services.py
def __init__(self, url=None):
	"""DO NOT create MorpheeResultsServiceProxy by yourself. Always use MAPIServices.get_service("MorpheeResults") method to create it.

	Parameters
	----------
	url : string
		Base URL to create of the REST service.
	"""
	super().__init__(url)

list(filter, skip, count)

Get the MorpheeResultProxy list of MORPHEE testrun results.

Parameters:

  • filter (string) –
    Use filter to filter the list of URLs. We get only result folder that starts with filter. Note that filter must be the complete name of a subfolder with \ separator (e.g. master\TESTRESULTS)
    
  • skip (int) –
    0 based start page index
    
  • count (int) –
    Number of testrun grouped by page
    

Returns:

  • MorpheeResultProxy array

    List of MorpheeResultProxy. Each MorpheeResultProxy manages result files of a MORPHEE testrun.

Source code in restmapi\restmapi\services.py
def list(self, filter, skip, count):
	"""Get the MorpheeResultProxy list of MORPHEE testrun results.

	Parameters
	----------
	filter : string
		Use filter to filter the list of URLs. We get only result folder that starts with filter. Note that filter must be the complete name of a subfolder with \ separator (e.g. master\TESTRESULTS) 
	skip : int
		0 based start page index
	count : int
		Number of testrun grouped by page

	Returns
	-------
	MorpheeResultProxy array
		List of MorpheeResultProxy. Each MorpheeResultProxy manages result files of a MORPHEE testrun.
	"""
	return [MorpheeResultProxy(url) for url in self.invoke_web_get_request(f"List?skip={skip}&count={count}&filter={filter}")]

MorpheeResultProxy

Bases: MAPIService

MORPHEEResultProxy represents the results of one TestRun (it describe the content of one .files file)

Source code in restmapi\restmapi\services.py
class MorpheeResultProxy(MAPIService):
	"""MORPHEEResultProxy represents the results of one TestRun (it describe the content of one .files file)"""
	def __init__(self, url):
		"""DO NOT create MorpheeResultProxy by yourself. Always use MAPIServices.get_service("MorpheeResults").list() method to create one.

		Parameters
		----------
		url : string
			Base URL to create of the REST service.
		"""
		super().__init__(url)

	def get_files(self):
		"""Result files description. It returns the content of the .files.

		Returns
		-------
		MorpheeResultFileProxy array
			Each entry of the .files MORPHEE file.
		"""
		return [MorpheeResultFileProxy(self._mapi_base_url, url) for url in self.invoke_web_get_request("")]

__init__(url)

DO NOT create MorpheeResultProxy by yourself. Always use MAPIServices.get_service("MorpheeResults").list() method to create one.

Parameters:

  • url (string) –
    Base URL to create of the REST service.
    
Source code in restmapi\restmapi\services.py
def __init__(self, url):
	"""DO NOT create MorpheeResultProxy by yourself. Always use MAPIServices.get_service("MorpheeResults").list() method to create one.

	Parameters
	----------
	url : string
		Base URL to create of the REST service.
	"""
	super().__init__(url)

get_files()

Result files description. It returns the content of the .files.

Returns:

  • MorpheeResultFileProxy array

    Each entry of the .files MORPHEE file.

Source code in restmapi\restmapi\services.py
def get_files(self):
	"""Result files description. It returns the content of the .files.

	Returns
	-------
	MorpheeResultFileProxy array
		Each entry of the .files MORPHEE file.
	"""
	return [MorpheeResultFileProxy(self._mapi_base_url, url) for url in self.invoke_web_get_request("")]

MorpheeResultFileProxy

Bases: MAPIService

MorpheeResultFileProxy is one MORPHEE result file

Source code in restmapi\restmapi\services.py
class MorpheeResultFileProxy(MAPIService):
	"""MorpheeResultFileProxy is one MORPHEE result file"""
	def __init__(self, parent_url, entry):
		"""DO NOT create MorpheeResultFileProxy by yourself. Always use MorpheeResultProxy.get_files() method to create one.

		Parameters
		----------
		parent_url : string
			Base URL to create of the REST service.
		entry :
			Json object returned by the server		

		"""
		super().__init__(f"{parent_url}/{entry['id']}")
		self._group = entry['group']
		self._id = entry['id']
		self._local = entry['local']
		self._name = entry['name']
		self._storage_key = entry['storageKey']
		self._type = entry['type']

	@property
	def group(self) -> str:
		"""Point group name"""		
		return self._group		

	@property
	def id(self) -> str:
		"""Point file id (unique id used inside the url)"""		
		return self.id			

	@property
	def local(self) -> int:
		"""Integer value that defines the status of the file (-1 file is deleted, 0 the file is located one another computer, 1 local file"""		
		return self._local					

	@property
	def name(self) -> str:
		"""Full path of the result file"""		
		return self._name					

	@property
	def storage_key(self) -> str:
		"""Storage key name"""		
		return self._storage_key

	@property
	def type(self) -> str:
		"""File format (MASCII, CSV, MDF4,...)"""		
		return self._type					

	def get_raw_content(self):
		"""Get raw content of a MORPHEE result file. To be used on MDF4 files.

		Returns
		-------
		byte array
			Content of the file.
		"""
		return self.invoke_web_request("", "GET", None, True).content

	def get_text_content(self):
		"""Get text content of a MORPHEE result file. To be used on MASCII or CSV files.

		Returns
		-------
		string
			Content of the file.
		"""
		content = self.invoke_web_request("", "GET", None, True).text
		return content#.decode('utf-8')

group property

Point group name

id property

Point file id (unique id used inside the url)

local property

Integer value that defines the status of the file (-1 file is deleted, 0 the file is located one another computer, 1 local file

name property

Full path of the result file

storage_key property

Storage key name

type property

File format (MASCII, CSV, MDF4,...)

__init__(parent_url, entry)

DO NOT create MorpheeResultFileProxy by yourself. Always use MorpheeResultProxy.get_files() method to create one.

Parameters:

  • parent_url (string) –
    Base URL to create of the REST service.
    
  • entry
    Json object returned by the server
    
Source code in restmapi\restmapi\services.py
def __init__(self, parent_url, entry):
	"""DO NOT create MorpheeResultFileProxy by yourself. Always use MorpheeResultProxy.get_files() method to create one.

	Parameters
	----------
	parent_url : string
		Base URL to create of the REST service.
	entry :
		Json object returned by the server		

	"""
	super().__init__(f"{parent_url}/{entry['id']}")
	self._group = entry['group']
	self._id = entry['id']
	self._local = entry['local']
	self._name = entry['name']
	self._storage_key = entry['storageKey']
	self._type = entry['type']

get_raw_content()

Get raw content of a MORPHEE result file. To be used on MDF4 files.

Returns:

  • byte array

    Content of the file.

Source code in restmapi\restmapi\services.py
def get_raw_content(self):
	"""Get raw content of a MORPHEE result file. To be used on MDF4 files.

	Returns
	-------
	byte array
		Content of the file.
	"""
	return self.invoke_web_request("", "GET", None, True).content

get_text_content()

Get text content of a MORPHEE result file. To be used on MASCII or CSV files.

Returns:

  • string

    Content of the file.

Source code in restmapi\restmapi\services.py
def get_text_content(self):
	"""Get text content of a MORPHEE result file. To be used on MASCII or CSV files.

	Returns
	-------
	string
		Content of the file.
	"""
	content = self.invoke_web_request("", "GET", None, True).text
	return content#.decode('utf-8')