Skip to content

Commit 10f5b39

Browse files
committed
listgen, support: attempt to improve data quality
1 parent a840aee commit 10f5b39

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

.github/workflows/listgen.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ name: Generate stdlib lists
22

33
on:
44
workflow_dispatch:
5+
inputs:
6+
dry-run:
7+
description: "Don't create any PRs for this run"
8+
type: boolean
9+
default: false
510
schedule:
611
- cron: "0 0 * * 2"
712

@@ -95,13 +100,20 @@ jobs:
95100
- name: walk modules
96101
env:
97102
LISTGEN_PYTHON_VERSION: ${{ matrix.python }}
103+
LISTGEN_DRY_RUN: ${{ inputs.dry-run }}
98104
run: |
99105
python -V
100106
python ./support/walk-modules.py "${LISTGEN_PYTHON_VERSION}.txt"
101107
sort -o "${LISTGEN_PYTHON_VERSION}.txt" "${LISTGEN_PYTHON_VERSION}.txt"
102-
mv "${LISTGEN_PYTHON_VERSION}.txt" ./stdlib_list/lists/
108+
109+
if [[ "${LISTGEN_DRY_RUN}" == "true" ]]; then
110+
diff ./stdlib_list/lists/"${LISTGEN_PYTHON_VERSION}.txt" "${LISTGEN_PYTHON_VERSION}.txt"
111+
else
112+
mv "${LISTGEN_PYTHON_VERSION}.txt" ./stdlib_list/lists/
113+
fi
103114
104115
- name: create PR
116+
if: ${{ !inputs.dry-run }}
105117
uses: peter-evans/create-pull-request@v5
106118
with:
107119
commit-message: "[BOT] update list for ${{ matrix.python }}"

support/walk-modules.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,9 @@ def walk(mod_name, io):
8383
walk(mod_name, io)
8484
else:
8585
for mod_name in sys.stdin:
86+
# Our precomputed list might not start at the root, since it
87+
# might be a package rather than a module.
88+
if "." in mod_name:
89+
top_mod = mod_name.split(".")[0]
90+
walk(top_mod, io)
8691
walk(mod_name.rstrip("\n"), io)

0 commit comments

Comments
 (0)