A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://stackoverflow.com/questions/79738644/getting-an-unexpected-token-error-with-jaxtyping below:

python - Getting an "unexpected token" error with jaxtyping

I'm getting these Pylance "Unexpected token at end of expression" errors in VS Code. It seems like Pylance isn't playing well with Jaxtyping, but there doesn't seem to be an obvious way to ignore this error message. Any suggestions for a fix or workaround?

After importing from jaxtyping and pytorch:

from jaxtyping import Float
from torch import Tensor

and adding type-hints for some attributes directly under a class declaration, I get the errors shown below (underlined red squiggly text):

In VS Code, I've messed around a bit in the settings.json trying out different things (e.g. Pyright as diagnostics source, and jedi as language server), without success.

Maybe there's a setting that could be added to this json block to just ignore these errors, but haven't found one.

"python.analysis.diagnosticSeverityOverrides": {
    "reportMissingImports": "none",
    "reportMissingModuleSource": "none",
    "reportUnknownVariableType": "none",
    "reportAssignmentType": "none",
},

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4