@@ -255,7 +255,8 @@ def find_axioms(
255255 try :
256256 regex_pattern = re .compile (pattern )
257257 except re .error as e :
258- raise re .error (f"Invalid regex pattern '{ pattern } ': { e } " ) from e
258+ msg = f"Invalid regex pattern '{ pattern } ': { e } "
259+ raise re .error (msg ) from e
259260
260261 for axiom in axioms :
261262 if axiom_type and not axiom .startswith (axiom_type + "(" ):
@@ -289,7 +290,7 @@ def find_axioms(
289290 break
290291
291292 if prefix_start < colon_idx : # We have a potential prefix
292- prefix = axiom_str [prefix_start :colon_idx ]
293+ _ = axiom_str [prefix_start :colon_idx ] # prefix var not used
293294
294295 # Find the end of the IRI
295296 end_idx = len (axiom_str )
@@ -366,7 +367,7 @@ def get_all_axiom_strings(
366367 break
367368
368369 if prefix_start < colon_idx : # We have a potential prefix
369- prefix = axiom_str [prefix_start :colon_idx ]
370+ _ = axiom_str [prefix_start :colon_idx ] # prefix var not used
370371
371372 # Find the end of the IRI
372373 end_idx = len (axiom_str )
@@ -549,7 +550,7 @@ def get_labels_for_iri(self, iri: str, annotation_property: Optional[str] = None
549550 label_property = annotation_property or self .annotation_property
550551
551552 # Check if iri is a CURIE (e.g. "ex:Person") and handle appropriately
552- if ":" in iri and not ( iri .startswith ("http://" ) or iri . startswith ( "https://" )):
553+ if ":" in iri and not iri .startswith (( "http://" , "https://" )):
553554 # This is a prefixed IRI, we need to get the full IRI
554555 prefix , local = iri .split (":" , 1 )
555556 # Get all prefixes to find the right one
@@ -566,12 +567,12 @@ def get_labels_for_iri(self, iri: str, annotation_property: Optional[str] = None
566567 # Get all annotations for this IRI with the specified property
567568 try :
568569 labels = self .ontology .get_annotations (full_iri , label_property )
569-
570- # Return the string values of the annotations
571- return labels if labels else []
572570 except Exception as e :
573571 logger .debug (f"Error getting labels for IRI { iri } : { e } " )
574572 return []
573+ else :
574+ # Return the string values of the annotations
575+ return labels if labels else []
575576
576577 def stop (self ) -> None :
577578 """
0 commit comments