@@ -264,7 +264,7 @@ def _parse_comment_trail(self, parse_trail: bool = True) -> tuple[str, str, str]
264264 # The comment itself
265265 while not self .end () and not self ._current .is_nl ():
266266 code = ord (self ._current )
267- if code == CHR_DEL or code <= CTRL_CHAR_LIMIT and code != CTRL_I :
267+ if code == CHR_DEL or ( code <= CTRL_CHAR_LIMIT and code != CTRL_I ) :
268268 raise self .parse_error (InvalidControlChar , code , "comments" )
269269
270270 if not self .inc ():
@@ -636,10 +636,8 @@ def _parse_inline_table(self) -> InlineTable:
636636 self .inc ()
637637 break
638638
639- if (
640- trailing_comma is False
641- or trailing_comma is None
642- and self ._current == ","
639+ if trailing_comma is False or (
640+ trailing_comma is None and self ._current == ","
643641 ):
644642 # Either the previous key-value pair was not followed by a comma
645643 # or the table has an unexpected leading comma.
@@ -675,10 +673,8 @@ def _parse_number(self, raw: str, trivia: Trivia) -> Item | None:
675673 raw = raw [1 :]
676674
677675 if len (raw ) > 1 and (
678- raw .startswith ("0" )
679- and not raw .startswith (("0." , "0o" , "0x" , "0b" , "0e" ))
680- or sign
681- and raw .startswith ("." )
676+ (raw .startswith ("0" ) and not raw .startswith (("0." , "0o" , "0x" , "0b" , "0e" )))
677+ or (sign and raw .startswith ("." ))
682678 ):
683679 return None
684680
@@ -703,10 +699,8 @@ def _parse_number(self, raw: str, trivia: Trivia) -> Item | None:
703699 if "_" in clean :
704700 return None
705701
706- if (
707- clean .endswith ("." )
708- or not clean .startswith ("0x" )
709- and clean .split ("e" , 1 )[0 ].endswith ("." )
702+ if clean .endswith ("." ) or (
703+ not clean .startswith ("0x" ) and clean .split ("e" , 1 )[0 ].endswith ("." )
710704 ):
711705 return None
712706
@@ -817,14 +811,15 @@ def _parse_string(self, delim: StringType) -> String:
817811 if (
818812 delim .is_singleline ()
819813 and not escaped
820- and (code == CHR_DEL or code <= CTRL_CHAR_LIMIT and code != CTRL_I )
814+ and (code == CHR_DEL or ( code <= CTRL_CHAR_LIMIT and code != CTRL_I ) )
821815 ) or (
822816 delim .is_multiline ()
823817 and not escaped
824818 and (
825819 code == CHR_DEL
826- or code <= CTRL_CHAR_LIMIT
827- and code not in [CTRL_I , CTRL_J , CTRL_M ]
820+ or (
821+ code <= CTRL_CHAR_LIMIT and code not in [CTRL_I , CTRL_J , CTRL_M ]
822+ )
828823 )
829824 ):
830825 raise self .parse_error (InvalidControlChar , code , "strings" )
0 commit comments