Coverage for src/ensae_teaching_cs/data/datasql.py: 100%

5 statements  

« prev     ^ index     » next       coverage.py v7.1.0, created at 2023-01-27 05:44 +0100

1""" 

2@file 

3@brief Example of databases 

4""" 

5from .data_helper import any_local_file 

6 

7 

8def anyfile(name, local=True, cache_folder="."): 

9 """ 

10 Returns any file in sub folder 

11 `data_sql <https://github.com/sdpython/ensae_teaching_cs/tree/master/src/ensae_teaching_cs/data/data_sql>`_. 

12 

13 @param name file to download 

14 @param local local data or web 

15 @param cache_folder where to cache the data if downloaded a second time 

16 @return text content (str) 

17 """ 

18 return any_local_file(name, "data_sql", cache_folder=cache_folder, filename=True) 

19 

20 

21def simple_database(name="World.db3", local=True, cache_folder="."): 

22 """ 

23 Returns a simple database. 

24 See :func:`ensae_teaching_cs.data.datasql.anyfile` to 

25 directly download it. 

26 

27 @param name filename 

28 @param local local data or web 

29 @param cache_folder where to cache the data if downloaded a second time 

30 @return text content (str) 

31 """ 

32 return anyfile(name, local=local, cache_folder=cache_folder)