Skip to content

Instantly share code, notes, and snippets.

@skshetry
skshetry / mit_scheme_bindings.txt
Created August 26, 2023 03:17 — forked from bobbyno/mit_scheme_bindings.txt
MIT Scheme bindings suitable for rlwrap completion
#
#!optional
#!rest
#(
#\
#\altmode
#\backnext
#\backspace
#\call
#\linefeed
@skshetry
skshetry / httpx_history.py
Created April 27, 2022 03:31
Track history of request, responses in httpx
import httpx
import pytest
from typing import NamedTuple, Dequeue
from unittest import mock
class Transaction(NamedTuple):
request: httpx.Request
response: httpx.Response
from dvc.repo import locked
from dvc.repo.scm_context import scm_context
from dvc.repo.add import create_stages
@locked
@scm_context
def single_add(repo, target):
# does not support --recursive add
stage, = create_stages(repo, [target])
import os
from funcy import log_durations
from rich.console import Console
import dvc.api
from dvc._debug import profile
from dvc.external_repo import clean_repos
from dvc.fs.pool import close_pools
@skshetry
skshetry / test_plots_html_e2e.py
Created November 4, 2021 03:21
Testing plots with playwright e2e
"""
Setup:
1. pip install pytest-playwright
2. playwright install
3. `pytest test_plots_html_e2e.py` to run in headless mode. Add `--headed` for non-headless mode.
"""
import dataclasses
import os
from typing import List
@skshetry
skshetry / tqdm_capture.py
Created March 13, 2021 05:30
Capturing tqdm instances
import pytest
from funcy import wrap_with
import threading
class TdqmCapture:
def __init__(self):
self._instances = []
@property
@skshetry
skshetry / dvc-schema.json
Last active June 12, 2020 07:37
Schema for `dvc.yaml`
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://github.com/iterative/dvc/blob/master/dvc-yaml.schema.json",
"$comment": "v0.1.0",
"title": "Pipeline Schema",
"description": "A dvc.yaml pipeline definition",
"type": "object",
"definitions": {
"OutputFlags": {
"type": "object",
@skshetry
skshetry / migrator.py
Last active October 16, 2021 10:16
Migrator for DVC from old-style stage to new pipeline file (use at your own risk, requires `dvc>=1.0.0`
import argparse
import logging
import os
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
def _get_repo():

Keybase proof

I hereby claim:

  • I am skshetry on github.
  • I am skshetry (https://keybase.io/skshetry) on keybase.
  • I have a public key whose fingerprint is 3C0A 8962 9BFA 5C16 B7B3 C730 424B DDBA 58C0 953D

To claim this, I am signing this object:

def import_these(*pkg_args):
    return [import_this(pkg_str) for pkg_str in pkg_args]

def import_this(pkg_str: str):
    import importlib
    try:
        return importlib.import_module(pkg_str)
    except ModuleNotFoundError:
        print(f"The '{pkg_str}' module wasn't found."