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

Method add_datetime_import

scripts/openapi.py:525–534  ·  view source on GitHub ↗
(node: cst.Module, index: int)

Source from the content-addressed store, hash-verified

523
524 @staticmethod
525 def add_datetime_import(node: cst.Module, index: int) -> cst.Module:
526 import_stmt = cst.SimpleStatementLine(
527 [
528 cst.ImportFrom(
529 cst.Name("datetime"), [cst.ImportAlias(cst.Name("datetime")), cst.ImportAlias(cst.Name("timezone"))]
530 )
531 ]
532 )
533 stmts = list(node.body)
534 return node.with_changes(body=stmts[:index] + [import_stmt] + stmts[index:])
535
536 @staticmethod
537 def add_future_import(node: cst.Module) -> cst.Module:

Callers 2

leave_ModuleMethod · 0.80
leave_ModuleMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected