Upload TypeGround benchmark dataset
Browse files- .gitattributes +2 -0
- README.md +128 -0
- data/slice_data.jsonl.gz +3 -0
- data/slice_data_testdata.jsonl.gz +3 -0
- data/snippet_data_50.jsonl.gz +3 -0
- data/snippet_data_testdata_50.jsonl.gz +3 -0
- data/types.json.gz +3 -0
- data/types_testdata.json.gz +3 -0
- type_cat.py +223 -0
.gitattributes
CHANGED
|
@@ -58,3 +58,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 58 |
# Video files - compressed
|
| 59 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 60 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
| 58 |
# Video files - compressed
|
| 59 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 60 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
| 61 |
+
*.json.gz filter=lfs diff=lfs merge=lfs -text
|
| 62 |
+
*.jsonl.gz filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
- code
|
| 6 |
+
tags:
|
| 7 |
+
- typescript
|
| 8 |
+
- type-inference
|
| 9 |
+
- programming-languages
|
| 10 |
+
- fill-mask
|
| 11 |
+
pretty_name: TypeGround
|
| 12 |
+
size_categories:
|
| 13 |
+
- 100M<n<1B
|
| 14 |
+
task_categories:
|
| 15 |
+
- fill-mask
|
| 16 |
+
- token-classification
|
| 17 |
+
configs:
|
| 18 |
+
- config_name: snippet
|
| 19 |
+
data_files:
|
| 20 |
+
- split: train
|
| 21 |
+
path: data/snippet_data_50.jsonl.gz
|
| 22 |
+
- split: test
|
| 23 |
+
path: data/snippet_data_testdata_50.jsonl.gz
|
| 24 |
+
- config_name: slice
|
| 25 |
+
data_files:
|
| 26 |
+
- split: train
|
| 27 |
+
path: data/slice_data.jsonl.gz
|
| 28 |
+
- split: test
|
| 29 |
+
path: data/slice_data_testdata.jsonl.gz
|
| 30 |
+
---
|
| 31 |
+
|
| 32 |
+
# TypeGround: A Compiler-Grounded Benchmark for TypeScript Type Inference
|
| 33 |
+
|
| 34 |
+
TypeGround is a compiler-grounded benchmark for TypeScript type inference. Every stage — annotation, context construction, and quality control — is validated by the TypeScript Compiler (TSC). It extracts variable declarations, function parameters, and return types from compilable TypeScript projects, combining developer annotations, TSC inference, LLM candidate generation, and TSC backfill checking to produce type labels.
|
| 35 |
+
|
| 36 |
+
Covers **2,735 projects, 99,209 source files, and 1,428,997 type annotations**.
|
| 37 |
+
|
| 38 |
+
## Benchmark Format
|
| 39 |
+
|
| 40 |
+
Each sample targets a single type position and includes:
|
| 41 |
+
|
| 42 |
+
- **Metadata** (`name`, `type`, `loc_cat`, `type_cat`, `line`, `file`)
|
| 43 |
+
- **Snippet code**: ±25 lines around the target, preserving local lexical and syntactic context.
|
| 44 |
+
- **Slice code**: type-dependency-based statements collected across function boundaries (imports, definitions, call sites, use sites).
|
| 45 |
+
|
| 46 |
+
The target type is replaced by `<mask>`; the model predicts the masked type expression.
|
| 47 |
+
|
| 48 |
+
### Location Categories
|
| 49 |
+
|
| 50 |
+
| Value | Meaning |
|
| 51 |
+
|-------|---------|
|
| 52 |
+
| `var` | Variable declaration |
|
| 53 |
+
| `arg` | Function parameter |
|
| 54 |
+
| `ret` | Function return |
|
| 55 |
+
|
| 56 |
+
### Type Categories
|
| 57 |
+
|
| 58 |
+
The `type_cat` field stores granular TSC type classifications (e.g., `NumberKeyword`, `FunctionType`, `UnionType`, `userDefined`). `type_cat.py` maps them into three analysis categories:
|
| 59 |
+
|
| 60 |
+
| Category | Coverage |
|
| 61 |
+
|----------|----------|
|
| 62 |
+
| `BuiltIn` | TS keywords (`*Keyword`), built-in objects (`Date`, `Error`, …), arrays/buffers, DOM (`HTML*`, `SVG*`, …), events (`*Event`), Canvas/WebGL, browser/Web APIs |
|
| 63 |
+
| `Constructed` | Function/constructor types, composite types (`ArrayType`, `UnionType`, `IntersectionType`, …), utility types (`Partial`, `Pick`, `Omit`, …), type operators (`MappedType`, `ConditionalType`, …) |
|
| 64 |
+
| `UserDefined` | `userDefined` — project-declared interfaces, type aliases, classes, enums |
|
| 65 |
+
|
| 66 |
+
## Data Files
|
| 67 |
+
|
| 68 |
+
| File | Records | Size | Description |
|
| 69 |
+
|------|---------|------|-------------|
|
| 70 |
+
| `types.json.gz` | ~11.4M | 21 MB | Train metadata |
|
| 71 |
+
| `types_testdata.json.gz` | ~694K | 1.3 MB | Test metadata |
|
| 72 |
+
| `snippet_data_50.jsonl.gz` | ~802K | 203 MB | Train snippets |
|
| 73 |
+
| `snippet_data_testdata_50.jsonl.gz` | ~41K | 11 MB | Test snippets |
|
| 74 |
+
| `slice_data.jsonl.gz` | ~1.2M | 307 MB | Train slices |
|
| 75 |
+
| `slice_data_testdata.jsonl.gz` | ~58K | 15 MB | Test slices |
|
| 76 |
+
|
| 77 |
+
### Format
|
| 78 |
+
|
| 79 |
+
**Metadata** (`types.json.gz`):
|
| 80 |
+
```json
|
| 81 |
+
{"name":"smooth","type":"number","loc_cat":"ret","type_cat":"NumberKeyword","line":1,"file":"repo/path/to/file.ts"}
|
| 82 |
+
```
|
| 83 |
+
|
| 84 |
+
**Snippet / Slice** (`snippet_data_50.jsonl.gz` / `slice_data.jsonl.gz`, one JSON object per line):
|
| 85 |
+
```json
|
| 86 |
+
{"id":"repo/path/to/file.ts#func#var#2","maskedText":"... <mask> ...","type":"number"}
|
| 87 |
+
{"id":"repo/path/to/file.ts#func#var#2","sliced_code":"... <mask> ...","type":"number"}
|
| 88 |
+
```
|
| 89 |
+
|
| 90 |
+
## Configs
|
| 91 |
+
|
| 92 |
+
| Config | Train file | Test file | Columns |
|
| 93 |
+
|--------|-----------|-----------|---------|
|
| 94 |
+
| `snippet` | `snippet_data_50.jsonl.gz` | `snippet_data_testdata_50.jsonl.gz` | `id`, `maskedText`, `type` |
|
| 95 |
+
| `slice` | `slice_data.jsonl.gz` | `slice_data_testdata.jsonl.gz` | `id`, `sliced_code`, `type` |
|
| 96 |
+
|
| 97 |
+
## Usage
|
| 98 |
+
|
| 99 |
+
```python
|
| 100 |
+
from datasets import load_dataset
|
| 101 |
+
|
| 102 |
+
# Snippet context
|
| 103 |
+
snippet = load_dataset("fumx66/TypeGround", "snippet")
|
| 104 |
+
print(snippet["train"][0]["maskedText"])
|
| 105 |
+
|
| 106 |
+
# Slice context
|
| 107 |
+
slice_ds = load_dataset("fumx66/TypeGround", "slice")
|
| 108 |
+
print(slice_ds["train"][0]["sliced_code"])
|
| 109 |
+
|
| 110 |
+
# Metadata
|
| 111 |
+
import gzip, json
|
| 112 |
+
with gzip.open("data/types.json.gz", "rt") as f:
|
| 113 |
+
types = json.load(f)
|
| 114 |
+
```
|
| 115 |
+
|
| 116 |
+
## Citation
|
| 117 |
+
|
| 118 |
+
```bibtex
|
| 119 |
+
@dataset{typeground,
|
| 120 |
+
title={TypeGround: A Compiler-Grounded Benchmark for TypeScript Type Inference},
|
| 121 |
+
year={2026},
|
| 122 |
+
url={https://huggingface.co/datasets/fumx66/TypeGround}
|
| 123 |
+
}
|
| 124 |
+
```
|
| 125 |
+
|
| 126 |
+
## License
|
| 127 |
+
|
| 128 |
+
MIT License
|
data/slice_data.jsonl.gz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:12af5a4a9e1ae97cfcba08603c6ad6201e7529ae9f1ba2367f771f8d6ace56ea
|
| 3 |
+
size 321637784
|
data/slice_data_testdata.jsonl.gz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:61718d869f0c28c27d49441a6096544b4082363ba30e56b8c8e58d4fe25fd487
|
| 3 |
+
size 15203695
|
data/snippet_data_50.jsonl.gz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f1ad40507f78fbc9183eb136cb8877ce707ac4b6915f26846b0de7a32707c411
|
| 3 |
+
size 211824589
|
data/snippet_data_testdata_50.jsonl.gz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ded7cbcd51676119a066bcd23a60c1c1daf37159221b888f32b5c0695179c0ff
|
| 3 |
+
size 10789568
|
data/types.json.gz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6987c110ddf7d0f29c6dc35bcb3ce277e302f40ad51b1e6aa3a242bc2256f290
|
| 3 |
+
size 21989144
|
data/types_testdata.json.gz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c8e3be4d445951cec9e6d49512f54a64dd4a711a53fdb62cfc6807661ecd4b4e
|
| 3 |
+
size 1355342
|
type_cat.py
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import csv
|
| 2 |
+
import os
|
| 3 |
+
|
| 4 |
+
def classify_type_cat(type_cat):
|
| 5 |
+
"""
|
| 6 |
+
Classify granular TSC type_cat strings into 3 major categories.
|
| 7 |
+
|
| 8 |
+
Priority order (first match wins):
|
| 9 |
+
1. UserDefined — project-declared interfaces, type aliases, classes, enums
|
| 10 |
+
2. Constructed — function/constructor types, composite types (Union, Array, etc.),
|
| 11 |
+
utility types (Partial, Pick, etc.), type operators (Mapped, Conditional, etc.)
|
| 12 |
+
3. BuiltIn — TS keywords, built-in objects (Date, Error, etc.), arrays/buffers,
|
| 13 |
+
DOM, events, Canvas/WebGL, browser/Web APIs
|
| 14 |
+
|
| 15 |
+
Falls back to BuiltIn for unrecognized values.
|
| 16 |
+
"""
|
| 17 |
+
if type_cat is None:
|
| 18 |
+
return None
|
| 19 |
+
|
| 20 |
+
# UserDefined
|
| 21 |
+
if type_cat == 'userDefined':
|
| 22 |
+
return 'UserDefined'
|
| 23 |
+
|
| 24 |
+
# Constructed: function and constructor types
|
| 25 |
+
if type_cat in {
|
| 26 |
+
'FunctionType', 'ConstructorType', 'Function', 'CallableFunction',
|
| 27 |
+
'VoidFunction', 'FunctionConstructor'
|
| 28 |
+
}:
|
| 29 |
+
return 'Constructed'
|
| 30 |
+
|
| 31 |
+
# Constructed: composite and utility types
|
| 32 |
+
if type_cat in {
|
| 33 |
+
'ArrayType', 'UnionType', 'IntersectionType', 'TupleType',
|
| 34 |
+
'TypeLiteral', 'Record', 'LiteralType', 'TemplateLiteralType',
|
| 35 |
+
'ParenthesizedType', 'MappedType', 'IndexedAccessType',
|
| 36 |
+
'ConditionalType', 'TypeOperator', 'TypeQuery', 'TypePredicate',
|
| 37 |
+
'ImportType', 'ThisType', 'Promise', 'PromiseLike',
|
| 38 |
+
'Partial', 'Readonly', 'Required', 'Pick', 'Omit', 'NonNullable',
|
| 39 |
+
'Awaited', 'ReturnType', 'Parameters', 'InstanceType', 'Exclude',
|
| 40 |
+
'Extract', 'NoInfer', 'InferType', 'ConstructorParameters',
|
| 41 |
+
'ThisParameterType', 'ReadonlyArray'
|
| 42 |
+
}:
|
| 43 |
+
return 'Constructed'
|
| 44 |
+
|
| 45 |
+
# BuiltIn: TS keyword types
|
| 46 |
+
if type_cat.endswith('Keyword'):
|
| 47 |
+
return 'BuiltIn'
|
| 48 |
+
|
| 49 |
+
# BuiltIn: standard built-in objects
|
| 50 |
+
if type_cat in {
|
| 51 |
+
'Date', 'RegExp', 'Error', 'TypeError', 'SyntaxError', 'EvalError',
|
| 52 |
+
'RangeError', 'ReferenceError', 'URIError', 'AggregateError',
|
| 53 |
+
'JSON', 'Console', 'Number', 'String', 'Boolean', 'Object',
|
| 54 |
+
'Symbol', 'BigInt'
|
| 55 |
+
} or type_cat.endswith('Constructor'):
|
| 56 |
+
return 'BuiltIn'
|
| 57 |
+
|
| 58 |
+
# BuiltIn: arrays and buffers
|
| 59 |
+
if type_cat in {
|
| 60 |
+
'Array', 'ArrayLike', 'ArrayBuffer', 'ArrayBufferLike',
|
| 61 |
+
'ArrayBufferView', 'BufferSource', 'Uint8Array', 'Uint8ClampedArray',
|
| 62 |
+
'Uint16Array', 'Uint32Array', 'Int8Array', 'Int16Array', 'Int32Array',
|
| 63 |
+
'Float32Array', 'Float64Array', 'DataView', 'Float32List', 'BigInteger',
|
| 64 |
+
'RegExpMatchArray', 'RegExpExecArray', 'TemplateStringsArray'
|
| 65 |
+
} or (type_cat.endswith('Array') and type_cat != 'ReadonlyArray'):
|
| 66 |
+
return 'BuiltIn'
|
| 67 |
+
|
| 68 |
+
# BuiltIn: HTML/SVG/DOM elements
|
| 69 |
+
if type_cat.startswith('HTML') or type_cat.startswith('SVG') or type_cat.endswith('Element'):
|
| 70 |
+
return 'BuiltIn'
|
| 71 |
+
|
| 72 |
+
# BuiltIn: DOM core types
|
| 73 |
+
if type_cat in {
|
| 74 |
+
'Element', 'HTMLElement', 'Node', 'Document', 'DocumentFragment',
|
| 75 |
+
'Text', 'Comment', 'Attr', 'NodeListOf', 'NodeList', 'HTMLCollection',
|
| 76 |
+
'HTMLCollectionOf', 'ChildNode', 'ParentNode', 'EventTarget',
|
| 77 |
+
'DocumentType', 'XMLDocument', 'HTMLDocument', 'CharacterData',
|
| 78 |
+
'CDATASection', 'ProcessingInstruction', 'DOMParser', 'XMLSerializer',
|
| 79 |
+
'TreeWalker', 'NodeIterator', 'NodeFilter', 'ShadowRoot', 'Selection',
|
| 80 |
+
'Range', 'DOMRect', 'DOMRectReadOnly', 'DOMRectList', 'DOMPoint',
|
| 81 |
+
'DOMMatrix', 'DOMTokenList', 'DOMStringMap', 'DOMException',
|
| 82 |
+
'DOMHighResTimeStamp', 'NamedNodeMap', 'ClientRect', 'XPathResult',
|
| 83 |
+
'XPathExpression', 'XPathNSResolver', 'WindowProxy', 'Credential',
|
| 84 |
+
'MediaDeviceInfo', 'MimeType', 'WeakKey', 'OptionalEffectTiming',
|
| 85 |
+
'KeyAlgorithm', 'ViewTransition', 'PerformanceEntryList'
|
| 86 |
+
}:
|
| 87 |
+
return 'BuiltIn'
|
| 88 |
+
|
| 89 |
+
# BuiltIn: events
|
| 90 |
+
if type_cat in {
|
| 91 |
+
'Event', 'MouseEvent', 'KeyboardEvent', 'TouchEvent', 'PointerEvent',
|
| 92 |
+
'WheelEvent', 'DragEvent', 'FocusEvent', 'InputEvent', 'ClipboardEvent',
|
| 93 |
+
'CustomEvent', 'ErrorEvent', 'CloseEvent', 'MessageEvent', 'ProgressEvent',
|
| 94 |
+
'StorageEvent', 'TransitionEvent', 'AnimationEvent', 'PromiseRejectionEvent',
|
| 95 |
+
'SubmitEvent', 'ToggleEvent', 'MIDIMessageEvent', 'RTCTrackEvent',
|
| 96 |
+
'AudioProcessingEvent', 'MediaQueryListEvent', 'EventListener',
|
| 97 |
+
'EventListenerOrEventListenerObject', 'EventListenerOptions',
|
| 98 |
+
'AddEventListenerOptions', 'EventInit', 'MouseEventInit', 'KeyboardEventInit',
|
| 99 |
+
'PointerEventInit', 'DragEventInit', 'FocusEventInit', 'InputEventInit',
|
| 100 |
+
'ClipboardEventInit', 'ErrorEventInit', 'WheelEventInit', 'UIEventInit',
|
| 101 |
+
'EventModifierInit', 'CustomEventInit', 'CustomElementRegistry',
|
| 102 |
+
'OnErrorEventHandler', 'UnderlyingSource'
|
| 103 |
+
} or type_cat.endswith('Event'):
|
| 104 |
+
return 'BuiltIn'
|
| 105 |
+
|
| 106 |
+
# BuiltIn: touch types
|
| 107 |
+
if type_cat in {'Touch', 'TouchList'} or type_cat.endswith('Touch'):
|
| 108 |
+
return 'BuiltIn'
|
| 109 |
+
|
| 110 |
+
# BuiltIn: Canvas / WebGL
|
| 111 |
+
if type_cat in {
|
| 112 |
+
'CanvasRenderingContext2D', 'CanvasRenderingContext2DSettings',
|
| 113 |
+
'OffscreenCanvasRenderingContext2D', 'OffscreenCanvas', 'CanvasImageSource',
|
| 114 |
+
'CanvasPattern', 'CanvasGradient', 'Path2D', 'ImageData', 'ImageDataArray',
|
| 115 |
+
'TextMetrics', 'CanvasState', 'WebGLRenderingContext', 'WebGL2RenderingContext',
|
| 116 |
+
'WebGLTexture', 'WebGLProgram', 'WebGLShader', 'WebGLBuffer', 'WebGLFramebuffer',
|
| 117 |
+
'WebGLRenderbuffer', 'WebGLUniformLocation', 'WebGLVertexArrayObject',
|
| 118 |
+
'WebGLQuery', 'WebGLActiveInfo', 'WebGLSync', 'WebGLContextAttributes',
|
| 119 |
+
'RenderingContext', 'ANGLE_instanced_arrays', 'OES_vertex_array_object',
|
| 120 |
+
'WEBGL_compressed_texture_s3tc', 'WEBGL_lose_context',
|
| 121 |
+
'WEBGL_debug_renderer_info', 'TexImageSource', 'HTMLCanvasElement'
|
| 122 |
+
} or 'Canvas' in type_cat or 'WebGL' in type_cat or type_cat.startswith('WEBGL_'):
|
| 123 |
+
return 'BuiltIn'
|
| 124 |
+
|
| 125 |
+
# BuiltIn: Web APIs
|
| 126 |
+
if type_cat in {
|
| 127 |
+
'Response', 'Request', 'URL', 'URLSearchParams',
|
| 128 |
+
'Headers', 'Body', 'RequestInit', 'RequestInfo', 'RequestMode',
|
| 129 |
+
'RequestCache', 'ResponseInit', 'ResponseType', 'HeadersInit',
|
| 130 |
+
'BodyInit', 'XMLHttpRequest', 'XMLHttpRequestBodyInit',
|
| 131 |
+
'AbortSignal', 'AbortController', 'ReadableStream', 'WritableStream',
|
| 132 |
+
'TransformStream', 'QueuingStrategy', 'CountQueuingStrategy',
|
| 133 |
+
'ReadableStreamDefaultReader', 'ReadableStreamDefaultController',
|
| 134 |
+
'ReadableStreamController', 'ReadableStreamReader', 'ReadableStreamReadResult',
|
| 135 |
+
'ReadableByteStreamController', 'WritableStreamDefaultWriter',
|
| 136 |
+
'TransformStreamDefaultController', 'DecompressionStream', 'CompressionStream',
|
| 137 |
+
'Transformer', 'TransferFunction',
|
| 138 |
+
'DataTransfer', 'DataTransferItem', 'DataTransferItemList',
|
| 139 |
+
'FontFace', 'FontFaceSet', 'DOMRectInit'
|
| 140 |
+
}:
|
| 141 |
+
return 'BuiltIn'
|
| 142 |
+
|
| 143 |
+
# BuiltIn: browser APIs
|
| 144 |
+
if type_cat in {
|
| 145 |
+
'Window', 'Location', 'History', 'Navigator', 'Screen', 'Performance',
|
| 146 |
+
'PerformanceEntry', 'PerformanceResourceTiming', 'PerformanceMeasure',
|
| 147 |
+
'PerformanceObserver', 'FrameRequestCallback', 'IdleDeadline',
|
| 148 |
+
'IdleRequestOptions', 'Storage', 'StorageEvent', 'StorageManager',
|
| 149 |
+
'Cache', 'ServiceWorker', 'ServiceWorkerRegistration',
|
| 150 |
+
'ServiceWorkerContainer', 'PushSubscription', 'PushSubscriptionJSON',
|
| 151 |
+
'Notification', 'NotificationOptions', 'Geolocation',
|
| 152 |
+
'GeolocationPosition', 'PositionOptions', 'MediaQueryList',
|
| 153 |
+
'MediaQueryListEvent', 'Clipboard', 'ClipboardItem', 'ClipboardItems',
|
| 154 |
+
'ClipboardItemOptions', 'CookieStore', 'Lock', 'LockOptions',
|
| 155 |
+
'Permissions', 'ShareData', 'FileSystem', 'FileSystemEntry',
|
| 156 |
+
'FileSystemFileEntry', 'FileSystemDirectoryEntry',
|
| 157 |
+
'FileSystemFileHandle', 'FileSystemWritableFileStream',
|
| 158 |
+
'FileSystemDirectoryReader', 'FileReader', 'File', 'Blob',
|
| 159 |
+
'BlobCallback', 'BlobPropertyBag', 'FormData', 'MediaStream',
|
| 160 |
+
'MediaStreamTrack', 'MediaStreamConstraints', 'MediaTrackConstraints',
|
| 161 |
+
'MediaTrackSettings', 'MediaTrackCapabilities', 'MediaSessionAction',
|
| 162 |
+
'MediaSessionActionHandler', 'MediaRecorder', 'MediaRecorderOptions',
|
| 163 |
+
'MediaSource', 'SourceBuffer', 'VideoEncoder', 'VideoEncoderSupport',
|
| 164 |
+
'VideoEncoderConfig', 'VideoFrame', 'AudioEncoder', 'AudioEncoderSupport',
|
| 165 |
+
'AudioEncoderConfig', 'AudioData', 'AudioContext', 'AudioBuffer',
|
| 166 |
+
'AudioBufferSourceNode', 'AudioNode', 'AudioListener', 'GainNode',
|
| 167 |
+
'PannerNode', 'MediaElementAudioSourceNode', 'MediaStreamAudioSourceNode',
|
| 168 |
+
'OfflineAudioContext', 'WebSocket', 'MessageChannel', 'MessagePort',
|
| 169 |
+
'MessageEventSource', 'BroadcastChannel', 'Worker', 'WorkerOptions',
|
| 170 |
+
'WorkerType', 'SharedWorker', 'RTCPeerConnection', 'RTCConfiguration',
|
| 171 |
+
'RTCDataChannel', 'RTCDataChannelInit', 'RTCIceCandidate',
|
| 172 |
+
'RTCIceCandidateInit', 'RTCSessionDescription',
|
| 173 |
+
'RTCSessionDescriptionInit', 'RTCRtpTransceiverInit',
|
| 174 |
+
'RTCRtpTransceiverDirection', 'RTCRtpSender', 'IntersectionObserver',
|
| 175 |
+
'IntersectionObserverEntry', 'IntersectionObserverInit',
|
| 176 |
+
'IntersectionObserverCallback', 'ResizeObserver', 'ResizeObserverEntry',
|
| 177 |
+
'ResizeObserverCallback', 'MutationObserver', 'MutationObserverInit',
|
| 178 |
+
'MutationCallback', 'MutationRecord', 'CSSStyleDeclaration',
|
| 179 |
+
'CSSStyleSheet', 'CSSRule', 'CSSRuleList', 'CSSGroupingRule',
|
| 180 |
+
'CSSStyleRule', 'StyleSheet', 'TextDecoder', 'TextEncoder',
|
| 181 |
+
'TextEncoderEncodeIntoResult', 'Crypto', 'CryptoKey', 'CryptoKeyPair',
|
| 182 |
+
'SubtleCrypto', 'KeyFormat', 'KeyType', 'KeyUsage', 'Algorithm',
|
| 183 |
+
'AlgorithmIdentifier', 'EcKeyImportParams', 'EcKeyGenParams',
|
| 184 |
+
'EcdsaParams', 'EcdhKeyDeriveParams', 'AesCtrParams', 'AesCbcParams',
|
| 185 |
+
'AesKeyGenParams', 'RsaHashedImportParams', 'RsaHashedKeyGenParams',
|
| 186 |
+
'RsaHashedKeyAlgorithm', 'RsaOaepParams', 'RsaPssParams',
|
| 187 |
+
'RsaKeyGenParams', 'Pbkdf2Params', 'HmacKeyGenParams',
|
| 188 |
+
'HmacImportParams', 'JsonWebKey', 'PaymentRequest', 'SpeechSynthesis',
|
| 189 |
+
'SpeechSynthesisVoice', 'SpeechSynthesisUtterance', 'ImageCapture',
|
| 190 |
+
'ImageBitmap', 'MathMLElement', 'IDBFactory', 'IDBOpenDBRequest',
|
| 191 |
+
'IDBDatabase', 'IDBObjectStore', 'IDBTransaction', 'IDBTransactionMode',
|
| 192 |
+
'IDBRequest', 'IDBCursorWithValue', 'IDBValidKey', 'IDBKeyRange',
|
| 193 |
+
'Plugin', 'External', 'Report', 'ClientTypes', 'InsertPosition',
|
| 194 |
+
'ScrollToOptions', 'ScrollIntoViewOptions', 'ScrollOptions',
|
| 195 |
+
'ScrollBehavior', 'ScrollLogicalPosition', 'FocusOptions',
|
| 196 |
+
'RegistrationOptions', 'DisplayMediaStreamOptions', 'Keyframe',
|
| 197 |
+
'KeyframeAnimationOptions', 'Animation', 'AnimationEffect',
|
| 198 |
+
'KeyframeEffect', 'MediaError', 'PropertyDescriptor',
|
| 199 |
+
'PropertyDescriptorMap', 'TypedPropertyDescriptor',
|
| 200 |
+
'PropertyDefinition', 'PropertyKey', 'MethodDecorator',
|
| 201 |
+
'PropertyDecorator', 'ClassDecorator', 'ParameterDecorator',
|
| 202 |
+
'ClassDecoratorContext', 'ClassAccessorDecoratorTarget',
|
| 203 |
+
'ClassAccessorDecoratorContext', 'CustomElementConstructor',
|
| 204 |
+
'ErrorCallback', 'OnErrorEventHandlerNonNull',
|
| 205 |
+
'StructuredSerializeOptions', 'TextTrack', 'TextTrackCue',
|
| 206 |
+
'TimeRanges', 'Highlight', 'ShadowRootInit'
|
| 207 |
+
}:
|
| 208 |
+
return 'BuiltIn'
|
| 209 |
+
|
| 210 |
+
# BuiltIn: File API
|
| 211 |
+
if type_cat in {'FileList'}:
|
| 212 |
+
return 'BuiltIn'
|
| 213 |
+
|
| 214 |
+
# BuiltIn: Server-Sent Events
|
| 215 |
+
if type_cat == 'EventSource':
|
| 216 |
+
return 'BuiltIn'
|
| 217 |
+
|
| 218 |
+
# BuiltIn: JS runtime "arguments" object
|
| 219 |
+
if type_cat == 'IArguments':
|
| 220 |
+
return 'BuiltIn'
|
| 221 |
+
|
| 222 |
+
# Default fallback
|
| 223 |
+
return 'BuiltIn'
|