Skip to content

Commit

Permalink
Avoid AnyStr except as generic type parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
baodrate committed Mar 1, 2022
1 parent 1700ef9 commit ccde5ce
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 8 deletions.
3 changes: 1 addition & 2 deletions pika-stubs/adapters/blocking_connection.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import types
from collections.abc import Mapping
from collections.abc import Sequence
from typing import Any
from typing import AnyStr
from typing import Callable
from typing import Iterator
from typing import Type
Expand Down Expand Up @@ -124,7 +123,7 @@ class BlockingChannel:
self, queue: str, auto_ack: bool = ...
) -> tuple[spec.Basic.GetOk, spec.BasicProperties, str] | tuple[None, None, None]: ...
def basic_publish(
self, exchange: str, routing_key: str, body: AnyStr, properties: spec.BasicProperties | None = ..., mandatory: bool = ...
self, exchange: str, routing_key: str, body: str | bytes, properties: spec.BasicProperties | None = ..., mandatory: bool = ...
) -> None: ...
def basic_qos(self, prefetch_size: int = ..., prefetch_count: int = ..., global_qos: bool = ...) -> None: ...
def basic_recover(self, requeue: bool = ...) -> None: ...
Expand Down
3 changes: 1 addition & 2 deletions pika-stubs/adapters/twisted_connection.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ from __future__ import annotations
from collections.abc import Mapping
from collections.abc import Sequence
from typing import Any
from typing import AnyStr
from typing import Callable
from typing import NamedTuple
from typing import TypeVar
Expand Down Expand Up @@ -77,7 +76,7 @@ class TwistedChannel:
def basic_get(self, queue: str, auto_ack: bool = ...) -> Deferred[ReceivedMessage]: ...
def basic_nack(self, delivery_tag: int | None = ..., multiple: bool = ..., requeue: bool = ...) -> None: ...
def basic_publish(
self, exchange: str, routing_key: str, body: AnyStr, properties: spec.BasicProperties | None = ..., mandatory: bool = ...
self, exchange: str, routing_key: str, body: str | bytes, properties: spec.BasicProperties | None = ..., mandatory: bool = ...
) -> Deferred[None]: ...
def basic_qos(
self, prefetch_size: int = ..., prefetch_count: int = ..., global_qos: bool = ...
Expand Down
3 changes: 1 addition & 2 deletions pika-stubs/channel.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ from __future__ import annotations
from collections.abc import Mapping
from collections.abc import Sequence
from typing import Any
from typing import AnyStr
from typing import Callable
from typing import TypeVar
from typing_extensions import Literal
Expand Down Expand Up @@ -74,7 +73,7 @@ class Channel:
def basic_get(self, queue: str, callback: _OnBasicGetCallback, auto_ack: bool = ...) -> None: ...
def basic_nack(self, delivery_tag: int = ..., multiple: bool = ..., requeue: bool = ...) -> None: ...
def basic_publish(
self, exchange: str, routing_key: str, body: AnyStr, properties: spec.BasicProperties | None = ..., mandatory: bool = ...
self, exchange: str, routing_key: str, body: str | bytes, properties: spec.BasicProperties | None = ..., mandatory: bool = ...
) -> None: ...
def basic_qos(
self,
Expand Down
3 changes: 1 addition & 2 deletions pika-stubs/compat.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ from __future__ import annotations
import abc
import re
from typing import Any
from typing import AnyStr
from typing import ItemsView
from typing import KeysView
from typing import Type
Expand Down Expand Up @@ -45,7 +44,7 @@ class long(int):

def canonical_str(value: Any) -> str: ...
def is_integer(value: Any) -> bool: ...
def as_bytes(value: AnyStr) -> bytes: ...
def as_bytes(value: str | bytes) -> bytes: ...
def to_digit(value: str) -> int: ...
def get_linux_version(release_str: str) -> tuple[int, int, int]: ...

Expand Down

0 comments on commit ccde5ce

Please sign in to comment.