Skip to content

Instantly share code, notes, and snippets.

@kervel
kervel / generated.py
Created December 22, 2022 08:19
result polymorphism data
from __future__ import annotations
from datetime import datetime, date
from enum import Enum
from typing import List, Dict, Optional, Any, Union
from pydantic import BaseModel as BaseModel, Field
from linkml_runtime.linkml_model import Decimal
metamodel_version = "None"
version = "None"
@kervel
kervel / preprocess_voc_data.py
Created May 4, 2021 15:07
preprocess VOC data
"""
Script that executes the first stage of the pipeline for VOC data (filtering)
"""
import argparse
import xml.etree.ElementTree as ET
import os
import random
@kervel
kervel / 00-airflow-dag-operator-readme
Last active March 1, 2021 11:44
airflow DAG operator
prototype airflow DAG operator
def make_box_layout():
return widgets.Layout(
border='solid 1px black',
margin='0px 10px 10px 0px',
padding='5px 5px 5px 5px'
)
class Sines(widgets.HBox):
def __init__(self):
controls = widgets.VBox([int_slider, color_picker, text_xlabel, text_ylabel])
widgets.HBox([controls, output])
# create some control elements
int_slider = widgets.IntSlider(value=1, min=0, max=10, step=1, description='freq')
color_picker = widgets.ColorPicker(value=initial_color, description='pick a color')
text_xlabel = widgets.Text(value='', description='xlabel', continuous_update=False)
text_ylabel = widgets.Text(value='', description='ylabel', continuous_update=False)
# callback functions
def update(change):
"""redraw line (update plot)"""
line.set_ydata(np.sin(change.new * x))
output = widgets.Output()
# create some x data
x = np.linspace(0, 2 * np.pi, 100)
# default line color
initial_color = '#FF00DD'
with output:
fig, ax = plt.subplots(constrained_layout=True, figsize=(6, 4))
def make_box_layout():
return widgets.Layout(
border='solid 1px red',
margin='0px 10px 10px 0px',
padding='5px 5px 5px 5px'
)
vbox1, vbox2 = make_boxes()
vbox1.layout = make_box_layout()
box_layout = widgets.Layout(
border='solid 1px red',
margin='0px 10px 10px 0px',
padding='5px 5px 5px 5px')
vbox1, vbox2 = make_boxes()
vbox1.layout = box_layout
vbox2.layout = box_layout