mirror of
https://github.com/paulscherrerinstitute/sf_daq_buffer.git
synced 2026-05-02 11:34:13 +02:00
hacked comment parsing
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
build
|
||||
__pycache__
|
||||
.idea
|
||||
.pytest_cache
|
||||
|
||||
@@ -8,6 +8,7 @@ import dateutil.parser
|
||||
import pytz
|
||||
import datetime
|
||||
import time
|
||||
import re
|
||||
|
||||
import logging
|
||||
logger = logging.getLogger("logger")
|
||||
@@ -78,6 +79,7 @@ def read_channels(filename):
|
||||
|
||||
channels = []
|
||||
for line in lines:
|
||||
line = re.sub(r'\w*#.*', "", line)
|
||||
line = line.strip()
|
||||
if line: # if not empty line
|
||||
channels.append(line) # remove all leading and trailing spaces
|
||||
|
||||
+2
-1
@@ -2,4 +2,5 @@ S10-CPCL-VM1MGC:LOAD
|
||||
|
||||
ONE
|
||||
TWO
|
||||
THREE
|
||||
# Comment that need to be removed
|
||||
THREE # one more comment at the end that need to be removed
|
||||
|
||||
@@ -27,9 +27,7 @@ class TestDownloadData(TestCase):
|
||||
def test_read_channels(self):
|
||||
channels = cadump.read_channels("channels.txt")
|
||||
logging.info(channels)
|
||||
self.assertEqual(len(channels), 3)
|
||||
|
||||
|
||||
self.assertEqual(len(channels), 4)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
Reference in New Issue
Block a user