Conditions | 1 |
Total Lines | 13 |
Code Lines | 3 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import atexit |
||
20 | def resource_filename(package: str, resource: str) -> Path: |
||
21 | """ |
||
22 | Reimplementation of the function with the same name from pkg_resources |
||
23 | |||
24 | Using importlib for better performance |
||
25 | |||
26 | package : str |
||
27 | The package from where to start looking for resource (often __name__) |
||
28 | resource : str |
||
29 | The resource to look up |
||
30 | """ |
||
31 | parent_package = package.rsplit('.',1)[0] |
||
32 | return _file_manager.enter_context(path(parent_package, resource)) |
||
33 | |||
51 |