(Samuel Colvin)
See this discussion.
| import asyncio | |
| import base64 | |
| import json | |
| from pathlib import Path | |
| from httpx import AsyncClient | |
| from bs4 import BeautifulSoup | |
| from devtools import debug | |
| START_URL = 'https://github.com/pydantic/pydantic/network/dependents' |
| <style> | |
| main { | |
| display: flex; | |
| } | |
| pre { | |
| margin: 0; | |
| padding: 0; | |
| } | |
| code, #output { | |
| white-space: pre-wrap; |
| ➤ HYPOTHESIS_MAX_EXAMPLES=1000 pytest tests/test_hypothesis.py::test_recursive_cycles -s | |
| Test session starts (platform: darwin, Python 3.10.5, pytest 7.1.2, pytest-sugar 0.9.4) | |
| benchmark: 3.4.1 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=True warmup_iterations=100000) | |
| rootdir: /Users/samuel/code/pydantic-core, configfile: pyproject.toml | |
| plugins: benchmark-3.4.1, sugar-0.9.4, hypothesis-6.48.1, timeout-2.1.0, mock-3.8.1 | |
| timeout: 30.0s | |
| timeout method: signal | |
| timeout func_only: False | |
| collecting ... |
| import os | |
| from typing import TypeVar, Generic | |
| import psutil | |
| import pytest | |
| from pydantic.generics import GenericModel | |
| process = psutil.Process(os.getpid()) |
(Samuel Colvin)
See this discussion.
| from pathlib import Path | |
| from watchfiles import watch | |
| from devtools import debug | |
| THIS_DIR = Path(__file__).parent | |
| for changes in watch(THIS_DIR, debug=True): | |
| debug(changes) |
| #!/usr/bin/env python3 | |
| import time | |
| clocks = ['🕛', '🕐', '🕑', '🕒', '🕓', '🕔', '🕕', '🕖', '🕗', '🕘', '🕙', '🕚'] | |
| # moves the cursor to the beginning of the line | |
| # (3 columns back in this case is always enough) | |
| reset_cursor = '\033[3D' | |
| i = 0 | |
| while True: |
| javascript:(function(){ | |
| const set_color = (cls, col) => document.querySelectorAll(cls).forEach(el => { | |
| el.parentNode.style.backgroundColor = col; | |
| el.parentNode.querySelectorAll('td').forEach(td => {td.style.backgroundColor = col}); | |
| }); | |
| set_color('.bg-ds-coverage-partial', '#ffa'); | |
| set_color('.bg-ds-coverage-uncovered', '#fdd'); | |
| })(); |
Usage is simply
VERSION_PATH=<package name> python <(curl -Ls https://bit.ly/set__version__)This will set the __version__ variable in `
| """ | |
| Take the "Derived Property: ID_Start" section from https://www.unicode.org/Public/13.0.0/ucd/DerivedCoreProperties.txt | |
| and save to "DerivedCoreProperties.txt" | |
| """ | |
| from pathlib import Path | |
| def get_value(s: str) -> int: | |
| return int(f'0x{s}', 0) |