Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REQUEST] Defered Type Hints & Type_checking paradigm #218

Open
3 tasks done
michaelfeil opened this issue Oct 10, 2024 · 0 comments
Open
3 tasks done

[REQUEST] Defered Type Hints & Type_checking paradigm #218

michaelfeil opened this issue Oct 10, 2024 · 0 comments

Comments

@michaelfeil
Copy link

Problem

I saw the following pattern in your codebase!

Use: - https://docs.python.org/3/library/typing.html#typing.TYPE_CHECKING TYPE_CHECKING variable to only import type hints when needed.
And

defered type hints as forward reference: https://stackoverflow.com/questions/51629105/python-type-hint-given-as-a-string

# Conditionally set the type hint based on importablity
# TODO: Clean this up
if dependencies.extras:
    engine: Optional[AsyncEmbeddingEngine] = None
else:
    engine = None

Solution

Above

Alternatives

No response

Explanation

Just fyi, send from mobile

Examples

No response

Additional context

No response

Acknowledgements

  • I have looked for similar requests before submitting this one.
  • I understand that the developers have lives and my issue will be answered when possible.
  • I understand the developers of this program are human, and I will make my requests politely.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant