MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / diffMessageIdTodayReport

Function diffMessageIdTodayReport

tools/donate-cpu-server.py:525–560  ·  view source on GitHub ↗
(resultPath: str, messageId: str)

Source from the content-addressed store, hash-verified

523
524
525def diffMessageIdTodayReport(resultPath: str, messageId: str) -> str:
526 text = messageId + '\n'
527 e = '[' + messageId + ']\n'
528 today = strDateTime()[:10]
529 for filename in sorted(glob.glob(resultPath + '/*.diff')):
530 if not os.path.isfile(filename):
531 continue
532 with open(filename, 'rt') as f:
533 diff_stats = json.loads(f.read())
534 if messageId not in diff_stats['sums']:
535 continue
536 if OLD_VERSION not in diff_stats['sums'][messageId]:
537 continue
538 if today not in diff_stats["date"]:
539 continue
540
541 url = None
542 diff = False
543 firstLine = True
544 for line in open(filename[:-5], 'rt'):
545 if firstLine:
546 firstLine = False
547 if not line.startswith(today):
548 break
549 if line.startswith('ftp://'):
550 url = line
551 elif line == 'diff:\n':
552 diff = True
553 elif not diff:
554 continue
555 elif line.endswith(e):
556 if url:
557 text += url
558 url = None
559 text += line
560 return text
561
562
563def summaryReportFromDict(out: dict, prefix: str, today: str) -> str:

Callers 1

runMethod · 0.85

Calls 2

strDateTimeFunction · 0.85
readMethod · 0.45

Tested by

no test coverage detected