Skip to content

Commit 12a8549

Browse files
larsonermassich
authored andcommitted
BUG: Add CR-LF hash (#5942)
The files have different line endings, on Windows they are CR-LF and on Unix LF
1 parent fd99e1b commit 12a8549

3 files changed

Lines changed: 11 additions & 6 deletions

File tree

doc/whats_new.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ Bug
7575

7676
- Fix :meth:`mne.io.Raw.append` annotations miss-alignment by `Joan Massich`_
7777

78+
- Fix hash bug in the ``mne.io.edf`` module when installing on Windows by `Eric Larson`_
79+
7880
- Fix :func:`mne.io.read_raw_edf` reading duplicate channel names by `Larry Eisenman`_
7981

8082
- Fix :func:`set_bipolar_reference` in the case of generating all bipolar combinations and also in the case of repeated channels in both lists (anode and cathode) by `Cristóbal Moënne-Loccoz`_

mne/io/edf/_utils.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,18 @@
99
#
1010
# License: BSD (3-clause)
1111

12+
import os.path as op
1213
import re
14+
1315
from ...utils import hashfunc
1416

1517

16-
def _load_gdf_events_lut(fname, md5):
17-
if hashfunc(fname, hash_type='md5') != md5:
18+
def _load_gdf_events_lut():
19+
fname = op.join(op.dirname(__file__), 'gdf_encodes.txt')
20+
hash_ = hashfunc(fname, hash_type='md5')
21+
# Linux or Windows line endings
22+
if hash_ not in ('12134a9be7e0bfa5941e95f8bfd330f7',
23+
'41696b162526f559dd7d139352eae178'):
1824
raise ValueError("File %s is corrupted. mdf5 hashes don't match." %
1925
fname)
2026

mne/io/edf/edf.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import re
1717

1818
import numpy as np
19-
import os.path as op
2019

2120
from ...utils import verbose, logger, warn
2221
from ..utils import _blk_read_lims
@@ -29,9 +28,7 @@
2928
from ._utils import _load_gdf_events_lut
3029

3130

32-
GDF_EVENT_ENCODES_FILE = op.join(op.dirname(__file__), 'gdf_encodes.txt')
33-
GDF_EVENTS_LUT = _load_gdf_events_lut(fname=GDF_EVENT_ENCODES_FILE,
34-
md5='12134a9be7e0bfa5941e95f8bfd330f7')
31+
GDF_EVENTS_LUT = _load_gdf_events_lut()
3532

3633

3734
@deprecated('find_edf_events is deprecated in 0.18, and will be removed'

0 commit comments

Comments
 (0)