Skip to content

Commit 139198f

Browse files
committed
Skip IAM policies that look like they've already been updated.
1 parent 105b2a6 commit 139198f

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

aws_doc_sdk_examples_tools/agent/make_prompts.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,22 @@ def write_prompts(doc_gen: DocGen, out_dir: Path, language: str) -> None:
2323
examples = doc_gen.examples
2424
snippets = doc_gen.snippets
2525
for example_id, example in examples.items():
26-
prompt_path = out_dir / f"{example_id}.md"
27-
snippet_key = (
28-
example.languages[language]
29-
.versions[0]
30-
.excerpts[0]
31-
.snippet_files[0]
32-
.replace("/", ".")
33-
)
34-
snippet = snippets[snippet_key]
35-
prompt_path.write_text(snippet.code, encoding="utf-8")
26+
# "Title" and "Abbrev" are the defaults. If they're not there, it suggests we've already
27+
# added new titles.
28+
DEFAULT_PREFIX = "[DEFAULT]"
29+
title = example.title or ""
30+
title_abbrev = example.title_abbrev or ""
31+
if title.startswith(DEFAULT_PREFIX) and title_abbrev.startswith(DEFAULT_PREFIX):
32+
prompt_path = out_dir / f"{example_id}.md"
33+
snippet_key = (
34+
example.languages[language]
35+
.versions[0]
36+
.excerpts[0]
37+
.snippet_files[0]
38+
.replace("/", ".")
39+
)
40+
snippet = snippets[snippet_key]
41+
prompt_path.write_text(snippet.code, encoding="utf-8")
3642

3743

3844
def setup_ailly(system_prompts: List[str], out_dir: Path) -> None:

0 commit comments

Comments
 (0)