diff --git a/csst_proto/config.py b/csst_proto/config.py index 1180e5fd8f0afca1effecec0023ac20a6a17d61a..d32fcd4983db880ba57e12756a1a3cad735decfd 100644 --- a/csst_proto/config.py +++ b/csst_proto/config.py @@ -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. diff --git a/csst_proto/demo.py b/csst_proto/demo.py index 89d5cb0f6d30492d2cf05bbb98231a6f1032d1cf..f75f4ecb040005366ac347fddcf383c54285f609 100644 --- a/csst_proto/demo.py +++ b/csst_proto/demo.py @@ -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)) diff --git a/csst_proto/flip_image.py b/csst_proto/flip_image.py index a95d4a364429bc3bbff00ea97f6e114de66e3aa4..9b462462c0f8266aa70142052e9333395581fb23 100644 --- a/csst_proto/flip_image.py +++ b/csst_proto/flip_image.py @@ -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. diff --git a/csst_proto/flip_image_in_parallel.py b/csst_proto/flip_image_in_parallel.py index dc35acb913bf654cfe11065e2394d2c9d15f203d..8f78572950b5fab9c4a99dd1e8ba81165952c057 100644 --- a/csst_proto/flip_image_in_parallel.py +++ b/csst_proto/flip_image_in_parallel.py @@ -30,7 +30,8 @@ def flip_multiple_images_mp(images: list[np.ndarray], n_jobs: int) -> list[np.nd Returns ------- - The flipped image list. + list[np.ndarray] + The flipped image list. """ with multiprocessing.Pool(n_jobs) as p: results = p.map(flip_image, images) @@ -52,7 +53,8 @@ def flip_multiple_images_jl(images: list[np.ndarray], n_jobs: int) -> list[np.nd Returns ------- - The flipped image list. + list[np.ndarray] + The flipped image list. """ return joblib.Parallel(n_jobs=n_jobs, backend="multiprocessing")( joblib.delayed(flip_image)(image) for image in images