Model: claude-3-5-sonnet-latest
2783979810
| #!/usr/bin/env python3 | |
| from contextlib import suppress | |
| from dataclasses import dataclass | |
| import argparse | |
| import json | |
| import sys | |
| @dataclass(slots=True, frozen=True) | |
| class Block: |
| #!/usr/bin/env python3 | |
| from base64 import b64encode | |
| from hashlib import blake2b | |
| from math import exp, log | |
| from typing import Iterable, TextIO | |
| import asyncio | |
| import json | |
| import os | |
| import random | |
| import sqlite3 |
| #[inline] | |
| pub fn mod_gt_neg_m(a: i64, m: u64) -> u64 { | |
| debug_assert!( | |
| m.try_into().is_ok_and(|m: i64| a >= -m), | |
| "input to mod_gt_neg_m must be >= -m" | |
| ); | |
| if a < 0 { | |
| (a + m as i64) as u64 | |
| } else { |
| #!/usr/bin/env python3 | |
| from html.parser import HTMLParser | |
| from io import StringIO | |
| import re | |
| import sys | |
| class ItemParser(HTMLParser): | |
| MISSING_SEMICOLONS = re.compile(r"((^|\n)(?:[^/]|/[^/])*[^};\s])(\s*(?://.*)?)$") |
| use core::{ | |
| mem::{self, ManuallyDrop}, | |
| sync::atomic::{AtomicUsize, Ordering}, | |
| }; | |
| use std::num::NonZero; | |
| static MAX_THREAD_ID: AtomicUsize = AtomicUsize::new(0); | |
| thread_local! { | |
| static THREAD_ID: NonZero<usize> = { |
| #!/usr/bin/env python3 | |
| import os | |
| import sys | |
| import textwrap | |
| # https://github.com/coreutils/coreutils/commit/fcfba90d0d27a1bacf2020bac4dbec74ed181028 | |
| IO_BUFSIZE = 256 * 1024 | |
| #!/usr/bin/env python3 | |
| # sort-imports.py: Sort imports in Python files. | |
| # | |
| # Usage: ./sort-imports.py file1.py file2.py ... | |
| # | |
| # Sorts imports within "stanzas". A stanza is a block of consecutive import | |
| # statements with the same indentation. Each stanza is sorted to contain first | |
| # all `from` imports, sorted by module, then by imported names; then `import` | |
| # imports, sorted by module. |
| // Copyright (c) 2008-2010 Bjoern Hoehrmann <[email protected]> | |
| // See http://bjoern.hoehrmann.de/utf-8/decoder/dfa/ for details. | |
| use std::{error::Error, fmt::Display}; | |
| #[derive(Debug)] | |
| pub struct Utf8Error; | |
| impl Display for Utf8Error { | |
| fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { |