This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import asyncio | |
| import os | |
| import uvloop | |
| # Set uvloop as the default event loop policy | |
| asyncio.set_event_loop_policy(uvloop.EventLoopPolicy()) | |
| class UnixSocketIPCServer: | |
| def __init__(self, socket_path): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import "fmt" | |
| type Stream[T any] struct { | |
| iter func() (T, bool) | |
| } | |
| func StreamFromSlice[T any](items []T) *Stream[T] { | |
| index := 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import uvloop | |
| import asyncio | |
| asyncio.set_event_loop_policy(uvloop.EventLoopPolicy()) | |
| async def handle_client(client_reader, client_writer, remote_host, remote_port): | |
| try: | |
| # Connect to the remote server | |
| remote_reader, remote_writer = await asyncio.open_connection(remote_host, remote_port) |