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_.result.reset()
|
||||||
worker_.kill()
|
worker_.kill()
|
||||||
|
|
||||||
def _partition(self, percentage, widgets, length):
|
@staticmethod
|
||||||
|
def _partition(percentage, widgets, length):
|
||||||
smaller_length = max(int(length * (percentage / 100)), 10)
|
smaller_length = max(int(length * (percentage / 100)), 10)
|
||||||
return [smaller_length, length - smaller_length]
|
return [smaller_length, length - smaller_length]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,8 @@ class Column:
|
||||||
return join_vertical([row_widget.appearance_for((width, item_height))
|
return join_vertical([row_widget.appearance_for((width, item_height))
|
||||||
for row_widget, item_height in zip(self.widgets, heights)])
|
for row_widget, item_height in zip(self.widgets, heights)])
|
||||||
|
|
||||||
def _appearance_list(self, widgets):
|
@staticmethod
|
||||||
|
def _appearance_list(widgets):
|
||||||
if widgets == []:
|
if widgets == []:
|
||||||
return []
|
return []
|
||||||
appearances = [row_widget.appearance() for row_widget in widgets]
|
appearances = [row_widget.appearance() for row_widget in widgets]
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,8 @@ class CharStyle:
|
||||||
attributes.append("u")
|
attributes.append("u")
|
||||||
return f"<CharStyle: fg:{self.fg_color} bg:{self.bg_color} attr:{','.join(attributes)}>"
|
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):
|
if isinstance(color_, int):
|
||||||
return color(color_, is_foreground)
|
return color(color_, is_foreground)
|
||||||
else: # true color
|
else: # true color
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue