Automatic fixes to Python files

check=True was manually set when return code was checked later
This commit is contained in:
Geoffrey Frogeye 2025-05-08 17:56:11 +02:00
parent a3f4c2a932
commit 34b545890d
7 changed files with 22 additions and 33 deletions

View file

@ -40,8 +40,7 @@ def humanSize(numi: int) -> str:
if abs(num) < 1000:
if num >= 10:
return f"{int(num):3d}{unit}"
else:
return f"{num:.1f}{unit}"
return f"{num:.1f}{unit}"
num /= 1024
return f"{numi:d}YiB"
@ -127,7 +126,7 @@ class Section(ComposableText):
color: rich.color.Color = rich.color.Color.default(),
) -> None:
super().__init__(parent=parent, sortKey=sortKey)
self.parent: "Module"
self.parent: Module
self.color = color
self.desiredText: str | None = None
@ -216,7 +215,7 @@ class Module(ComposableText):
def __init__(self, parent: "Side") -> None:
super().__init__(parent=parent)
self.parent: "Side"
self.parent: Side
self.children: typing.MutableSequence[Section]
self.mirroring: Module | None = None
@ -229,8 +228,7 @@ class Module(ComposableText):
def getSections(self) -> typing.Sequence[Section]:
if self.mirroring:
return self.mirroring.children
else:
return self.children
return self.children
def updateMarkup(self) -> None:
super().updateMarkup()
@ -276,11 +274,10 @@ class Side(ComposableText):
text += ""
else:
text += "%{F" + hexa + "}%{R}"
elif lastSection.color == section.color:
text += ""
else:
if lastSection.color == section.color:
text += ""
else:
text += "%{R}%{B" + hexa + "}"
text += "%{R}%{B" + hexa + "}"
text += "%{F-}"
text += section.getMarkup()
lastSection = section
@ -292,7 +289,7 @@ class Side(ComposableText):
class Screen(ComposableText):
def __init__(self, parent: "Bar", output: str) -> None:
super().__init__(parent=parent)
self.parent: "Bar"
self.parent: Bar
self.children: typing.MutableSequence[Side]
self.output = output
@ -323,7 +320,7 @@ class Bar(ComposableText):
self.refresh = asyncio.Event()
self.taskGroup = asyncio.TaskGroup()
self.providers: list["Provider"] = list()
self.providers: list[Provider] = list()
self.actionIndex = 0
self.actions: dict[str, typing.Callable] = dict()
@ -547,7 +544,7 @@ class MultiSectionsProvider(Provider):
self.updaters: dict[Section, typing.Callable] = dict()
async def getSectionUpdater(self, section: Section) -> typing.Callable:
raise NotImplementedError()
raise NotImplementedError
@staticmethod
async def doNothing() -> None:
@ -584,7 +581,7 @@ class PeriodicProvider(Provider):
pass
async def loop(self) -> None:
raise NotImplementedError()
raise NotImplementedError
@classmethod
async def task(cls, bar: Bar) -> None:

View file

@ -218,15 +218,13 @@ class MprisProvider(MirrorProvider):
) -> typing.Any:
if key in something.keys():
return something[key]
else:
return default
return default
@staticmethod
def formatUs(ms: int) -> str:
if ms < 60 * 60 * 1000000:
return time.strftime("%M:%S", time.gmtime(ms // 1000000))
else:
return str(datetime.timedelta(microseconds=ms))
return str(datetime.timedelta(microseconds=ms))
def findCurrentPlayer(self) -> None:
for name in [self.playerctldName] + self.manager.props.player_names:

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python3
import sys
import os
import sys
# From https://github.com/python/cpython/blob/v3.7.0b5/Lib/site.py#L436