File tree Expand file tree Collapse file tree 2 files changed +13
-13
lines changed Expand file tree Collapse file tree 2 files changed +13
-13
lines changed Original file line number Diff line number Diff line change @@ -237,23 +237,24 @@ def _optimize_union(self, t: DUnion):
237237
238238 types = [self .optimize_type (t ) for t in other_types ]
239239
240- if Unknown in types :
241- types .remove (Unknown )
242-
243- optional = False
244- if Null in types :
245- optional = True
246- while Null in types :
247- types .remove (Null )
248240
249241 if len (types ) > 1 :
242+ if Unknown in types :
243+ types .remove (Unknown )
244+
245+ optional = False
246+ if Null in types :
247+ optional = True
248+ while Null in types :
249+ types .remove (Null )
250+
250251 meta_type = DUnion (* types )
251252 if len (meta_type .types ) == 1 :
252253 meta_type = meta_type .types [0 ]
254+
255+ if optional :
256+ return DOptional (meta_type )
253257 else :
254258 meta_type = types [0 ]
255259
256- if optional :
257- return DOptional (meta_type )
258- else :
259- return meta_type
260+ return meta_type
Original file line number Diff line number Diff line change @@ -29,7 +29,6 @@ def load_data() -> dict:
2929
3030def main ():
3131 data = load_data ()
32- del data ["paths" ]
3332
3433 gen = MetadataGenerator (
3534 dict_keys_regex = [],
You can’t perform that action at this time.
0 commit comments