fix(api-nodes): enable 2 more pylint rules, removed non needed code #10192
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We can safely enable the
import-outside-toplevel
rule, since there is no reason for API nodes not to import all required modules at the top of the file. If there is ever a strong need to import something elsewhere, we can mark that line with# noqa
.After enabling the
inconsistent-return-statements
rule, I reviewed thevalidate_input_media
function. It sometimes returnsNone
, but overall does nothing useful. It can return a string in case of failed validation, but its result is never checked anywhere. When testing the API, I found that rewriting it toraise
an error on validation would break some existing workflows, because the Moonvalley API successfully processes videos with non-odd dimensions (so the check itself is invalid if we enforce it). I also could not find any cases wherewith_frame_conditioning
is required - maybe it was intended for a future video2video implementation that does not yet exist. For now, I suggest removing this unused function completely. If we need this functionality later, we can re-implement it invalidation_utils.py
so it can benefit other nodes and be easy to find/test.Test that moving import does not break Gemini node:
Test to prove that dimension check for Moonvalley node is incorrect if we enable it:
moonvalley.mp4