Skip to content

Commit a01250b

Browse files
committed
relax stringent requirements for string annotation fields
1 parent 0ab2fa0 commit a01250b

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
# Versions should comply with PEP440. For a discussion on single-sourcing
2121
# the version across setup.py and the project code, see
2222
# https://packaging.python.org/en/latest/single_source_version.html
23-
version='1.3.3',
23+
version='1.3.4',
2424

2525
description='The WFDB Python Toolbox',
2626
long_description=long_description,

wfdb/readwrite/annotations.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -243,17 +243,18 @@ def checkfield(self, field):
243243
if not hasattr(label_store[i], '__index__'):
244244
raise TypeError('The label_store values of the '+field+' field must be integer-like')
245245

246-
if not isinstance(symbol[i], strtypes) or len(symbol[i]) not in [1,2]:
247-
raise ValueError('The symbol values of the '+field+' field must be strings of length 1 or 2')
246+
if not isinstance(symbol[i], strtypes) or len(symbol[i]) not in [1,2,3]:
247+
raise ValueError('The symbol values of the '+field+' field must be strings of length 1 to 3')
248248

249249
if bool(re.search('[ \t\n\r\f\v]', symbol[i])):
250250
raise ValueError('The symbol values of the '+field+' field must not contain whitespace characters')
251251

252252
if not isinstance(description[i], strtypes):
253253
raise TypeError('The description values of the '+field+' field must be strings')
254254

255-
if bool(re.search('[\t\n\r\f\v]', description[i])):
256-
raise ValueError('The description values of the '+field+' field must not contain tabs or newlines')
255+
# Would be good to enfore this but existing garbage annotations have tabs and newlines...
256+
#if bool(re.search('[\t\n\r\f\v]', description[i])):
257+
# raise ValueError('The description values of the '+field+' field must not contain tabs or newlines')
257258

258259
# The string fields
259260
elif field in ['symbol', 'description', 'aux_note']:
@@ -265,8 +266,8 @@ def checkfield(self, field):
265266

266267
if field == 'symbol':
267268
for e in uniq_elements:
268-
if len(e) not in [1,2]:
269-
raise ValueError('Subelements of the '+field+' field must be strings of length 1 or 2')
269+
if len(e) not in [1,2,3]:
270+
raise ValueError('Subelements of the '+field+' field must be strings of length 1 to 3')
270271
if bool(re.search('[ \t\n\r\f\v]', e)):
271272
raise ValueError('Subelements of the '+field+' field may not contain whitespace characters')
272273
else:

0 commit comments

Comments
 (0)