Skip to content

Commit 6201432

Browse files
Add builtin_items data to whats_left.html (#81)
* Add builtin_items data to whats_left.html * Rework logic to group items by the "builtin" key This obviates the need for the Prettier workaround. * Rework script to address review comments * Reflow space around conditional in list item * Give reason for early exit in shell script Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Replace paths relative to execution with paths relative to script --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent ed2147f commit 6201432

File tree

3 files changed

+89
-0
lines changed

3 files changed

+89
-0
lines changed

_data/whats_left/builtin_items.csv

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
builtin,name,is_inherited
2+
BaseException,BaseException.__getattribute__,(inherited)
3+
BaseException,BaseException.add_note,
4+
NoneType,NoneType.__eq__,(inherited)
5+
NoneType,NoneType.__ge__,(inherited)
6+
NoneType,NoneType.__gt__,(inherited)
7+
NoneType,NoneType.__hash__,(inherited)
8+
NoneType,NoneType.__le__,(inherited)
9+
NoneType,NoneType.__lt__,(inherited)
10+
NoneType,NoneType.__ne__,(inherited)
11+
bool,bool.__invert__,(inherited)
12+
bytearray,bytearray.__buffer__,
13+
bytearray,bytearray.__getattribute__,(inherited)
14+
bytearray,bytearray.__release_buffer__,
15+
bytearray,bytearray.__str__,(inherited)
16+
bytes,bytes.__buffer__,
17+
bytes,bytes.__getattribute__,(inherited)
18+
bytes,bytes.__str__,(inherited)
19+
classmethod,classmethod.__init__,(inherited)
20+
complex,complex.__getattribute__,(inherited)
21+
dict,dict.__getattribute__,(inherited)
22+
dict_items,dict_items.__hash__,(inherited)
23+
enumerate,enumerate.__getattribute__,(inherited)
24+
filter,filter.__getattribute__,(inherited)
25+
int,int.__getattribute__,(inherited)
26+
list,list.__getattribute__,(inherited)
27+
map,map.__getattribute__,(inherited)
28+
memoryview,memoryview.__buffer__,
29+
memoryview,memoryview.__getattribute__,(inherited)
30+
memoryview,memoryview.__release_buffer__,
31+
memoryview,memoryview._from_flags,
32+
property,property.__getattribute__,(inherited)
33+
range,range.__getattribute__,(inherited)
34+
set,set.__getattribute__,(inherited)
35+
slice,slice.__getattribute__,(inherited)
36+
tuple,tuple.__getattribute__,(inherited)
37+
zip,zip.__getattribute__,(inherited)

_layouts/whats_left.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,17 @@
4040
{% endfor %}
4141
</ol>
4242
</div>
43+
44+
<div class="section-title">What's left: Built-in Items</div>
45+
{% assign items_by_builtin = site.data.whats_left.builtin_items | group_by: "builtin" %}
46+
{% for group in items_by_builtin %}
47+
<h4>{{ group.name }}</h4>
48+
<div class="column-count-is-2">
49+
<ol>
50+
{% for item in group.items %}
51+
<li class="word-wrap-anywhere"><code>{{ item.name }}</code>{% if item.is_inherited %} {{ item.is_inherited }}{% endif %}</li>
52+
{% endfor %}
53+
</ol>
54+
</div>
55+
{% endfor %}
4356
</div>
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
# paths where the script is located
5+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
6+
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
7+
8+
DATA_DIR="$PROJECT_ROOT/_data"
9+
TEMP_FILE="$DATA_DIR/whats_left.temp"
10+
OUTPUT_DIR="$DATA_DIR/whats_left"
11+
OUTPUT_FILE="$OUTPUT_DIR/builtin_items.csv"
12+
13+
# create directory if it doesn't exist
14+
mkdir -p "$OUTPUT_DIR"
15+
16+
# exit violently if the temp file does not exist
17+
if [ ! -f "$TEMP_FILE" ]; then
18+
echo "error: input file $TEMP_FILE not found" >&2
19+
exit 1
20+
fi
21+
22+
# generate the CSV file for builtin items from the temp file
23+
awk -f - "$TEMP_FILE" > "$OUTPUT_FILE" <<'EOF'
24+
BEGIN {
25+
OFS=","
26+
print "builtin,name,is_inherited"
27+
}
28+
/^# builtin items/ { in_section=1; next }
29+
/^$/ { if (in_section) exit }
30+
in_section {
31+
split($1, a, ".")
32+
rest = ""
33+
idx = index($0, " ")
34+
if (idx > 0) {
35+
rest = substr($0, idx+1)
36+
}
37+
print a[1], $1, rest
38+
}
39+
EOF

0 commit comments

Comments
 (0)