Intro-to-Jinja-tpl-v2/quiet_night.py

13 lines
263 B
Python
Raw Normal View History

2024-02-13 13:16:17 +00:00
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!")