File tree 3 files changed +6
-6
lines changed
3 files changed +6
-6
lines changed Original file line number Diff line number Diff line change 8
8
rng = random .Random (2 )
9
9
10
10
11
- def third_party_api_call (x : int ) -> str :
11
+ def third_party_api_call (x ) :
12
12
# Simulate a third-party API call that fails.
13
13
print (f"Simulating third-party API call with { x } " )
14
14
if x < 3 :
@@ -19,7 +19,7 @@ def third_party_api_call(x: int) -> str:
19
19
20
20
# Use the `dispatch.function` decorator to declare a stateful function.
21
21
@dispatch .function
22
- def application () -> str :
22
+ def application ():
23
23
x = rng .randint (0 , 5 )
24
24
return third_party_api_call (x )
25
25
Original file line number Diff line number Diff line change 5
5
6
6
# Use the `dispatch.function` decorator declare a stateful function.
7
7
@dispatch .function
8
- def publish (url , payload ) -> str :
8
+ def publish (url , payload ):
9
9
r = requests .post (url , data = payload )
10
10
r .raise_for_status ()
11
11
return r .text
Original file line number Diff line number Diff line change @@ -31,21 +31,21 @@ def get_gh_api(url):
31
31
32
32
33
33
@dispatch .function
34
- async def get_repo_info (repo_owner : str , repo_name : str ) -> dict :
34
+ async def get_repo_info (repo_owner , repo_name ) :
35
35
url = f"https://api.github.com/repos/{ repo_owner } /{ repo_name } "
36
36
repo_info = get_gh_api (url )
37
37
return repo_info
38
38
39
39
40
40
@dispatch .function
41
- async def get_contributors (repo_info : dict ) -> list [ dict ] :
41
+ async def get_contributors (repo_info ) :
42
42
url = repo_info ["contributors_url" ]
43
43
contributors = get_gh_api (url )
44
44
return contributors
45
45
46
46
47
47
@dispatch .function
48
- async def main () -> list [ dict ] :
48
+ async def main ():
49
49
repo_info = await get_repo_info ("dispatchrun" , "coroutine" )
50
50
print (
51
51
f"""Repository: { repo_info ['full_name' ]}
You can’t perform that action at this time.
0 commit comments