MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / crate_for_example

Method crate_for_example

misc/python/materialize/cargo.py:201–222  ·  view source on GitHub ↗

Find the crate containing the named example. Args: example: The name of the example to find. Raises: ValueError: The named example did not exist in exactly one crate in the Cargo workspace.

(self, example: str)

Source from the content-addressed store, hash-verified

199 return out
200
201 def crate_for_example(self, example: str) -> Crate:
202 """Find the crate containing the named example.
203
204 Args:
205 example: The name of the example to find.
206
207 Raises:
208 ValueError: The named example did not exist in exactly one crate in
209 the Cargo workspace.
210 """
211 out = None
212 for crate in self.crates.values():
213 for e in crate.examples:
214 if e == example:
215 if out is not None:
216 raise ValueError(
217 f"example {example} appears more than once in cargo workspace"
218 )
219 out = crate
220 if out is None:
221 raise ValueError(f"example {example} does not exist in cargo workspace")
222 return out
223
224 def transitive_path_dependencies(
225 self, crate: Crate, dev: bool = False

Callers 2

inputsMethod · 0.80

Calls 2

ValueErrorClass · 0.85
valuesMethod · 0.45

Tested by

no test coverage detected