-
Notifications
You must be signed in to change notification settings - Fork 0
/
tickets.py
executable file
·36 lines (28 loc) · 997 Bytes
/
tickets.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env python3
"""Summarize tickets by user"""
import argparse
import csv
from collections import defaultdict
import six
def tickets(tickets_file):
"""Summarize tickets by user"""
items = defaultdict(list)
with open(tickets_file, "rb") as infile:
reader = csv.reader(infile)
for row in reader:
assignee = row[49]
summary = row[32]
request = row[50]
date = row[19]
work_details = "%s - %s - %s" % (request, date, summary)
items[assignee].append(work_details)
for key, values in list(items.items()):
six.print_(key, "-", len(values), "request(s)")
for item in values:
six.print_(item)
six.print_()
if __name__ == "__main__":
PARSER = argparse.ArgumentParser(description="summarize a set of tickets")
PARSER.add_argument("-f", "--file", help="tickets file", required=True)
ARGS = vars(PARSER.parse_args())
tickets(ARGS["file"])