Skip to content

Commit

Permalink
Get rid of '# type: ignore', make add_metadata_to_index generic in me…
Browse files Browse the repository at this point in the history
…ssage type
  • Loading branch information
gvanrossum-ms committed Mar 8, 2025
1 parent 8bbee3b commit e17ed79
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions python/kp/knowpro/convindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ def text_range_from_location(
]


def add_metadata_to_index(
messages: list[IMessage],
def add_metadata_to_index[TMessage: IMessage](
messages: list[TMessage],
semantic_refs: list[SemanticRef],
semantic_ref_index: ITermToSemanticRefIndex,
knowledge_validator: KnowledgeValidator | None = None,
Expand Down
4 changes: 2 additions & 2 deletions python/kp/memconv/import_podcasts.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class Podcast(interfaces.IConversation[PodcastMessage]):

# __init__() parameters, in that order (via `@dataclass`).
name_tag: str = field(default="")
messages: list[PodcastMessage] = field( # type: ignore
messages: list[PodcastMessage] = field(
default_factory=list
)
tags: list[str] = field(default_factory=list)
Expand All @@ -101,7 +101,7 @@ def add_metadata_to_index(self) -> None:
if self.semantic_ref_index:
assert self.semantic_refs is not None
convindex.add_metadata_to_index(
self.messages, # type: ignore
self.messages,
self.semantic_refs,
self.semantic_ref_index,
)
Expand Down

0 comments on commit e17ed79

Please sign in to comment.