44Interacts with the SPARQL Anything GitHub repository.
55
66Author: Marco Ratta
7- Date: 29/02/2024
7+ Last Modified: 23/06/2025
88"""
99
1010import os
@@ -28,7 +28,7 @@ def has_jar():
2828 return False
2929
3030
31- def get_release_uri (ghub : Github , uri : str , version : str ) -> str :
31+ def get_release_url (ghub : Github , uri : str , version : str ) -> str :
3232 """
3333 Retrieves the download url for latest SPARQL Anything release.\n
3434 Args:\n
@@ -43,12 +43,12 @@ def get_release_uri(ghub: Github, uri: str, version: str) -> str:
4343 """
4444 try :
4545 repo = ghub .get_repo (uri )
46- release = repo .get_release (version )
47- jar = None
46+ release = repo .get_release (version )
47+ url = ""
4848 for asset in release .assets :
4949 if asset .name == f'sparql-anything-{ version } .jar' :
50- jar = asset
51- return jar . browser_download_url
50+ url = asset . browser_download_url
51+ return url
5252 except RateLimitExceededException as exc :
5353 print ('WARNING !!! get_release_url() raised a '
5454 + f'{ type (exc )} exception and passed it on.' )
@@ -73,7 +73,7 @@ def download_sparql_anything(ghub: Github, uri: str, version: str) -> None:
7373 path2jar = os .path .join (
7474 get_module_path (), f'sparql-anything-{ version } .jar'
7575 )
76- dl_link = get_release_uri (ghub , uri , version )
76+ dl_link = get_release_url (ghub , uri , version )
7777 request = requests .get (dl_link , stream = True , timeout = 10.0 )
7878 length = int (request .headers .get ('content-length' , 0 ))
7979 with open (path2jar , 'wb' ) as jar :
@@ -123,16 +123,13 @@ def get_path2jar():
123123 return path
124124
125125
126- def remove_sparql_anything ():
126+ def remove_jar ():
127127 """
128128 Removes the SPARQL Anything jar from the installation folder.\n
129129 Raises:\n
130130 FileNotFoundError.
131131 """
132132 try :
133133 os .remove (get_path2jar ())
134- print ("SPARQL Anything sucessfully removed" )
135134 except FileNotFoundError as err :
136- print ('WARNING !!! remove_sparql_anything() raised a '
137- + f'{ type (err )} exception and re-raised it.' )
138- raise
135+ raise err
0 commit comments