@@ -182,6 +182,26 @@ def uninstall_dependencies(self, tool_id: str) -> dict:
182182 url = self ._make_url (tool_id ) + "/dependencies"
183183 return self ._delete (url = url )
184184
185+ def get_tool_source (self , tool_id : str ) -> str :
186+ """
187+ Get the raw tool XML source for a given tool ID.
188+
189+ :type tool_id: str
190+ :param tool_id: id of the requested tool
191+
192+ :rtype: str
193+ :return: Tool XML source as a string
194+
195+ .. note::
196+ This method works only on Galaxy 22.01 or later and if the user is a
197+ Galaxy admin or the Galaxy instance has the
198+ ``enable_tool_source_display`` option set to ``true`` in the
199+ ``config/galaxy.yml`` configuration file.
200+ """
201+ raw_source_url = self ._make_url (tool_id ) + "/raw_tool_source"
202+ ht_response = self ._get (url = raw_source_url , json = False )
203+ return ht_response .text
204+
185205 def show_tool (self , tool_id : str , io_details : bool = False , link_details : bool = False ) -> dict [str , Any ]:
186206 """
187207 Get details of a given tool.
@@ -216,7 +236,8 @@ def get_tool_tests(self, tool_id: str, tool_version: str | None = None) -> list[
216236 the tests for all available tool versions.
217237
218238 :rtype: list
219- :return: List of test case definitions, e.g.::
239+ :return: List of test case definitions.
240+ For example::
220241
221242 [
222243 {
@@ -551,10 +572,10 @@ def post_to_fetch(self, path: str, history_id: str, session_id: str, **kwargs: A
551572 :type session_id: str
552573 :param session_id: Session ID returned by the tus service
553574
554- See :meth:`upload_file` for additional parameters.
555-
556575 :rtype: dict
557576 :return: Information about the created upload job
577+
578+ See :meth:`upload_file` for additional parameters.
558579 """
559580 payload = self ._fetch_payload (path , history_id , session_id , ** kwargs )
560581 url = "/" .join ((self .gi .url , "tools/fetch" ))
@@ -571,10 +592,10 @@ def upload_from_ftp(self, path: str, history_id: str, **kwargs: Any) -> dict[str
571592 :type history_id: str
572593 :param history_id: id of the history where to upload the file
573594
574- See :meth:`upload_file` for the optional parameters.
575-
576595 :rtype: dict
577596 :return: Information about the created upload job
597+
598+ See :meth:`upload_file` for the optional parameters.
578599 """
579600 payload = self ._upload_payload (history_id , ** kwargs )
580601 payload ["files_0|ftp_files" ] = path
0 commit comments