Commit 55300f36 authored by BO ZHANG's avatar BO ZHANG 🏀
Browse files

fix docstring and typing

parent e5cef66b
Pipeline #1427 failed with stage
in 0 seconds
......@@ -24,7 +24,7 @@ HERE: str = os.path.dirname(__file__)
# 这个函数演示了如何利用随包数据
# 当config_path被指定时,会读取指定的config_path
# 当config_path=None时,读取随包数据中的config/default_config.toml
def read_config(config_path: Optional[str] = None):
def read_config(config_path: Optional[str] = None) -> dict:
"""
Get config info from a toml file.
......
......@@ -11,7 +11,7 @@ Modified-History:
from typing import Any
def demo_function(*args: Any):
def demo_function(*args: Any) -> int:
"""
A demo function.
......@@ -66,9 +66,9 @@ class DemoClass:
>>> a.say_hello()
"""
def __init__(self, first_name, last_name):
def __init__(self, first_name, last_name) -> None:
self.first_name = first_name
self.last_name = last_name
def say_hello(self):
def say_hello(self) -> None:
print("Hello, {} {}!".format(self.first_name, self.last_name))
......@@ -61,7 +61,7 @@ def flip_image(image: np.ndarray, use_numpy: bool = False) -> np.ndarray:
# 此函数读取了随包数据中的test_image.txt
def read_default_image():
def read_default_image() -> np.ndarray:
"""
Read default image.
......
......@@ -30,6 +30,7 @@ def flip_multiple_images_mp(images: list[np.ndarray], n_jobs: int) -> list[np.nd
Returns
-------
list[np.ndarray]
The flipped image list.
"""
with multiprocessing.Pool(n_jobs) as p:
......@@ -52,6 +53,7 @@ def flip_multiple_images_jl(images: list[np.ndarray], n_jobs: int) -> list[np.nd
Returns
-------
list[np.ndarray]
The flipped image list.
"""
return joblib.Parallel(n_jobs=n_jobs, backend="multiprocessing")(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment