From ceee76c5d803f0f690bda9b33ebcd3484c2f21b3 Mon Sep 17 00:00:00 2001 From: BO ZHANG Date: Wed, 5 Oct 2022 00:31:17 +0800 Subject: [PATCH] added a demo class --- csst_proto/some_other_modules.py | 39 +++++++++++++++++++++++++++++++ csst_proto/top_level_interface.py | 4 ++-- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/csst_proto/some_other_modules.py b/csst_proto/some_other_modules.py index e9c2417..1f1d2ba 100644 --- a/csst_proto/some_other_modules.py +++ b/csst_proto/some_other_modules.py @@ -14,3 +14,42 @@ def a_demo_function(*args): >>> a_demo_function(None) """ return None + + +class ADemoClass: + """ + A demo class. + + This class is a demo. + This is a second-line comment for extended summary. + + Parameters + ---------- + first_name : str + The first name. + last_name : str + The last name. + + Attributes + ---------- + first_name : str + The first name. + last_name : str + The last name. + + Methods + ------- + say_hello() + Print hello message. + + Examples + -------- + >>> a = ADemoClass("Jane", "Doe") + >>> a.say_hello() + """ + def __init__(self, first_name, last_name): + self.first_name = first_name + self.last_name = last_name + + def say_hello(self): + print("Hello, {} {}!".format(self.first_name, self.last_name)) diff --git a/csst_proto/top_level_interface.py b/csst_proto/top_level_interface.py index 6180569..ea4f113 100644 --- a/csst_proto/top_level_interface.py +++ b/csst_proto/top_level_interface.py @@ -1,5 +1,5 @@ from .flip_image import flip_image, read_test_image -from .some_other_modules import a_demo_function +from .some_other_modules import a_demo_function, ADemoClass -__all__ = ["flip_image", "read_test_image", "a_demo_function"] +__all__ = ["flip_image", "read_test_image", "a_demo_function", "ADemoClass"] -- GitLab