Skip to content

Commit 451fd48

Browse files
authored
Merge pull request numpy#26975 from jorenham/typing/final-literal-version
TYP: Use ``Final`` and ``LiteralString`` for the constants in ``numpy.version``
2 parents 19c0728 + 2b04765 commit 451fd48

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

numpy/version.pyi

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,24 @@
1-
version: str
2-
__version__: str
3-
full_version: str
1+
import sys
2+
from typing import Final, TypeAlias
43

5-
git_revision: str
6-
release: bool
7-
short_version: str
4+
if sys.version_info >= (3, 11):
5+
from typing import LiteralString
6+
else:
7+
LiteralString: TypeAlias = str
8+
9+
__all__ = (
10+
'__version__',
11+
'full_version',
12+
'git_revision',
13+
'release',
14+
'short_version',
15+
'version',
16+
)
17+
18+
version: Final[LiteralString]
19+
__version__: Final[LiteralString]
20+
full_version: Final[LiteralString]
21+
22+
git_revision: Final[LiteralString]
23+
release: Final[bool]
24+
short_version: Final[LiteralString]

0 commit comments

Comments
 (0)