MCPcopy Create free account
hub / github.com/github/awesome-copilot / gen_core

Function gen_core

skills/python-pypi-package-builder/scripts/scaffold.py:277–330  ·  view source on GitHub ↗
(mod: str)

Source from the content-addressed store, hash-verified

275
276
277def gen_core(mod: str) -> str:
278 return f'''\
279from __future__ import annotations
280
281from {mod}.exceptions import YourPackageError
282
283
284class YourClient:
285 """
286 Main entry point for <your purpose>.
287
288 Args:
289 api_key: Required authentication credential.
290 timeout: Request timeout in seconds. Defaults to 30.
291 retries: Number of retry attempts. Defaults to 3.
292
293 Raises:
294 ValueError: If api_key is empty or timeout is non-positive.
295
296 Example:
297 >>> from {mod} import YourClient
298 >>> client = YourClient(api_key="sk-...")
299 >>> result = client.process(data)
300 """
301
302 def __init__(
303 self,
304 api_key: str,
305 timeout: int = 30,
306 retries: int = 3,
307 ) -> None:
308 if not api_key:
309 raise ValueError("api_key must not be empty")
310 if timeout <= 0:
311 raise ValueError("timeout must be positive")
312 self._api_key = api_key
313 self.timeout = timeout
314 self.retries = retries
315
316 def process(self, data: dict) -> dict:
317 """
318 Process data and return results.
319
320 Args:
321 data: Input dictionary to process.
322
323 Returns:
324 Processed result as a dictionary.
325
326 Raises:
327 YourPackageError: If processing fails.
328 """
329 raise NotImplementedError
330''&#x27;
331
332
333def gen_exceptions(mod: str) -> str:

Callers 1

scaffoldFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected