MCPcopy
hub / github.com/ActivityWatch/activitywatch / main

Function main

scripts/logcrawler.py:53–76  ·  view source on GitHub ↗
(exclude_testing: bool = False, limit_days: int = 10, limit_lines: int = 10)

Source from the content-addressed store, hash-verified

51
52
53def main(exclude_testing: bool = False, limit_days: int = 10, limit_lines: int = 10):
54 file_lines = collect()
55
56 if exclude_testing:
57 keys = filter(lambda k: "testing" not in k, file_lines.keys())
58 file_lines = {key: file_lines[key] for key in keys}
59
60 for filename, lines in sorted(file_lines.items()):
61 lines = sorted(file_lines[filename], reverse=True)
62
63 # Filter lines older than x days
64 if limit_days:
65 lines = [line for line in lines if line_age(line) <= limit_days]
66
67 if lines:
68 print("-" * 50)
69 print("File: {}".format(filename))
70
71 # Print lines up to the limit
72 for line in lines[:limit_lines]:
73 print(" " + line)
74
75 if limit_lines < len(lines):
76 print("Showing {} out of {} lines".format(limit_lines, len(lines)))
77
78
79if __name__ == "__main__":

Callers 1

logcrawler.pyFile · 0.70

Calls 3

collectFunction · 0.85
line_ageFunction · 0.85
formatMethod · 0.80

Tested by

no test coverage detected