Commit Graph

3 Commits

Author SHA1 Message Date
Hood Chatham e4edd7a4d2
Make various JsProxy classes implement issubclass and isinstance more helpfully (#3277)
Before we had a single `JsProxy` documentation class. Apparently mypy treated
it as `Any`. It had a bunch of methods on it that may or may not appear in
any specific ` sProxy`.

This does two things:

1. Split up `JsProxy` class into several synthetic subclasses like `JsArray`,
`JsBuffer` etc. These work much better with mypy, they should also improve
documentation layout and it helps when different subclassess have different
methods with the same name (e.g., `JsArray` and `JsMap` both will have `pop`
methods).

2. Make `isinstance` and `issubclass` work correctly both with synthetic `JsProxy`
classes like `JsArray`, `JsBuffer` etc and with `type(an_actual_jsproxy)`.

This cleans up the bootstrapping mess in `_importhook` because the `JsProxy`
from `_core_docs` works fine for instance checks now. 

I had to make changes to various other Python files 
because mypy now understands the types better and noticed that there were type errors.
For instance, this fixed several minor mistakes in the types in `http.py`.
2022-11-22 17:04:10 -08:00
Gyeongjae Choi 7231cab3ff
DOC Fix doc warnings (#2898) 2022-07-25 13:30:56 +09:00
Hood Chatham 516364e468
Move more functions into submodules of pyodide (#2790)
This resolves #2689.
2022-06-28 06:31:58 -07:00