Skip to content

Commit

Permalink
[Typing][A-72] Add type annotations for paddle.version (#65244)
Browse files Browse the repository at this point in the history
  • Loading branch information
SigureMo authored Jun 19, 2024
1 parent 4b423e9 commit 04ed231
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
20 changes: 10 additions & 10 deletions python/setup.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ with_pip_cuda_libraries = '%(with_pip_cuda_libraries)s'

__all__ = ['cuda', 'cudnn', 'nccl', 'show', 'xpu', 'xpu_xre', 'xpu_xccl', 'xpu_xhpc']

def show():
def show() -> None:
"""Get the version of paddle if `paddle` package if tagged. Otherwise, output the corresponding commit id.

Returns:
Expand Down Expand Up @@ -218,10 +218,10 @@ def show():
print('xpu_xhpc:', xpu_xhpc_version)
print('cinn:', cinn_version)

def mkl():
def mkl() -> str:
return with_mkl

def nccl():
def nccl() -> str:
"""Get nccl version of paddle package.

Returns:
Expand All @@ -239,7 +239,7 @@ def nccl():
"""
return nccl_version

def cuda():
def cuda() -> str:
"""Get cuda version of paddle package.

Returns:
Expand All @@ -257,7 +257,7 @@ def cuda():
"""
return cuda_version

def cudnn():
def cudnn() -> str:
"""Get cudnn version of paddle package.

Returns:
Expand All @@ -275,7 +275,7 @@ def cudnn():
"""
return cudnn_version

def xpu():
def xpu() -> str:
"""Get xpu version of paddle package. The API is deprecated now, please use xpu_xhpc() instead.

Returns:
Expand All @@ -289,7 +289,7 @@ def xpu():
"""
return xpu_xhpc_version

def xpu_xre():
def xpu_xre() -> str:
"""Get xpu xre version of paddle package.

Returns:
Expand All @@ -307,7 +307,7 @@ def xpu_xre():
"""
return xpu_xre_version

def xpu_xccl():
def xpu_xccl() -> str:
"""Get xpu xccl version of paddle package.

Returns:
Expand All @@ -325,7 +325,7 @@ def xpu_xccl():
"""
return xpu_xccl_version

def xpu_xhpc():
def xpu_xhpc() -> str:
"""Get xpu xhpc version of paddle package.

Returns:
Expand All @@ -343,7 +343,7 @@ def xpu_xhpc():
"""
return xpu_xhpc_version

def cinn():
def cinn() -> str:
"""Get CINN version of paddle package.

Returns:
Expand Down
20 changes: 10 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ def write_version_py(filename='paddle/version/__init__.py'):
__all__ = ['cuda', 'cudnn', 'nccl', 'show', 'xpu', 'xpu_xre', 'xpu_xccl', 'xpu_xhpc']
def show():
def show() -> None:
"""Get the version of paddle if `paddle` package if tagged. Otherwise, output the corresponding commit id.
Returns:
Expand Down Expand Up @@ -537,10 +537,10 @@ def show():
print('xpu_xhpc:', xpu_xhpc_version)
print('cinn:', cinn_version)
def mkl():
def mkl() -> str:
return with_mkl
def nccl():
def nccl() -> str:
"""Get nccl version of paddle package.
Returns:
Expand All @@ -558,7 +558,7 @@ def nccl():
"""
return nccl_version
def cuda():
def cuda() -> str:
"""Get cuda version of paddle package.
Returns:
Expand All @@ -576,7 +576,7 @@ def cuda():
"""
return cuda_version
def cudnn():
def cudnn() -> str:
"""Get cudnn version of paddle package.
Returns:
Expand All @@ -594,7 +594,7 @@ def cudnn():
"""
return cudnn_version
def xpu():
def xpu() -> str:
"""Get xpu version of paddle package. The API is deprecated now, please use xpu_xhpc() instead.
Returns:
Expand All @@ -608,7 +608,7 @@ def xpu():
"""
return xpu_xhpc_version
def xpu_xre():
def xpu_xre() -> str:
"""Get xpu xre version of paddle package.
Returns:
Expand All @@ -626,7 +626,7 @@ def xpu_xre():
"""
return xpu_xre_version
def xpu_xccl():
def xpu_xccl() -> str:
"""Get xpu xccl version of paddle package.
Returns:
Expand All @@ -644,7 +644,7 @@ def xpu_xccl():
"""
return xpu_xccl_version
def xpu_xhpc():
def xpu_xhpc() -> str:
"""Get xpu xhpc version of paddle package.
Returns:
Expand All @@ -662,7 +662,7 @@ def xpu_xhpc():
"""
return xpu_xhpc_version
def cinn():
def cinn() -> str:
"""Get CINN version of paddle package.
Returns:
Expand Down

0 comments on commit 04ed231

Please sign in to comment.