Coverage for  / home / jenkins / .local / lib / python3.10 / site-packages / hyper_parallel / codegen / astkit / __init__.py: 100%

3 statements  

« prev     ^ index     » next       coverage.py v7.13.1, created at 2026-10-25 05:45 +0800

1# Copyright 2026 Huawei Technologies Co., Ltd 

2# Licensed under the Apache License, Version 2.0 

3# ============================================================================ 

4"""AST patch toolkit for generated forward lowering. 

5 

6The lowerer finds each boundary class's ``forward`` and re-implements it as an 

7explicit call to the codegen runtime (the module's bound 

8``self._hp_boundary`` redistribution plus an inner wrapper or local compute 

9function). 

10This package owns that structural patch: 

11 

12- :mod:`index` — parse the source once and answer "where is class X's 

13 forward" / "where do imports end". 

14- :mod:`edits` — apply positional text edits (replace a body, insert after 

15 imports). 

16 

17Both layers are pure text over source; nothing here imports torch or the 

18training stack, so a generation-time host can patch a modeling file without 

19loading the model. 

20""" 

21from hyper_parallel.codegen.astkit.edits import ( 

22 TextEdit, 

23 apply_edits, 

24 insert_after_imports, 

25 replace_function_body, 

26) 

27from hyper_parallel.codegen.astkit.index import SourceIndex, build_source_index 

28 

29__all__ = [ 

30 "SourceIndex", 

31 "TextEdit", 

32 "apply_edits", 

33 "build_source_index", 

34 "insert_after_imports", 

35 "replace_function_body", 

36]