Ejemplo n.º 1
0
def main():
    username = password = server = None
    parser = argparse.ArgumentParser(
        description='Get all issues/stories for an Epic')
    parser.add_argument('-i', help="Provide Issue Key", required=True)
    cfg = None
    try:
        cf = ConfigFile('config.yaml')
        cfg = cf.config
        username = cfg['username']
        password = cfg['password']
        server = cfg['server']
    except FileNotFoundError as e:
        print("Config File does not exist, falling back to argument parsing")
        parser.add_argument('-u', help="Provide User Name")
        parser.add_argument('-p', help="Provide Password")
        parser.add_argument('-s', help="Provide Server URL")
    args = parser.parse_args()
    if (cfg is None):
        username = args.u
        password = args.p
        server = args.s
    issue_key = args.i
    jc = JiraConn(username, password, server)
    issue = Issue(jc.jira, issue_key)
    issue.descope()
Ejemplo n.º 2
0
def main():
    username = password = server = None
    parser = argparse.ArgumentParser(
        description='Move an Issue to another Epic')
    parser.add_argument('-I', '--issues','--stories', nargs='+', \
       help="Provide Issue Keys", required=True)
    parser.add_argument('-e',
                        '--epic',
                        help="Provide Issue Key",
                        required=True)
    cfg = None
    try:
        cf = ConfigFile('config.yaml')
        cfg = cf.config
        username = cfg['username']
        password = cfg['password']
        server = cfg['server']
    except FileNotFoundError as e:
        print("Config File does not exist, falling back to argument parsing")
        parser.add_argument('-u', help="Provide User Name")
        parser.add_argument('-p', help="Provide Password")
        parser.add_argument('-s', help="Provide Server URL")
    args = parser.parse_args()
    if (cfg is None):
        username = args.u
        password = args.p
        server = args.s
    issues = args.issues
    epic = args.epic
    jc = JiraConn(username, password, server)
    for issue in issues:
        i = Issue(jc.jira, issue)
        i.set_epic(epic)
Ejemplo n.º 3
0
 def batch_alter(__self__):
     tot = 0
     for e in __self__.estimates:
         key_and_estimate = e.split(':')
         key = key_and_estimate[0]
         estimate = key_and_estimate[1]
         tot += int(0 if estimate is None else estimate)
         issue = Issue(__self__.jc.jira, key)
         issue.set_estimate_in_story_points(int(estimate))
     return (tot)
Ejemplo n.º 4
0
 def show_estimates(__self__):
     tot = 0
     if (__self__.keys is None):
         print("Keys need to specified to show.")
         raise AssertionError()
     total_estimate = 0
     for key in __self__.keys:
         issue = Issue(__self__.jc.jira, key)
         estimate = issue.get_estimate_in_story_points()
         tot += int(0 if estimate is None else estimate)
         print("{} Est. {}".format(key, estimate))
     return (tot)
Ejemplo n.º 5
0
def main():
    username = password = server = None
    parser = argparse.ArgumentParser(description='Get Story Point Estimates')
    parser.add_argument('-u', help="Provide User Name")
    parser.add_argument('-p', help="Provide Password")
    parser.add_argument('-s', help="Provide Server URL")
    parser.add_argument('-i', help="Provide Issue Key")
    parser.add_argument('-E', help="Provide new storypoint Estimate")
    cfg = None
    try:
        cf = ConfigFile('config.yaml')
        cfg = cf.config
        username = cfg['username']
        password = cfg['password']
        server = cfg['server']
    except FileNotFoundError as e:
        print("Config File does not exist, falling back to argument parsing")
        parser.add_argument('-u', help="Provide User Name")
        parser.add_argument('-p', help="Provide Password")
        parser.add_argument('-s', help="Provide Server URL")
    args = parser.parse_args()
    if (cfg is None):
        username = args.u
        password = args.p
        server = args.s
    issue_key = args.i
    try:
        assert (username != None and password != None and server != None
                and issue_key != None)
    except AssertionError as a:
        print("None username, password and/or server or issue_key")
        print(
            'Usage: {:s} [-u <user> -p <password> -s <server>] -i <issue key> [-E <estimate>]'
        )
        exit(1)
    jc = JiraConn(username, password, server)
    issue = Issue(jc.jira, issue_key)
    print("Current Estimate for Issue is ",
          issue.get_estimate_in_story_points())
    if (args.E):
        try:
            print("New Estimate Provided, Updating.")
            estimate = float(args.E)
            issue.set_estimate_in_story_points(estimate)
        except JIRAError as e:
            print("New Estimate update failed. {} {}".format(
                e.status_code, e.text))
            exit(2)
        print("Updated.")
Ejemplo n.º 6
0
def main():
    username = password = server = None
    cfg = None
    try:
        cf = ConfigFile('config.yaml')
        cfg = cf.config
        username = cfg['username']
        password = cfg['password']
        server = cfg['server']
    except FileNotFoundError as e:
        print("Config File does not exist." + e.strerror)
        exit(1)
    parser = argparse.ArgumentParser(prog='listissues',
                                     description="Will list issues from jira")
    parser.add_argument('--project',
                        help="Provide Project Name",
                        required=True)
    parser.add_argument('--output', help="Output file")
    parser.add_argument("--query", help='Query string to filter your fetch')
    args = parser.parse_args()
    project_string = args.project
    output_file = args.output
    query_string = args.query
    if (project_string is None):
        parser.print_help()
        raise Exception("Project is None, check command line")

    if (output_file is not None):
        try:
            of = open(output_file, "w")
        except OSError as oe:
            print(f'Error opening file for writing, {oe.errno} {oe.strerror}')
            sys.exit(oe.errno)

    # Connect to jira
    jc = JiraConn(username, password, server)
    assert (jc != None)
    p = Project(jc.jira, project_string)
    issues = p.get_issues_for_query(max_rows=50, query=query_string)
    for i in issues:
        issue = Issue(jc.jira, i.key)
        print(issue.i.key,
              issue.i.fields.issuetype,
              issue.i.fields.status,
              issue.i.fields.priority,
              issue.i.fields.created,
              issue.i.fields.updated,
              issue.i.fields.customfield_13000,
              sep='|')
        if (output_file is not None):
            print(issue.i.key,
                  issue.i.fields.issuetype,
                  issue.i.fields.status,
                  issue.i.fields.priority,
                  issue.i.fields.created,
                  issue.i.fields.updated,
                  issue.i.fields.customfield_13000,
                  sep='|',
                  file=of)
Ejemplo n.º 7
0
def main():
    username = password = server = None
    parser = argparse.ArgumentParser(description='Get and Set \
			Estimates for Issues (Epics and Stories)')
    parser.add_argument("action", choices=("alter", "show"))
    parser.add_argument('-i',
                        '--issues',
                        nargs='+',
                        help="List of Issues",
                        required=True)
    parser.add_argument('--factor',
                        '-f',
                        help="Provide Normalization Factor",
                        required=True)
    cfg = None
    try:
        cf = ConfigFile('config.yaml')
        cfg = cf.config
        username = cfg['username']
        password = cfg['password']
        server = cfg['server']
    except FileNotFoundError as e:
        print("Config File does not exist, falling back to argument parsing")
        parser.add_argument('-u', help="Provide User Name")
        parser.add_argument('-p', help="Provide Password")
        parser.add_argument('-s', help="Provide Server URL")
    args = parser.parse_args()
    if (cfg is None):
        username = args.u
        password = args.p
        server = args.s
    issues = args.issues
    factor = float(args.factor)
    jc = JiraConn(username, password, server)
    for issue_key in issues:
        issue = Issue(jc.jira, issue_key)
        estimate = issue.get_estimate_in_story_points()
        new_estimate = estimate * factor
        if (args.action == "show"):
            print("{:10s} ({:2.2f} -->> {:2.2f})".format(issue.i.key, \
              estimate, new_estimate))
        elif (args.action == "alter"):
            issue.set_estimate_in_story_points(new_estimate)
        else:
            print("invalid action, exiting.")
            exit(121)
Ejemplo n.º 8
0
def main():
    username = password = server = None
    parser = argparse.ArgumentParser(
        description='Scope and Descope Issues (Stories, Epics etc.)')
    parser.add_argument("action", choices=("scope", "descope", "show"))
    parser.add_argument('-i', help="Provide Issue Key", required=True)
    parser.add_argument(
        '-R', help="Release String - uses the Jira Planned Iteration field")
    cfg = None
    try:
        cf = ConfigFile('config.yaml')
        cfg = cf.config
        username = cfg['username']
        password = cfg['password']
        server = cfg['server']
    except FileNotFoundError as e:
        print("Config File does not exist, falling back to argument parsing")
        parser.add_argument('-u', help="Provide User Name")
        parser.add_argument('-p', help="Provide Password")
        parser.add_argument('-s', help="Provide Server URL")
    args = parser.parse_args()
    if (cfg is None):
        username = args.u
        password = args.p
        server = args.s
    issue_key = args.i
    pi_string = args.R
    jc = JiraConn(username, password, server)
    issue = Issue(jc.jira, issue_key)
    if (args.action == "scope"):
        issue.scope(pi_string)
    elif (args.action == "descope"):
        issue.descope()
    else:
        print(issue.get_release())
Ejemplo n.º 9
0
def main():
    username = password = server = None
    parser = argparse.ArgumentParser(
        description='Tagging and Untagging of Jira issues')
    parser.add_argument('action',
                        choices=("tag", "detag", "print"),
                        help="Provide action")
    parser.add_argument('-i',
                        nargs='+',
                        help="Provide Issue Key",
                        required=True)
    parser.add_argument('-T',
                        '--tags',
                        nargs='+',
                        help="List of Tags",
                        required=False)
    cfg = None
    try:
        cf = ConfigFile('config.yaml')
        cfg = cf.config
        username = cfg['username']
        password = cfg['password']
        server = cfg['server']
    except FileNotFoundError as e:
        print("Config File does not exist, falling back to argument parsing")
        parser.add_argument('-u', help="Provide User Name")
        parser.add_argument('-p', help="Provide Password")
        parser.add_argument('-s', help="Provide Server URL")
    args = parser.parse_args()
    if (cfg is None):
        username = args.u
        password = args.p
        server = args.s
    issues = args.i
    try:
        assert (username != None and password != None and server != None)
    except AssertionError as a:
        print("None username, password, issue, release and/or server")
        exit(1)
    jc = JiraConn(username, password, server)
    for issue_key in issues:
        issue = Issue(jc.jira, issue_key)
        tags = args.tags
        if (args.action == "tag"):
            issue.tag(tags)
        elif (args.action == "detag"):
            issue.detag(tags)
        else:
            issue.show_tags()
Ejemplo n.º 10
0
def main():
    username = password = server = None
    parser = argparse.ArgumentParser(
        description='Scope and Descope Issues (Stories, Epics etc.)')
    parser.add_argument('--issues',
                        '-I',
                        nargs='+',
                        help="Provide Issue Key or list thereof",
                        required=True)
    parser.add_argument('--planned_iteration',
                        '-P',
                        help="PI - uses the Planned iteration field")
    #parser.add_argument('--release', '-R', help="Release String - uses the Jira Planned Iteration field")
    cfg = None
    try:
        cf = ConfigFile('config.yaml')
        cfg = cf.config
        username = cfg['username']
        password = cfg['password']
        server = cfg['server']
    except FileNotFoundError as e:
        print("Config File does not exist, falling back to argument parsing")
        parser.add_argument('-u', help="Provide User Name")
        parser.add_argument('-p', help="Provide Password")
        parser.add_argument('-s', help="Provide Server URL")
    args = parser.parse_args()
    if (cfg is None):
        username = args.u
        password = args.p
        server = args.s
    issues = args.issues
    pi_string = args.planned_iteration
    #release_string = args.release
    jc = JiraConn(username, password, server)
    for issue in issues:
        print("Scoping issue {} for {}".format(issue, pi_string))
        issue = Issue(jc.jira, issue)
        issue.scope(pi_string)
Ejemplo n.º 11
0
def main():
    username = password = server = None
    parser = argparse.ArgumentParser(description='Get and Set \
			Estimates for Issues (Epics and Stories)')
    parser.add_argument("action", choices=("alter", "show"))
    parser.add_argument('-i', help="Provide Issue Key", required=True)
    parser.add_argument('--estimate',
                        '-E',
                        help="Provide Issue Key",
                        required=False)
    cfg = None
    try:
        cf = ConfigFile('config.yaml')
        cfg = cf.config
        username = cfg['username']
        password = cfg['password']
        server = cfg['server']
    except FileNotFoundError:
        print("Config File does not exist, falling back to argument parsing")
        parser.add_argument('-u', help="Provide User Name")
        parser.add_argument('-p', help="Provide Password")
        parser.add_argument('-s', help="Provide Server URL")
    args = parser.parse_args()
    if (cfg is None):
        username = args.u
        password = args.p
        server = args.s
    issue_key = args.i
    jc = JiraConn(username, password, server)
    issue = Issue(jc.jira, issue_key)
    if (args.action == "show"):
        if (args.estimate):
            print("Ignoring script argument --estimate, none required")
        print(issue.get_estimate_in_story_points())
    elif (args.action == "alter"):
        estimate = float(args.estimate)
        issue.set_estimate_in_story_points(estimate)
Ejemplo n.º 12
0
def main():
	username = password = server = None
	parser = argparse.ArgumentParser(description='Get and Set \
			Estimates for Issues (Epics and Stories)')
	parser.add_argument("action", choices=("what","alter"))
	parser.add_argument('-i', help="Provide Issue Key", required=True)
	parser.add_argument('-T','--tid', help="Provide the Transition ID", required=False)
	parser.add_argument('-C','--comment',help="Comment for the transition", required=False)

	cfg = None
	try:
		cf = ConfigFile('config.yaml')
		cfg = cf.config
		username = cfg['username']
		password = cfg['password']
		server = cfg['server']
	except FileNotFoundError as e:
		print("Config File does not exist, falling back to argument parsing")
		parser.add_argument('-u', help="Provide User Name")
		parser.add_argument('-p', help="Provide Password")
		parser.add_argument('-s', help="Provide Server URL")
	args = parser.parse_args()
	if (cfg is None):
		username = args.u
		password = args.p
		server = args.s
	issue_key = args.i
	jc = JiraConn(username, password, server)
	issue = Issue(jc.jira, issue_key)
	if(args.action == "what"):
		issue.available_transitions()
	elif (args.action == "alter"):
		try:
			jc.jira.transition_issue(issue.i, str(args.tid))
		except JIRAError as e:
			print("Exception: error is {}-{}".format(e.status_code, e.text))
Ejemplo n.º 13
0
def main():
	username = password = server = None
	parser = argparse.ArgumentParser(description='Jira issues Team Assignment')
	parser.add_argument('action', \
			choices=("assign","unassign","print"), help="Provide action")
	parser.add_argument('-i','--issues', help="Provide Issue Keys", nargs='+', required=True)
	parser.add_argument('-T', '--team', help="Team Code String", required=False)
	cfg = None
	try:
		cf = ConfigFile('config.yaml')
		cfg = cf.config
		username = cfg['username']
		password = cfg['password']
		server = cfg['server']
	except FileNotFoundError as e:
		print("Config File does not exist, falling back to argument parsing")
		parser.add_argument('-u', help="Provide User Name")
		parser.add_argument('-p', help="Provide Password")
		parser.add_argument('-s', help="Provide Server URL")
	args = parser.parse_args()
	if (cfg is None):
		username = args.u
		password = args.p
		server = args.s
	issues = args.issues
	try:
		assert(username != None and password != None and server != None)
	except AssertionError as a:
		print("None username, password, issue, release and/or server")
		exit(1)
	jc = JiraConn(username, password, server)
	action = args.action
	team = args.team
	for issue_key in issues:
		issue = Issue(jc.jira, issue_key)
		if (action == "assign"):
			issue.assign_team(team)
		elif(action == "print"):
			issue.show_teams()
		elif(action == "unassign"):
			issue.unassign_all_teams()
Ejemplo n.º 14
0
# Build LDA model, cluster articles into issues
for year in years:
    print("Corpus " + str(year) + ":")
    corpus[year].build_lda(num_topics=num_issues)
    corpus[year].issue_model = IssueModel(corpus=corpus[year],
                                          model=corpus[year].lda)
    corpus[year].issue_model.build_issues()
    print("Corpus " + str(year) + " Done\n")

# Init Issues (for Issue Tracking)
issues = []
for year in years:
    issue_model = corpus[year].issue_model
    top_issue_id = issue_model.sorted_issues[0][0]
    issues.append(
        Issue(articles=issue_model.issues[top_issue_id],
              keywords=issue_model.keywords[top_issue_id]))

# ----------------------------------------------------

# ### Show Results

# Select year to show
show_year = 2017

# Show top trending issues
corpus[show_year].issue_model.show_top_issues()

# Show Articles from Top Issues
corpus[show_year].issue_model.show_issues(k=5)

# ----------------------------------------------------