From 11acf9073dcddc8b39ef511315df7a61886d17a8 Mon Sep 17 00:00:00 2001 From: fenix Date: Tue, 13 Feb 2024 14:16:17 +0100 Subject: [PATCH] decorator - Py ii pre -pie Decorator --- quiet_night.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 quiet_night.py diff --git a/quiet_night.py b/quiet_night.py new file mode 100644 index 0000000..bdb38e9 --- /dev/null +++ b/quiet_night.py @@ -0,0 +1,12 @@ +from datetime import datetime + +def not_during_the_night(func): + def wrapper(): + if 7 <= datetime.now().hour < 22: + func() + else: + pass # Hush, the neighbors are asleep + return wrapper + +def say_whee(): + print("Whee!")