mirror of
https://github.com/RGBCube/GitHubWrapper
synced 2025-05-18 06:55:09 +00:00
Fix example string getting placed when there is no example
This commit is contained in:
parent
6557c7b9b1
commit
067ad05ab2
1 changed files with 4 additions and 5 deletions
|
@ -132,7 +132,9 @@ def generate(
|
|||
if examples := value.get("examples"):
|
||||
s = "" if len(examples) == 1 else "s"
|
||||
|
||||
examples = ", ".join([str(example) for example in examples]).replace("\n", "\\n")
|
||||
examples = ", ".join([str(example) for example in examples]).replace(
|
||||
"\n", "\\n"
|
||||
)
|
||||
|
||||
if (examples_short := examples[:70]) != examples:
|
||||
examples = f"{examples_short}[...]"
|
||||
|
@ -140,10 +142,7 @@ def generate(
|
|||
examples = f" # Example{s}: {examples}" if examples else ""
|
||||
|
||||
typed_dict.extend(
|
||||
[
|
||||
f" # Format: {fmt}" if (fmt := value.get("format")) else "",
|
||||
examples
|
||||
]
|
||||
[f" # Format: {fmt}" if (fmt := value.get("format")) else "", examples]
|
||||
)
|
||||
|
||||
typed_dict.append(f" {key}: {param_annotation}")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue