Skip to content

Commit 00cfc95

Browse files
GameRoManiennae
andauthored
Fix type annotations (#13358)
* Fix type annotations * fix: update the syntax to use | the type hint str | (str, int) is not the correct syntax for defining a union type that includes a tuple. * Use typing module for annotations instead (for python version <3.10) --------- Co-authored-by: Jennifer Davis <sigje@google.com>
1 parent 02a0c8e commit 00cfc95

File tree

1 file changed

+3
-1
lines changed
  • trace/cloud-trace-demo-app-opentelemetry/app

1 file changed

+3
-1
lines changed

trace/cloud-trace-demo-app-opentelemetry/app/app.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
import random
2121
import time
2222

23+
from typing import Tuple, Union
24+
2325
import flask
2426

2527
# [START trace_demo_imports]
@@ -62,7 +64,7 @@ def configure_exporter(exporter):
6264

6365

6466
@app.route("/")
65-
def template_test() -> str or (str, int):
67+
def template_test() -> Union[str, Tuple[str, int]]:
6668
# Sleep for a random time to imitate a random processing time
6769
time.sleep(random.uniform(0, 0.5))
6870

0 commit comments

Comments
 (0)