mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-18 09:57:40 +03:00
returned string rather than printing
This commit is contained in:
parent
9c4bc182ca
commit
398bc76056
@ -7,6 +7,7 @@ import re
|
|||||||
import sys
|
import sys
|
||||||
import dataclasses
|
import dataclasses
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
import io
|
||||||
|
|
||||||
|
|
||||||
def get_func_name(thing: ast.AST) -> str:
|
def get_func_name(thing: ast.AST) -> str:
|
||||||
@ -173,7 +174,7 @@ class LangEntry:
|
|||||||
return out
|
return out
|
||||||
|
|
||||||
|
|
||||||
def generate_lang_template(data: dict[pathlib.Path, list[ast.Call]]):
|
def generate_lang_template(data: dict[pathlib.Path, list[ast.Call]]) -> str:
|
||||||
"""Generate a full en.template from the given data."""
|
"""Generate a full en.template from the given data."""
|
||||||
entries: list[LangEntry] = []
|
entries: list[LangEntry] = []
|
||||||
for path, calls in data.items():
|
for path, calls in data.items():
|
||||||
@ -194,6 +195,7 @@ def generate_lang_template(data: dict[pathlib.Path, list[ast.Call]]):
|
|||||||
|
|
||||||
deduped.append(e)
|
deduped.append(e)
|
||||||
|
|
||||||
|
out = ""
|
||||||
print(f'Done Deduping entries {len(entries)=} {len(deduped)=}', file=sys.stderr)
|
print(f'Done Deduping entries {len(entries)=} {len(deduped)=}', file=sys.stderr)
|
||||||
for entry in deduped:
|
for entry in deduped:
|
||||||
assert len(entry.comments) == len(entry.locations)
|
assert len(entry.comments) == len(entry.locations)
|
||||||
@ -211,9 +213,11 @@ def generate_lang_template(data: dict[pathlib.Path, list[ast.Call]]):
|
|||||||
comment += to_append
|
comment += to_append
|
||||||
|
|
||||||
header = f'{comment.strip()} {files}'.strip()
|
header = f'{comment.strip()} {files}'.strip()
|
||||||
print(f'/* {header} */')
|
out += f'/* {header} */\n'
|
||||||
print(f'{string} = {string};')
|
out += f'{string} = {string};\n'
|
||||||
print()
|
out += "\n"
|
||||||
|
|
||||||
|
return out
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user