From 8df767f163e465e95447d4f95e25968d70856ebb Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Wed, 29 Mar 2023 10:46:53 +0100 Subject: [PATCH] Add default values to `pika.spec` (#9973) --- stubs/pika/pika/spec.pyi | 59 ++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/stubs/pika/pika/spec.pyi b/stubs/pika/pika/spec.pyi index 5eb0e8dea..303743359 100644 --- a/stubs/pika/pika/spec.pyi +++ b/stubs/pika/pika/spec.pyi @@ -1,3 +1,4 @@ +import builtins from _typeshed import Incomplete from typing import ClassVar from typing_extensions import Literal, Self, TypeAlias @@ -5,8 +6,8 @@ from typing_extensions import Literal, Self, TypeAlias from .amqp_object import Class, Method, Properties # Ouch. Since str = bytes at runtime, we need a type alias for "str". -_str: TypeAlias = str # noqa: Y042 -str = bytes +_str: TypeAlias = builtins.str # noqa: Y042 +str = builtins.bytes PROTOCOL_VERSION: Incomplete PORT: int @@ -56,8 +57,8 @@ class Connection(Class): version_major: int = 0, version_minor: int = 9, server_properties: Incomplete | None = None, - mechanisms: _str = ..., - locales: _str = ..., + mechanisms: _str = "PLAIN", + locales: _str = "en_US", ) -> None: ... @property def synchronous(self): ... @@ -73,9 +74,9 @@ class Connection(Class): def __init__( self, client_properties: Incomplete | None = None, - mechanism: _str = ..., + mechanism: _str = "PLAIN", response: Incomplete | None = None, - locale: _str = ..., + locale: _str = "en_US", ) -> None: ... @property def synchronous(self): ... @@ -127,7 +128,7 @@ class Connection(Class): virtual_host: Incomplete capabilities: Incomplete insist: Incomplete - def __init__(self, virtual_host: _str = ..., capabilities: _str = ..., insist: bool = False) -> None: ... + def __init__(self, virtual_host: _str = "/", capabilities: _str = "", insist: bool = False) -> None: ... @property def synchronous(self): ... def decode(self, encoded, offset: int = 0): ... @@ -136,7 +137,7 @@ class Connection(Class): class OpenOk(Method): INDEX: ClassVar[int] known_hosts: Incomplete - def __init__(self, known_hosts: _str = ...) -> None: ... + def __init__(self, known_hosts: _str = "") -> None: ... @property def synchronous(self): ... def decode(self, encoded, offset: int = 0): ... @@ -151,7 +152,7 @@ class Connection(Class): def __init__( self, reply_code: Incomplete | None = None, - reply_text: _str = ..., + reply_text: _str = "", class_id: Incomplete | None = None, method_id: Incomplete | None = None, ) -> None: ... @@ -171,7 +172,7 @@ class Connection(Class): class Blocked(Method): INDEX: ClassVar[int] reason: Incomplete - def __init__(self, reason: _str = ...) -> None: ... + def __init__(self, reason: _str = "") -> None: ... @property def synchronous(self): ... def decode(self, encoded, offset: int = 0): ... @@ -210,7 +211,7 @@ class Channel(Class): class Open(Method): INDEX: ClassVar[int] out_of_band: Incomplete - def __init__(self, out_of_band: _str = ...) -> None: ... + def __init__(self, out_of_band: _str = "") -> None: ... @property def synchronous(self): ... def decode(self, encoded, offset: int = 0): ... @@ -219,7 +220,7 @@ class Channel(Class): class OpenOk(Method): INDEX: ClassVar[int] channel_id: Incomplete - def __init__(self, channel_id: _str = ...) -> None: ... + def __init__(self, channel_id: _str = "") -> None: ... @property def synchronous(self): ... def decode(self, encoded, offset: int = 0): ... @@ -252,7 +253,7 @@ class Channel(Class): def __init__( self, reply_code: Incomplete | None = None, - reply_text: _str = ..., + reply_text: _str = "", class_id: Incomplete | None = None, method_id: Incomplete | None = None, ) -> None: ... @@ -282,7 +283,7 @@ class Access(Class): read: Incomplete def __init__( self, - realm: _str = ..., + realm: _str = "/data", exclusive: bool = False, passive: bool = True, active: bool = True, @@ -377,7 +378,7 @@ class Exchange(Class): ticket: int = 0, destination: Incomplete | None = None, source: Incomplete | None = None, - routing_key: _str = ..., + routing_key: _str = "", nowait: bool = False, arguments: Incomplete | None = None, ) -> None: ... @@ -407,7 +408,7 @@ class Exchange(Class): ticket: int = 0, destination: Incomplete | None = None, source: Incomplete | None = None, - routing_key: _str = ..., + routing_key: _str = "", nowait: bool = False, arguments: Incomplete | None = None, ) -> None: ... @@ -440,7 +441,7 @@ class Queue(Class): def __init__( self, ticket: int = 0, - queue: _str = ..., + queue: _str = "", passive: bool = False, durable: bool = False, exclusive: bool = False, @@ -475,9 +476,9 @@ class Queue(Class): def __init__( self, ticket: int = 0, - queue: _str = ..., + queue: _str = "", exchange: Incomplete | None = None, - routing_key: _str = ..., + routing_key: _str = "", nowait: bool = False, arguments: Incomplete | None = None, ) -> None: ... @@ -499,7 +500,7 @@ class Queue(Class): ticket: Incomplete queue: Incomplete nowait: Incomplete - def __init__(self, ticket: int = 0, queue: _str = ..., nowait: bool = False) -> None: ... + def __init__(self, ticket: int = 0, queue: _str = "", nowait: bool = False) -> None: ... @property def synchronous(self): ... def decode(self, encoded, offset: int = 0): ... @@ -522,7 +523,7 @@ class Queue(Class): if_empty: Incomplete nowait: Incomplete def __init__( - self, ticket: int = 0, queue: _str = ..., if_unused: bool = False, if_empty: bool = False, nowait: bool = False + self, ticket: int = 0, queue: _str = "", if_unused: bool = False, if_empty: bool = False, nowait: bool = False ) -> None: ... @property def synchronous(self): ... @@ -548,9 +549,9 @@ class Queue(Class): def __init__( self, ticket: int = 0, - queue: _str = ..., + queue: _str = "", exchange: Incomplete | None = None, - routing_key: _str = ..., + routing_key: _str = "", arguments: Incomplete | None = None, ) -> None: ... @property @@ -601,8 +602,8 @@ class Basic(Class): def __init__( self, ticket: int = 0, - queue: _str = ..., - consumer_tag: _str = ..., + queue: _str = "", + consumer_tag: _str = "", no_local: bool = False, no_ack: bool = False, exclusive: bool = False, @@ -650,7 +651,7 @@ class Basic(Class): mandatory: Incomplete immediate: Incomplete def __init__( - self, ticket: int = 0, exchange: _str = ..., routing_key: _str = ..., mandatory: bool = False, immediate: bool = False + self, ticket: int = 0, exchange: _str = "", routing_key: _str = "", mandatory: bool = False, immediate: bool = False ) -> None: ... @property def synchronous(self): ... @@ -666,7 +667,7 @@ class Basic(Class): def __init__( self, reply_code: Incomplete | None = None, - reply_text: _str = ..., + reply_text: _str = "", exchange: Incomplete | None = None, routing_key: Incomplete | None = None, ) -> None: ... @@ -700,7 +701,7 @@ class Basic(Class): ticket: Incomplete queue: Incomplete no_ack: Incomplete - def __init__(self, ticket: int = 0, queue: _str = ..., no_ack: bool = False) -> None: ... + def __init__(self, ticket: int = 0, queue: _str = "", no_ack: bool = False) -> None: ... @property def synchronous(self): ... def decode(self, encoded, offset: int = 0): ... @@ -729,7 +730,7 @@ class Basic(Class): class GetEmpty(Method): INDEX: ClassVar[int] cluster_id: Incomplete - def __init__(self, cluster_id: _str = ...) -> None: ... + def __init__(self, cluster_id: _str = "") -> None: ... @property def synchronous(self): ... def decode(self, encoded, offset: int = 0): ...