|
100 | 100 |
|
101 | 101 | # Regexp objects for reading headers
|
102 | 102 | # Record line
|
103 |
| -_rx_record = re.compile(''.join( |
104 |
| - ["[ \t]*", |
105 |
| - "(?P<record_name>[-\w]+)/?(?P<n_seg>\d*)[ \t]+", |
106 |
| - "(?P<n_sig>\d+)[ \t]*(?P<fs>\d*\.?\d*)/*(?P<counter_freq>-?\d*\.?\d*)", |
107 |
| - "\(?(?P<base_counter>-?\d*\.?\d*)\)?[ \t]*(?P<sig_len>\d*)[ \t]*", |
108 |
| - "(?P<base_time>\d{,2}:?\d{,2}:?\d{,2}\.?\d{,6})[ \t]*", |
109 |
| - "(?P<base_date>\d{,2}/?\d{,2}/?\d{,4})"]) |
110 |
| -) |
| 103 | +_rx_record = re.compile( |
| 104 | + 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}) |
| 111 | + ''', re.VERBOSE) |
111 | 112 |
|
112 | 113 | # Signal line
|
113 |
| -_rx_signal = re.compile(''.join( |
114 |
| - ["[ \t]*", |
115 |
| - "(?P<file_name>~?[-\w]*\.?[\w]*)[ \t]+(?P<fmt>\d+)x?" |
116 |
| - "(?P<samps_per_frame>\d*):?(?P<skew>\d*)\+?(?P<byte_offset>\d*)[ \t]*", |
117 |
| - "(?P<adc_gain>-?\d*\.?\d*e?[\+-]?\d*)\(?(?P<baseline>-?\d*)\)?", |
118 |
| - "/?(?P<units>[\w\^\-\?%\/]*)[ \t]*(?P<adc_res>\d*)[ \t]*", |
119 |
| - "(?P<adc_zero>-?\d*)[ \t]*(?P<init_value>-?\d*)[ \t]*(?P<checksum>-?\d*)", |
120 |
| - "[ \t]*(?P<block_size>\d*)[ \t]*(?P<sig_name>[\S]?[^\t\n\r\f\v]*)"]) |
121 |
| -) |
| 114 | +_rx_signal = re.compile( |
| 115 | + 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]*) |
| 123 | + ''', re.VERBOSE) |
122 | 124 |
|
123 | 125 | # Segment line
|
124 |
| -_rx_segment = re.compile('[ \t]*(?P<seg_name>[-\w]*~?)[ \t]+(?P<seg_len>\d+)') |
125 |
| - |
| 126 | +_rx_segment = re.compile( |
| 127 | + r''' |
| 128 | + [ \t]* |
| 129 | + (?P<seg_name>[-\w]*~?)[ \t]+(?P<seg_len>\d+) |
| 130 | + ''', re.VERBOSE) |
126 | 131 |
|
127 | 132 | class BaseHeaderMixin(object):
|
128 | 133 | """
|
|
0 commit comments