Skip to content

fix(client): resolve mypy type narrowing issue for cross encoder - #254

Merged
codeforstartups merged 1 commit into
codeforstartups:developmentfrom
ramashishmaurya:fix/cross-encoder-mypy
Sep 25, 2026
Merged

codeforstartups merged 1 commit into
codeforstartups:developmentfrom
ramashishmaurya:fix/cross-encoder-mypy

Conversation

@ramashishmaurya

Copy link
Copy Markdown
Contributor

Description:
Resolved a strict type-checking issue identified by mypy in _cross_encoder_rerank (client.py).

The instance variable self._cross_encoder was typed as potentially None, leading mypy to throw a None has no attribute predict error since it couldn't guarantee that the instance variable wasn't mutated between the null check and the method call.

Assigned it to a local variable encoder first, ensuring safe type narrowing and preventing potential runtime AttributeErrors in multi-threaded contexts.

@codeforstartups
codeforstartups merged commit 61238f0 into codeforstartups:development Sep 25, 2026
3 checks passed
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

Successfully merging this pull request may close these issues.

2 participants