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

[WIP] 🏷️ Add type hints #911

Closed
wants to merge 8 commits into from
Closed

[WIP] 🏷️ Add type hints #911

wants to merge 8 commits into from

Conversation

DavidRomanovizc
Copy link

@DavidRomanovizc DavidRomanovizc commented May 5, 2023

What do these changes do?

This pull request adds type hints to aiomysql, making it easier for developers to understand the API and to use the library in their code. Due to cyclic dependencies between the cursor and connection classes, two files have been merged into one. Additionally, the _ContextManager class has been generalized as much as possible to improve code reuse and maintainability.

Related issue number

#707

Checklist

  • I think the code is well written
  • Unit tests for the changes exist
  • Documentation reflects the changes
  • Add a new news fragment into the CHANGES folder

@DavidRomanovizc
Copy link
Author

@cyrus01337

@DavidRomanovizc DavidRomanovizc changed the title 🏷️ Add type hints [WIP] 🏷️ Add type hints May 5, 2023
@Nothing4You Nothing4You linked an issue May 6, 2023 that may be closed by this pull request
@DavidRomanovizc DavidRomanovizc self-assigned this May 7, 2023
self._conn = None


class _PoolConnectionContextManager:

Check failure

Code scanning / CodeQL

`__iter__` method returns a non-iterator Error

Class _PoolConnectionContextManager is returned as an iterator (by
__iter__
) but does not fully implement the iterator interface.
def setoutputsizes(self, *args):
"""Does nothing, required by DB API."""

async def nextset(self):

Check notice

Code scanning / CodeQL

Explicit returns mixed with implicit (fall through) returns Note

Mixing implicit and explicit returns may indicate an error as implicit returns always return None.
logger.info("%r", args)
return self._rowcount

async def executemany(self, query, args):

Check notice

Code scanning / CodeQL

Explicit returns mixed with implicit (fall through) returns Note

Mixing implicit and explicit returns may indicate an error as implicit returns always return None.
row = self._conv_row(row)
return row

async def fetchone(self):

Check notice

Code scanning / CodeQL

Explicit returns mixed with implicit (fall through) returns Note

Mixing implicit and explicit returns may indicate an error as implicit returns always return None.
@DavidRomanovizc DavidRomanovizc marked this pull request as draft August 22, 2023 16:53
@DavidRomanovizc DavidRomanovizc closed this by deleting the head repository Dec 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add type hints
2 participants