Skip to content

Commit

Permalink
Polish and cleanup (#377)
Browse files Browse the repository at this point in the history
* A new Tempo method

* Tempo: add team member

* Bugfix

* Set workload method

* Bump version

* Organize the imports

* Polish
  • Loading branch information
gonchik authored Oct 28, 2019
1 parent b9140ce commit fb44644
Show file tree
Hide file tree
Showing 13 changed files with 37 additions and 18 deletions.
2 changes: 1 addition & 1 deletion atlassian/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.14.1
1.14.2
12 changes: 6 additions & 6 deletions atlassian/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from .confluence import Confluence
from .jira import Jira
from .bamboo import Bamboo
from .bitbucket import Bitbucket
from .bitbucket import Bitbucket as Stash
from .portfolio import Portfolio
from .bamboo import Bamboo
from .confluence import Confluence
from .crowd import Crowd
from .service_desk import ServiceDesk
from .marketplace import MarketPlace
from .jira import Jira
from .jira8 import Jira8
from .marketplace import MarketPlace
from .portfolio import Portfolio
from .service_desk import ServiceDesk

__all__ = [
'Confluence',
Expand Down
4 changes: 4 additions & 0 deletions atlassian/bamboo.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# coding=utf-8
import logging

from requests.exceptions import HTTPError

from .rest_client import AtlassianRestAPI

log = logging.getLogger(__name__)
Expand Down Expand Up @@ -196,6 +198,7 @@ def get_vcs_branches(self, plan_key, max_results=25):
"""
Get all vcs names for the current plan
:param plan_key: str TST-BLD
:param max_results
:return:
"""
resource = 'plan/{plan_key}/vcsBranches'.format(plan_key=plan_key)
Expand Down Expand Up @@ -302,6 +305,7 @@ def build_result(self, build_key, expand=None, include_all_states=False):
using stages.stage.results.result. All expand parameters should contain results.result prefix.
:param build_key: Should be in the form XX-YY[-ZZ]-99, that is, the last token should be an integer representing
the build number
:param include_all_states
"""
try:
int(build_key.split('-')[-1])
Expand Down
17 changes: 10 additions & 7 deletions atlassian/bitbucket.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# coding=utf-8
import logging

from .rest_client import AtlassianRestAPI

log = logging.getLogger(__name__)
Expand Down Expand Up @@ -560,7 +561,8 @@ def get_pull_request_settings(self, project, repository):
:param repository:
:return:
"""
url = 'rest/api/1.0/projects/{project}/repos/{repository}/settings/pull-requests'.format(project=project,repository=repository)
url = 'rest/api/1.0/projects/{project}/repos/{repository}/settings/pull-requests'.format(project=project,
repository=repository)
return self.get(url)

def set_pull_request_settings(self, project, repository, data):
Expand All @@ -571,7 +573,8 @@ def set_pull_request_settings(self, project, repository, data):
:param data: json body
:return:
"""
url = 'rest/api/1.0/projects/{project}/repos/{repository}/settings/pull-requests'.format(project=project,repository=repository)
url = 'rest/api/1.0/projects/{project}/repos/{repository}/settings/pull-requests'.format(project=project,
repository=repository)
return self.post(url, data=data)

def get_pull_requests(self, project, repository, state='OPEN', order='newest', limit=100, start=0, at=None):
Expand Down Expand Up @@ -1074,7 +1077,7 @@ def get_branches_permissions(self, project, repository=None, start=0, limit=25):
:param limit:
:return:
"""
if repository != None:
if repository is not None:
url = 'rest/branch-permissions/2.0/projects/{project}/repos/{repository}/restrictions'.format(
project=project,
repository=repository)
Expand All @@ -1098,12 +1101,12 @@ def all_branches_permissions(self, project, repository=None):
"""
start = 0
branches_permissions = []
response = self.get_branches_permissions(project=project, repository=repository, start=start)
branches_permissions += response.get('values')
response = self.get_branches_permissions(project=project, repository=repository, start=start)
branches_permissions += response.get('values')
while not response.get('isLastPage'):
start = response.get('nextPageStart')
response = self.get_branches_permissions(project=project, repository=repository, start=start)
branches_permissions += response.get('values')
response = self.get_branches_permissions(project=project, repository=repository, start=start)
branches_permissions += response.get('values')
return branches_permissions

def reindex(self):
Expand Down
8 changes: 5 additions & 3 deletions atlassian/confluence.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# coding=utf-8
from atlassian import utils
from .rest_client import AtlassianRestAPI
from requests import HTTPError
import logging
import os
import time

from requests import HTTPError

from atlassian import utils
from .rest_client import AtlassianRestAPI

log = logging.getLogger(__name__)


Expand Down
1 change: 1 addition & 0 deletions atlassian/crowd.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# coding=utf-8
import logging

from .rest_client import AtlassianRestAPI

log = logging.getLogger(__name__)
Expand Down
2 changes: 2 additions & 0 deletions atlassian/jira.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# coding=utf-8
import logging

from requests.exceptions import HTTPError

from .rest_client import AtlassianRestAPI

log = logging.getLogger(__name__)
Expand Down
1 change: 1 addition & 0 deletions atlassian/jira8.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# coding=utf-8
import logging

from .rest_client import AtlassianRestAPI

log = logging.getLogger(__name__)
Expand Down
1 change: 1 addition & 0 deletions atlassian/marketplace.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# coding=utf-8
import logging

from .rest_client import AtlassianRestAPI

log = logging.getLogger(__name__)
Expand Down
1 change: 1 addition & 0 deletions atlassian/portfolio.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# coding=utf-8
import logging

from .rest_client import AtlassianRestAPI

log = logging.getLogger(__name__)
Expand Down
1 change: 1 addition & 0 deletions atlassian/request_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging

from six import PY3


Expand Down
4 changes: 3 additions & 1 deletion atlassian/rest_client.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# coding=utf-8
import json
import logging
from six.moves.urllib.parse import urlencode

import requests
from oauthlib.oauth1 import SIGNATURE_RSA
from requests_oauthlib import OAuth1
from six.moves.urllib.parse import urlencode

from atlassian.request_utils import get_default_logger

log = get_default_logger(__name__)
Expand Down
1 change: 1 addition & 0 deletions atlassian/service_desk.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# coding=utf-8
import logging

from .rest_client import AtlassianRestAPI

log = logging.getLogger(__name__)
Expand Down

0 comments on commit fb44644

Please sign in to comment.