Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

howbazaar
Copy link

binds: Optional[Any] = ..., extension: Optional[Any] = ...,
info: Optional[Any] = ..., query_cls: Any = ...) -> None: ...
connection_callable: Any = ...
def __enter__(self): ...

Choose a reason for hiding this comment

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

The return type annotation is missing.

Copy link
Author

Choose a reason for hiding this comment

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

This was copied from the SessionTransaction above. I matched the style there.

Copy link

Choose a reason for hiding this comment

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

Suggested change
def __enter__(self): ...
def __enter__(self) -> Session: ...

Copy link

Choose a reason for hiding this comment

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

This one is actually pretty important, as it tells Pylance/Pylint what type session is in

with Session() as session: 

info: Optional[Any] = ..., query_cls: Any = ...) -> None: ...
connection_callable: Any = ...
def __enter__(self): ...
def __exit__(self, type, value, traceback): ...

Choose a reason for hiding this comment

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

The parameter and return type annotations are missing.

Copy link
Author

Choose a reason for hiding this comment

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

Same for this method.

Copy link

@jkeiser jkeiser Dec 16, 2021

Choose a reason for hiding this comment

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

Suggested change
def __exit__(self, type, value, traceback): ...
def __exit__(self, type: Optional[Type[BaseException]], value: Optional[BaseException], traceback: Optional[TracebackType]) -> None: ...

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@mrtolkien
Copy link

Any update on that issue? I'm trying to use mypy + pydantic + sqlalchemy in a project and needing to write # type: ignore on every single session opening is quite problematic.

@Kfelts
Copy link

Kfelts commented Nov 2, 2022

Any update on that issue? I'm trying to use mypy + pydantic + sqlalchemy in a project and needing to write # type: ignore on every single session opening is quite problematic.

I'm here for the same reason. It's been almost a year since this was submitted.

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.

6 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.