Dynamically added methods and attributes are not seen by linters
amq92 opened this issue · 0 comments
amq92 commented
MWE :
from simple_slurm import Slurm
slurm = Slurm()
slurm.add_arguments(gres='gpu') # <-- OK
slurm.add_gres('gpu') # <-- NOK
cmd = 'echo ' + Slurm.SLURM_ARRAY_TASK_ID # <-- NOK
pylint
main.py:5:0: E1101: Instance of 'Slurm' has no 'add_gres' member (no-member)
main.py:6:16: E1101: Class 'Slurm' has no 'SLURM_ARRAY_TASK_ID' member (no-member)
pylance
/ pyright
Cannot access member "add_gres" for type "Slurm"
Member "add_gres" is unknownPylancereportGeneralTypeIssues
Cannot access member "SLURM_ARRAY_TASK_ID" for type "Type[Slurm]"
Member "SLURM_ARRAY_TASK_ID" is unknownPylancereportGeneralTypeIssues
flake8
shows nothing (this is my default linter)
All linters were tested with their default configuration.
This is not deal-breaker, but rather a nice-to-have feature.
A naive solution would be to hard-code the methods and attributes into the code (manually) instead of dynamically adding them.
However, I assume that a more elegant solution must exist ...