@@ -255,14 +255,20 @@ def visit_sequence_pattern(self, o: SequencePattern) -> PatternType:
255255        state : (
256256            # Start in the state where we not encountered an unpack. 
257257            # a list of all the possible types that could match the sequence. If it's a tuple, then store one for each index 
258-             tuple [Literal ["NO_UNPACK" ], list [list [Type ]]] | 
258+             tuple [Literal ["NO_UNPACK" ], list [list [Type ]]]
259+             | 
259260            # If we encounter a single tuple with an unpack, store the type, the unpack index, and the index in the union type 
260-             tuple [Literal ["UNPACK" ], TupleType , int , int ] | 
261+             tuple [Literal ["UNPACK" ], TupleType , int , int ]
262+             | 
261263            # If we have encountered a tuple with an unpack plus any other types, then store a list of them. For any tuples 
262264            # without unpacks, store them as a list of their items. 
263265            tuple [Literal ["MULTI_UNPACK" ], list [list [Type ]]]
264-          ) =  ("NO_UNPACK" , [])
265-         for  i , t  in  enumerate (current_type .items ) if  isinstance (current_type , UnionType ) else  ((0 , current_type ),):
266+         ) =  ("NO_UNPACK" , [])
267+         for  i , t  in  (
268+             enumerate (current_type .items )
269+             if  isinstance (current_type , UnionType )
270+             else  ((0 , current_type ),)
271+         ):
266272            t  =  get_proper_type (t )
267273            n_patterns  =  len (o .patterns )
268274            if  isinstance (t , TupleType ):
@@ -301,8 +307,11 @@ def visit_sequence_pattern(self, o: SequencePattern) -> PatternType:
301307            # if we previously encountered an unpack, then change the state. 
302308            if  state [0 ] ==  "UNPACK" :
303309                # if we already unpacked something, change this 
304-                 state  =  ("MULTI_UNPACK" , [[self .chk .iterable_item_type (tuple_fallback (state [1 ]), o )] *  n_patterns ])
305-             assert  state [0 ] !=  "UNPACK"  # for type checker 
310+                 state  =  (
311+                     "MULTI_UNPACK" ,
312+                     [[self .chk .iterable_item_type (tuple_fallback (state [1 ]), o )] *  n_patterns ],
313+                 )
314+             assert  state [0 ] !=  "UNPACK"   # for type checker 
306315            state [1 ].append (inner_t )
307316        if  state [0 ] ==  "UNPACK" :
308317            _ , update_tuple_type , unpack_index , union_index  =  state 
@@ -318,7 +327,10 @@ def visit_sequence_pattern(self, o: SequencePattern) -> PatternType:
318327            unpack_index  =  None 
319328            if  not  state [1 ]:
320329                return  self .early_non_match ()
321-             inner_types  =  [make_simplified_union (x ) for  x  in  zip_longest (* state [1 ], fillvalue = UninhabitedType ())]
330+             inner_types  =  [
331+                 make_simplified_union (x )
332+                 for  x  in  zip_longest (* state [1 ], fillvalue = UninhabitedType ())
333+             ]
322334
323335        # 
324336        # match inner patterns 
0 commit comments