Matches DAP Frame objects. If source is py.path.local, it's automatically wrapped with some.dap.source(). If line is str, it is treated as a line marker, and translated to a line number via get_marked_line_numbers(source["path"]) if possible.
(source, line, column=some.int, **kwargs)
| 27 | |
| 28 | |
| 29 | def frame(source, line, column=some.int, **kwargs): |
| 30 | """Matches DAP Frame objects. |
| 31 | |
| 32 | If source is py.path.local, it's automatically wrapped with some.dap.source(). |
| 33 | |
| 34 | If line is str, it is treated as a line marker, and translated to a line |
| 35 | number via get_marked_line_numbers(source["path"]) if possible. |
| 36 | """ |
| 37 | |
| 38 | if isinstance(source, py.path.local): |
| 39 | source = some.dap.source(source) |
| 40 | |
| 41 | if isinstance(line, str): |
| 42 | if isinstance(source, dict): |
| 43 | path = source["path"] |
| 44 | elif isinstance(source, _impl.DictContaining): |
| 45 | path = source.items["path"] |
| 46 | else: |
| 47 | path = None |
| 48 | assert isinstance( |
| 49 | path, _impl.Path |
| 50 | ), "source must be some.dap.source() to use line markers in some.dap.frame()" |
| 51 | line = code.get_marked_line_numbers(path.path)[line] |
| 52 | |
| 53 | d = {"id": some.dap.id, "source": source, "line": line, "column": column} |
| 54 | d.update(kwargs) |
| 55 | return some.dict.containing(d) |