Skip to content

Commit fc3e65f

Browse files
committed
Use property decorator
1 parent 7b6ab95 commit fc3e65f

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

bpython/curtsiesfrontend/repl.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1735,9 +1735,15 @@ def __repr__(self):
17351735
lines scrolled down: {self.scroll_offset}
17361736
>"""
17371737

1738-
def _get_current_line(self):
1738+
@property
1739+
def current_line(self):
1740+
"""The current line"""
17391741
return self._current_line
17401742

1743+
@current_line.setter
1744+
def current_line(self, value):
1745+
self._set_current_line(value)
1746+
17411747
def _set_current_line(
17421748
self,
17431749
line,
@@ -1758,13 +1764,15 @@ def _set_current_line(
17581764
self.special_mode = None
17591765
self.unhighlight_paren()
17601766

1761-
current_line = property(
1762-
_get_current_line, _set_current_line, None, "The current line"
1763-
)
1764-
1765-
def _get_cursor_offset(self):
1767+
@property
1768+
def cursor_offset(self):
1769+
"""The current cursor offset from the front of the "line"."""
17661770
return self._cursor_offset
17671771

1772+
@cursor_offset.setter
1773+
def cursor_offset(self, value):
1774+
self._set_cursor_offset(value)
1775+
17681776
def _set_cursor_offset(
17691777
self,
17701778
offset,
@@ -1787,13 +1795,6 @@ def _set_cursor_offset(
17871795
self.update_completion()
17881796
self.unhighlight_paren()
17891797

1790-
cursor_offset = property(
1791-
_get_cursor_offset,
1792-
_set_cursor_offset,
1793-
None,
1794-
"The current cursor offset from the front of the " "line",
1795-
)
1796-
17971798
def echo(self, msg, redraw=True):
17981799
"""
17991800
Notification that redrawing the current line is necessary (we don't

0 commit comments

Comments
 (0)