Skip to content

Commit

Permalink
Merge pull request #105 from coddingtonbear/fix_pep8_errors
Browse files Browse the repository at this point in the history
PEP-8/style fixes.
  • Loading branch information
ralphbean committed Mar 12, 2014
2 parents 968b027 + 307069f commit 9eb3f6d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
13 changes: 8 additions & 5 deletions bugwarrior/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,14 +331,18 @@ def _bool_option(section, option, default):

# Before running CRUD operations, call the pre_import hook(s).
if conf.has_option('hooks', 'pre_import'):
pre_import = [t.strip() for t in conf.get('hooks', 'pre_import').split(',')]
pre_import = [
t.strip() for t in conf.get('hooks', 'pre_import').split(',')
]
if pre_import is not None:
for hook in pre_import:
exit_code = subprocess.call(hook, shell=True)
if exit_code is not 0:
log.name('hooks:pre_import').error(
'Non-zero exit code %d on hook %s' % (exit_code, hook))
sys.exit(1)
msg = 'Non-zero exit code %d on hook %s' % (
exit_code, hook
)
log.name('hooks:pre_import').error(msg)
raise RuntimeError(msg)

for issue in issue_generator:
if isinstance(issue, tuple) and issue[0] == ABORT_PROCESSING:
Expand All @@ -351,7 +355,6 @@ def _bool_option(section, option, default):
_, task = tw.get_task(uuid=existing_uuid)
task_copy = copy.deepcopy(task)


annotations_changed = merge_annotations(issue_dict, task)

if annotations_changed:
Expand Down
18 changes: 8 additions & 10 deletions bugwarrior/services/activecollab.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import itertools
import json
import re
import urllib2
import time

Expand Down Expand Up @@ -41,7 +40,6 @@ def get_task_dict(self, project, key, task):
assigned_task.update(task)
return assigned_task


def get_project_slug(self, permalink):
project_name = permalink.split('/')[4]
return project_name
Expand Down Expand Up @@ -81,7 +79,9 @@ def get_issue_generator(self, user_id, project_id, project_name):
(subtask[u'assignee_id'] == int(self.user_id))
and (subtask[u'completed_on'] is None)
):
subtask['project'] = self.get_project_slug(subtask['permalink'])
subtask['project'] = self.get_project_slug(
subtask['permalink']
)
subtask['type'] = 'subtask'
yield subtask

Expand Down Expand Up @@ -137,9 +137,7 @@ class ActiveCollabIssue(Issue):
}
UNIQUE_KEY = (FOREIGN_ID, )


def to_taskwarrior(self):

record = {
'project': self.record['project'],
'priority': self.get_priority(),
Expand All @@ -154,7 +152,7 @@ def to_taskwarrior(self):
}

if self.record['type'] == 'subtask':
" Store the parent task ID for subtasks "
# Store the parent task ID for subtasks
record['actaskid'] = self.record['permalink'].split('/')[6]

due_on = self.record.get('due_on')
Expand All @@ -179,8 +177,7 @@ def get_project(self):
project_id = self.record['permalink'].split('/')[4]
if (project_id.isdigit()):
return self.record['project']
else:
return project_id
return project_id

def get_default_description(self):
return self.build_default_description(
Expand Down Expand Up @@ -225,15 +222,16 @@ def validate_config(cls, config, target):

IssueService.validate_config(config, target)


def issues(self):
# Loop through each project
start = time.time()
issue_generators = []
projects = self.projects
for project in projects:
for project_id, project_name in project.iteritems():
log.name(self.target).debug(" Getting tasks for #%d %s" % (project_id, project_name))
log.name(self.target).debug(
" Getting tasks for #%d %s" % (project_id, project_name)
)
issue_generators.append(
self.client.get_issue_generator(
self.user_id, project_id, project_name
Expand Down

0 comments on commit 9eb3f6d

Please sign in to comment.