Skip to content

Commit 02ffe77

Browse files
author
Benjamin Moody
committed
Reformat header patterns with more whitespace for readability.
1 parent 5274f26 commit 02ffe77

File tree

1 file changed

+25
-15
lines changed

1 file changed

+25
-15
lines changed

wfdb/io/_header.py

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -102,31 +102,41 @@
102102
# Record line
103103
_rx_record = re.compile(
104104
r'''
105-
[ \t]*
106-
(?P<record_name>[-\w]+)/?(?P<n_seg>\d*)[ \t]+
107-
(?P<n_sig>\d+)[ \t]*(?P<fs>\d*\.?\d*)/*(?P<counter_freq>-?\d*\.?\d*)
108-
\(?(?P<base_counter>-?\d*\.?\d*)\)?[ \t]*(?P<sig_len>\d*)[ \t]*
109-
(?P<base_time>\d{,2}:?\d{,2}:?\d{,2}\.?\d{,6})[ \t]*
110-
(?P<base_date>\d{,2}/?\d{,2}/?\d{,4})
105+
[ \t]* (?P<record_name>[-\w]+)
106+
/?(?P<n_seg>\d*)
107+
[ \t]+ (?P<n_sig>\d+)
108+
[ \t]* (?P<fs>\d*\.?\d*)
109+
/*(?P<counter_freq>-?\d*\.?\d*)
110+
\(?(?P<base_counter>-?\d*\.?\d*)\)?
111+
[ \t]* (?P<sig_len>\d*)
112+
[ \t]* (?P<base_time>\d{,2}:?\d{,2}:?\d{,2}\.?\d{,6})
113+
[ \t]* (?P<base_date>\d{,2}/?\d{,2}/?\d{,4})
111114
''', re.VERBOSE)
112115

113116
# Signal line
114117
_rx_signal = re.compile(
115118
r'''
116-
[ \t]*
117-
(?P<file_name>~?[-\w]*\.?[\w]*)[ \t]+(?P<fmt>\d+)x?
118-
(?P<samps_per_frame>\d*):?(?P<skew>\d*)\+?(?P<byte_offset>\d*)[ \t]*
119-
(?P<adc_gain>-?\d*\.?\d*e?[\+-]?\d*)\(?(?P<baseline>-?\d*)\)?
120-
/?(?P<units>[\w\^\-\?%\/]*)[ \t]*(?P<adc_res>\d*)[ \t]*
121-
(?P<adc_zero>-?\d*)[ \t]*(?P<init_value>-?\d*)[ \t]*(?P<checksum>-?\d*)
122-
[ \t]*(?P<block_size>\d*)[ \t]*(?P<sig_name>[\S]?[^\t\n\r\f\v]*)
119+
[ \t]* (?P<file_name>~?[-\w]*\.?[\w]*)
120+
[ \t]+ (?P<fmt>\d+)
121+
x?(?P<samps_per_frame>\d*)
122+
:?(?P<skew>\d*)
123+
\+?(?P<byte_offset>\d*)
124+
[ \t]* (?P<adc_gain>-?\d*\.?\d*e?[\+-]?\d*)
125+
\(?(?P<baseline>-?\d*)\)?
126+
/?(?P<units>[\w\^\-\?%\/]*)
127+
[ \t]* (?P<adc_res>\d*)
128+
[ \t]* (?P<adc_zero>-?\d*)
129+
[ \t]* (?P<init_value>-?\d*)
130+
[ \t]* (?P<checksum>-?\d*)
131+
[ \t]* (?P<block_size>\d*)
132+
[ \t]* (?P<sig_name>[\S]?[^\t\n\r\f\v]*)
123133
''', re.VERBOSE)
124134

125135
# Segment line
126136
_rx_segment = re.compile(
127137
r'''
128-
[ \t]*
129-
(?P<seg_name>[-\w]*~?)[ \t]+(?P<seg_len>\d+)
138+
[ \t]* (?P<seg_name>[-\w]*~?)
139+
[ \t]+ (?P<seg_len>\d+)
130140
''', re.VERBOSE)
131141

132142
class BaseHeaderMixin(object):

0 commit comments

Comments
 (0)