Skip to content

Instantly share code, notes, and snippets.

Avatar

Henry Schreiner henryiii

View GitHub Profile
@henryiii
henryiii / flake8_errmsg.py
Last active Sep 5, 2022
flake8 checker for error messages showing up unrendered in the traceback
View flake8_errmsg.py
#!/usr/bin/env python
"""
Flake8 checker for raw literals inside raises.
Requires Python 3.10. This can be run without Flake8 as well. Try:
git ls-files '*.py' | xargs python3 plugins/flake8_errmsg.py
Local use:
@henryiii
henryiii / example_all.py
Last active Mar 3, 2022
Example of a package builder (pyodide)
View example_all.py
from graphlib import TopologicalSorter
import asyncio
import dataclasses
import yaml
from pathlib import Path
import functools
from typing import NoReturn
@functools.total_ordering
View make_hist.py
# Run inside https://github.com/mayeut/manylinux-timeline
#
# Example nox file for those too lazy to set up a venv:
#
# import nox
#
# @nox.session(reuse_venv=True)
# def run(session):
# session.install("hist[plot]", "pandas")
# session.run("python", "make_hist.py")
View convert_catch2.py
#!/usr/bin/env python3
import sys
import re
import os
testCaseRegex = re.compile(r"TEST\s*\((\w+),\s*(\w+)\)")
testFixtureRegex = re.compile(r"TEST_F\s*\((\w+),\s*(\w+)\)")
expectRegex = re.compile(r"EXPECT_(\w+)\s*\((.*)\);")
assertRegex = re.compile(r"ASSERT_(\w+)\s*\((.*)\);")
@henryiii
henryiii / NextTry.py
Last active Dec 10, 2020
MyPy and Vectors
View NextTry.py
from __future__ import annotations # type: ignore
from typing import Protocol, TypeVar, Generic
T = TypeVar("T")
U = TypeVar("U")
V = TypeVar("V")
W = TypeVar("W")
@henryiii
henryiii / issue.md
Created Jun 4, 2020
pip issue description
View issue.md

Environment

  • pip version: latest
  • Python version: 3.5.4
  • OS: Windows

This happens when using nuget to get Python, and only on Python 3.5. Python 2.7 and 3.6-3.8 are just fine. I have only seen this problem on Windows. This is breaking cibuildwheel, which uses this setup. See pypa/cibuildwheel#358 - there you can see the logs. This may be true with any portable install, I'm not sure.

Description The surrounding environment is used when making a PEP 518 build, rather than the new one created for the build. When building with -v, it is making the environment, but it is not being used.

View 04_runge_kutta.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View treewatch.py
#!/usr/bin/env python3
from argparse import ArgumentParser
from pathlib import Path
from textwrap import indent
import curses
import unicodedata
FOLDER_OPEN = unicodedata.lookup('Open File Folder')
FOLDER_CLOSED = unicodedata.lookup('File Folder')
View CreateData.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View pypi_counter.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.