@@ -175,13 +175,12 @@ def detect_copyrights_from_lines(
175
175
)
176
176
177
177
for candidates in candidate_lines_groups :
178
- if TRACE :
179
- from pprint import pformat
180
- can = pformat (candidates , width = 160 )
181
- logger_debug (
182
- f' detect_copyrights_from_lines: processing candidates group:\n '
183
- f' { can } '
184
- )
178
+ if TRACE or TRACE_DEEP :
179
+ logger_debug (f'========================================================================' )
180
+ logger_debug (f' detect_copyrights_from_lines: processing candidates group:' )
181
+ for can in candidates :
182
+ logger_debug (f' { can } ' )
183
+
185
184
186
185
detections = detector .detect (
187
186
numbered_lines = candidates ,
@@ -246,27 +245,27 @@ def detect(self,
246
245
return
247
246
248
247
if TRACE or TRACE_TOK :
249
- logger_debug (f'CopyrightDetector: numbered_lines: { numbered_lines } ' )
248
+ logger_debug (f' CopyrightDetector: numbered_lines: { numbered_lines } ' )
250
249
251
250
tokens = list (get_tokens (numbered_lines ))
252
251
253
252
if TRACE :
254
- logger_debug (f'CopyrightDetector: initial tokens: { tokens } ' )
253
+ logger_debug (f' CopyrightDetector: initial tokens: { tokens } ' )
255
254
256
255
if not tokens :
257
256
return
258
257
259
258
# first, POS tag each token using token regexes
260
259
lexed_text = list (self .lexer .lex_tokens (tokens , trace = TRACE_TOK ))
261
260
262
- if TRACE :
263
- logger_debug (f'CopyrightDetector: lexed tokens: { lexed_text } ' )
261
+ if TRACE or TRACE_DEEP :
262
+ logger_debug (f' CopyrightDetector: lexed tokens:\n { lexed_text } ' )
264
263
265
264
# then build a parse parse_tree based on tagged tokens
266
265
parse_tree = self .parser .parse (lexed_text )
267
266
268
- if TRACE :
269
- logger_debug (f'CopyrightDetector: parse_tree:\n { tree_pformat (parse_tree )} ' )
267
+ if TRACE or TRACE_DEEP :
268
+ logger_debug (f' CopyrightDetector: final parse_tree:\n { tree_pformat (parse_tree )} ' )
270
269
271
270
non_copyright_labels = frozenset ()
272
271
if not include_copyright_years :
@@ -312,7 +311,7 @@ def detect(self,
312
311
junk = COPYRIGHTS_JUNK ,
313
312
)
314
313
315
- if TRACE :
314
+ if TRACE or TRACE_DEEP :
316
315
logger_debug (f'CopyrightDetector: detection: { copyrght } ' )
317
316
318
317
if copyrght :
@@ -3879,15 +3878,13 @@ def candidate_lines(numbered_lines):
3879
3878
3880
3879
if TRACE_TOK :
3881
3880
numbered_lines = list (numbered_lines )
3882
- logger_debug (
3883
- f'candidate_lines: numbered_lines: { numbered_lines !r} ' )
3881
+ logger_debug (f'candidate_lines: numbered_lines: { numbered_lines !r} ' )
3884
3882
3885
3883
# the previous line (chars only)
3886
3884
previous_chars = None
3887
3885
for numbered_line in numbered_lines :
3888
3886
if TRACE :
3889
- logger_debug (
3890
- f'# candidate_lines: evaluating line: { numbered_line !r} ' )
3887
+ logger_debug (f'# candidate_lines: evaluating line: { numbered_line !r} ' )
3891
3888
3892
3889
_line_number , line = numbered_line
3893
3890
0 commit comments