File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed
Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -60,25 +60,34 @@ def is_paired(input_string: str) -> bool:
6060 while paired and brackets_list :
6161 logger .info ("brackets_list: %s" , brackets_list )
6262 for i , bracket in enumerate (brackets_list ):
63-
6463 if bracket in RIGHT :
6564 paired = False
6665 logger .info ("Right side bracket found: %s. Return False." , bracket )
6766 break
6867
6968 if i + 1 < len (brackets_list ):
70- if brackets_list [i + 1 ] != PAIRS [bracket ] and brackets_list [- 1 ] != PAIRS [bracket ]:
69+ if (
70+ brackets_list [i + 1 ] != PAIRS [bracket ]
71+ and brackets_list [- 1 ] != PAIRS [bracket ]
72+ ):
7173 paired = False
7274 logger .info ("No matching bracket found: %s. Return False." , bracket )
7375 break
7476 else :
7577 if brackets_list [i + 1 ] == PAIRS [bracket ]:
76- logger .info ("Matching pair found: %s." , brackets_list [:2 ], )
78+ logger .info (
79+ "Matching pair found: %s." ,
80+ brackets_list [:2 ],
81+ )
7782 del brackets_list [1 ]
7883 del brackets_list [0 ]
7984 break
8085 elif brackets_list [- 1 ] == PAIRS [bracket ]:
81- logger .info ("Matching pair found: %s %s." , brackets_list [0 ], brackets_list [- 1 ])
86+ logger .info (
87+ "Matching pair found: %s %s." ,
88+ brackets_list [0 ],
89+ brackets_list [- 1 ],
90+ )
8291 del brackets_list [0 ]
8392 del brackets_list [- 1 ]
8493 break
You can’t perform that action at this time.
0 commit comments