mirror of
https://github.com/RGBCube/GitHubWrapper
synced 2025-05-18 15:05:08 +00:00
Fix some bugs in parser
This commit is contained in:
parent
8f4e18cb2b
commit
ce0cd52ce2
2 changed files with 7 additions and 7 deletions
|
@ -57,11 +57,8 @@ else:
|
||||||
|
|
||||||
end = time.perf_counter() - start
|
end = time.perf_counter() - start
|
||||||
|
|
||||||
exit_code = os.system(
|
os.system(
|
||||||
f"unimport {to} --gitignore -r --ignore-init; isort {to}; black {to}; flynt {to} -tc",
|
f"unimport {to} --gitignore -r --ignore-init; isort {to}; black {to}; flynt {to} -tc",
|
||||||
)
|
)
|
||||||
|
|
||||||
if exit_code != 0:
|
|
||||||
print(f"Formatting failed with exit code {exit_code}")
|
|
||||||
|
|
||||||
print(f"\n\nSuccess! Finished in {end*1000:.3} milliseconds")
|
print(f"\n\nSuccess! Finished in {end*1000:.3} milliseconds")
|
||||||
|
|
|
@ -129,12 +129,15 @@ def generate(
|
||||||
param_annotation = f"NotRequired[{param_annotation}]"
|
param_annotation = f"NotRequired[{param_annotation}]"
|
||||||
|
|
||||||
if not no_comments:
|
if not no_comments:
|
||||||
|
examples = (', '.join(str(ex) for ex in exs)).replace("\n", "\\n") if (exs := value.get("examples")) else ""
|
||||||
|
|
||||||
|
if (example := examples[:70]) != examples:
|
||||||
|
examples = f"{example}[...]"
|
||||||
|
|
||||||
typed_dict.extend(
|
typed_dict.extend(
|
||||||
[
|
[
|
||||||
f" # Format: {fmt}" if (fmt := value.get("format")) else "",
|
f" # Format: {fmt}" if (fmt := value.get("format")) else "",
|
||||||
f" # Example: {', '.join(str(ex) for ex in exs)}"
|
f" # Example: {examples}"
|
||||||
if (exs := value.get("examples"))
|
|
||||||
else "",
|
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue