Skip to content

Commit

Permalink
sync with main
Browse files Browse the repository at this point in the history
  • Loading branch information
minrk committed Feb 14, 2024
2 parents 22875ad + 96b98bb commit d042ee2
Show file tree
Hide file tree
Showing 20 changed files with 55 additions and 70 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
- uses: actions/checkout@v4

- name: setup python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
architecture: ${{ matrix.arch || 'x64' }}
Expand All @@ -109,7 +109,7 @@ jobs:

# preserve pip cache to speed up installation
- name: Cache pip
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements file
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- uses: actions/checkout@v4

- name: setup python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.11"

Expand All @@ -45,7 +45,7 @@ jobs:
- uses: actions/checkout@v4

- name: setup python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.11"

Expand Down Expand Up @@ -153,7 +153,7 @@ jobs:
- uses: actions/checkout@v4

- name: setup python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.11"
architecture: ${{ matrix.architecture }}
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ repos:
exclude: zmq/tests/test_imports.py

- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
rev: 7.0.0
hooks:
- id: flake8
exclude: ^buildutils/templates/
Expand Down Expand Up @@ -67,7 +67,7 @@ repos:
name: isort (pyi)
types: [pyi]
- repo: https://github.com/psf/black
rev: 23.12.1
rev: 24.1.1
hooks:
- id: black
# don't run black twice on constants.py
Expand Down
1 change: 1 addition & 0 deletions examples/asyncio/coroutines.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Example using zmq with asyncio coroutines"""

# Copyright (c) PyZMQ Developers.
# This example is in the public domain (CC-0)

Expand Down
1 change: 1 addition & 0 deletions examples/asyncio/router_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
Contributed by github:jcpinto54 and github:frobnitzem
"""

# Copyright (c) 2022 PyZMQ Developers.
# This example is in the public domain (CC-0)

Expand Down
1 change: 1 addition & 0 deletions examples/asyncio/tornado_asyncio.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Example showing ZMQ with asyncio and tornadoweb integration."""

# Copyright (c) PyZMQ Developers.
# This example is in the public domain (CC-0)

Expand Down
1 change: 1 addition & 0 deletions examples/device/device.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Demonstrate using zmq.proxy device for message relay"""

# This example is placed in the Public Domain
# It may also be used under the Creative Commons CC-0 License, (C) PyZMQ Developers

Expand Down
1 change: 0 additions & 1 deletion examples/eventloop/asyncweb.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
the event loop.
"""


import asyncio
import random
import sys
Expand Down
1 change: 1 addition & 0 deletions examples/eventloop/coroutines.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Example using zmq with tornado coroutines"""

# Copyright (c) PyZMQ Developers.
# This example is in the public domain (CC-0)

Expand Down
1 change: 1 addition & 0 deletions examples/gevent/reqrep.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Complex example which is a combination of the rr* examples from the zguide.
"""

from gevent import spawn

import zmq.green as zmq
Expand Down
9 changes: 3 additions & 6 deletions zmq/_future.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,14 +275,12 @@ def get(self, key):
@overload # type: ignore
def recv_multipart(
self, flags: int = 0, *, track: bool = False
) -> Awaitable[List[bytes]]:
...
) -> Awaitable[List[bytes]]: ...

@overload
def recv_multipart(
self, flags: int = 0, *, copy: Literal[True], track: bool = False
) -> Awaitable[List[bytes]]:
...
) -> Awaitable[List[bytes]]: ...

@overload
def recv_multipart(
Expand All @@ -293,8 +291,7 @@ def recv_multipart(
@overload
def recv_multipart(
self, flags: int = 0, copy: bool = True, track: bool = False
) -> Awaitable[Union[List[bytes], List[_zmq.Frame]]]:
...
) -> Awaitable[Union[List[bytes], List[_zmq.Frame]]]: ...

def recv_multipart(
self, flags: int = 0, copy: bool = True, track: bool = False
Expand Down
24 changes: 8 additions & 16 deletions zmq/eventloop/zmqstream.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,24 +178,21 @@ def on_err(self, callback: Callable):
def on_recv(
self,
callback: Callable[[List[bytes]], Any],
) -> None:
...
) -> None: ...

@overload
def on_recv(
self,
callback: Callable[[List[bytes]], Any],
copy: Literal[True],
) -> None:
...
) -> None: ...

@overload
def on_recv(
self,
callback: Callable[[List[zmq.Frame]], Any],
copy: Literal[False],
) -> None:
...
) -> None: ...

@overload
def on_recv(
Expand All @@ -205,8 +202,7 @@ def on_recv(
Callable[[List[bytes]], Any],
],
copy: bool = ...,
):
...
): ...

def on_recv(
self,
Expand Down Expand Up @@ -254,24 +250,21 @@ def on_recv(
def on_recv_stream(
self,
callback: Callable[["ZMQStream", List[bytes]], Any],
) -> None:
...
) -> None: ...

@overload
def on_recv_stream(
self,
callback: Callable[["ZMQStream", List[bytes]], Any],
copy: Literal[True],
) -> None:
...
) -> None: ...

@overload
def on_recv_stream(
self,
callback: Callable[["ZMQStream", List[zmq.Frame]], Any],
copy: Literal[False],
) -> None:
...
) -> None: ...

@overload
def on_recv_stream(
Expand All @@ -281,8 +274,7 @@ def on_recv_stream(
Callable[["ZMQStream", List[bytes]], Any],
],
copy: bool = ...,
):
...
): ...

def on_recv_stream(
self,
Expand Down
17 changes: 10 additions & 7 deletions zmq/log/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"""


# encoding: utf-8

# Copyright (C) PyZMQ Developers
Expand Down Expand Up @@ -113,12 +112,16 @@

fields = {
'msg': msg.decode('utf8').strip(),
'ts': datetime.now().strftime(args.dateformat) + ' '
if args.timestamp
else '',
'aligned': '.'.join(aligned_parts)
if args.align
else topic.decode('utf8').strip(),
'ts': (
datetime.now().strftime(args.dateformat) + ' '
if args.timestamp
else ''
),
'aligned': (
'.'.join(aligned_parts)
if args.align
else topic.decode('utf8').strip()
),
'color': colors.get(level, ''),
'color_rst': colors.get('__RESET__', ''),
'sep': args.separator,
Expand Down
6 changes: 2 additions & 4 deletions zmq/sugar/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,15 @@ class Context(ContextBase, AttributeSetter, Generic[ST]):
_socket_class: Type[ST] = Socket # type: ignore

@overload
def __init__(self: "Context[Socket]", io_threads: int = 1):
...
def __init__(self: "Context[Socket]", io_threads: int = 1): ...

@overload
def __init__(self: "Context[Socket]", io_threads: "Context"):
# this should be positional-only, but that requires 3.8
...

@overload
def __init__(self: "Context[Socket]", *, shadow: Union["Context", int]):
...
def __init__(self: "Context[Socket]", *, shadow: Union["Context", int]): ...

def __init__(
self: "Context[Socket]",
Expand Down
33 changes: 11 additions & 22 deletions zmq/sugar/socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,24 +109,21 @@ def __init__(
socket_type: int,
*,
copy_threshold: Optional[int] = None,
):
...
): ...

@overload
def __init__(
self: "Socket[bytes]",
*,
shadow: Union["Socket", int],
copy_threshold: Optional[int] = None,
):
...
): ...

@overload
def __init__(
self: "Socket[bytes]",
ctx_or_socket: "Socket",
):
...
): ...

def __init__(
self: "Socket[bytes]",
Expand Down Expand Up @@ -578,8 +575,7 @@ def send(
track: Literal[True],
routing_id: Optional[int] = ...,
group: Optional[str] = ...,
) -> "zmq.MessageTracker":
...
) -> "zmq.MessageTracker": ...

@overload
def send(
Expand All @@ -591,8 +587,7 @@ def send(
track: Literal[False],
routing_id: Optional[int] = ...,
group: Optional[str] = ...,
) -> None:
...
) -> None: ...

@overload
def send(
Expand All @@ -603,8 +598,7 @@ def send(
copy: bool = ...,
routing_id: Optional[int] = ...,
group: Optional[str] = ...,
) -> None:
...
) -> None: ...

@overload
def send(
Expand All @@ -615,8 +609,7 @@ def send(
track: bool = ...,
routing_id: Optional[int] = ...,
group: Optional[str] = ...,
) -> Optional["zmq.MessageTracker"]:
...
) -> Optional["zmq.MessageTracker"]: ...

def send(
self,
Expand Down Expand Up @@ -755,24 +748,20 @@ def send_multipart(
@overload
def recv_multipart(
self, flags: int = ..., *, copy: Literal[True], track: bool = ...
) -> List[bytes]:
...
) -> List[bytes]: ...

@overload
def recv_multipart(
self, flags: int = ..., *, copy: Literal[False], track: bool = ...
) -> List[zmq.Frame]:
...
) -> List[zmq.Frame]: ...

@overload
def recv_multipart(self, flags: int = ..., *, track: bool = ...) -> List[bytes]:
...
def recv_multipart(self, flags: int = ..., *, track: bool = ...) -> List[bytes]: ...

@overload
def recv_multipart(
self, flags: int = 0, copy: bool = True, track: bool = False
) -> Union[List[zmq.Frame], List[bytes]]:
...
) -> Union[List[zmq.Frame], List[bytes]]: ...

def recv_multipart(
self, flags: int = 0, copy: bool = True, track: bool = False
Expand Down
1 change: 1 addition & 0 deletions zmq/tests/test_asyncio.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test asyncio support"""

# Copyright (c) PyZMQ Developers
# Distributed under the terms of the Modified BSD License.

Expand Down
1 change: 1 addition & 0 deletions zmq/tests/test_imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Test Imports - the quickest test to ensure that we haven't
introduced version-incompatible syntax errors.
"""

# Copyright (C) PyZMQ Developers
# Distributed under the terms of the Modified BSD License.

Expand Down
1 change: 1 addition & 0 deletions zmq/tests/test_mypy.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Test our typing with mypy
"""

import os
import sys
from subprocess import PIPE, STDOUT, Popen
Expand Down
Loading

0 comments on commit d042ee2

Please sign in to comment.