Skip to content

Commit

Permalink
remove type annotations from examples so they are compatible with Pyt…
Browse files Browse the repository at this point in the history
…hon 3.8

Signed-off-by: Achille Roussel <[email protected]>
  • Loading branch information
achille-roussel committed Jun 17, 2024
1 parent 6799ab3 commit a406d2a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions examples/auto_retry.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
rng = random.Random(2)


def third_party_api_call(x: int) -> str:
def third_party_api_call(x):
# Simulate a third-party API call that fails.
print(f"Simulating third-party API call with {x}")
if x < 3:
Expand All @@ -19,7 +19,7 @@ def third_party_api_call(x: int) -> str:

# Use the `dispatch.function` decorator to declare a stateful function.
@dispatch.function
def application() -> str:
def application():
x = rng.randint(0, 5)
return third_party_api_call(x)

Expand Down
2 changes: 1 addition & 1 deletion examples/getting_started.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# Use the `dispatch.function` decorator declare a stateful function.
@dispatch.function
def publish(url, payload) -> str:
def publish(url, payload):
r = requests.post(url, data=payload)
r.raise_for_status()
return r.text
Expand Down
6 changes: 3 additions & 3 deletions examples/github_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,21 @@ def get_gh_api(url):


@dispatch.function
async def get_repo_info(repo_owner: str, repo_name: str) -> dict:
async def get_repo_info(repo_owner, repo_name):
url = f"https://api.github.com/repos/{repo_owner}/{repo_name}"
repo_info = get_gh_api(url)
return repo_info


@dispatch.function
async def get_contributors(repo_info: dict) -> list[dict]:
async def get_contributors(repo_info):
url = repo_info["contributors_url"]
contributors = get_gh_api(url)
return contributors


@dispatch.function
async def main() -> list[dict]:
async def main():
repo_info = await get_repo_info("dispatchrun", "coroutine")
print(
f"""Repository: {repo_info['full_name']}
Expand Down

0 comments on commit a406d2a

Please sign in to comment.