Skip to content

Commit 7cbbd62

Browse files
committed
Build fixes
1 parent e595223 commit 7cbbd62

9 files changed

+40
-28
lines changed

atlassian/insight.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def __init__(self, *args, **kwargs):
2828

2929
def __cloud_init(self, *args, **kwargs):
3030
"""
31-
Creates a InsightCloud specific version of Insight()
31+
Creates an InsightCloud specific version of Insight()
3232
3333
Returns:
3434
Insight(AtlassianRestAPI)

examples/bamboo/bamboo_label_based_cleaner.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,28 +31,26 @@ def get_plans_from_project(project_key):
3131
if __name__ == "__main__":
3232
bamboo = Bamboo(url=BAMBOO_URL, username=BAMBOO_LOGIN, password=BAMBOO_PASSWORD, timeout=180)
3333
projects = get_all_projects()
34-
print((f"Start analyzing the {len(projects)} projects"))
34+
print(f"Start analyzing the {len(projects)} projects")
3535
for project in projects:
36-
print((f"Inspecting {project} project"))
36+
print(f"Inspecting {project} project")
3737
plans = get_plans_from_project(project)
38-
print((f"Start analyzing the {len(plans)} plans"))
38+
print(f"Start analyzing the {len(plans)} plans")
3939
for plan in plans:
40-
print((f"Inspecting {plan} plan"))
40+
print(f"Inspecting {plan} plan")
4141
build_results = [
4242
x for x in bamboo.results(plan_key=plan, label=LABEL, max_results=100, include_all_states=True)
4343
]
4444
for build in build_results:
4545
build_key = build.get("buildResultKey") or None
46-
print((f"Inspecting {build_key} build"))
46+
print(f"Inspecting {build_key} build")
4747
build_value = bamboo.build_result(build_key)
4848
build_complete_time = build_value.get("buildCompletedTime") or None
4949
if not build_complete_time:
5050
continue
5151
datetimeObj = datetime.strptime(build_complete_time.split("+")[0] + "000", "%Y-%m-%dT%H:%M:%S.%f")
5252
if datetime.now() > datetimeObj + timedelta(days=OLDER_DAYS):
53-
print(
54-
(f"Build is old {build_key} as build complete date {build_complete_time.strftime('%Y-%m-%d')}")
55-
)
53+
print(f"Build is old {build_key} as build complete date {build_complete_time.strftime('%Y-%m-%d')}")
5654
if not DRY_RUN:
57-
print((f"Removing {build_key} build"))
55+
print(f"Removing {build_key} build")
5856
bamboo.delete_build_result(build_key)

examples/bamboo/bamboo_remove_old_failed_results.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,20 @@ def remove_build_result(build_key, status):
4343
datetime_obj = datetime.strptime(build_complete_time.split("+")[0] + "000", "%Y-%m-%dT%H:%M:%S.%f")
4444
if datetime.now() > datetime_obj + timedelta(days=OLDER_DAYS):
4545
if build_value.get("buildState") == status:
46-
print((f"Removing build result - {build_key}"))
46+
print(f"Removing build result - {build_key}")
4747
if not DRY_RUN:
4848
bamboo.delete_build_result(build_key=build_key)
4949

5050

5151
def project_review(plans):
5252
for plan in plans:
53-
print((f"Inspecting {plan} plan"))
53+
print(f"Inspecting {plan} plan")
5454
branches = get_branches_from_plan(plan)
5555
for branch in branches:
5656
build_results = get_results_from_branch(branch)
5757
for build in build_results:
5858
build_key = build.get("buildResultKey") or None
59-
print((f"Inspecting build - {build_key}"))
59+
print(f"Inspecting build - {build_key}")
6060
if build_key:
6161
for status in STATUS_CLEANED_RESULTS:
6262
remove_build_result(build_key=build_key, status=status)
@@ -68,7 +68,7 @@ def project_review(plans):
6868
for project in projects:
6969
if project in EXCLUDED_PROJECTS:
7070
continue
71-
print((f"Inspecting project - {project}"))
71+
print(f"Inspecting project - {project}")
7272
results = []
7373
all_plans_of_project = get_plans_from_project(project)
7474
project_review(plans=all_plans_of_project)

examples/bamboo/bamboo_remove_unknown_status_build_results.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def remove_build_result(build_key, status):
4242

4343
def project_review(plans):
4444
for plan in plans:
45-
print((f"Inspecting {plan} plan"))
45+
print(f"Inspecting {plan} plan")
4646
branches = get_branches_from_plan(plan)
4747
for branch in branches:
4848
build_results = get_results_from_branch(branch)

examples/bitbucket/bitbucket_oauth2.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@
55

66
from requests_oauthlib import OAuth2Session
77
from atlassian.bitbucket import Cloud
8-
from flask import Flask, request, redirect, session
98

9+
try:
10+
from flask import Flask, request, redirect, session
11+
except ImportError:
12+
print("Please install Flask library to run this example")
13+
exit(1)
1014
app = Flask(__name__)
1115
app.secret_key = ""
1216

examples/confluence/confluence_attach_file.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,15 @@ def attach_file(page_title, file_location, file_name, mime_type, space):
3535
mime_type = magic.Magic(mime=True)
3636

3737
file_location_with_page = "~/test/test_file.pdf"
38-
file_name = "So excited overview of report.pdf"
38+
file_name_pdf = "So excited overview of report.pdf"
3939
title = "The page with attachments"
4040
space = "TST"
4141

42-
content_type = magic.from_file(file_name, mime=True)
42+
content_type = magic.from_file(file_name_pdf, mime=True)
4343
attach_file(
44-
file_location=file_location_with_page, file_name=file_name, mime_type=content_type, page_title=title, space=space
44+
file_location=file_location_with_page,
45+
file_name=file_name_pdf,
46+
mime_type=content_type,
47+
page_title=title,
48+
space=space,
4549
)
Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
from atlassian import Assets
2-
import pandas as pd
2+
3+
try:
4+
import pandas as pd
5+
except ImportError:
6+
print("Please install Flask library to run this example")
7+
exit(1)
38

49

510
def delete_object(ins, object_id):
@@ -11,8 +16,9 @@ def delete_object(ins, object_id):
1116

1217

1318
if __name__ == "__main__":
14-
ins = Assets(url="https://jira.example.com", username="admin",
15-
token="--------------------------------", cloud=False)
19+
ins = Assets(
20+
url="https://jira.example.com", username="admin", token="--------------------------------", cloud=False
21+
)
1622

17-
df = pd.read_csv('diff.csv')
18-
df['Internal Object ID'].drop_duplicates().apply(lambda x: delete_object(ins, x))
23+
df = pd.read_csv("diff.csv")
24+
df["Internal Object ID"].drop_duplicates().apply(lambda x: delete_object(ins, x))

examples/jira/jira_add_components_to_all_projects.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111

1212
for i in jira.get_all_projects(included_archived=None):
1313
if i["key"] in project_to_skip:
14-
print((f"Skipping project {i['key']} "))
14+
print(f"Skipping project {i['key']} ")
1515
else:
1616
for j in components:
17-
print((f"Creating in project {i['key']} "))
17+
print(f"Creating in project {i['key']} ")
1818
comp = {"project": i["key"], "name": j}
1919
jira.create_component(comp)
20-
print((f"{comp.get('name')} - component created "))
20+
print(f"{comp.get('name')} - component created ")

examples/jira/jira_issue_type_counter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@
1717
else:
1818
percent_of_deprecated = 0
1919
percentage = round(percent_of_deprecated, 1)
20-
print((f"{issue_type}, {number}, {percentage}% of {category}"))
20+
print(f"{issue_type}, {number}, {percentage}% of {category}")

0 commit comments

Comments
 (0)