home.social

#gitlogui — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #gitlogui, aggregated by home.social.

  1. 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 (codeberg.org/harald/gitlogui) the main script of which I called glu. So I am running

    pyfix glu

    all the time, which reads funny. 😀

    #python #gitlogui #mypy #ruff #strongTyping #linting

  2. 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 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.

    #python #typehint #strongTyping #gitlogui