Skip to content

Typing questions #355

Closed
Closed

Description

@Acurisu

def get_collection_of_primitive_values(self, primitive_type: Any) -> Optional[List[T]]: inside JsonParseNode takes primitive_type: Any, however we raise an error if primitive_type is not of type primitive_types = {bool, str, int, float, UUID, datetime, timedelta, date, time, bytes}. Why not just make primitive_type be a union type of these supported primitives? But then we could also remove T, since currently I don't quite see the use for it.
Alternatively we could leave T but then shouldn't we make primitive_type have type Type[T] or similar which allows for more restrictive typing on the user's end?

Activity

  1. Acurisu commented on Aug 7, 2024

    @Acurisu
    ContributorAuthor

    Also this function does not strictly follow the signature of the underlying abstractmethod which is def get_collection_of_primitive_values(self) -> List[T]:. Couldn't this be unexpected?

  2. andrueastman commented on Nov 11, 2024

    @andrueastman
    Contributor

    We'll close this for now as this was resolved with #402. With the type information updated to use primitive_type: type[T] where T is a union of the primitive types. Typing signatures were also aligned fixed in #331

  3. moved this from Todo 📃 to Done ✔️ in Kiotaon Nov 11, 2024
  4. Acurisu commented on Nov 11, 2024

    @Acurisu
    ContributorAuthor

    Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

type:enhancementEnhancement request targeting an existing experiencetype:questionAn issue that's a question

Type

No type

Projects

  • Status
    Done ✔️

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions