@@ -1425,7 +1425,7 @@ def parser_debug_msg(msg: str, line: str, ln: int):
1425
1425
select_counter = 0
1426
1426
block_id_stack = []
1427
1427
semi_split = []
1428
- doc_string = None
1428
+ doc_string : str = None
1429
1429
if file_obj .fixed :
1430
1430
COMMENT_LINE_MATCH = FIXED_COMMENT_LINE_MATCH
1431
1431
DOC_COMMENT_MATCH = FIXED_DOC_MATCH
@@ -1448,15 +1448,15 @@ def parser_debug_msg(msg: str, line: str, ln: int):
1448
1448
continue # Skip empty lines
1449
1449
# Skip comment lines
1450
1450
match = COMMENT_LINE_MATCH .match (line )
1451
- if match is not None :
1451
+ if match :
1452
1452
# Check for documentation
1453
1453
doc_match = DOC_COMMENT_MATCH .match (line )
1454
- if doc_match is not None :
1454
+ if doc_match :
1455
1455
doc_lines = [line [doc_match .end (0 ) :].strip ()]
1456
1456
if doc_match .group (1 ) == ">" :
1457
1457
doc_forward = True
1458
1458
else :
1459
- if ( doc_string is not None ) and ( doc_string != "" ) :
1459
+ if doc_string :
1460
1460
doc_lines = [doc_string ] + doc_lines
1461
1461
doc_string = None
1462
1462
doc_forward = False
@@ -1482,7 +1482,7 @@ def parser_debug_msg(msg: str, line: str, ln: int):
1482
1482
)
1483
1483
continue
1484
1484
# Handle trailing doc strings
1485
- if ( doc_string is not None ) and ( doc_string != "" ) :
1485
+ if doc_string :
1486
1486
file_ast .add_doc ("!! " + doc_string )
1487
1487
log .debug (f"{ doc_string } !!! Doc string({ line_number } )" )
1488
1488
doc_string = None
@@ -1539,7 +1539,7 @@ def parser_debug_msg(msg: str, line: str, ln: int):
1539
1539
if file_ast .END_SCOPE_REGEX is not None :
1540
1540
match = END_WORD_REGEX .match (line_no_comment )
1541
1541
# Handle end statement
1542
- if match is not None :
1542
+ if match :
1543
1543
end_scope_word = None
1544
1544
if match .group (1 ) is None :
1545
1545
end_scope_word = ""
@@ -1580,11 +1580,11 @@ def parser_debug_msg(msg: str, line: str, ln: int):
1580
1580
continue
1581
1581
# Skip if known generic code line
1582
1582
match = NON_DEF_REGEX .match (line_no_comment )
1583
- if match is not None :
1583
+ if match :
1584
1584
continue
1585
1585
# Mark implicit statement
1586
1586
match = IMPLICIT_REGEX .match (line_no_comment )
1587
- if match is not None :
1587
+ if match :
1588
1588
err_message = None
1589
1589
if file_ast .current_scope is None :
1590
1590
err_message = "IMPLICIT statement without enclosing scope"
@@ -1593,7 +1593,7 @@ def parser_debug_msg(msg: str, line: str, ln: int):
1593
1593
file_ast .current_scope .set_implicit (False , line_number )
1594
1594
else :
1595
1595
file_ast .current_scope .set_implicit (True , line_number )
1596
- if err_message is not None :
1596
+ if err_message :
1597
1597
file_ast .parse_errors .append (
1598
1598
{
1599
1599
"line" : line_number ,
@@ -1607,7 +1607,7 @@ def parser_debug_msg(msg: str, line: str, ln: int):
1607
1607
continue
1608
1608
# Mark contains statement
1609
1609
match = CONTAINS_REGEX .match (line_no_comment )
1610
- if match is not None :
1610
+ if match :
1611
1611
err_message = None
1612
1612
try :
1613
1613
if file_ast .current_scope is None :
@@ -1616,7 +1616,7 @@ def parser_debug_msg(msg: str, line: str, ln: int):
1616
1616
file_ast .current_scope .mark_contains (line_number )
1617
1617
except ValueError :
1618
1618
err_message = "Multiple CONTAINS statements in scope"
1619
- if err_message is not None :
1619
+ if err_message :
1620
1620
file_ast .parse_errors .append (
1621
1621
{
1622
1622
"line" : line_number ,
@@ -1629,9 +1629,9 @@ def parser_debug_msg(msg: str, line: str, ln: int):
1629
1629
parser_debug_msg ("CONTAINS" , line , line_number )
1630
1630
continue
1631
1631
# Look for trailing doc string
1632
- if line_post_comment is not None :
1632
+ if line_post_comment :
1633
1633
doc_match = FREE_DOC_MATCH .match (line_post_comment )
1634
- if doc_match is not None :
1634
+ if doc_match :
1635
1635
doc_string = line_post_comment [doc_match .end (0 ) :].strip ()
1636
1636
# Loop through tests
1637
1637
obj_read = None
0 commit comments