-
Notifications
You must be signed in to change notification settings - Fork 404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
General cleanup of code #2273
Comments
Yeah, the question is identifying what should be removed. |
At least the code pieces commented with Python 2, which I already removed and pushed. Maybe 'Upgrade code to Python 3 style' is a better title, in order to upgrade strings to f-strings with pyupgrade as well and upgrade remaining strings manually.
|
In addition to that, I also suggest a switch to double-quoted strings "" instead of '', and an upgrade to the insanely fast |
These seem reasonable, but let's defer this until after 1.11.1 goes out, which should be in a week. Then I have a bunch of changes to improve the imports loops, except for the big one of calling the UI from logitech_receiver. |
I think the mentioned issues have already been implemented. However, when adapting the title to clean up, it could target
|
The advice I have received is that the license notice should be at the top of each file. It's probably overkill but that is what I have been told. |
Yes, it is and it is not beneficial for development and leads to some irritation for me. It is obvious, that there's no real plan for maintaining them, since most of the years date back to 2012-2013. This needs a plan and the best is to remove unnecessary duplication and ambiguous years from the individual files.
|
The important part of this section is the license. The code is Solaar uses the GPL and this can't be changed and should be prominently mentioned in each file. It is true that the copyright line has not been updated. I'm now putting new information in for the files that I am touching. |
Good, then a cleanup and unification would be to replace all existing ones with that timeless message, as 90% of them are dated. |
This needs a pre-commit hook then, otherwise it will never be up-to-date. |
The copyright lines are the least important part of the license block, or so I understand. Having them be out of date is not ideal but doesn't invalidate the license. |
Sure, but there's certainly a nice handy tool to maintain it. Or, I would not even add a date at all anymore. |
Related pwr-Solaar#2273
Related pwr-Solaar#2273
The basic files in root often use all capitals, as is already used for readme and manifest. Related pwr-Solaar#2273
Hi. I wish I could help for this task, since it is a good way to discover the project and step up. I am a pretty good soldier, but I do not know the battlefield and the HQ-objectives, so I should be instructed. I was thinking, that the point:
Would be feasible without a deep knowledge of the project. (The Namedint to Enum could also be a good candidate) I understand, that the point is to replace with "try ... except ... " the "assert" assertions in the productive code, since it is meant to be testing purpose. Is this correct? My dev/test environments will be:
|
Hi, you actually picked the hardest task of these. I meant to rewrite the code in a way that it does not rely on a humongoues amount of availability checks. I wouldn't recommend to start with this. They need more like a good overview of the wgole project and a solid plan. The remaining tasks are easier to get started and can be done in smaller iterations. Any change should be covered by a small unit test. It is often helpful to split some parts of a huge function into smaller ones, that are testable on their own. |
Ok. Then I will do the [NamedInt, NamedInts, UnsortedNamedInts] part. About the tests, I have 28 from the 470 tests that are failing. Is this something, that I can first ignore (some of the tests seems quite recent and maybe not stable yet / in development) Is the fact that the existing following test still passes: logitech_receiver/test_setting_templates.py::test_key_template[test0] not a test? or is another purpose to increase the test coverage? |
I am thinking about starting with the class _SettingWithValueUI from diversion_rules.py and the list of settings. But I am a bit clueless about the tests to create. I will think about it. Or:
seems to be another good candidate (like by creating a class instead of those 3 consts)? |
The tree model stuff likely needs to change for GTK 4.0, so I'd not touch it right now.
Starting from my latest pull request #2626 all tests should pass. I think the hidpp constants contain many NamedInts, which seem doable to replace, especially the ones without fallback value. Some modules like diversion/rules at not teddy for testing yet, but if a function is well testable on its own a test helps. |
I saw the diff of your PR. I will wait for the merge before any modifications 😃 I can not work on it before this weekend. Do you have WIP on hidapi (I saw #2480 is in progress), which would conflict with hidpp (not sure about it, I did not check the code about this part): to avoid conflicts, I would use your branch. |
No, there's nothing else to consider. This is the latest version and already includes many hidapi abstraction improvements. |
Is this: What you are expecting for the testing, before I start with the refactoring? |
Yes, that looks good |
Related pwr-Solaar#2273
Related pwr-Solaar#2273
Convert Feature NamedInts to SupportedFeature integer enum. Related pwr-Solaar#2273
Convert Feature NamedInts to SupportedFeature integer enum. Related pwr-Solaar#2273
Convert Feature NamedInts to SupportedFeature integer enum. Related pwr-Solaar#2273
Convert Feature NamedInts to SupportedFeature integer enum. Related #2273
Explicitly list supported notification types and introduce unit tests. Related pwr-Solaar#2273
Convert Feature NamedInts to SupportedFeature integer enum. Related pwr-Solaar#2273
Convert Feature NamedInts to SupportedFeature integer enum. Related pwr-Solaar#2273
Replace NamedInts implementation with IntFlag enum and plain flag_names function. Related pwr-Solaar#2273
- Move general FirmwareKind to common module. - Replace NamedInts implementation with IntEnum. - Harden related HIDPP 1.0 get_firmware test. Related pwr-Solaar#2273
Information
Is your feature request related to a problem? Please describe.
The text was updated successfully, but these errors were encountered: