Diagrams
Events
classDiagram
class Message {
time: float
is_forwarded: bool
handler_name: str
# remove pesky trailing newlines from iterating over a text file | |
def denewlining(line_iterator): | |
for line in line_iterator: | |
yield line.rstrip("\n\r") | |
with open(__file__) as infile: | |
for line in denewlining(infile): | |
print(f"{line!r} <-- look ma! no trailing newlines!") |
import contextlib | |
class InvalidStateActionError(NotImplementedError): | |
pass | |
class InvalidStateTransitionError(InvalidStateActionError): | |
pass |
classDiagram
class Message {
time: float
is_forwarded: bool
handler_name: str
[ | |
{"id": "1", "title": "PEP Purpose and Guidelines", "authors": "Warsaw, Hylton, Goodger, Coghlan", "discussions_to": null, "status": "Active", "type": "Process", "topic": "", "created": "13-Jun-2000", "python_version": null, "post_history": "21-Mar-2001, 29-Jul-2002, 03-May-2003, 05-May-2012, 07-Apr-2013", "resolution": null, "requires": null, "replaces": null, "superseded_by": null, "url": "https://peps.python.org/pep-0001/", "abstract": ""}, | |
{"id": "2", "title": "Procedure for Adding New Modules", "authors": "Cannon, Faassen", "discussions_to": null, "status": "Active", "type": "Process", "topic": "", "created": "07-Jul-2001", "python_version": null, "post_history": "07-Jul-2001, 09-Mar-2002", "resolution": null, "requires": null, "replaces": null, "superseded_by": null, "url": "https://peps.python.org/pep-0002/", "abstract": "\nIntroduction\nThe Python Standard Library contributes significantly to Python's\nsuccess. The language comes with \"batteries included\", so it is easy\nfor people to become produ |
import typing | |
from functools import lru_cache | |
T = typing.TypeVar("T") | |
PredicateFunction = typing.Callable[[T], bool] | |
SourceIterable = typing.Iterable[T] | |
ObjectList = typing.List[T] | |
def splitby( |
<html> | |
<head> | |
<title>Plusminus Dice Roller</title> | |
<link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css" /> | |
<script defer src="https://pyscript.net/alpha/pyscript.js"></script> | |
<py-env> | |
- plusminus | |
</py-env> | |
</head> |
<html> | |
<head> | |
<script defer src="https://pyscript.net/alpha/pyscript.min.js"></script> | |
<py-env> | |
- littletable | |
</py-env> | |
</head> | |
<body> | |
<h2>Iris data</h2> |
<html> | |
<head> | |
<script defer src="https://pyscript.net/alpha/pyscript.js"></script> | |
</head> | |
<body> | |
<table cellpadding=30 border=2> | |
<tr> | |
<td> |
<html> | |
<head> | |
<link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css" /> | |
<script defer src="https://pyscript.net/alpha/pyscript.js"></script> | |
<py-env> | |
- pyparsing==3.0.9 | |
- railroad-diagrams | |
- jinja2 | |
</py-env> | |
<py-script> |
import rich.progress | |
import rich.spinner | |
import time | |
import random | |
class RandomChars(rich.progress.ProgressColumn): | |
"""Simulation of computer 'thinking' by displaying random characters | |
Args: | |
chars (str): characters from which to choose for display. Defaults to 0-9A-F. |