Skip to content

Commit

Permalink
Small fix for type checking with pyright
Browse files Browse the repository at this point in the history
The type checker that is included with Visual Studio Code (pyright)
will only resolve imports in the try branch of a try-except statement.

This means that VSPresetVideoFormat won't be resolved if your typing
stubs are up-to-date, as the correct import is in the except branch.

Swapping the try and except branches makes it work with freshly
generated stubs, but will break older ones. However, since there is
(seemingly) no way to make it work with both, having newer ones work
seems like the better compromise to me.
  • Loading branch information
StollD committed Oct 18, 2024
1 parent ea70fce commit 6e89939
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions vstools/utils/vs_enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
from vapoursynth import FLOAT, GRAY, INTEGER, RGB, YUV

try:
from vapoursynth import PresetFormat as VSPresetVideoFormat
except ImportError:
from vapoursynth import PresetVideoFormat as VSPresetVideoFormat
except ImportError:
from vapoursynth import PresetFormat as VSPresetVideoFormat

from .other import IS_DOCS

Expand Down

0 comments on commit 6e89939

Please sign in to comment.