Skip to content

Use Sequence type hints in .transform_...() methods of TopLevelMixin #4087

Description

@Antyos

What happened?

I have noticed that several methods use list type hints instead of Sequence (which is covariant). For example:

def transform_aggregate(
self,
aggregate: Optional[list[AggregatedFieldDef]] = Undefined,
groupby: Optional[list[str | FieldName]] = Undefined,
**kwds: dict[str, Any] | str,
) -> Self:

What would you like to happen instead?

All instances of list in type hints for various mixins should be replaced with Sequence (or potentially Collection, if applicable).

I think there is some level of codegen involved for the files in vegalite/v6/, so I'm not so sure where to start if I were to make a PR.

Which version of Altair are you using?

main branch

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugneeds-triageBug report needs maintainer response

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions