Skip to content

Instantly share code, notes, and snippets.

View harupy's full-sized avatar
🇯🇵
Focusing

Harutaka Kawamura harupy

🇯🇵
Focusing
View GitHub Profile
@pytest.hookimpl(hookwrapper=True)
def pytest_report_teststatus(report, config):
outcome = yield
res = outcome.get_result()
attr_name = "___TIME___"
if report.when == "setup":
# HACK: store the start time in `config`
setattr(config, attr_name, time.time())
elif report.when == "call":
import libcst as cst
import pathlib
import argparse
import difflib
class AssertMethodTransformer(cst.CSTTransformer):
@staticmethod
def is_unittest_assert_method(node: cst.Call, name: str) -> bool:
return (
import libcst as cst
import pathlib
import argparse
import difflib
class AssertMethodTransformer(cst.CSTTransformer):
@staticmethod
def is_unittest_assert_method(node: cst.Call, name: str) -> bool:
return (
import mlflow
from sklearn.linear_model import LogisticRegression
from pathlib import Path
import tempfile
with mlflow.start_run():
mi = mlflow.sklearn.log_model(LogisticRegression(), "model")
client = mlflow.MlflowClient()
with tempfile.TemporaryDirectory() as tmpdir:
import boto3
import requests
import uuid
import tempfile
from pathlib import Path
import sys
with tempfile.TemporaryDirectory() as tmpdir:
# Create a 500MB file
b"""
{
"id": "chatcmpl-7lG2usbCnpQIBmid2fGZjsT9Wymh4",
"object": "chat.completion.chunk",
"created": 1691497452,
"model": "gpt-3.5-turbo-0613",
"choices": [
{
"index": 0,
"delta": {"content": " set"},
from __future__ import annotations
import ast
import os
import random
import subprocess
import textwrap
import openai
services:
mysql:
image: mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: root-password
MYSQL_DATABASE: mlflowdb
MYSQL_USER: mlflowuser
MYSQL_PASSWORD: mlflowpassword
command: mysqld --default-authentication-plugin=mysql_native_password