(function, curdir: Optional[str] = None)
| 84 | |
| 85 | |
| 86 | def getlocation(function, curdir: Optional[str] = None) -> str: |
| 87 | function = get_real_func(function) |
| 88 | fn = Path(inspect.getfile(function)) |
| 89 | lineno = function.__code__.co_firstlineno |
| 90 | if curdir is not None: |
| 91 | try: |
| 92 | relfn = fn.relative_to(curdir) |
| 93 | except ValueError: |
| 94 | pass |
| 95 | else: |
| 96 | return "%s:%d" % (relfn, lineno + 1) |
| 97 | return "%s:%d" % (fn, lineno + 1) |
| 98 | |
| 99 | |
| 100 | def num_mock_patch_args(function) -> int: |
no test coverage detected