@@ -59,13 +59,11 @@ def main(source_path: str, output_format: str) -> bool:
59
59
60
60
is_failed : bool = False
61
61
62
+ msg = "String unnecessarily split in two by black. Please merge them manually."
63
+
62
64
if os .path .isfile (source_path ):
63
65
for source_path , line_number in strings_to_concatenate (source_path ):
64
66
is_failed = True
65
- msg = (
66
- "String unnecessarily split in two by black. "
67
- "Please merge them manually."
68
- )
69
67
print (
70
68
output_format .format (
71
69
source_path = source_path , line_number = line_number , msg = msg
@@ -81,10 +79,6 @@ def main(source_path: str, output_format: str) -> bool:
81
79
os .path .join (subdir , file_name )
82
80
):
83
81
is_failed = True
84
- msg = (
85
- "String unnecessarily split in two by black. "
86
- "Please merge them manually."
87
- )
88
82
print (
89
83
output_format .format (
90
84
source_path = source_path , line_number = line_number , msg = msg
@@ -104,19 +98,17 @@ def strings_to_concatenate(source_path: str) -> Generator[Tuple[str, int], None,
104
98
105
99
Yields
106
100
------
107
- Tuple
108
- Containing:
109
- source_path
110
- Source file path.
111
- line_number
112
- Line number of unconcatenated string.
101
+ source_path : str
102
+ Source file path.
103
+ line_number : int
104
+ Line number of unconcatenated string.
113
105
"""
114
106
with open (source_path , "r" ) as file_name :
115
107
tokens : List = list (tokenize .generate_tokens (file_name .readline ))
116
108
117
109
for current_token , next_token in zip (tokens , tokens [1 :]):
118
110
if current_token [0 ] == next_token [0 ] == token .STRING :
119
- yield ( source_path , current_token [2 ][0 ])
111
+ yield source_path , current_token [2 ][0 ]
120
112
121
113
122
114
if __name__ == "__main__" :
0 commit comments