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

Avoid creating redundant query object #235

Merged
merged 4 commits into from
Apr 11, 2022
Merged

Conversation

amos402
Copy link
Contributor

@amos402 amos402 commented Mar 31, 2022

Since motor_cursor would create a query object every time when it is accessed, this change it's for preventing that meaningless object allocation.

@roman-right
Copy link
Member

Sounds good.
But it looks like mypy doesn't agree with something. You can run it against your code on committing using pre-commit: pre-commit install

@amos402
Copy link
Contributor Author

amos402 commented Apr 1, 2022

The first commit was for not to breaking any logic changes.
Yet, the more delightful solution is to set the cursor in __aiter__, now it should satisfied the mypy.
Now it can be called by aiter multiple times which match the generator standard.

@roman-right roman-right merged commit 4fdcd7d into BeanieODM:main Apr 11, 2022
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