DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
raw_file_check Namespace Reference

Functions

 compare_raw_name (file1, file2)
 
 compare_raw_size (file1, file2)
 
 compare_raw_content (file1, file2, buffer_size=1024)
 

Function Documentation

◆ compare_raw_content()

raw_file_check.compare_raw_content ( file1,
file2,
buffer_size = 1024 )
Compare the content of two files from their path

Definition at line 11 of file raw_file_check.py.

11def compare_raw_content(file1, file2, buffer_size=1024):
12 """Compare the content of two files from their path"""
13 buffer_count = 0
14 with open(file1, 'rb') as f1, open(file2, 'rb') as f2:
15 while True:
16 data1 = f1.read(buffer_size)
17 data2 = f2.read(buffer_size)
18
19 if not data1 and not data2:
20 return True
21 if not data1 or not data2:
22 return False
23 if data1 != data2:
24 print("Files are differents at bytes " + str(buffer_size * buffer_count) + " to " + str(buffer_size * (buffer_count + 1)))
25 print(data1)
26 print(data2)
27 return False
28 buffer_count += 1

◆ compare_raw_name()

raw_file_check.compare_raw_name ( file1,
file2 )
Compare the name of two files from their path

Definition at line 3 of file raw_file_check.py.

3def compare_raw_name(file1, file2):
4 """Compare the name of two files from their path"""
5 return os.path.basename(file1) == os.path.basename(file2)
6

◆ compare_raw_size()

raw_file_check.compare_raw_size ( file1,
file2 )
Compare the size of two files from their path

Definition at line 7 of file raw_file_check.py.

7def compare_raw_size(file1, file2):
8 """Compare the size of two files from their path"""
9 return os.path.getsize(file1) == os.path.getsize(file2)
10