2020MAX_CW_LETTERS = 32 # As specified in RTF Spec
2121INTEGER_MAGNITUDE = 32 # As specified in RTF Spec
2222PLAIN_TEXT = CONTROL_WORD = (
23- BACKSLASH
24- + MAX_CW_LETTERS
25- + MINUS
26- + len (str ((1 << INTEGER_MAGNITUDE ) // 2 ))
27- + DELIMITER
23+ BACKSLASH + MAX_CW_LETTERS + MINUS + len (str ((1 << INTEGER_MAGNITUDE ) // 2 )) + DELIMITER
2824)
2925
3026
@@ -33,9 +29,7 @@ def __init__(self) -> None:
3329 self .text = ""
3430
3531 @classmethod
36- def probe (
37- cls , pattern : re_patterns .Bytes_Regex , file : io .BufferedReader
38- ) -> Bytestring_Type :
32+ def probe (cls , pattern : re_patterns .Bytes_Regex , file : io .BufferedReader ) -> Bytestring_Type :
3933 logger .debug (f"Probing file at position { file .tell ()} " )
4034 original_position = file .tell ()
4135 while True :
@@ -54,9 +48,7 @@ def probe(
5448 elif match := re_patterns .plain_text .match (probed ):
5549 result = Bytestring_Type .PLAIN_TEXT
5650 else :
57- logger .debug (
58- f"This does not match anything, it's probably a newline, moving on"
59- )
51+ logger .debug (f"This does not match anything, it's probably a newline, moving on" )
6052 original_position += 1
6153 file .seek (original_position )
6254 logger .debug (f"Probe moved to position { file .tell ()} " )
@@ -100,9 +92,7 @@ def __init__(self, encoding: str, file: io.BufferedReader) -> None:
10092 file .seek (target_position )
10193 # handle \binN:
10294 if self .control_name == "bin" :
103- self .bindata = file .read (
104- utils .twos_complement (self .parameter , INTEGER_MAGNITUDE )
105- )
95+ self .bindata = file .read (utils .twos_complement (self .parameter , INTEGER_MAGNITUDE ))
10696 else :
10797 logger .warning (f"Missing Control Word" )
10898 file .seek (self .start_position )
@@ -188,9 +178,7 @@ def __init__(self, encoding: str, file: io.BufferedReader) -> None:
188178 logger .debug (f"Returned to position { file .tell ()} " )
189179 else :
190180 logger .warning (
191- utils .warn (
192- f"Expected a group but found no group start. Creating unknown group"
193- )
181+ utils .warn (f"Expected a group but found no group start. Creating unknown group" )
194182 )
195183 file .seek (self .start_position )
196184 while True :
0 commit comments