Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/zmq/sugar/version.py: 81%
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1"""PyZMQ and 0MQ version functions."""
3# Copyright (C) PyZMQ Developers
4# Distributed under the terms of the Modified BSD License.
5from __future__ import annotations
7import re
8from typing import Match, cast
10from zmq.backend import zmq_version_info
12__version__: str = "27.2.0.dev"
13_version_pat = re.compile(r"(\d+)\.(\d+)\.(\d+)(.*)")
14_match = cast(Match, _version_pat.match(__version__))
15_version_groups = _match.groups()
17VERSION_MAJOR = int(_version_groups[0])
18VERSION_MINOR = int(_version_groups[1])
19VERSION_PATCH = int(_version_groups[2])
20VERSION_EXTRA = _version_groups[3].lstrip(".")
22version_info: tuple[int, int, int] | tuple[int, int, int, float] = (
23 VERSION_MAJOR,
24 VERSION_MINOR,
25 VERSION_PATCH,
26)
28if VERSION_EXTRA:
29 version_info = (
30 VERSION_MAJOR,
31 VERSION_MINOR,
32 VERSION_PATCH,
33 float('inf'),
34 )
36__revision__: str = ''
39def pyzmq_version() -> str:
40 """return the version of pyzmq as a string"""
41 if __revision__:
42 return '+'.join([__version__, __revision__[:6]])
43 else:
44 return __version__
47def pyzmq_version_info() -> tuple[int, int, int] | tuple[int, int, int, float]:
48 """return the pyzmq version as a tuple of at least three numbers
50 If pyzmq is a development version, `inf` will be appended after the third integer.
51 """
52 return version_info
55def zmq_version() -> str:
56 """return the version of libzmq as a string"""
57 return "{}.{}.{}".format(*zmq_version_info())
60__all__ = [
61 'zmq_version',
62 'zmq_version_info',
63 'pyzmq_version',
64 'pyzmq_version_info',
65 '__version__',
66 '__revision__',
67]