Skip to content

Commit dff1f04

Browse files
committed
settings: moar lambda
Signed-off-by: David Aguilar <davvid@gmail.com>
1 parent cee844f commit dff1f04

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

cola/settings.py

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ def mklist(obj):
2727

2828
class Settings(object):
2929
_file = resources.config_home('settings')
30+
bookmarks = property(lambda self: mklist(self.values['bookmarks']))
31+
gui_state = property(lambda self: mkdict(self.values['gui_state']))
32+
recent = property(lambda self: mklist(self.values['recent']))
3033

3134
def __init__(self, verify=git.is_git_worktree):
3235
"""Load existing settings if they exist"""
@@ -39,7 +42,6 @@ def __init__(self, verify=git.is_git_worktree):
3942
self.load()
4043
self.remove_missing()
4144

42-
4345
def remove_missing(self):
4446
missing_bookmarks = []
4547
missing_recent = []
@@ -64,20 +66,6 @@ def remove_missing(self):
6466
except:
6567
pass
6668

67-
# properties
68-
def _get_bookmarks(self):
69-
return mklist(self.values['bookmarks'])
70-
71-
def _get_gui_state(self):
72-
return mkdict(self.values['gui_state'])
73-
74-
def _get_recent(self):
75-
return mklist(self.values['recent'])
76-
77-
bookmarks = property(_get_bookmarks)
78-
gui_state = property(_get_gui_state)
79-
recent = property(_get_recent)
80-
8169
def add_bookmark(self, bookmark):
8270
"""Adds a bookmark to the saved settings"""
8371
if bookmark not in self.bookmarks:

0 commit comments

Comments
 (0)