Skip to content

Instantly share code, notes, and snippets.

Created April 22, 2020 13:09
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
#!/usr/bin/env python
from pathlib import Path
import trio # type: ignore
import time
import sys
from lean_client.trio_server import TrioLeanServer
async def main(path):
lines = Path(path).read_text().split('\n')
async with trio.open_nursery() as nursery:
server = TrioLeanServer(nursery, debug=False)
await server.start()
await server.full_sync(path)
for i, line in enumerate(lines):
before = await server.state(path, i+1, 0)
after = await server.state(path, i+1, len(line))
if before or after:
print(f'Line {i+1}: {line}')
#print(f'State before:\n{before}\n')
#print(f'State after:\n{after}\n')
print(f'Line {i+1}: <skipped>')
if __name__ == '__main__':
path = sys.argv[1], path)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment