@@ -465,8 +465,7 @@ def imports_closure(
465465 # visit item
466466 sn = todo .pop ()
467467 if sn not in self .schema_map :
468- imported_schema = self .load_import (sn )
469- self .schema_map [sn ] = imported_schema
468+ self .schema_map [sn ] = self .load_import (sn )
470469
471470 # resolve item's imports if it has not been visited already
472471 # we will get duplicates, but not cycles this way, and
@@ -1904,6 +1903,10 @@ def slot_applicable_range_elements(self, slot: SlotDefinition) -> list[ClassDefi
19041903 :param slot:
19051904 :return: list of element types
19061905 """
1906+ if not slot or not isinstance (slot , SlotDefinition ):
1907+ err_msg = "A SlotDefinition must be provided to generate the slot applicable range elements."
1908+ raise ValueError (err_msg )
1909+
19071910 is_any = False
19081911 range_types = []
19091912 for r in self .slot_range_as_union (slot ):
@@ -1930,6 +1933,10 @@ def slot_range_as_union(self, slot: SlotDefinition) -> list[ElementName]:
19301933 :param slot:
19311934 :return: list of ranges
19321935 """
1936+ if not slot or not isinstance (slot , SlotDefinition ):
1937+ err_msg = "A SlotDefinition must be provided to generate the slot range as union."
1938+ raise ValueError (err_msg )
1939+
19331940 return list ({y .range for y in [slot , * [x for x in [* slot .exactly_one_of , * slot .any_of ] if x .range ]]})
19341941
19351942 def induced_slot_range (self , slot : SlotDefinition , strict : bool = False ) -> set [str | ElementName ]: # noqa: FBT001, FBT002
@@ -1947,6 +1954,9 @@ def induced_slot_range(self, slot: SlotDefinition, strict: bool = False) -> set[
19471954 :return: set of ranges
19481955 :rtype: set[str | ElementName]
19491956 """
1957+ if not slot or not isinstance (slot , SlotDefinition ):
1958+ err_msg = "A SlotDefinition must be provided to generate the induced slot range."
1959+ raise ValueError (err_msg )
19501960
19511961 slot_range = slot .range
19521962 any_of_range = {x .range for x in slot .any_of if x .range }
0 commit comments