From 5890bc744ffb0dd8b4ec3eaca7af837b1056e619 Mon Sep 17 00:00:00 2001 From: camillebrianceau Date: Wed, 20 Nov 2024 16:05:53 +0100 Subject: [PATCH] first ideas for entities --- src/clinicaio/hello.py | 50 +++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/src/clinicaio/hello.py b/src/clinicaio/hello.py index d9dd5d4..540e730 100644 --- a/src/clinicaio/hello.py +++ b/src/clinicaio/hello.py @@ -1,34 +1,34 @@ +__all__ = [ + "greet", + "say_goodbye", +] +def greet(name: str): + """Greet the person with provided name. -class Label(UserString): - def __init__(self, value: str): - super().__init__(self.validate(value)) + Parameters + ---------- + name : str + The name of the person to greet. + """ + print(_build_greeting_message(name)) - @classmethod - def validate(cls, value: str) -> str: - if value.isalnum(): - return value - raise ValueError( - f"Label '{value}' is not a valid BIDS label: it must be composed only by letters and/or numbers." - ) - -class Index: - value: PositiveInt - length_as_string: PositiveInt # for padding with zeros - # Implement the constraint and the string representation taking into account the padding... -class Entity: - key: Label - value : Label | Index +def _build_greeting_message(name: str) -> str: + return f"Hello {name} !" - def __str__(self) -> str: - return f"{self.key}-{self.value}" -class SubjectEntity(Entity): - key = Label("sub") +def say_goodbye(name: str): + """Say goodbye to the person with the provided name. - def __init__(self, value: str): - self.value = Label(value) + Parameters + ---------- + name : str + The name of the person to say goodbye to. + """ + print(_build_good_bye_message(name)) -... \ No newline at end of file + +def _build_good_bye_message(name: str) -> str: + return f"Goodbye {name} !"