Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.

Commit 367a967

Browse files
committed
skip the heavy math for API.build pass 1
1 parent 42ff3eb commit 367a967

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

gapic/schema/api.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ def build(
122122
opts: Options = Options(),
123123
prior_protos: Optional[Mapping[str, "Proto"]] = None,
124124
load_services: bool = True,
125+
skip_context_analysis: bool = False,
125126
all_resources: Optional[Mapping[str, wrappers.MessageType]] = None,
126127
) -> "Proto":
127128
"""Build and return a Proto instance.
@@ -146,6 +147,7 @@ def build(
146147
opts=opts,
147148
prior_protos=prior_protos or {},
148149
load_services=load_services,
150+
skip_context_analysis=skip_context_analysis,
149151
all_resources=all_resources or {},
150152
).proto
151153

@@ -475,6 +477,7 @@ def disambiguate_keyword_sanitize_fname(
475477
prior_protos=pre_protos,
476478
# Ugly, ugly hack.
477479
load_services=False,
480+
skip_context_analysis=True,
478481
)
479482
if is_target:
480483
duration = time.time() - t0
@@ -1120,6 +1123,7 @@ def __init__(
11201123
opts: Options = Options(),
11211124
prior_protos: Optional[Mapping[str, Proto]] = None,
11221125
load_services: bool = True,
1126+
skip_context_analysis: bool = False,
11231127
all_resources: Optional[Mapping[str, wrappers.MessageType]] = None,
11241128
):
11251129
self.proto_messages: Dict[str, wrappers.MessageType] = {}
@@ -1129,6 +1133,7 @@ def __init__(
11291133
self.file_to_generate = file_to_generate
11301134
self.prior_protos = prior_protos or {}
11311135
self.opts = opts
1136+
self.skip_context_analysis = skip_context_analysis
11321137

11331138
# Iterate over the documentation and place it into a dictionary.
11341139
#
@@ -1235,7 +1240,7 @@ def proto(self) -> Proto:
12351240

12361241
# If this is not a file being generated, we do not need to
12371242
# do anything else.
1238-
if not self.file_to_generate:
1243+
if not self.file_to_generate or self.skip_context_analysis:
12391244
return naive
12401245

12411246
visited_messages: Set[wrappers.MessageType] = set()

0 commit comments

Comments
 (0)