util: Add/update annotations

Change-Id: I20f9a3dc085a68f5d72a7bddd224990d3c5b8402
Reviewed-on: https://pigweed-review.googlesource.com/c/infra/recipes/+/195044
Pigweed-Auto-Submit: Rob Mohr <mohrr@google.com>
Presubmit-Verified: CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ted Pudlik <tpudlik@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed-service-accounts.iam.gserviceaccount.com>
diff --git a/recipe_modules/util/api.py b/recipe_modules/util/api.py
index 3cfa418..361e07f 100644
--- a/recipe_modules/util/api.py
+++ b/recipe_modules/util/api.py
@@ -15,7 +15,7 @@
 
 import json
 import re
-from typing import Any, Optional, Sequence
+from typing import Any, Sequence
 
 import attrs
 from google.protobuf import json_format
@@ -95,9 +95,9 @@
 
     def find_matching_comment(
         self, rx: re.Pattern, comments: Sequence[str]
-    ) -> Optional[str]:
+    ) -> str | None:
         """Find a comment in comments that matches regex object rx."""
-        result: Optional[str] = None
+        result: str | None = None
         with self.m.step.nest('checking comments'):
             for i, comment in enumerate(comments):
                 with self.m.step.nest(f'comment ({i})') as pres: