Skip to content

Commit

Permalink
Issue #82 related: Some pep8 cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
jenisys committed Nov 2, 2013
1 parent 7f98990 commit d915515
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
5 changes: 4 additions & 1 deletion bugwarrior/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def asbool(some_value):
""" Cast config values to boolean. """
return str(some_value).lower() in ['y', 'yes', 't', 'true', '1', 'on']


def get_service_password(service, username, oracle=None, interactive=False):
"""
Retrieve the sensitive password for a service by:
Expand Down Expand Up @@ -48,10 +49,11 @@ def get_service_password(service, username, oracle=None, interactive=False):
password = getpass.getpass(prompt)

if password is None:
die("MISSING PASSWORD: oracle='%s', interactive=%s for service=%s" % \
die("MISSING PASSWORD: oracle='%s', interactive=%s for service=%s" %
(oracle, interactive, service))
return password


def load_example_rc():
root = '/'.join(__file__.split('/')[:-1])
fname = root + '/README.rst'
Expand Down Expand Up @@ -126,6 +128,7 @@ def validate_config(config):
# Call the service-specific validator
SERVICES[service].validate_config(config, target)


def load_config():
opts, args = parse_args()

Expand Down
2 changes: 1 addition & 1 deletion bugwarrior/services/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def __init__(self, *args, **kw):
username = self.config.get(self.target, 'username')
service = "github://%[email protected]/%s" % (login, username)
password = get_service_password(service, login, oracle=password,
interactive=self.config.interactive)
interactive=self.config.interactive)
self.auth = (login, password)

self.exclude_repos = []
Expand Down
11 changes: 5 additions & 6 deletions bugwarrior/services/jira.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ def __init__(self, *args, **kw):
if not password or password.startswith("@oracle:"):
service = "jira://%s@%s" % (self.username, self.url)
password = get_service_password(service, self.username,
oracle=password, interactive=self.config.interactive)
oracle=password,
interactive=self.config.interactive)

default_query = 'assignee=' + self.username + \
' AND status != closed and status != resolved'
Expand Down Expand Up @@ -79,8 +80,9 @@ def annotations(self, issue):

return dict(annotations)

def __convert_for_jira4(self,issue):
def __convert_for_jira4(self, issue):
print(issue.key)

class IssueWrapper:
pass
#print(self.jira.issue(issue.key).fields.summary.value)
Expand Down Expand Up @@ -118,15 +120,12 @@ def __issue(self, case, jira_version):
def issues(self):
cases = self.jira.search_issues(self.query, maxResults=-1)

jira_version = 5 # Default version number
jira_version = 5 # Default version number
if self.config.has_option(self.target, 'jira.version'):
jira_version = self.config.getint(self.target, 'jira.version')
if jira_version == 4:
# Convert for older jira versions that don't support the new API
cases = [self.__convert_for_jira4(case) for case in cases]


log.name(self.target).debug(" Found {0} total.", len(cases))


return [self.__issue(case, jira_version) for case in cases]

0 comments on commit d915515

Please sign in to comment.