You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that all pydantic validators show up as false positives.
Given a module like this query.py
from pydantic import BaseModel, field_validator
class Query(BaseModel):
limit: int | None = None # number of rows to output
@field_validator("limit", mode="before")
@classmethod
def limit_must_be_int_or_none(cls, item: int | None) -> int | None:
"""Validate limit."""
match item:
case None | int():
return item
case _:
return None
Uncalled will flag the limit_must_be_int_or_none. I assume this is because my code doesn't call it. However, pydantic does call it whenever my Query gets instantiated. It is very much not dead code.
$ uncalled --how both query.py
query.py: Unused function limit_must_be_int_or_none
The text was updated successfully, but these errors were encountered:
Thanks for reporting! This is an instance of the general issue with frameworks, with the twist that it's a decorator. It might be nontrivial to fix in the regex mode. The AST mode will need a dedicated filter.
It seems that all pydantic validators show up as false positives.
Given a module like this
query.py
Uncalled will flag the
limit_must_be_int_or_none
. I assume this is because my code doesn't call it. However, pydantic does call it whenever my Query gets instantiated. It is very much not dead code.The text was updated successfully, but these errors were encountered: