Skip to content

Instantly share code, notes, and snippets.

View saulshanabrook's full-sized avatar
🏊

Saul Shanabrook saulshanabrook

🏊
View GitHub Profile

I would like to propose allowing runtime access to arguments of type application (parameters) on classes inside of classmethods and the __init__ function.

I originally brought this up on the thread for implementing PEP 585, because it might entail changes to the runtime data structure being created there, but was advised that this would have to be brought up separately and would likely result in it's own PEP if there is expressed desire for it and a reasonable way to implement it (https://mail.python.org/archives/list/typing-sig@python.org/message/TQQRXNXY5KU2BG3Y7LPVN4QOSTRZZ2L6/).

Motivation

This would allow a common syntax to create strongly typed collections to be analyzed by tools like MyPy and also used at runtime. Many built in collections do not need this feature, because at runtime they can be heterogeneous.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@saulshanabrook
saulshanabrook / README.md
Created November 20, 2019 20:14
Jupyter output renderers

Jupyter output renderers

Add new MIME type: application/vnd.jupyter.renderer+json;package={package_name} where {package_name} is the name (and possible version) of an NPM package, like standalone-dx or standalone-dx@^1.0.0.

You should be able to import a renderMime function from that package with this signature:

type RenderMIME = (options: {
digraph{
node[shape=plaintext,color=none]
// splines=polyline
// concentrate=true
nodesep=0.3
// layout=dagre
edge[penwidth=1,arrowsize=0.6]
digraph{
node[shape=plaintext]
compound=true;
keras->"tensorflow python"->"tensorflow graph"->"xla hlo"->"tpu ir"->tpu
"tensorflow eager" -> "tensorflow graph" -> tflite -> "tflite interpreter"->{cpu gpu}
keras->"plaid ml"->{cpu gpu}
"tensorflow graph"-> "tensorRT(nvidia)"->gpu
"tensorflow graph"-> "ngraph(intel)"->"plaid ml"
subgraph cluster_llvm {
llvm "xla runtime" "Glow Runtime" "ATen" "numpy capi" xnd
type Middleware<A, B, C, D> = Fn<A, [B, Fn<C, D>] | null>;
function applyMiddleware<A, B, C, D>(
middleware: Middleware<A, B, C, D>,
b_c: Fn<B, C>
): Fn<A, D | null> {
return a => {
const res = middleware(a);
if (!res) {
return null;