-
-
Notifications
You must be signed in to change notification settings - Fork 263
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
Fix pylint and flake8 issues #194
Conversation
Ready for review. Details at: https://travis-ci.org/dagwieers/plugin.video.netflix/builds/582479348 |
All pylint and flake8 issues are now fixed in this PR. |
I hope changing iteritems to itens won't slow down the add-on, as it's already pretty CPU consuming on a Raspberry Pi. |
@Smeulf I agree, we need to test the performance impact. Once we have integrations tests implemented, I would like to look at performance and see where we can improve the add-on. One of the slowdowns is the use of Requests on Raspberry Pi, for VRT NU and InputStream Helper we moved to using urllib/urllib2. Another slowdown is the imports at the top of files. In some cases it is better to import modules when they are needed (it depends of code paths, are they avoidable or not). |
I also don't mind splitting off the Python 3 stuff from this PR. But unfortunately it does not make sense to do that on the master branch because it would lead to conflicts later. |
Be aware I have both Pi2 and Pi3, so I can run tests under LibreELEC and OSMC on both versions, should you give me the proper tools ;) No Pi4 (Yet^^). |
@Smeulf The slow urllib3 (requests) imports have been fixed in the meantime. But it used to take 4 seconds in later releases. Now it is 100ms on import, but possible slow on first requests. |
Are you sure it's a really good idea to merge it now in master? I'm pertty confident about what you're doing, but... Well you know ;) |
@Smeulf In my tests on Raspberry Pi 3 I don't see any real differences though. I think any performance wins are more likely to be found elsewhere than this. |
Didn't know you have one :) so be it! |
@Smeulf I have RPi2, RPi3 and RPi4 in use today. But RPi2 and RPi3 are used most of the time ;-) |
I got my integration tests working:
But I need this PR to be merged first before I can start adding the tests. |
My integration tests are failing on Travis and I guess I need @CastagnaIT or @Smeulf to look at what is going on. https://travis-ci.org/dagwieers/plugin.video.netflix/builds/582479467 Running |
The only variable used to perform the handshake is the esn. Not sure it will work :/ |
So you mean I should not set both NETFLIX_USERNAME and NETFLIX_PASSWORD, and also provide a NETFLIX_ESN ? |
Yes, the username and password should be sufficient. Setting a custom esn is used mostly for Android when 4K is not available. If no esn is set (most of the time) the add-on should generate one (based on the profile iirc). |
Very good. That will increase coverage ;-) PS While testing the integration tests (on my Intel laptop) things are very slow, and I can see things running repeatedly that shouldn't be run repeatedly IMO. (This is unrelated to any recent changes, because the same code works fine on Netflix, it might be that e.g. debug-mode is just a lot slower). |
I think there are some better solutions for iteritems than the one proposed by kodi-addon-checker. https://python-future.org/compatible_idioms.html#lists-versus-iterators |
That's exactly the article I had in mind when asking that question! :D |
Any example? |
@Smeulf The profiles are being processed repeatedly (very slowly) every time (and sometimes more than once). Have you run these integration tests |
I didn't run Everytime the addon.py is launch, we send a web request to get the profile list. That seems pretty good as we need to ensure the profile still exists. But that request takes between 200 and 800ms (here on Windows, I assume on Pi it's worse). The second profile request is made before request to some lists or data. As if we validate again the profile still exists. And there I don't know why. |
This is a set of fixes for known pylint and flake8 issues. The goal is to enable pylint and tox by default so new code is properly tested and conforms to pylint and flake8 checks.
@Smeulf I removed the Python 3 stuff from this PR. Thanks for your insights ;-) |
Please merge! And enable Travis support. https://travis-ci.org/dagwieers/plugin.video.netflix/builds/582739408 |
Check if this PR fulfills these requirements:
Types of changes
Description
This is a set of fixes for known pylint and flake8 issues.
The goal is to enable pylint and tox by default so new code
is properly tested and conforms to pylint and flake8 checks.