This file contains 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 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 |
This file contains 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 functools | |
def decorator(func): | |
@functools.wraps(func) | |
def wrapper_decorator(*args, **kwargs): | |
# Do something before | |
value = func(*args, **kwargs) | |
# Do something after | |
return value | |
return wrapper_decorator |
This file contains 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
#with os | |
import os | |
os.makedirs('2018/10/05', mode=0o770) | |
#with pathlib | |
import pathlib | |
p = pathlib.Path('2018/10/05') | |
p.mkdir(parents=True) |
This file contains 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
3d:tessellate -> Mosaïquer | |
DataPlotly:build_generic_plot -> Build a generic plot | |
Networks:auto_connectors -> Auto-connecteurs | |
Networks:build_connectors -> Créer connecteurs | |
Networks:build_graph -> Créer graphe | |
Networks:concatenate_networks -> Concaténer réseaux | |
Networks:connect_nodes2lines -> Connecter des points à des lignes | |
Networks:get_link_flows_data -> Importer des données de flux | |
Networks:gtfs_import -> Import GTFS | |
Networks:indicators_by_OD -> indicateurs par OD |
This file contains 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
layer = iface.activeLayer() | |
features = layer.getFeatures() | |
newFeature = QgsFeature(layer.fields()) | |
newFeature["ID_POINT_D"]=20084 | |
pt = QgsGeometry().fromPointXY(QgsPointXY(2.272507912597,51.020400936747)) | |
newFeature.setGeometry(pt) | |
layer.startEditing() | |
layer.addFeature(newFeature) | |
''' | |
layer.commitChanges() |
This file contains 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
liste1 = [100, 24, 'toto', '%'] | |
liste2 = [89, 25, 'totol', '%*'] | |
def meme(l1, l2): | |
for x in l1: | |
for j in l2: | |
if x==j: | |
return True | |
print(meme(liste1,liste2)) |
NewerOlder