MCPcopy Create free account
hub / github.com/googleapis/google-api-python-client / key2param

Function key2param

googleapiclient/discovery.py:168–189  ·  view source on GitHub ↗

Converts key names into parameter names. For example, converting "max-results" -> "max_results" Args: key: string, the method key name. Returns: A safe method name based on the key name.

(key)

Source from the content-addressed store, hash-verified

166
167
168def key2param(key):
169 """Converts key names into parameter names.
170
171 For example, converting "max-results" -> "max_results"
172
173 Args:
174 key: string, the method key name.
175
176 Returns:
177 A safe method name based on the key name.
178 """
179 result = []
180 key = list(key)
181 if not key[0].isalpha():
182 result.append("x")
183 for c in key:
184 if c.isalnum():
185 result.append(c)
186 else:
187 result.append("_")
188
189 return "".join(result)
190
191
192@positional(2)

Callers 3

test_key2paramMethod · 0.90
set_parametersMethod · 0.85
createMethodFunction · 0.85

Calls

no outgoing calls

Tested by 1

test_key2paramMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…