I hereby claim:
- I am schlerp on github.
- I am schlerp (https://keybase.io/schlerp) on keybase.
- I have a public key whose fingerprint is 3462 D9BE E84D 362E DF04 7884 358F 08BB BA65 7953
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
from typing import Dict, Literal, List, Tuple, Union | |
from itertools import product | |
from random import choice | |
STR_TRUE_VAL = "#" | |
STR_FALSE_VAL = " " | |
def str_repr(val: int): |
class OperationArgSchema(pydantic.BaseModel): | |
name: str | |
type: str | |
label: str | |
value: Any | |
class OperationSchema(pydantic.BaseModel): | |
operation_id: str | |
nodeType: str |
class Node(object): | |
def __init__(self, *args, **kwargs): | |
self.df: pd.DataFrame = None | |
def get_sample(self, *args, n_rows: int = 100, **kwargs): | |
return self.df.sample(*args, n=n_rows, **kwargs) | |
class OutputNode(Node): | |
_node_type = "OutputNode" | |
pass |
async def get_operations_collection( | |
module_list: List[ModuleType] = [inputs, processors, outputs] | |
) -> List[Dict[str, Any]]: | |
operations_collection = [] | |
for module in module_list: | |
importlib.invalidate_caches() | |
module = importlib.reload(module) | |
for _class in get_classes_from_module(module): | |
if hasattr(_class, "_node_subtype"): | |
args = [arg for arg in get_init_args_from_class(_class)] |
TYPE_MAP = { | |
str: "str", | |
float: "float", | |
int: "int", | |
bool: "bool", | |
inspect._empty: "str", # the default return when type is undefined | |
List[str]: "array", | |
List[int]: "array", | |
List[float]: "array", | |
List[bool]: "array", |
def get_classes_from_module(module: ModuleType) -> Iterator[Any]: | |
for _, obj in inspect.getmembers(module): | |
if inspect.isclass(obj): | |
yield obj |
px.bar( | |
df, | |
x="Animal", | |
y="Height", | |
color="Legs", | |
title=format_title("Animal Height/Length", "data collected at my local zoo during 2020"), | |
template=custom_template | |
) |
def format_title(title, subtitle=None, subtitle_font_size=14): | |
title = f'<b>{title}</b>' | |
if not subtitle: | |
return title | |
subtitle = f'<span style="font-size: {subtitle_font_size}px;">{subtitle}</span>' | |
return f'{title}<br>{subtitle}' | |
px.bar( | |
df, | |
x="Animal", | |
y="Height", | |
color="Legs", | |
title="The heights of various animals at my zoo", | |
template=custom_template | |
) |