Coverage for src/code_beatrix/algorithm/data/__init__.py: 100%

8 statements  

« prev     ^ index     » next       coverage.py v7.1.0, created at 2023-04-29 13:45 +0200

1""" 

2@file 

3@brief shortcut to data 

4""" 

5import os 

6 

7 

8def load_prenoms_w(): 

9 """ 

10 returns a list of first names, 

11 taken from `Nominis <http://nominis.cef.fr/contenus/prenom/alphabetique.html>`_. 

12 """ 

13 folder = os.path.abspath(os.path.dirname(__file__)) 

14 name = os.path.join(folder, "prenoms_w.txt") 

15 with open(name, "r", encoding="utf-8") as f: 

16 names = f.readlines() 

17 names = [_.strip(" \n\r\t") for _ in names] 

18 return [_ for _ in names if _]