1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

""" 

:Author: Daniel Mohr 

:Email: daniel.mohr@dlr.de 

:Date: 2021-02-15 (last change). 

:License: GNU GENERAL PUBLIC LICENSE, Version 3, 29 June 2007. 

""" 

 

import os 

 

from dabu.analyse_data_structure import analyse_data_structure 

from dabu.analyse_file_format import analyse_file_format_dict 

 

from .print_json_output import print_json_output 

 

 

def run_check_file_format(args): 

""" 

:Author: Daniel Mohr 

:Email: daniel.mohr@dlr.de 

:Date: 2021-02-15 (last change). 

 

:param args: namespace return from ArgumentParser.parse_args 

""" 

actpath = os.getcwd() 

for path in args.directory: # for every given directory 

os.chdir(actpath) 

os.chdir(path) 

result = analyse_data_structure() 

checksum_file = None 

if args.checksum_from_file is not None: 

checksum_file = args.checksum_from_file[0] 

result = analyse_file_format_dict( 

result, 

args.output_format, 

not args.skip_creating_checksums, 

checksum_file) 

print_json_output(result, args.output_format)