-
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 2 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,12 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #!/bin/bash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
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. It's a good practice to start your bash scripts with
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.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # 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 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # 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 |
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.
@gemini-code-assist Is it possible to rework the suggestion to use a heredoc?
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.
@gemini-code-assist Is it possible to rework the suggestion to use a heredoc?
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.
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.
| # 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 |
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.
There's a minor formatting issue here that results in an extraneous trailing space when
item.is_inheritedis not present. This happens because the space before theifstatement is unconditional. Moving the space inside the conditional block will ensure it only appears when needed.