Skip to content

Conversation

@MangoTCF
Copy link

@MangoTCF MangoTCF commented Jan 27, 2026

This PR is part 1 of many.
Files modified by me are:

tools.py
actions.py
aliases.py
config.py
mapper.py
special_actions.py
uinut.py

Other files are reformatted via ruff as per the configuration in pyproject.toml
As open as i could be to constructive criticism, as this is my first more or less serious PR.

@C0rn3j
Copy link
Owner

C0rn3j commented Jan 27, 2026

You should be able to drop the format everything with ruff commit, I've taken in most of the changes that Ruff recommended, still need to later mark the areas I left out so it does not touch it on the next run.

Hopefully this does not make it too annoying to drop the commit and rebase.

I'm planning to also run ruff check --fix later to catch other easy issues.

@MangoTCF MangoTCF reopened this Jan 27, 2026
@MangoTCF
Copy link
Author

Shot myself in the foot with git a bit, everything should be a-ok now

@MangoTCF MangoTCF changed the title Add typings to some parts of the code and run a formatter on the codebase for the first time in seemingly ages Add typings to some parts of the code Jan 27, 2026
@MangoTCF
Copy link
Author

Should I infer and add a complete, really big, type to the config in config.py or is it being a dict[str, Any] enough?

@C0rn3j
Copy link
Owner

C0rn3j commented Jan 27, 2026

We can always make it more specific later if desired, Any is probably fine there

@MangoTCF
Copy link
Author

Also we really need to migrate away from PyGObject as it at the very least messes with typecheckers

And, like, the whole GTK5 release = GTK3 EOL thing

I propose Qt 6 as it looks like thay are moving in the right direction


def __init__(self):
self.in_use = False
super().__init__()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need to init the super class here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linter complains :) It's better to do that for code consistency etc.

Comment on lines +350 to 351
# why not move size to be the second argument then?
control_with, size = DEFAULT, control_with
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a cursed shorthand.

>>> x, y = 1, 2
>>> x, y = 3, x
>>> print(x, y)
3 1

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, i get it, but why do
def f(a, b, c=DEFAULT, ..., shorthand_notation_thing=0):
if one can do
def f(a, b, shorthand_notation_thing=0, c=DEFAULT, ...):
?


def whole(self, mapper, x, y, what):
@override
def whole(self, mapper, x: int | float, y: int | float, what: str, *_params):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the added *_params?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My linter says that this method "overrides in an incompatible way". There's some more errors like this, but I'd need some more experience with the codebase to be sure how to fix them

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically, the signatures of the methods should be compatible as per the docs which IMHO is a good idea

@C0rn3j
Copy link
Owner

C0rn3j commented Jan 28, 2026

I've unresolved some things you've set as resolved without a change/answer and added some more.

I think besides the currently open conversations, this is LGTM, so please let's get this PR in before expanding it further, it's getting hard to review, thanks!

@MangoTCF
Copy link
Author

Also to avoid having to do the whole rebasing thing on the next PR you could run ruff check --fix which would supposedly fix everything that's safe to fix.

@MangoTCF
Copy link
Author

MangoTCF commented Jan 29, 2026

@C0rn3j could you please look through the open conversations and affirm that everything is OK and my reasons for doing the things I did are valid?

@C0rn3j
Copy link
Owner

C0rn3j commented Jan 29, 2026

Did you perhaps Start a review but never sent it in? I see no comments.

class Keys(IntEnum):
"""Keys enum contains all keys and button from linux/uinput.h (KEY_* BTN_*)."""

# TODO: Put these back when minimum Python version is... 3.10? https://github.com/C0rn3j/sc-controller/issues/24
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, what's the stance with these TODOs? 3.09 is EOL as per this


def whole(self, mapper, x, y, what):
@override
def whole(self, mapper, x: int | float, y: int | float, what: str, *_params):
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically, the signatures of the methods should be compatible as per the docs which IMHO is a good idea

@MangoTCF
Copy link
Author

Yup, you're completely right -_- i need to learn how to interface with all this better

@MangoTCF
Copy link
Author

MangoTCF commented Feb 1, 2026

@C0rn3j Any updates? Or did i do something wrong again? :p

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants