@@ -155,7 +155,7 @@ def _extract_user_message_example(self, flow: Flow) -> None:
155
155
# The SpecOp.spec type is Union[Spec, dict]. Convert Dict to Spec if it's provided
156
156
match_spec : Spec = (
157
157
spec_op .spec
158
- if type (spec_op .spec ) == Spec
158
+ if isinstance (spec_op .spec , Spec )
159
159
else Spec (** cast (Dict , spec_op .spec ))
160
160
)
161
161
@@ -178,7 +178,7 @@ def _extract_user_message_example(self, flow: Flow) -> None:
178
178
# which isn't in the Spec definition
179
179
await_spec_dict : Dict [str , Any ] = (
180
180
asdict (spec_op .spec )
181
- if type (spec_op .spec ) == Spec
181
+ if isinstance (spec_op .spec , Spec )
182
182
else cast (Dict , spec_op .spec )
183
183
)
184
184
@@ -212,15 +212,15 @@ def _extract_bot_message_example(self, flow: Flow):
212
212
213
213
el = flow .elements [1 ]
214
214
215
- if type (el ) != SpecOp :
215
+ if not isinstance (el , SpecOp ) :
216
216
return
217
217
218
218
spec_op : SpecOp = cast (SpecOp , el )
219
219
spec : Dict [str , Any ] = (
220
220
asdict (
221
221
spec_op .spec
222
- ) # TODO! Refactor thiss function as it's duplicated in many places
223
- if type (spec_op .spec ) == Spec
222
+ ) # TODO! Refactor this function as it's duplicated in many places
223
+ if isinstance (spec_op .spec , Spec )
224
224
else cast (Dict , spec_op .spec )
225
225
)
226
226
@@ -240,7 +240,7 @@ def _process_flows(self):
240
240
"""Process the provided flows to extract the user utterance examples."""
241
241
# Flows can be either Flow or Dict. Convert them all to Flow for following code
242
242
flows : List [Flow ] = [
243
- cast (Flow , flow ) if type (flow ) == Flow else Flow (** cast (Dict , flow ))
243
+ cast (Flow , flow ) if isinstance (flow , Flow ) else Flow (** cast (Dict , flow ))
244
244
for flow in self .config .flows
245
245
]
246
246
0 commit comments