Skip to content

Commit 6799ab3

Browse files
fix formatting
Signed-off-by: Achille Roussel <[email protected]>
1 parent 0c186a3 commit 6799ab3

File tree

9 files changed

+26
-9
lines changed

9 files changed

+26
-9
lines changed

examples/auto_retry.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
import dispatch
2-
import dispatch.integrations.requests
31
import random
2+
43
import requests
54

5+
import dispatch
6+
import dispatch.integrations.requests
7+
68
rng = random.Random(2)
79

10+
811
def third_party_api_call(x: int) -> str:
912
# Simulate a third-party API call that fails.
1013
print(f"Simulating third-party API call with {x}")

examples/fanout.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
import dispatch
21
import httpx
32

3+
import dispatch
4+
5+
46
@dispatch.function
57
def get_repo(repo_owner: str, repo_name: str):
68
url = f"https://api.github.com/repos/{repo_owner}/{repo_name}"
@@ -39,4 +41,5 @@ async def fanout():
3941
)
4042
return await reduce_stargazers(repos)
4143

44+
4245
print(dispatch.run(fanout()))

examples/getting_started.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import dispatch
21
import requests
32

3+
import dispatch
4+
45

56
# Use the `dispatch.function` decorator declare a stateful function.
67
@dispatch.function

examples/github_stats.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@
1414
1515
"""
1616

17-
import dispatch
1817
import httpx
18+
19+
import dispatch
1920
from dispatch.error import ThrottleError
2021

22+
2123
def get_gh_api(url):
2224
print(f"GET {url}")
2325
response = httpx.get(url)

src/dispatch/function.py

+1
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,7 @@ def set_default_registry(reg: Registry):
386386
# for results.
387387
_calls: Dict[str, asyncio.Future] = {}
388388

389+
389390
class Client:
390391
"""Client for the Dispatch API."""
391392

src/dispatch/http.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
overload,
1717
)
1818

19-
from aiohttp import web, ClientConnectionError
19+
from aiohttp import ClientConnectionError, web
2020
from http_message_signatures import InvalidSignature
2121
from typing_extensions import ParamSpec, TypeAlias
2222

23-
from dispatch.function import Batch, Function, Registry, default_registry, _calls
23+
from dispatch.function import Batch, Function, Registry, _calls, default_registry
2424
from dispatch.proto import CallResult, Input
2525
from dispatch.sdk.v1 import function_pb2 as function_pb
2626
from dispatch.signature import (
@@ -81,7 +81,9 @@ def function(self, func):
8181
def batch(self) -> Batch:
8282
return self.registry.batch()
8383

84-
async def run(self, url: str, method: str, headers: Mapping[str, str], data: bytes) -> bytes:
84+
async def run(
85+
self, url: str, method: str, headers: Mapping[str, str], data: bytes
86+
) -> bytes:
8587
return await function_service_run(
8688
url,
8789
method,

src/dispatch/scheduler.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,9 @@ async def _run(self, input: Input) -> Output:
490490
state.suspended = {}
491491

492492

493-
async def run_coroutine(state: State, coroutine: Coroutine, pending_calls: List[Call]) -> Optional[Output]:
493+
async def run_coroutine(
494+
state: State, coroutine: Coroutine, pending_calls: List[Call]
495+
) -> Optional[Output]:
494496
return await make_coroutine(state, coroutine, pending_calls)
495497

496498

src/dispatch/status.py

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ def temporary(self) -> bool:
5050
Status.HTTP_ERROR,
5151
}
5252

53+
5354
# Maybe we should find a better way to define that enum. It's that way to please
5455
# Mypy and provide documentation for the enum values.
5556

src/dispatch/test/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060

6161
_dispatch_ids = (str(i) for i in range(2**32 - 1))
6262

63+
6364
class Client(BaseClient):
6465
def session(self) -> aiohttp.ClientSession:
6566
# Use an individual sessionn in the test client instead of the default
@@ -76,6 +77,7 @@ def __init__(self, app: web.Application):
7677
def url(self):
7778
return f"http://{self.host}:{self.port}"
7879

80+
7981
class Service(web.Application):
8082
tasks: Dict[str, asyncio.Task]
8183
_session: Optional[aiohttp.ClientSession] = None

0 commit comments

Comments
 (0)