Skip to content

Commit

Permalink
Remove private/property attributes from Issue
Browse files Browse the repository at this point in the history
AFAIK we've never used these property decorators to diverge behavior
from the underlying data structures and they are thus superfluous. We
could always reintroduce them if they are needed.

This is to further slim down the base classes in order to stabilize
them, per #791.
  • Loading branch information
ryneeverett committed Sep 14, 2024
1 parent 90df565 commit 2738e59
Show file tree
Hide file tree
Showing 15 changed files with 18 additions and 29 deletions.
15 changes: 2 additions & 13 deletions bugwarrior/services/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,10 @@ class Issue(abc.ABC):
PRIORITY_MAP = {}

def __init__(self, foreign_record, config, main_config, extra=None):
self._foreign_record = foreign_record
self.record = foreign_record
self.config = config
self.main_config = main_config
self._extra = extra if extra else {}

def update_extra(self, extra):
self._extra.update(extra)
self.extra = extra if extra else {}

@abc.abstractmethod
def to_taskwarrior(self):
Expand Down Expand Up @@ -268,14 +265,6 @@ def build_default_description(
url,
)

@property
def record(self):
return self._foreign_record

@property
def extra(self):
return self._extra


class ServiceClient:
""" Abstract class responsible for making requests to service API's. """
Expand Down
2 changes: 1 addition & 1 deletion bugwarrior/services/activecollab.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,5 +247,5 @@ def issues(self):
extra = {
'annotations': self.annotations(issue, issue_obj)
}
issue_obj.update_extra(extra)
issue_obj.extra.update(extra)
yield issue_obj
2 changes: 1 addition & 1 deletion bugwarrior/services/azuredevops.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def issues(self):
"namespace": (
f"{self.config.organization}\\{self.config.project}"),
}
issue_obj.update_extra(extra)
issue_obj.extra.update(extra)
yield issue_obj

def get_owner(self, issue):
Expand Down
4 changes: 2 additions & 2 deletions bugwarrior/services/bitbucket.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def issues(self):
'url': url,
'annotations': self.get_annotations(tag, issue, issue_obj, url)
}
issue_obj.update_extra(extras)
issue_obj.extra.update(extras)
yield issue_obj

if self.config.include_merge_requests:
Expand Down Expand Up @@ -239,5 +239,5 @@ def not_resolved(tup): return tup[1]['state'] not in closed
'annotations': self.get_annotations(
tag, issue, issue_obj, url)
}
issue_obj.update_extra(extras)
issue_obj.extra.update(extras)
yield issue_obj
2 changes: 1 addition & 1 deletion bugwarrior/services/bts.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,5 +228,5 @@ def issues(self):
extra = {
'annotations': self.annotations(issue)
}
issue_obj.update_extra(extra)
issue_obj.extra.update(extra)
yield issue_obj
2 changes: 1 addition & 1 deletion bugwarrior/services/bz.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ def issues(self):
else:
extra['assigned_on'] = None

issue_obj.update_extra(extra)
issue_obj.extra.update(extra)
yield issue_obj

def _get_assigned_date(self, issue):
Expand Down
2 changes: 1 addition & 1 deletion bugwarrior/services/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,5 +498,5 @@ def issues(self):
'body': self.body(issue),
'namespace': self.config.username,
}
issue_obj.update_extra(extra)
issue_obj.extra.update(extra)
yield issue_obj
4 changes: 2 additions & 2 deletions bugwarrior/services/gitlab.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ def _get_issue_objs(self, issues, issue_type):
'annotations': self.annotations(repo, issue_url, type_plural, issue),
'description': self.description(issue),
}
issue_obj.update_extra(extra)
issue_obj.extra.update(extra)
yield issue_obj

def _get_todo_objs(self, todos):
Expand All @@ -645,7 +645,7 @@ def _get_todo_objs(self, todos):
'type': 'todo',
'annotations': [],
}
todo_obj.update_extra(extra)
todo_obj.extra.update(extra)
yield todo_obj

def include(self, issue):
Expand Down
2 changes: 1 addition & 1 deletion bugwarrior/services/gmail.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def issues(self):
extra = {
'annotations': self.annotations(issue),
}
issue.update_extra(extra)
issue.extra.update(extra)
yield issue


Expand Down
2 changes: 1 addition & 1 deletion bugwarrior/services/jira.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,5 +456,5 @@ def issues(self):
extra.update({
'annotations': self.annotations(case, issue)
})
issue.update_extra(extra)
issue.extra.update(extra)
yield issue
2 changes: 1 addition & 1 deletion bugwarrior/services/pagure.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,5 +200,5 @@ def issues(self):
'type': 'pull_request' if 'branch' in issue else 'issue',
'annotations': self.annotations(issue)
}
issue_obj.update_extra(extra)
issue_obj.extra.update(extra)
yield issue_obj
2 changes: 1 addition & 1 deletion bugwarrior/services/teamwork_projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,5 +159,5 @@ def issues(self):
"host": self.config.host,
'annotations': self.get_comments(issue),
}
issue_obj.update_extra(extra)
issue_obj.extra.update(extra)
yield issue_obj
2 changes: 1 addition & 1 deletion bugwarrior/services/trac.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,5 +170,5 @@ def issues(self):
'annotations': self.annotations(issue),
'project': project,
}
issue_obj.update_extra(extra)
issue_obj.extra.update(extra)
yield issue_obj
2 changes: 1 addition & 1 deletion bugwarrior/services/trello.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def issues(self):
listextra = dict(boardname=board['name'], listname=lst['name'])
for card in self.get_cards(lst['id']):
issue = self.get_issue_for_record(card, extra=listextra)
issue.update_extra({"annotations": self.annotations(card)})
issue.extra.update({"annotations": self.annotations(card)})
yield issue

def annotations(self, card_json):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_azuredevops.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def test_to_taskwarrior(self):
"annotations": [],
"namespace": "test_organization\\test_project",
}
issue.update_extra(extra)
issue.extra.update(extra)

expected = {
issue.TITLE: TEST_ISSUE["fields"]["System.Title"],
Expand Down

0 comments on commit 2738e59

Please sign in to comment.