#gitlogui — Public Fediverse posts
Live and recent posts from across the Fediverse tagged #gitlogui, aggregated by home.social.
-
I have a script called pyfix which runs mypy and ruff to
- have strong typing
- have a fixed and orderly import order
- have the file always formatted in the same way
- detect programming errors and redundancies.Now I am working on gitlogui (https://codeberg.org/harald/gitlogui) the main script of which I called glu. So I am running
pyfix glu
all the time, which reads funny. 😀
-
Nice one. Type hints in Python allow to list a number of literal values, similar to TypeScript union types and the syntax is actually somewhat more explicit.
To implement page up/down in https://codeberg.org/harald/gitlogui I have now:
def doPage(self, factor: Literal[-1] | Literal[1]) -> None:
step = factor * int(self.pageSize.get())
...and I can be sure, when using mypy, that doPage is only ever called with either -1 or 1.