Coverage for src / renaissance / integrations / python / ast / util.py: 86%

14 statements  

« prev     ^ index     » next       coverage.py v7.13.4, created at 2026-09-09 14:04 +0000

1def convert(lines, line_nr, col): 

2 if line_nr > len(lines): 

3 return 0 

4 return sum(len(lines[i]) + 1 for i in range(line_nr - 1)) + col 

5 # add node to the node list for references 

6 

7 

8def to_str(node) -> str: 

9 if hasattr(node, "signature"): 

10 return node.signature 

11 return str(node) 

12 

13 

14def convert_function(fun): 

15 signature: str = fun.signature + "\n\n\n" 

16 if len(fun.node.args.args) == 0: 

17 signature = signature.replace(f"{fun.name}()", f"{fun.name}(self)", 1) 

18 else: 

19 signature = signature.replace(f"{fun.name}(", f"{fun.name}(self,", 1) 

20 return signature