Repository navigation
Commit f298146
authored
Accept pathlib.Path record names in rdann (#626)
`rdann` fails when `record_name` is a `pathlib.Path`:
```python
wfdb.rdann(pathlib.Path("sample-data/100"), "atr")
# TypeError: unsupported operand type(s) for +: 'PosixPath' and 'str'
```
The file name is built with `record_name + "." + extension`. `rdrecord`,
`rdsamp` and `rdheader` already accept path-like objects, so `rdann` now
converts `record_name` with `os.fspath` at the start, and the docstring
says `str or os.PathLike`.
This is the remaining part of #346, without the changes to how PhysioNet
URLs are built.
Tests: reading `sample-data/100` with a `Path` gives the same
annotations as with a string (this fails on `main`), and reading from a
`.wfdb` archive given as a `Path` works too.4 files changed
Lines changed: 30 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1892 | 1892 | | |
1893 | 1893 | | |
1894 | 1894 | | |
1895 | | - | |
| 1895 | + | |
1896 | 1896 | | |
1897 | 1897 | | |
1898 | 1898 | | |
| |||
1942 | 1942 | | |
1943 | 1943 | | |
1944 | 1944 | | |
| 1945 | + | |
1945 | 1946 | | |
1946 | 1947 | | |
1947 | 1948 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
357 | 358 | | |
358 | 359 | | |
359 | 360 | | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
704 | 704 | | |
705 | 705 | | |
706 | 706 | | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
707 | 723 | | |
708 | 724 | | |
709 | 725 | | |
| |||
0 commit comments