8000 refactoring: ♻️ Many things by remimd · Pull Request #232 · 100nm/python-injection · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

refactoring: ♻️ Many things #232

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

Merged
merged 1 commit into from
May 5, 2025
Merged

refactoring: ♻️ Many things #232

merged 1 commit into from
May 5, 2025

Conversation

remimd
Copy link
Contributor
@remimd remimd commented May 5, 2025

No description provided.

@remimd remimd requested a review from Copilot May 5, 2025 10:22
@remimd remimd self-assigned this May 5, 2025
Copy link
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors dependency injection utilities and functions to introduce improved type annotations and updated naming conventions. Key changes include updating FastAPI dependency resolution, revising generic signatures for instance-getting functions, and renaming simple injectable classes to reflect their transient nature.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
injection/ext/fastapi.py Refactored async dependency naming and assignment logic
injection/_core/scope.py Added generic type annotations to get_scope
injection/_core/module.py Updated generic signatures, refactored injectable type usage, and improved function signatures
injection/_core/injectables.py Renamed SimpleInjectable to TransientInjectable
injection/_core/descriptors.py Refactored lazy instance retrieval similar to FastAPIInject behavior
Comments suppressed due to low confidence (1)

injection/ext/fastapi.py:21

  • [nitpick] The variable name 'ainstance' may be ambiguous or mistaken; consider renaming it to 'lazy_instance' or another descriptive name for clarity.
ainstance = (module or mod()).aget_lazy_instance(cls, default)

Comment on lines +600 to 601
return AsyncInjectedFunction(metadata) # type: ignore[arg-type, return-value]

Copy link
Preview
Copilot AI May 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The use of a 'type: ignore' comment suggests a type mismatch; consider updating the type annotations for AsyncInjectedFunction to resolve this without suppressing errors.

Suggested change
return AsyncInjectedFunction(metadata) # type: ignore[arg-type, return-value]
assert isinstance(metadata, AsyncInjectMetadata), "metadata must be of type AsyncInjectMetadata"
return AsyncInjectedFunction(metadata)

Copilot uses AI. Check for mistakes.

@remimd remimd merged commit fdcccbc into dev May 5, 2025
5 checks passed
@remimd remimd deleted the refactoring branch May 5, 2025 10:24
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.

1 participant
0