Skip to content

Commit

Permalink
Fix writeme to handle new READMEs (awsdocs#6540)
Browse files Browse the repository at this point in the history
* Fix writeme to handle new READMEs

---------

Co-authored-by: David Souther <davidsouther+github@gmail.com>
meyertst-aws and DavidSouther authored Jun 13, 2024
1 parent abe92e1 commit 672744a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions .tools/readmes/render.py
Original file line number Diff line number Diff line change
@@ -129,14 +129,15 @@ def _transform_hello(self, pre_hello):
post_hello.append(action)
return sorted(post_hello, key=itemgetter("title_abbrev"))


def _transform_actions(self, pre_actions):
post_actions = []
for pre_id, pre in pre_actions.items():
try:
api = next(iter(pre["services"][self.scanner.svc_name]))
except:
raise MissingMetadataError(f"Action not found for example {pre_id} and service {self.scanner.svc_name}.")
raise MissingMetadataError(
f"Action not found for example {pre_id} and service {self.scanner.svc_name}."
)
action = {
"title_abbrev": api,
"file": self.scanner.snippet(
@@ -331,7 +332,8 @@ def write(self):
self.readme_filename,
f'{self.lang_config["service_folder"]}/{config.saved_readme}',
)
os.remove(self.readme_filename) # Do this so that new files are always updated to the correct case (README.md).
# Do this so that new files are always updated to the correct case (README.md).
Path(self.readme_filename).unlink(missing_ok=True)
with open(self.readme_filename, "w", encoding="utf-8") as f:
f.write(self.readme_text)
print(f"Updated {self.readme_filename}.")

0 comments on commit 672744a

Please sign in to comment.