feat: Semaine 9

This commit is contained in:
gauvainboiche
2026-05-15 16:24:56 +02:00
parent 3315cb2336
commit ce1f0e513a
108 changed files with 3150 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
import argparse
import time
def timer_command(fonction):
def internal_wrapper(args):
if args.verbose:
print("[DEBUG] Lancement de la commande...")
start_time = time.perf_counter()
result = fonction(args)
print(f"[DEBUG] Terminé en {time.perf_counter() - start_time}")
return result
return fonction(args)
return internal_wrapper
parser = argparse.ArgumentParser(description="Un scanneur")
parser.add_argument("-n", "--numbers", nargs= "+", type= int, help="Nombres à additioner")
parser.add_argument("-v", "--verbose", action="store_true", help="Mode verbeux")
@timer_command
def addition(args):
return sum(args.numbers)
args = parser.parse_args()
print(addition(args))