diff --git a/atlassian/bamboo.py b/atlassian/bamboo.py index 2e20d7094..b3e2ed124 100755 --- a/atlassian/bamboo.py +++ b/atlassian/bamboo.py @@ -201,7 +201,8 @@ def get_vcs_branches(self, plan_key, max_results=25): :return: """ resource = 'plan/{plan_key}/vcsBranches'.format(plan_key=plan_key) - return self.base_list_call(resource, start_index=0, max_results=max_results) + return self.base_list_call(resource, start_index=0, max_results=max_results, clover_enabled=None, expand=None, + favourite=None) """ Build results """ diff --git a/atlassian/bitbucket.py b/atlassian/bitbucket.py index 2185d3c72..740da636d 100644 --- a/atlassian/bitbucket.py +++ b/atlassian/bitbucket.py @@ -815,8 +815,8 @@ def update_pull_request_comment(self, project, repository, pull_request_id, comm that must match the server's version of the comment or the update will fail. """ - url = "rest/api/1.0/projects/{project}/repos/{repository}/pull-requests/{pull_request_id}/comments/{comment_id}".format( - project=project, repository=repository, pull_request_id=pull_request_id, comment_id=comment_id + url = 'rest/api/1.0/projects/{project}/repos/{repo}/pull-requests/{pull_request}/comments/{comment_id}'.format( + project=project, repo=repository, pull_request=pull_request_id, comment_id=comment_id ) payload = { "version": comment_version, @@ -852,8 +852,8 @@ def change_reviewed_status(self, project_key, repository_slug, pull_request_id, :param user_slug: :return: """ - url = "rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/participants/{userSlug}".format( - projectKey=project_key, repositorySlug=repository_slug, pullRequestId=pull_request_id, userSlug=user_slug, + url = 'rest/api/1.0/projects/{projectKey}/repos/{repo}/pull-requests/{pull_request}/participants/{userSlug}'.format( + projectKey=project_key, repo=repository_slug, pull_request=pull_request_id, userSlug=user_slug, ) approved = True if status == "APPROVED" else False data = { diff --git a/atlassian/confluence.py b/atlassian/confluence.py index 8ea0efd9b..1af555718 100644 --- a/atlassian/confluence.py +++ b/atlassian/confluence.py @@ -895,10 +895,11 @@ def get_group_members(self, group_name='confluence-users', start=0, limit=1000, :param expand: OPTIONAL: A comma separated list of properties to expand on the content. status :return: """ - url = 'rest/api/group/{group_name}/member?limit={limit}&start={start}&expand={expand}'.format(group_name=group_name, - limit=limit, - start=start, - expand=expand) + url = 'rest/api/group/{group_name}/member?limit={limit}&start={start}&expand={expand}'.format( + group_name=group_name, + limit=limit, + start=start, + expand=expand) return (self.get(url) or {}).get('results') def get_space(self, space_key, expand='description.plain,homepage'): diff --git a/atlassian/jira.py b/atlassian/jira.py index ff41feae2..e6c650bf7 100644 --- a/atlassian/jira.py +++ b/atlassian/jira.py @@ -1,6 +1,6 @@ # coding=utf-8 import logging - +import re from requests.exceptions import HTTPError from .rest_client import AtlassianRestAPI @@ -306,34 +306,33 @@ def user_find_by_user_string(self, username, start=0, limit=50, include_inactive } return self.get(url, params=params) - def is_user_in_application(self, username, applicationKey): + def is_user_in_application(self, username, application_key): """ Utility function to test whether a user has an application role :param username: The username of the user to test. - :param applicationKey: The application key of the application + :param application_key: The application key of the application :return: True if the user has the application, else False """ user = self.user(username, 'applicationRoles') # Get applications roles of the user if 'self' in user: - for applicationRole in user.get('applicationRoles').get('items'): - if applicationRole.get('key') == applicationKey: + for application_role in user.get('applicationRoles').get('items'): + if application_role.get('key') == application_key: return True - return False - def add_user_to_application(self, username, applicationKey): + def add_user_to_application(self, username, application_key): """ Add a user to an application :param username: The username of the user to add. - :param applicationKey: The application key of the application + :param application_key: The application key of the application :return: True if the user was added to the application, else False :see: https://docs.atlassian.com/software/jira/docs/api/REST/7.5.3/#api/2/user-addUserToApplication """ params = { 'username': username, - 'applicationKey': applicationKey + 'applicationKey': application_key } - return self.post('rest/api/2/user/application', params=params) == None + return self.post('rest/api/2/user/application', params=params) is None # Application roles def get_all_application_roles(self): @@ -577,8 +576,13 @@ def bulk_issue(self, issue_list, fields='*all'): :param list issue_list: :return: """ + jira_issue_regex = re.compile('[A-Z]{1,10}-\d+') missing_issues = list() - jql = 'key in ({})'.format(', '.join(['"{}"'.format(key) for key in issue_list])) + matched_issue_keys = list() + for key in issue_list: + if re.match(jira_issue_regex, key): + matched_issue_keys.append(key) + jql = 'key in ({})'.format(', '.join(matched_issue_keys)) query_result = self.jql(jql, fields=fields) if 'errorMessages' in query_result.keys(): for message in query_result['errorMessages']: @@ -2071,10 +2075,9 @@ def tempo_teams_add_member(self, team_id, member_key): :return: """ data = {"member": {"key": str(member_key), "type": "USER"}, - "membership": { - "availability": "100", - "role": {"id": 1} - }} + "membership": {"availability": "100", + "role": {"id": 1}} + } return self.tempo_teams_add_member_raw(team_id, member_data=data) def tempo_teams_add_membership(self, team_id, member_id): diff --git a/atlassian/jira8.py b/atlassian/jira8.py index 9f8a78a1e..caa3b600a 100644 --- a/atlassian/jira8.py +++ b/atlassian/jira8.py @@ -7,4 +7,4 @@ class Jira8(Jira): - # methods migrated into main module \ No newline at end of file + # methods migrated into main module