modal-labs / synchronicity

Synchronicity lets you interoperate with asynchronous Python APIs.
Apache License 2.0
80 stars 3 forks source link

Minor cleanup of type stub generation - remove ReprObj #145

Closed freider closed 2 months ago

freider commented 2 months ago

Removes the hacky ReprObj thing that was used as a hack in tricky type annotation translation cases.

This lets code later down the stub emission code path introspect the actual types, since it preserves types and not just the formatted representation of the type.

A nice side effect of the refactor is that it better preserves original types as well, by not translating typing.Optional into typing.Union[None, ...] etc.

Since this only touches type_stub emission it should be relatively safe

freider commented 2 months ago

@prbot approve