|
1 |
| -# Copyright (c) 2022-2023. Analog Devices Inc. |
| 1 | +# Copyright (c) 2022-2024. Analog Devices Inc. |
2 | 2 | #
|
3 | 3 | # Licensed under the Apache License, Version 2.0 (the "License");
|
4 | 4 | # you may not use this file except in compliance with the License.
|
|
28 | 28 |
|
29 | 29 | logger = get_logger(__name__)
|
30 | 30 |
|
31 |
| -# line numbers from griffe are not reliable before python 3.8; this may eventually be fixed... |
32 |
| -_supports_linenums = sys.version_info >= (3,8) |
33 |
| - |
34 | 31 | def _re_or(*exps: str) -> str:
|
35 | 32 | """Construct an "or" regular expression from a sequence of regular expressions.
|
36 | 33 |
|
@@ -309,10 +306,9 @@ def _error(self, msg: str, just_warn: bool = False) -> None:
|
309 | 306 | prefix = f"file://{parent.filepath}:"
|
310 | 307 | line = doc.lineno
|
311 | 308 | if line is not None: # pragma: no branch
|
312 |
| - if _supports_linenums: # pragma: no branch |
313 |
| - # Add line offset to match in docstring. This can still be |
314 |
| - # short if the doc string has leading newlines. |
315 |
| - line += doc.value.count("\n", 0, self._cur_offset) |
| 309 | + # Add line offset to match in docstring. This can still be |
| 310 | + # short if the doc string has leading newlines. |
| 311 | + line += doc.value.count("\n", 0, self._cur_offset) |
316 | 312 | prefix += f"{line}:"
|
317 | 313 | # It would be nice to add the column as well, but we cannot determine
|
318 | 314 | # that without knowing how much the doc string was unindented.
|
|
0 commit comments