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

Add decorator type hint #101

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Conversation

dev0Guy
Copy link
Contributor

@dev0Guy dev0Guy commented Feb 8, 2025

User description

Can see the before:
image
After:
image


Generated description

Below is a concise technical summary of the changes proposed in this PR:

Enhances type hinting across multiple decorator files in the nest/core/decorators directory. Introduces generic type variables and updates function signatures to improve type safety and code clarity. Adds conditional imports for typing features based on Python version compatibility.

TopicDetails
Version compatibility Adds conditional imports for typing features based on Python version
Modified files (3)
  • nest/core/decorators/http_code.py
  • nest/core/decorators/http_method.py
  • nest/core/decorators/database.py
Latest Contributors(2)
UserCommitDate
itay.dar@lemonade.comFix-async-orm-provider...September 15, 2024
amirm.lavasani@gmail.comAdd-HTTP-Status-Code-F...June 24, 2024
Type hint updates Improves type hinting in decorator functions and classes across multiple files
Modified files (7)
  • nest/core/decorators/http_code.py
  • nest/core/decorators/injectable.py
  • nest/core/decorators/module.py
  • nest/core/decorators/http_method.py
  • nest/core/decorators/class_based_view.py
  • nest/core/decorators/database.py
  • nest/core/decorators/controller.py
Latest Contributors(2)
UserCommitDate
dev0Guyreorganize-module-clas...January 11, 2025
itay.dar@lemonade.comMigrate-pynest-to-poet...December 20, 2024
This pull request is reviewed by Baz. Join @dev0Guy and the rest of your team on (Baz).

@@ -1,6 +1,9 @@
from typing import Callable, List, Union, TypeVar, ParamSpec, TypeAlias
Copy link

Choose a reason for hiding this comment

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

❌ Failed check: CLI Test / test (MongoDB)
I’ve attached the relevant part of the log for your convenience:
ImportError: cannot import name 'ParamSpec' from 'typing' module in Python 3.9


Finding type: Log Error

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added version check

Copy link

Choose a reason for hiding this comment

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

It looks like this comment has been addressed in commit 58d4b04. The code now checks the Python version and imports ParamSpec from typing_extensions for versions below 3.10, resolving the ImportError for Python 3.9.

@@ -1,6 +1,16 @@
from typing import Callable, List, Union, TypeVar, TypeAlias
Copy link

Choose a reason for hiding this comment

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

❌ Failed check: CLI Test / test (PostgresSync)
I’ve attached the relevant part of the log for your convenience:
ImportError: cannot import name 'TypeAlias' from 'typing' module in Python 3.9


Finding type: Log Error

Copy link

Choose a reason for hiding this comment

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

It looks like this comment has been addressed. The commit 9de7fce modified the import statement to handle different Python versions, addressing the ImportError for TypeAlias in Python 3.9. The code now conditionally imports TypeAlias from typing_extensions for versions below 3.10, resolving the issue raised in the thread.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

same as above

@@ -1,6 +1,16 @@
from typing import Callable, List, Union, TypeVar, TypeAlias
Copy link

Choose a reason for hiding this comment

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

❌ Failed check: CLI Test / test (SyncORM)
I’ve attached the relevant part of the log for your convenience:
ImportError: cannot import name 'TypeAlias' from 'typing' module in Python 3.9


Finding type: Log Error

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