$ python -m venv venv
$ source venv/bin/activate
$ python -m pip install anyio di pydantic quart
$ python poc.py
This service isn't started at launch, which is by design. The command being launched establishes a tunnel to a virtual machine running on the host using UTM.app. I created a LoginItem that launches the virtual machine at startup using UTM's registered URI handlers. By starting these tunnels lazily, we are able to connect at a time after the virtual machine has already booted and able to be reached on the network. Trying to do this at startup would result in a failure to connect.
- Ensure ssh is configured on the remote machine, you've generated an ssh key and you've copied that ssh key to the remote host.
- Replace
{{ path_to_public_key }}
with the full path to the ssh key you generated in step 1. - Replace
{{ remote_user }}
with your username on the remote machine. - Replace
{{ remote_host }}
with the remote hostname or ip address (for virtual machines this will probably be an ip add
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
""" | |
This script demonstrates the use of nested transactions in SQLAlchemy, including | |
a workaround for an issue with the SQLite backend. | |
References: | |
http://docs.sqlalchemy.org/en/latest/orm/session_transaction.html#using-savepoint | |
http://docs.sqlalchemy.org/en/latest/dialects/sqlite.html#serializable-isolation-savepoints-transactional-ddl | |
""" | |
from sqlalchemy import Column, String, Integer |
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 threading | |
import asyncio | |
async def run_coro_threadsafe(self, coro, other_loop, our_loop = None): | |
"""Schedules coro in other_loop, awaits until coro has run and returns | |
its result. | |
""" | |
loop = our_loop or asyncio.get_event_loop() | |
# schedule coro safely in other_loop, get a concurrent.future back |
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 code, traceback, signal | |
def debug(sig, frame): | |
"""Interrupt running process, and provide a python prompt for | |
interactive debugging.""" | |
d={'_frame':frame} # Allow access to frame object. | |
d.update(frame.f_globals) # Unless shadowed by global | |
d.update(frame.f_locals) | |
i = code.InteractiveConsole(d) |
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
551 results - 58 files | |
tests/integration/views/v1/api_key_test.py: | |
381 with self.mock_client_custom_theme(self.client_id.decode()): | |
382: resp = await self.get(webapp_client, APIKeyCheckThemeV1) | |
383 self._assert_response_meta( | |
402 with self.mock_client_custom_theme(non_matching_id): | |
403: resp = await self.get(webapp_client, APIKeyCheckThemeV1) | |
404 self._assert_response_meta( |
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
""" | |
PROBLEM | |
Suppose we have some input data describing a graph of relationships between | |
parents and children over multiple generations. The data is formatted as a | |
list of (parent, child) pairs, where each individual is assigned a unique | |
integer identifier. | |
For example, in this diagram, 6 and 8 have common ancestors of 4 and 14. |
NewerOlder