Coverage for /wheeldirectory/casa-6.7.0-12-py3.10.el8/lib/py/lib/python3.10/site-packages/casatools/errors.py: 79%

19 statements  

« prev     ^ index     » next       coverage.py v7.6.4, created at 2024-10-31 19:53 +0000

1 

2def create_error_string( errors ): 

3 variable = None 

4 value = None 

5 vec = False 

6 if type(errors) == dict: 

7 for k,v in errors.items(): 

8 if type(v) == list: 

9 if v[0] == 'path not found': 

10 value = k 

11 if v[0] == 'path vector element not found': 

12 value = k 

13 vec = True 

14 if v[0] == 'must be of cReqPath type': 

15 variable = k 

16 

17 if value is not None: 

18 if variable is not None: 

19 return ( "all elements of the %s vector parameter must be a path that exists (at least one element of \"%s\" does not exist)" 

20 if vec else "the %s parameter must be a path that exists ('%s' does not exist)" ) % (variable, value) 

21 else: 

22 return ( "all elements of the vector parameter must be a path that exists (at least one element of \"%s\" does not exist)" 

23 if vec else "the path parameter must contain a path that exists ('%s' does not exist)" ) % value 

24 else: 

25 return str(errors)