MCPcopy Index your code
hub / github.com/PyGithub/PyGithub / add_schema_to_class

Method add_schema_to_class

scripts/openapi.py:2074–2082  ·  view source on GitHub ↗
(cls, class_name: str, filename: str, schemas: list[str], dry_run: bool)

Source from the content-addressed store, hash-verified

2072
2073 @classmethod
2074 def add_schema_to_class(cls, class_name: str, filename: str, schemas: list[str], dry_run: bool) -> int:
2075 with open(filename) as r:
2076 code = "".join(r.readlines())
2077
2078 transformer = AddSchemasTransformer(class_name, schemas)
2079 tree = cst.parse_module(code)
2080 updated_tree = tree.visit(transformer)
2081 cls.write_code(code, updated_tree.code, filename, dry_run)
2082 return transformer.schema_added
2083
2084 @staticmethod
2085 def write_code(orig_code: str, updated_code: str, filename: str, dry_run: bool) -> bool:

Callers 1

suggest_schemasMethod · 0.95

Calls 2

write_codeMethod · 0.80

Tested by

no test coverage detected