Skip to content

Commit

Permalink
refactoring by removing some duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
benjmin-r committed Mar 1, 2016
1 parent 77eb3f4 commit f2e7541
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions trello/checklist.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,8 @@ def set_checklist_item(self, name, checked):
:name: name of the checklist item
:checked: True if item state should be checked, False otherwise
"""

# Locate the id of the checklist item
try:
[ix] = [i for i in range(len(self.items)) if
self.items[i]['name'] == name]
except ValueError:
ix = self._get_item_id(name)
if ix is None:
return

json_obj = self.client.fetch_json(
Expand Down Expand Up @@ -96,11 +92,8 @@ def rename_checklist_item(self, name, new_name):
:name: name of the checklist item
:new_name: new name of item
"""

# Locate the id of the checklist item
try:
[ix] = [i for i in range(len(self.items)) if self.items[i]['name'] == name]
except ValueError:
ix = self._get_item_id(name)
if ix is None:
return

json_obj = self.client.fetch_json(
Expand Down

0 comments on commit f2e7541

Please sign in to comment.