Compare commits
No commits in common. "778324ad33ffc6405e980101369c42ce58b783a8" and "2b69416c449d1d709611af19a61e667b47a54d24" have entirely different histories.
778324ad33
...
2b69416c44
5 changed files with 0 additions and 50 deletions
|
|
@ -30,7 +30,6 @@ app = [
|
||||||
"zope.traversing",
|
"zope.traversing",
|
||||||
]
|
]
|
||||||
auth = ["pyjwt[crypto]", "cryptography", "requests"]
|
auth = ["pyjwt[crypto]", "cryptography", "requests"]
|
||||||
fastapi = ["fastapi[standard]"]
|
|
||||||
test = ["zope.testrunner"]
|
test = ["zope.testrunner"]
|
||||||
#test = ["pytest"]
|
#test = ["pytest"]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
"""package scopes.api"""
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
# package scopes.api.main
|
|
||||||
|
|
||||||
from fastapi import FastAPI
|
|
||||||
|
|
||||||
app = FastAPI()
|
|
||||||
|
|
||||||
@app.get('/')
|
|
||||||
def read_root():
|
|
||||||
return {'Hello': 'World'}
|
|
||||||
|
|
||||||
@app.get('/persons/{name}')
|
|
||||||
def read_person(name: str, q: str | None = None):
|
|
||||||
return {'name': name, 'query': q}
|
|
||||||
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
"""package scopes.core"""
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
""" package scopes.core.actor """
|
|
||||||
|
|
||||||
import asyncio
|
|
||||||
|
|
||||||
quit = object()
|
|
||||||
|
|
||||||
async def loop(q, bhv):
|
|
||||||
while True:
|
|
||||||
msg = await q.get()
|
|
||||||
if msg == quit:
|
|
||||||
break
|
|
||||||
bhv(msg)
|
|
||||||
|
|
||||||
def create(q, bhv):
|
|
||||||
return asyncio.create_task(loop(q, bhv))
|
|
||||||
|
|
||||||
# some simple behaviors
|
|
||||||
|
|
||||||
def show(msg):
|
|
||||||
print(msg)
|
|
||||||
|
|
||||||
# main
|
|
||||||
|
|
||||||
async def main():
|
|
||||||
q = asyncio.Queue()
|
|
||||||
task = create(q, show)
|
|
||||||
await q.put("Hello World!")
|
|
||||||
await q.put(quit)
|
|
||||||
await task
|
|
||||||
|
|
||||||
def run():
|
|
||||||
asyncio.run(main())
|
|
||||||
|
|
||||||
Loading…
Add table
Reference in a new issue