|
1 | 1 | # Copyright (c) Microsoft Corporation. |
2 | 2 | # Licensed under the MIT License. |
3 | 3 |
|
| 4 | +from collections.abc import Sequence |
4 | 5 | import enum |
5 | 6 | from typing import assert_never |
6 | 7 |
|
@@ -156,7 +157,13 @@ def collect_action_properties( |
156 | 157 | if action.object_entity_name != "none": |
157 | 158 | props.append((PropertyNames.Object.value, action.object_entity_name, ordinal)) |
158 | 159 | if action.indirect_object_entity_name != "none": |
159 | | - props.append((PropertyNames.IndirectObject.value, action.indirect_object_entity_name, ordinal)) |
| 160 | + props.append( |
| 161 | + ( |
| 162 | + PropertyNames.IndirectObject.value, |
| 163 | + action.indirect_object_entity_name, |
| 164 | + ordinal, |
| 165 | + ) |
| 166 | + ) |
160 | 167 | return props |
161 | 168 |
|
162 | 169 |
|
@@ -186,15 +193,23 @@ async def add_to_property_index( |
186 | 193 | assert semantic_ref.semantic_ref_ordinal == semantic_ref_ordinal |
187 | 194 | if isinstance(semantic_ref.knowledge, kplib.Action): |
188 | 195 | collected.extend( |
189 | | - collect_action_properties(semantic_ref.knowledge, semantic_ref_ordinal) |
| 196 | + collect_action_properties( |
| 197 | + semantic_ref.knowledge, semantic_ref_ordinal |
| 198 | + ) |
190 | 199 | ) |
191 | 200 | elif isinstance(semantic_ref.knowledge, kplib.ConcreteEntity): |
192 | 201 | collected.extend( |
193 | | - collect_entity_properties(semantic_ref.knowledge, semantic_ref_ordinal) |
| 202 | + collect_entity_properties( |
| 203 | + semantic_ref.knowledge, semantic_ref_ordinal |
| 204 | + ) |
194 | 205 | ) |
195 | 206 | elif isinstance(semantic_ref.knowledge, Tag): |
196 | 207 | collected.append( |
197 | | - (PropertyNames.Tag.value, semantic_ref.knowledge.text, semantic_ref_ordinal) |
| 208 | + ( |
| 209 | + PropertyNames.Tag.value, |
| 210 | + semantic_ref.knowledge.text, |
| 211 | + semantic_ref_ordinal, |
| 212 | + ) |
198 | 213 | ) |
199 | 214 | elif isinstance(semantic_ref.knowledge, Topic): |
200 | 215 | pass |
@@ -239,7 +254,9 @@ async def add_property( |
239 | 254 |
|
240 | 255 | async def add_properties_batch( |
241 | 256 | self, |
242 | | - properties: list[tuple[str, str, SemanticRefOrdinal | ScoredSemanticRefOrdinal]], |
| 257 | + properties: Sequence[ |
| 258 | + tuple[str, str, SemanticRefOrdinal | ScoredSemanticRefOrdinal] |
| 259 | + ], |
243 | 260 | ) -> None: |
244 | 261 | for name, value, ordinal in properties: |
245 | 262 | await self.add_property(name, value, ordinal) |
|
0 commit comments