Hello community,
here is the log from the commit of package python-atlassian-python-api for
openSUSE:Leap:15.2 checked in at 2020-03-23 07:13:42
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Leap:15.2/python-atlassian-python-api (Old)
and /work/SRC/openSUSE:Leap:15.2/.python-atlassian-python-api.new.3160
(New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-atlassian-python-api"
Mon Mar 23 07:13:42 2020 rev:3 rq:787218 version:1.15.6
Changes:
--------
---
/work/SRC/openSUSE:Leap:15.2/python-atlassian-python-api/python-atlassian-python-api.changes
2020-03-06 12:44:02.166857825 +0100
+++
/work/SRC/openSUSE:Leap:15.2/.python-atlassian-python-api.new.3160/python-atlassian-python-api.changes
2020-03-23 07:14:15.434511639 +0100
@@ -1,0 +2,13 @@
+Fri Mar 20 01:07:09 UTC 2020 - [email protected]
+
+- Update to 1.15.6:
+ * Bamboo examples and Confluence fix of params (#464)
+ * Added parameter for user() method: (#465)
+ * Check for if an element is a valid email (#466)
+ * Ability of adding reviewers when opening a PR (#470)
+ * Util method to convert a nested dictionary into an HTML table with header
+ row and header column (#473)
+ * Bamboo examples (#474)
+ * Add ability of deleting a pull request (#472)
+
+-------------------------------------------------------------------
Old:
----
atlassian-python-api-1.15.4.tar.gz
New:
----
atlassian-python-api-1.15.6.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-atlassian-python-api.spec ++++++
--- /var/tmp/diff_new_pack.zNFD53/_old 2020-03-23 07:14:15.706511803 +0100
+++ /var/tmp/diff_new_pack.zNFD53/_new 2020-03-23 07:14:15.706511803 +0100
@@ -18,7 +18,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-atlassian-python-api
-Version: 1.15.4
+Version: 1.15.6
Release: 0
Summary: Python Atlassian REST API Wrapper
License: Apache-2.0
++++++ atlassian-python-api-1.15.4.tar.gz -> atlassian-python-api-1.15.6.tar.gz
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/atlassian-python-api-1.15.4/PKG-INFO
new/atlassian-python-api-1.15.6/PKG-INFO
--- old/atlassian-python-api-1.15.4/PKG-INFO 2020-02-28 15:10:15.000000000
+0100
+++ new/atlassian-python-api-1.15.6/PKG-INFO 2020-03-05 12:43:06.000000000
+0100
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: atlassian-python-api
-Version: 1.15.4
+Version: 1.15.6
Summary: Python Atlassian REST API Wrapper
Home-page: https://github.com/atlassian-api/atlassian-python-api
Author: Matt Harasymczuk
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/atlassian-python-api-1.15.4/atlassian/VERSION
new/atlassian-python-api-1.15.6/atlassian/VERSION
--- old/atlassian-python-api-1.15.4/atlassian/VERSION 2020-02-28
14:20:13.000000000 +0100
+++ new/atlassian-python-api-1.15.6/atlassian/VERSION 2020-03-05
12:08:33.000000000 +0100
@@ -1,2 +1 @@
-1.15.4
-
+1.15.6
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/atlassian-python-api-1.15.4/atlassian/bamboo.py
new/atlassian-python-api-1.15.6/atlassian/bamboo.py
--- old/atlassian-python-api-1.15.4/atlassian/bamboo.py 2020-02-28
13:51:34.000000000 +0100
+++ new/atlassian-python-api-1.15.6/atlassian/bamboo.py 2020-03-05
12:41:42.000000000 +0100
@@ -33,7 +33,7 @@
:return: generator with the contents of
response[elements_key][element_key]
"""
start_index = 0
- params['start-index'] = start_index
+ params["start-index"] = start_index
response = self.get(path, data, flags, params, headers)
if self.advanced_mode:
try:
@@ -46,12 +46,12 @@
results = response[elements_key]
size = 0
# Check if we still can get results
- if size > max_results or results['size'] == 0:
+ if size > max_results or results["size"] == 0:
return
for r in results[element_key]:
size += 1
yield r
- start_index += results['max-result']
+ start_index += results["max-result"]
except TypeError:
logging.error("Broken response: {}".format(response))
yield response
@@ -59,7 +59,7 @@
def base_list_call(self, resource, expand, favourite, clover_enabled,
max_results, label=None, start_index=0,
**kwargs):
flags = []
- params = {'max-results': max_results}
+ params = {"max-results": max_results}
if expand:
params['expand'] = expand
if favourite:
@@ -87,16 +87,17 @@
resource = 'project/{}'.format(project_key)
return self.base_list_call(resource, expand, favourite,
clover_enabled, start_index=0, max_results=25)
- def project_plans(self, project_key, max_results=25):
+ def project_plans(self, project_key, start_index=0, max_results=25):
"""
Returns a generator with the plans in a given project
:param project_key: Project key
+ :param start_index:
:param max_results:
:return: Generator with plans
"""
resource = 'project/{}'.format(project_key, max_results=max_results)
return self.base_list_call(resource, expand='plans', favourite=False,
- clover_enabled=False,
max_results=max_results,
+ clover_enabled=False,
start_index=start_index, max_results=max_results,
elements_key='plans', element_key='plan')
def plans(self, expand=None, favourite=False, clover_enabled=False,
start_index=0, max_results=25):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/atlassian-python-api-1.15.4/atlassian/bitbucket.py
new/atlassian-python-api-1.15.6/atlassian/bitbucket.py
--- old/atlassian-python-api-1.15.4/atlassian/bitbucket.py 2020-02-28
15:01:53.000000000 +0100
+++ new/atlassian-python-api-1.15.6/atlassian/bitbucket.py 2020-03-05
11:36:37.000000000 +0100
@@ -844,8 +844,7 @@
return commits_list
def open_pull_request(self, source_project, source_repo, dest_project,
dest_repo, source_branch, destination_branch,
- title,
- description):
+ title, description, reviewers=None):
"""
Create a new pull request between two branches.
The branches may be in the same repository, or different ones.
@@ -859,6 +858,7 @@
:param destination_branch: where the PR is being merged into
:param title: the title of the PR
:param description: the description of what the PR does
+ :param reviewers: the list of reviewers or a single reviewer of the PR
:return:
"""
body = {
@@ -883,8 +883,25 @@
'key': dest_project
}
}
- }
+ },
+ 'reviewers': []
}
+
+ def add_reviewer(reviewer):
+ entry = {
+ 'user': {
+ 'name': reviewer
+ }
+ }
+ body['reviewers'].append(entry)
+
+ if reviewers is not None:
+ if isinstance(reviewers, str):
+ add_reviewer(reviewers)
+ elif isinstance(reviewers, list):
+ for reviewer in reviewers:
+ add_reviewer(reviewer)
+
return self.create_pull_request(dest_project, dest_repo, body)
def create_pull_request(self, project_key, repository, data):
@@ -902,6 +919,25 @@
repository=repository)
return self.post(url, data=data)
+ def delete_pull_request(self, project, repository, pull_request_id,
pull_request_version):
+ """
+ Delete a pull request.
+
+ :param project: the project key
+ :param repository: the repository slug
+ :param pull_request_id: the ID of the pull request within the
repository
+ :param pull_request_version: the version of the pull request
+ :return:
+ """
+ if not self.cloud:
+ url =
'rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}'.format(
+ projectKey=project, repositorySlug=repository,
pullRequestId=pull_request_id)
+ else:
+ url =
'rest/api/2.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}'.format(
+ projectKey=project, repositorySlug=repository,
pullRequestId=pull_request_id)
+ data = {'version': pull_request_version}
+ return self.delete(url, data=data)
+
def decline_pull_request(self, project_key, repository, pr_id, pr_version):
"""
Decline a pull request.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/atlassian-python-api-1.15.4/atlassian/confluence.py
new/atlassian-python-api-1.15.6/atlassian/confluence.py
--- old/atlassian-python-api-1.15.4/atlassian/confluence.py 2020-02-28
13:52:21.000000000 +0100
+++ new/atlassian-python-api-1.15.6/atlassian/confluence.py 2020-03-02
20:19:08.000000000 +0100
@@ -1058,7 +1058,7 @@
params = {}
if expand:
params["expand"] = expand
- return self.get(url)
+ return self.get(url, params=params)
def create_space(self, space_key, space_name):
"""
@@ -1474,7 +1474,6 @@
url = 'rest/api/2/group/user'
params = {'groupname': group_name}
data = {'name': username}
-
return self.post(url, params=params, data=data)
def get_subtree_of_content_ids(self, page_id):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/atlassian-python-api-1.15.4/atlassian/jira.py
new/atlassian-python-api-1.15.6/atlassian/jira.py
--- old/atlassian-python-api-1.15.4/atlassian/jira.py 2020-02-28
14:34:19.000000000 +0100
+++ new/atlassian-python-api-1.15.6/atlassian/jira.py 2020-03-05
11:36:37.000000000 +0100
@@ -90,16 +90,30 @@
url =
'sr/jira.issueviews:searchrequest-csv-all-fields/temp/SearchRequest.csv'
return self.get(url, params=params, not_json_response=True,
headers={'Accept': 'application/csv'})
- def user(self, username, expand=None):
+ def user(self, username=None, key=None, expand=None):
"""
Returns a user. This resource cannot be accessed anonymously.
+ You can use only one parameter: username or key
+
:param username:
+ :param key: if username and key are different
:param expand: Can be 'groups,applicationRoles'
:return:
"""
- params = {'username': username}
+ params = {}
+
+ if username and not key:
+ params = {'username': username}
+ elif not username and key:
+ params = {'key': key}
+ elif username and key:
+ return 'You cannot specify both the username and the key
parameters'
+ elif not username and not key:
+ return 'You must specify at least one parameter: username or key'
+
if expand:
params['expand'] = expand
+
return self.get('rest/api/2/user', params=params)
def is_active_user(self, username):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/atlassian-python-api-1.15.4/atlassian/utils.py
new/atlassian-python-api-1.15.6/atlassian/utils.py
--- old/atlassian-python-api-1.15.4/atlassian/utils.py 2020-02-12
20:55:35.000000000 +0100
+++ new/atlassian-python-api-1.15.6/atlassian/utils.py 2020-03-05
11:36:37.000000000 +0100
@@ -5,7 +5,7 @@
log = logging.getLogger(__name__)
-def is_email(string):
+def is_email(element):
"""
>>> is_email('[email protected]')
True
@@ -15,11 +15,7 @@
True
"""
email_regex = r'^[A-Za-z0-9\.\+_-]+@[A-Za-z0-9\._-]+\.[a-zA-Z]*$'
-
- if isinstance(string, str) and not re.match(email_regex, string):
- return False
- else:
- return True
+ return re.match(email_regex, str(element))
def html_email(email, title=None):
@@ -77,7 +73,7 @@
return html + '</tr>'
-def html_row_with_ordered_headers(data, headers):
+def html_row_with_ordered_headers(data, col_headers, row_header=None):
"""
>>> headers = ['administrators', 'key', 'leader', 'project']
>>> data = {'key': 'DEMO', 'project': 'Demonstration',
@@ -99,7 +95,9 @@
"""
html = '\n\t<tr>'
- for header in headers:
+ if row_header:
+ html += '<th>{}</th>'.format(row_header.replace('_', ' ').title())
+ for header in col_headers:
element = data[header]
if isinstance(element, list):
@@ -173,6 +171,50 @@
return html + '\n</tbody></table>'
+
+def html_table_from_nested_dict(data, ordering):
+ """
+ >>> ordering = ['manager', 'admin', 'employee_count']
+ >>> data = {
+ 'project_A': {'manager': 'John', 'admin': '[email protected]',
'employee_count': '4'},
+ 'project_B': {'manager': 'Jane', 'admin': '[email protected]',
'employee_count': '7'}
+ }
+ >>> html_table_from_nested_dict(data, ordering)
+ <table>
+ <tbody>
+ <tr>
+ <th></th>
+ <th>Manager</th>
+ <th>Admin</th>
+ <th>Employee Count</th>
+ </tr>
+ <tr>
+ <th>Project A</th>
+ <td>John</td>
+ <td><a
href="mailto:[email protected]">[email protected]</a></td>
+ <td>4</td>
+ </tr>
+ <tr>
+ <th>Project B</th>
+ <td>Jane</td>
+ <td><a
href="mailto:[email protected]">[email protected]</a></td>
+ <td>7</td>
+ </tr>
+ </tbody>
+ </table>
+ """
+
+ html = '<table><tbody>'
+ # Add an empty first cell for the row header column
+ header_row = ['']
+ header_row.extend(ordering)
+ html += html_table_header_row(header_row)
+
+ for row_header, row in data.items():
+ html += html_row_with_ordered_headers(row, ordering, row_header)
+
+ return html + '\n</tbody></table>'
+
def block_code_macro_confluence(code, lang=None):
"""
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/atlassian-python-api-1.15.4/atlassian_python_api.egg-info/PKG-INFO
new/atlassian-python-api-1.15.6/atlassian_python_api.egg-info/PKG-INFO
--- old/atlassian-python-api-1.15.4/atlassian_python_api.egg-info/PKG-INFO
2020-02-28 15:10:15.000000000 +0100
+++ new/atlassian-python-api-1.15.6/atlassian_python_api.egg-info/PKG-INFO
2020-03-05 12:43:06.000000000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: atlassian-python-api
-Version: 1.15.4
+Version: 1.15.6
Summary: Python Atlassian REST API Wrapper
Home-page: https://github.com/atlassian-api/atlassian-python-api
Author: Matt Harasymczuk
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/atlassian-python-api-1.15.4/tests/test-confluence-attach.py
new/atlassian-python-api-1.15.6/tests/test-confluence-attach.py
--- old/atlassian-python-api-1.15.4/tests/test-confluence-attach.py
2020-02-17 09:25:04.000000000 +0100
+++ new/atlassian-python-api-1.15.6/tests/test-confluence-attach.py
2020-03-05 11:57:53.000000000 +0100
@@ -44,7 +44,7 @@
os.write(fd, b'Hello World - Version 1')
# upload a new file
- result = confluence.attach_file(filename, None, title=title,
space=space, comment='upload from unittest')
+ result = confluence.attach_file(filename, "", title=title,
space=space, comment='upload from unittest')
# attach_file() returns: {'results': [{'id': 'att144005326', 'type':
'attachment', ...
self.assertTrue('results' in result)
@@ -53,7 +53,7 @@
# upload a new version of an existing file
os.lseek(fd, 0, 0)
os.write(fd, b'Hello Universe - Version 2')
- result = confluence.attach_file(filename, None, title=title,
space=space, comment='upload from unittest')
+ result = confluence.attach_file(filename, "", title=title,
space=space, comment='upload from unittest')
# attach_file() returns: {'id': 'att144005326', 'type': 'attachment',
...
self.assertTrue('id' in result)