Skip to content

Fix writeme to handle new READMEs #6540

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

Merged
merged 2 commits into from
Jun 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .tools/readmes/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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}.")
Expand Down
Loading