VEX API returns a number but Linter complains it does not

Hi,

I’m using Python on VEXcode IDE 2.4.0 for the EXP Brain. VEXos is 1.0.2.
Saving the optical brightness in a variable and printing the variable causes the linter to error.

brightness_var = optical_6.brightness() # linter produces error "Assigning result of a function call, where function has no return"
print(brightness_var)

But the code runs without issue when I click “Download Anyway”.

As a sanity check, I’ve performed the following tests that pass:

print(optical_6.brightness()) # works fine without error

brightness_var = float(optical_6.brightness()) # also works fine
print(brightness_var)

The linter complains brightness() doesn’t return a float but it does:

print(type(optical_6.brightness())) # prints "<class 'float'>"

Am I missing something? Again, the code works fine as expected, just the linter is mad.

Thank you.

Unfortunately, the data (dummy Python code) that the linter is using has quite a few mistakes. Many of these have been corrected in the VS Code extension but have not been back ported to VEXcode yet. If you see a mistake but the code is working correctly, then just ignore it, by adding

# pylint:disable=assignment-from-no-return

somewhere before you call the function

7 Likes