in usort/types.py [0:0]
def calculate_sort_key(self) -> None:
top: Optional[str] = None
ndots = 0
if self.stem is None:
top = top_level_name(self.items[0].name)
elif not self.stem.startswith("."):
top = top_level_name(self.stem)
else:
# replicate ... sorting before .. before ., but after absolute
ndots = 100 - (len(self.stem) - len(self.stem.lstrip(".")))
category = self.config.category(top) if top else CAT_FIRST_PARTY
self.sort_key = SortKey(
# TODO this will raise on missing category
category_index=self.config.categories.index(category),
is_from_import=bool(self.stem),
ndots=ndots,
)