-
Notifications
You must be signed in to change notification settings - Fork 20
Add builtin_items data to whats_left.html #81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
b451253
4178638
c621759
5ac3b5b
e46a987
fae0be0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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) |
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,39 @@ | ||||||||
| #!/bin/bash | ||||||||
| set -euo pipefail | ||||||||
|
|
||||||||
| # paths where the script is located | ||||||||
| SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" | ||||||||
| PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" | ||||||||
|
|
||||||||
| DATA_DIR="$PROJECT_ROOT/_data" | ||||||||
| TEMP_FILE="$DATA_DIR/whats_left.temp" | ||||||||
| OUTPUT_DIR="$DATA_DIR/whats_left" | ||||||||
| OUTPUT_FILE="$OUTPUT_DIR/builtin_items.csv" | ||||||||
|
|
||||||||
| # create directory if it doesn't exist | ||||||||
| mkdir -p "$OUTPUT_DIR" | ||||||||
|
|
||||||||
| # exit violently if the temp file does not exist | ||||||||
| if [ ! -f "$TEMP_FILE" ]; then | ||||||||
| echo "error: input file $TEMP_FILE not found" >&2 | ||||||||
| exit 1 | ||||||||
| fi | ||||||||
|
|
||||||||
| # generate the CSV file for builtin items from the temp file | ||||||||
| awk -f - "$TEMP_FILE" > "$OUTPUT_FILE" <<'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) | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The current method of extracting the A more robust approach is to take the substring from the first space onwards and then remove any leading spaces from it.
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @gemini-code-assist @coderabbitai The approach is dependent on the behavior of this line, which currently guarantees one period and at most one space: https://github.com/RustPython/RustPython/blob/5cad66cebfc62a7912197ae299ac13e8629c560d/whats_left.py#L477
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are absolutely right, @fanninpm. My apologies for overlooking the specific guarantee provided by the Python script at There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: Length of output: 539 @fanninpm, you're absolutely right! I can confirm from the upstream code that line 477 uses: print(f"{module}.{method}" + (f" {reason}" if reason else ""))This guarantees the format is either Given this upstream format guarantee, the defensive handling of multiple spaces isn't necessary. Your implementation is appropriate and correctly relies on the documented behavior from the source. |
||||||||
| } | ||||||||
| print a[1], $1, rest | ||||||||
| } | ||||||||
| EOF | ||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scripts/whats_left_modules.shdoes not include this declaration.