Here _preferred_backends is Dict[str, str] of file extensions to backend IDs from preferred_backends traitlet, so self._preferred_backends.get(ext) returns a preferred backend ID (str). Only _backends stores BackendInstances in Dict[str, BackendInstance].
To improve clarity updated var naming in the function to mention ids, Updated helped text for preferred_backends and legacy_job_backend traitlets clearly explaining that they expect backend ids.
Looking at recent traitlets docs it seems we could add typing https://traitlets.readthedocs.io/en/stable/using_traitlets.html#default-values-and-checking-type-and-value. Adding typing to all traitlets as currently we have none would be a good follow-up.
Originally posted by @andrii-i in #596 (comment)
Here
_preferred_backendsisDict[str, str]of file extensions to backend IDs frompreferred_backendstraitlet, soself._preferred_backends.get(ext)returns a preferred backend ID (str). Only_backendsstoresBackendInstances inDict[str, BackendInstance].To improve clarity updated var naming in the function to mention ids, Updated helped text for
preferred_backendsandlegacy_job_backendtraitlets clearly explaining that they expect backend ids.Looking at recent traitlets docs it seems we could add typing https://traitlets.readthedocs.io/en/stable/using_traitlets.html#default-values-and-checking-type-and-value. Adding typing to all traitlets as currently we have none would be a good follow-up.
Originally posted by @andrii-i in #596 (comment)