-
Hey, I had code like this... def build_secrets(distribution_name: str) -> dict:
try:
credentials = config["artifactory"]["read_credentials"]
except NoSectionError:
return {}
return {"read_auth": credentials} While How would I turn this warning into an error? I have already scrolled though pylance's Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Pylance does not emit diagnostics (errors, warnings, etc.) for an unused parameter, so there's no way to adjust the severity. There are many legitimate cases in Python for function parameters that must be present but go unused (e.g. magic methods, abstract method implementations, protocol method implementations, base class method overrides), so emitting a diagnostic for this case would be produce many false positives. Instead, Pylance uses a subtle "grayed out" effect so you can see that a parameter is unreferenced and decide whether that's appropriate in your particular case. |
Beta Was this translation helpful? Give feedback.
Pylance does not emit diagnostics (errors, warnings, etc.) for an unused parameter, so there's no way to adjust the severity. There are many legitimate cases in Python for function parameters that must be present but go unused (e.g. magic methods, abstract method implementations, protocol method implementations, base class method overrides), so emitting a diagnostic for this case would be produce many false positives. Instead, Pylance uses a subtle "grayed out" effect so you can see that a parameter is unreferenced and decide whether that's appropriate in your particular case.