Skip to content

Conversation

bryanforbes
Copy link
Collaborator

  • 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

* 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
import sys
import textwrap
# PostgresMessageMeta imported for backward compatibility
from ._postgres_message import ( # noqa: F401
Copy link
Contributor

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.

Copy link
Collaborator Author

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Good point.

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.

3 participants