Skip to content
This repository was archived by the owner on Nov 17, 2025. It is now read-only.
This repository was archived by the owner on Nov 17, 2025. It is now read-only.

Add KernelType type annotation #72

@rlouf

Description

@rlouf

[W]e could really use some type annotations for arguments like this. I honestly don't know the exact form of a valid kernel type (other than that it's a callable of some sort), so this is one instance where the type info really helps. In order to figure this out, I would have to trace where it's used in this codebase, and/or guess and check.

A custom type (alias) that explicitly ties together the functions in this library that construct valid kernel arguments is really all that's necessary to answer basic questions, so there's no need to delve much deeper than KernelType = Callable[[...], ...]—although something like KernelType = NewType("KernelType", Callable[[...], ...]) might be better for maintaining the "this function takes/outputs acceptable kernels" information when the local variable name KernelType isn't present in context (e.g. some Mypy reporting).

Originally posted by @brandonwillard in #66 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationenhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions