Cannot access member "default " for type "int"
Member "default" is unknown [reportAttributeAccessIssue]
because the variable v is type-hinted with the type int in the function signature.
It would be good to correct the type-hint for k and v, as well as perhaps giving them more descriptive names, such as name and value respectively.
It would also be good to update the docstring accordingly, and correct the descriptions of the k and v parameters (they're the name and value of a parameter, not of a method).
The
inspect.signature()
function returns aSignature
, and is used in the YAML generator here: https://github.com/DiamondLightSource/httomo/blob/d9afc1f04e29a375cee17d33033d75f47a99da34/templates/yaml_templates_generator.py#L71-L73Signature.parameters
is of typeParameter
. Iterating over aParameters
value like inyaml_generator.py
: https://github.com/DiamondLightSource/httomo/blob/d9afc1f04e29a375cee17d33033d75f47a99da34/templates/yaml_templates_generator.py#L80will be iterating over key-value pairs where:
str
Parameter
The key and value in that loop is passed to the
_set_value_param()
function: https://github.com/DiamondLightSource/httomo/blob/d9afc1f04e29a375cee17d33033d75f47a99da34/templates/yaml_templates_generator.py#L100-L106but the type-hints for the key and value are incorrect.
This causes static type checkers like pyright to highlight the use of
v.default
in that function https://github.com/DiamondLightSource/httomo/blob/d9afc1f04e29a375cee17d33033d75f47a99da34/templates/yaml_templates_generator.py#L120-L121with the following error:
because the variable
v
is type-hinted with the typeint
in the function signature.It would be good to correct the type-hint for
k
andv
, as well as perhaps giving them more descriptive names, such asname
andvalue
respectively.It would also be good to update the docstring accordingly, and correct the descriptions of the
k
andv
parameters (they're the name and value of a parameter, not of a method).