Skip to content

Add typing to _ConnectionParameters and related functions #1199

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
wants to merge 8 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
Remove stringified annotations after future import
  • Loading branch information
DanielNoord committed Oct 29, 2024
commit 294e6bce8e6ec21a8654a88fd316016b8e7f5794
6 changes: 3 additions & 3 deletions asyncpg/connect_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class _ConnectionParameters(typing.NamedTuple):
sslmode: SSLMode
ssl_negotiation: SSLNegotiation
server_settings: typing.Optional[typing.Dict[str, str]]
target_session_attrs: "SessionAttribute"
target_session_attrs: SessionAttribute
krbsrvname: typing.Optional[str]
gsslib: str

Expand Down Expand Up @@ -130,7 +130,7 @@ def _read_password_file(passfile: pathlib.Path) \
def _read_password_from_pgpass(
*,
passfile: pathlib.Path,
hosts: "Sequence[str]",
hosts: Sequence[str],
ports: typing.List[int],
database: str,
user: str
Expand Down Expand Up @@ -167,7 +167,7 @@ def _read_password_from_pgpass(


def _validate_port_spec(
hosts: "Sequence[object]", port: typing.Union[int, typing.List[int]]
hosts: Sequence[object], port: typing.Union[int, typing.List[int]]
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
hosts: Sequence[object], port: typing.Union[int, typing.List[int]]
hosts: typing.List[str], port: typing.Union[int, typing.List[int]]

Copy link
Contributor Author

@DanielNoord DanielNoord Dec 18, 2024

Choose a reason for hiding this comment

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

I did this because of line 172. If your suggestion is correct we can remove the else branch. Since I didn't want to change the functionality of the code too much I just added what the code is able to handle instead of what it likely should be, if that makes sense.

Would you want me to change this? Or is keeping as is fine? If it is the latter, could you press the Merge button? :)

) -> typing.List[int]:
if isinstance(port, list):
# If there is a list of ports, its length must
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy