Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/Crypto/Util/_file_system.py: 80%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

10 statements  

1# SPDX-FileCopyrightText: 2016 Legrandin <helderijs@gmail.com> 

2# SPDX-License-Identifier: BSD-2-Clause 

3 

4from __future__ import annotations 

5 

6import os 

7 

8 

9def pycryptodome_filename(dir_comps: list[str], filename: str) -> str: 

10 """Return the complete file name for the module 

11 

12 dir_comps : list of string 

13 The list of directory names in the PyCryptodome package. 

14 The first element must be "Crypto". 

15 

16 filename : string 

17 The filename (inclusing extension) in the target directory. 

18 """ 

19 

20 if dir_comps[0] != "Crypto": 

21 raise ValueError("Only available for modules under 'Crypto'") 

22 

23 dir_comps = list(dir_comps[1:]) + [filename] 

24 

25 util_lib, _ = os.path.split(os.path.abspath(__file__)) 

26 root_lib = os.path.join(util_lib, "..") 

27 

28 return os.path.join(root_lib, *dir_comps)