Get the lines for this function based on the given backend. The given API call is inserted at the correct location.
(self, call, backend)
| 616 | return '<FunctionAnnotation for %s>' % self.name |
| 617 | |
| 618 | def get_lines(self, call, backend): |
| 619 | """ Get the lines for this function based on the given backend. |
| 620 | The given API call is inserted at the correct location. |
| 621 | """ |
| 622 | if backend is None: |
| 623 | raise RuntimeError("Backend must be specified!") |
| 624 | backend_selector = (backend, ) # first lines are for all backends |
| 625 | lines = [] |
| 626 | for line in self.lines: |
| 627 | if line.lstrip().startswith('# ---'): |
| 628 | backend_selector = line.strip().split(' ') |
| 629 | continue |
| 630 | if line.lstrip().startswith('# /---'): |
| 631 | backend_selector = backend |
| 632 | continue |
| 633 | if backend in backend_selector: |
| 634 | if line.strip() == '()': |
| 635 | indent = line.split('(')[0][4:] |
| 636 | line = indent + call |
| 637 | lines.append(line) |
| 638 | return lines |
| 639 | |
| 640 | def is_arg_set(self, name): |
| 641 | """Get whether a given variable name is set. |
no test coverage detected