Skip to content

Add typing to traitlets #602

Description

@andrii-i

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions