Coding style
- Use staticmethod where possible.
This commit is contained in:
parent
d5ab419fc2
commit
0ab831e48b
3 changed files with 6 additions and 3 deletions
|
|
@ -679,7 +679,8 @@ class Screen:
|
|||
worker_.result.reset()
|
||||
worker_.kill()
|
||||
|
||||
def _partition(self, percentage, widgets, length):
|
||||
@staticmethod
|
||||
def _partition(percentage, widgets, length):
|
||||
smaller_length = max(int(length * (percentage / 100)), 10)
|
||||
return [smaller_length, length - smaller_length]
|
||||
|
||||
|
|
|
|||
|
|
@ -122,7 +122,8 @@ class Column:
|
|||
return join_vertical([row_widget.appearance_for((width, item_height))
|
||||
for row_widget, item_height in zip(self.widgets, heights)])
|
||||
|
||||
def _appearance_list(self, widgets):
|
||||
@staticmethod
|
||||
def _appearance_list(widgets):
|
||||
if widgets == []:
|
||||
return []
|
||||
appearances = [row_widget.appearance() for row_widget in widgets]
|
||||
|
|
|
|||
|
|
@ -127,7 +127,8 @@ class CharStyle:
|
|||
attributes.append("u")
|
||||
return f"<CharStyle: fg:{self.fg_color} bg:{self.bg_color} attr:{','.join(attributes)}>"
|
||||
|
||||
def _color_code(self, color_, is_foreground):
|
||||
@staticmethod
|
||||
def _color_code(color_, is_foreground):
|
||||
if isinstance(color_, int):
|
||||
return color(color_, is_foreground)
|
||||
else: # true color
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue