Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions _data/whats_left/builtin_items.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
builtin,name,is_inherited
BaseException,BaseException.__getattribute__,(inherited)
BaseException,BaseException.add_note,
NoneType,NoneType.__eq__,(inherited)
NoneType,NoneType.__ge__,(inherited)
NoneType,NoneType.__gt__,(inherited)
NoneType,NoneType.__hash__,(inherited)
NoneType,NoneType.__le__,(inherited)
NoneType,NoneType.__lt__,(inherited)
NoneType,NoneType.__ne__,(inherited)
bool,bool.__invert__,(inherited)
bytearray,bytearray.__buffer__,
bytearray,bytearray.__getattribute__,(inherited)
bytearray,bytearray.__release_buffer__,
bytearray,bytearray.__str__,(inherited)
bytes,bytes.__buffer__,
bytes,bytes.__getattribute__,(inherited)
bytes,bytes.__str__,(inherited)
classmethod,classmethod.__init__,(inherited)
complex,complex.__getattribute__,(inherited)
dict,dict.__getattribute__,(inherited)
dict_items,dict_items.__hash__,(inherited)
enumerate,enumerate.__getattribute__,(inherited)
filter,filter.__getattribute__,(inherited)
int,int.__getattribute__,(inherited)
list,list.__getattribute__,(inherited)
map,map.__getattribute__,(inherited)
memoryview,memoryview.__buffer__,
memoryview,memoryview.__getattribute__,(inherited)
memoryview,memoryview.__release_buffer__,
memoryview,memoryview._from_flags,
property,property.__getattribute__,(inherited)
range,range.__getattribute__,(inherited)
set,set.__getattribute__,(inherited)
slice,slice.__getattribute__,(inherited)
tuple,tuple.__getattribute__,(inherited)
zip,zip.__getattribute__,(inherited)
13 changes: 13 additions & 0 deletions _layouts/whats_left.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,17 @@
{% endfor %}
</ol>
</div>

<div class="section-title">What's left: Built-in Items</div>
{% assign items_by_builtin = site.data.whats_left.builtin_items | group_by: "builtin" %}
{% for group in items_by_builtin %}
<h4>{{ group.name }}</h4>
<div class="column-count-is-2">
<ol>
{% for item in group.items %}
<li class="word-wrap-anywhere"><code>{{ item.name }}</code> {% if item.is_inherited %}{{ item.is_inherited }}{% endif %}</li>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There's a minor formatting issue here that results in an extraneous trailing space when item.is_inherited is not present. This happens because the space before the if statement is unconditional. Moving the space inside the conditional block will ensure it only appears when needed.

          <li class="word-wrap-anywhere"><code>{{ item.name }}</code>{% if item.is_inherited %} {{ item.is_inherited }}{% endif %}</li>

{% endfor %}
</ol>
</div>
{% endfor %}
</div>
12 changes: 12 additions & 0 deletions scripts/whats_left_builtin_items.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

It's a good practice to start your bash scripts with set -euo pipefail. This makes the script more robust by exiting on errors, treating unset variables as errors, and ensuring that a pipeline's exit status is the exit status of the last command to exit with a non-zero status.

Suggested change
#!/bin/bash
#!/bin/bash
set -euo pipefail

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scripts/whats_left_modules.sh does not include this declaration.


# create directory if it doesn't exist
mkdir -p ../_data/whats_left

# start a new csv file for builtin items
echo "builtin,name,is_inherited" > ../_data/whats_left/builtin_items.csv

# read the temp file
# in awk:
sed -n '/# builtin items/{n;:a;/^$/q;p;n;ba;}' ../_data/whats_left.temp | \
awk -v OFS=',' '{split($1,a,".");if(index($0,FS)>0){b=substr($0,index($0,FS)+1)}else{b=""};print a[1],$1,b}' >> ../_data/whats_left/builtin_items.csv
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The combination of echo, sed, and awk with redirection can be simplified into a single, more readable awk script. This improves maintainability by making the logic for parsing the temp file and generating the CSV self-contained and easier to understand.

Suggested change
# start a new csv file for builtin items
echo "builtin,name,is_inherited" > ../_data/whats_left/builtin_items.csv
# read the temp file
# in awk:
sed -n '/# builtin items/{n;:a;/^$/q;p;n;ba;}' ../_data/whats_left.temp | \
awk -v OFS=',' '{split($1,a,".");if(index($0,FS)>0){b=substr($0,index($0,FS)+1)}else{b=""};print a[1],$1,b}' >> ../_data/whats_left/builtin_items.csv
# Generate the CSV file for builtin items from the temp file
awk '
BEGIN {
OFS=","
print "builtin,name,is_inherited"
}
/^# builtin items$/ { in_section=1; next }
/^$/ { if(in_section) exit }
in_section {
split($1, a, ".")
rest = ""
idx = index($0, " ")
if (idx > 0) {
rest = substr($0, idx + 1)
}
print a[1], $1, rest
}
' ../_data/whats_left.temp > ../_data/whats_left/builtin_items.csv

Copy link
Contributor Author

@fanninpm fanninpm Nov 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gemini-code-assist Is it possible to rework the suggestion to use a heredoc?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gemini-code-assist Is it possible to rework the suggestion to use a heredoc?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's definitely possible to rework the suggestion to use a heredoc. This can make the awk script more self-contained and potentially easier to read within the shell script. Here's an updated suggestion that uses a heredoc for the awk script:

This approach replaces the echo command for the header and the sed | awk pipeline with a single awk command that reads its script from the heredoc. The awk script itself handles printing the header and processing the relevant section of the temp file.

Suggested change
# start a new csv file for builtin items
echo "builtin,name,is_inherited" > ../_data/whats_left/builtin_items.csv
# read the temp file
# in awk:
sed -n '/# builtin items/{n;:a;/^$/q;p;n;ba;}' ../_data/whats_left.temp | \
awk -v OFS=',' '{split($1,a,".");if(index($0,FS)>0){b=substr($0,index($0,FS)+1)}else{b=""};print a[1],$1,b}' >> ../_data/whats_left/builtin_items.csv
# Generate the CSV file for builtin items from the temp file
awk -f - ../_data/whats_left.temp > ../_data/whats_left/builtin_items.csv << 'EOF'
BEGIN {
OFS=","
print "builtin,name,is_inherited"
}
/^# builtin items$/ { in_section=1; next }
/^$/ { if(in_section) exit }
in_section {
split($1, a, ".")
rest = ""
idx = index($0, " ")
if (idx > 0) {
rest = substr($0, idx + 1)
}
print a[1], $1, rest
}
EOF