fix: improve type hints in __init__.py#53
Merged
sachaservan merged 1 commit intotinfoilsh:mainfrom Dec 16, 2025
Merged
Conversation
- Replace dict = None with Optional[dict] = None for proper type safety - Add Optional[int] = None for timeout parameters - Add missing type hint for tf_client parameter (SecureClient) - Add return type annotations (httpx.Response) for get() and post() methods - Add necessary imports (Optional from typing, httpx) This improves IDE support, type checking, and consistency with the rest of the codebase.
Member
|
@kalenmcmillan just got a chance to look at this. Thanks for your contributions. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Improves type hints in
src/tinfoil/__init__.pyfor better type safety, IDE support, and consistency with the rest of the codebase. Replaces incorrectdict = Noneandint = Nonepatterns withOptional[dict]andOptional[int], and adds missing return type annotations.Changes
typingandhttpximport for return type annotations.TinfoilAI,AsyncTinfoilAI, andNewSecureClientconstructors: changemeasurement: dict = Nonetomeasurement: Optional[dict] = None._HTTPSecureClient.get()andpost()methods: change headers:dict = None,params: dict = None,data: dict = None,json: dict = None, andtimeout: int = Noneto useOptional[...].tf_clientparameter in_HTTPSecureClient.__init__(): specifytf_client: SecureClient.get()andpost()methods: both now return ->httpx.Response.Summary by cubic
Improves type hints in src/tinfoil/init.py to use Optional for nullable params and adds return types for HTTP methods. This tightens type safety and improves IDE support.
Written for commit 1627629. Summary will update automatically on new commits.