Skip to content

Commit cb816bc

Browse files
committed
Use {} and [] instead of dict() and list()
Solve pylint warning and it's more appropriate I would say.
1 parent 4a4798e commit cb816bc

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

simpleline/render/prompt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def __init__(self, message=DEFAULT_MESSAGE):
5656
:type message: str|None
5757
"""
5858
self.message = message
59-
self.options = dict()
59+
self.options = {}
6060

6161
def set_message(self, message):
6262
"""Set the prompt message.

simpleline/render/widgets.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def width(self):
5959

6060
def clear(self):
6161
"""Clears this widgets buffer and resets cursor."""
62-
self._buffer = list()
62+
self._buffer = []
6363
self._cursor = (0, 0)
6464

6565
@property
@@ -131,14 +131,14 @@ def draw(self, w, row=None, col=None, block=False):
131131
# fill up rows to accommodate for w.height
132132
if self.height < row + w.height:
133133
for _i in range(row + w.height - self.height):
134-
self._buffer.append(list())
134+
self._buffer.append([])
135135

136136
# append columns to accommodate for w.width
137137
for l in range(row, row + w.height):
138138
l_len = len(self._buffer[l])
139139
w_len = len(w.content[l - row])
140140
if l_len < col + w_len:
141-
self._buffer[l] += ((col + w_len - l_len) * list(" "))
141+
self._buffer[l] += ((col + w_len - l_len) * [" "])
142142
self._buffer[l][col:col + w_len] = w.content[l - row][:]
143143

144144
# move the cursor to new spot
@@ -220,11 +220,11 @@ def write(self, text, row=None, col=None, width=None, block=False, wordwrap=Fals
220220
def _increase_x_buffer_size(self, x):
221221
if x >= len(self._buffer):
222222
for _i in range(x - len(self._buffer) + 1):
223-
self._buffer.append(list())
223+
self._buffer.append([])
224224

225225
def _increase_y_buffer_size(self, x, y):
226226
if y >= len(self._buffer[x]):
227-
self._buffer[x] += ((y - len(self._buffer[x]) + 1) * list(" "))
227+
self._buffer[x] += ((y - len(self._buffer[x]) + 1) * [" "])
228228

229229
def _save_character_to_buffer(self, x, y, character):
230230
self._buffer[x][y] = character
@@ -342,7 +342,7 @@ def write(self, text, row=None, col=None, width=None, block=False, wordwrap=Fals
342342
To print just a blank line we don't need too much logic.
343343
"""
344344
for i in range(0, self._lines):
345-
self._buffer.append(list())
345+
self._buffer.append([])
346346
self._buffer[i] += ""
347347
self.set_cursor_position(self._lines - 1, 0)
348348

0 commit comments

Comments
 (0)