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

Sign up
Appearance settings

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

Open
bryanforbes wants to merge 1 commit into MagicStack:master
base: master
Choose a base branch
Loading
from bryanforbes:feature/refactor-exceptions

Conversation

Copy link
Collaborator

@bryanforbes bryanforbes commented Mar 5, 2024

  • 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

@eltoder eltoder Mar 5, 2024

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

@bryanforbes bryanforbes Mar 5, 2024

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

@eltoder eltoder Mar 5, 2024

Choose a reason for hiding this comment

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

Good point.

bryanforbes reacted with thumbs up emoji
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@elprans elprans elprans approved these changes

+1 more reviewer

@eltoder eltoder eltoder left review comments

Reviewers whose approvals may not affect merge requirements
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /