This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import warnings | |
def deprecated(msg=""): | |
def inner(func): | |
""" | |
This is a decorator which can be used to mark functions | |
as deprecated. It will result in a warning being emitted | |
when the function is used. | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def mpl_layout(rows_cols, axis=0): | |
""" | |
Description: | |
------------ | |
Prepare matplotlib layout for complexe layouts. | |
Exemple: | |
-------- | |
If you have done 6 independant experiences with graphes but you want to show them all in one figure with 2 graphes on each row | |
and 3 rows of graphes. Moreover, you want to display the graphes by lines, eg: on each row, you want 2 consecutive experiences. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def singleton(cls): | |
""" | |
Simple singleton implementation. | |
Usage: | |
@singleton | |
class A: | |
pass | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# vim: set fileencoding=utf8 : | |
"""Singleton Mixin""" | |
class Singleton(object): | |
"""Singleton Mixin Class | |
Inherit this class and make the subclass Singleton. | |
Usage: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def warn(*args, **kwargs): | |
pass | |
import warnings | |
warnings.warn = warn |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import OrderedDict | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from pprint import pprint | |
# data source : https://fr.wikipedia.org/wiki/Liste_de_sondages_sur_l%27%C3%A9lection_pr%C3%A9sidentielle_fran%C3%A7aise_de_2017#Avril_2017 | |
scores_fillon = [ | |
19.5, | |
18.5, | |
21, | |
19, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
search_dir='.' | |
for entry in "$search_dir"/*; do | |
# entry = la/bas/truc.zip | |
filename=$(basename "$entry") | |
# filename = truc.zip | |
extension=$([[ "$filename" = *.* ]] && echo "${filename##*.}" || echo '') | |
# extension = zip | |
re_nbr='^[0-9]+$' | |
if ! [[ $extension =~ $re_nbr ]] && ! [[ -z "$extension" ]] ; then | |
if ! [[ -d "$extension" ]] ; then |
NewerOlder