Skip to content

Instantly share code, notes, and snippets.

View Fifan31's full-sized avatar

AIME Stéphan Fifan31

  • Toulouse, FRANCE
View GitHub Profile
@Fifan31
Fifan31 / decorators.py
Created March 2, 2021 16:19
Some python decorators
import functools
import time
def timer(func):
"""Print the runtime of the decorated function"""
@functools.wraps(func)
def wrapper_timer(*args, **kwargs):
start_time = time.perf_counter() # 1
value = func(*args, **kwargs)
end_time = time.perf_counter() # 2
# Configuration file for starship prompt
# see https://starship.rs/
# This file must be copied into ~/.config/starship.toml
# Get editor completions based on the config schema
"$schema" = 'https://starship.rs/config-schema.json'
# Inserts a blank line between shell prompt
add_newline = false