-
Notifications
You must be signed in to change notification settings - Fork 433
Refactor exception classes #1129
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
Refactor exception classes #1129
Conversation
* Moved `PostgresMessageMeta` and `PostgresMessage` into their own file to make it easier to add typings later on * Re-exported `PostgresMessageMeta` and `PostgresMessage` from `asyncpg.exceptions._base` to maintain backwards compatibility * Removed `import asyncpg` statements and import within methods to prevent circular imports
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can add them to __all__
. Then you won't need as
and noqa
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I do that, then they will be imported with from ._base import *
in asyncpg/exceptions/__init__.py
, and then they will be accessible as asyncpg.PostgresMessage
and asyncpg.PostgresMessageMeta
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point.
PostgresMessageMeta
andPostgresMessage
into their own file to make it easier to add typings later onPostgresMessageMeta
andPostgresMessage
fromasyncpg.exceptions._base
to maintain backwards compatibilityimport asyncpg
statements and import within methods to prevent circular imports