MCPcopy Index your code
hub / github.com/googleapis/google-api-python-client / keyword_context_from_sample

Function keyword_context_from_sample

samples-index.py:131–155  ·  view source on GitHub ↗

Return info for expanding a sample into a template. Sample may not be about a specific api. Args: keywords: list of string, list of keywords for the given api. dirname: string, directory name of the sample. desc: string, long description of the sample. uri: string, uri of the s

(keywords, dirname, desc, uri)

Source from the content-addressed store, hash-verified

129
130
131def keyword_context_from_sample(keywords, dirname, desc, uri):
132 """Return info for expanding a sample into a template.
133
134 Sample may not be about a specific api.
135
136 Args:
137 keywords: list of string, list of keywords for the given api.
138 dirname: string, directory name of the sample.
139 desc: string, long description of the sample.
140 uri: string, uri of the sample code if provided in the README.
141
142 Returns:
143 A dictionary of values useful for template expansion.
144 """
145 if uri is None:
146 uri = BASE_HG_URI + dirname.replace("/", "%2F")
147 else:
148 uri = "".join(uri)
149 context = {
150 "keywords": keywords,
151 "dir": dirname,
152 "uri": uri,
153 "desc": wiki_escape(desc),
154 }
155 return context
156
157
158def scan_readme_files(dirname):

Callers 1

mainFunction · 0.85

Calls 1

wiki_escapeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…