MCPcopy
hub / github.com/psycopg/psycopg / convert

Function convert

tools/async_to_sync.py:123–136  ·  view source on GitHub ↗
(fpin: Path, fpout: Path)

Source from the content-addressed store, hash-verified

121
122
123def convert(fpin: Path, fpout: Path) -> None:
124 logger.info("converting %s", fpin)
125 with fpin.open() as f:
126 source = f.read()
127
128 tree = ast.parse(source, filename=str(fpin))
129 tree = async_to_sync(tree, filepath=fpin)
130 output = tree_to_str(tree, fpin)
131
132 with fpout.open("w") as f:
133 print(output, file=f)
134
135 sp.check_call(["black", "-q", str(fpout)])
136 sp.check_call(["isort", "-q", str(fpout)])
137
138
139def check(outputs: list[str]) -> int:

Callers 1

mainFunction · 0.85

Calls 6

async_to_syncFunction · 0.85
tree_to_strFunction · 0.85
infoMethod · 0.45
openMethod · 0.45
readMethod · 0.45
parseMethod · 0.45

Tested by

no test coverage detected