Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/astroid/brain/brain_pkg_resources.py: 83%

6 statements  

« prev     ^ index     » next       coverage.py v7.2.7, created at 2023-06-07 06:53 +0000

1# Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html 

2# For details: https://github.com/pylint-dev/astroid/blob/main/LICENSE 

3# Copyright (c) https://github.com/pylint-dev/astroid/blob/main/CONTRIBUTORS.txt 

4 

5from astroid import parse 

6from astroid.brain.helpers import register_module_extender 

7from astroid.manager import AstroidManager 

8 

9 

10def pkg_resources_transform(): 

11 return parse( 

12 """ 

13def require(*requirements): 

14 return pkg_resources.working_set.require(*requirements) 

15 

16def run_script(requires, script_name): 

17 return pkg_resources.working_set.run_script(requires, script_name) 

18 

19def iter_entry_points(group, name=None): 

20 return pkg_resources.working_set.iter_entry_points(group, name) 

21 

22def resource_exists(package_or_requirement, resource_name): 

23 return get_provider(package_or_requirement).has_resource(resource_name) 

24 

25def resource_isdir(package_or_requirement, resource_name): 

26 return get_provider(package_or_requirement).resource_isdir( 

27 resource_name) 

28 

29def resource_filename(package_or_requirement, resource_name): 

30 return get_provider(package_or_requirement).get_resource_filename( 

31 self, resource_name) 

32 

33def resource_stream(package_or_requirement, resource_name): 

34 return get_provider(package_or_requirement).get_resource_stream( 

35 self, resource_name) 

36 

37def resource_string(package_or_requirement, resource_name): 

38 return get_provider(package_or_requirement).get_resource_string( 

39 self, resource_name) 

40 

41def resource_listdir(package_or_requirement, resource_name): 

42 return get_provider(package_or_requirement).resource_listdir( 

43 resource_name) 

44 

45def extraction_error(): 

46 pass 

47 

48def get_cache_path(archive_name, names=()): 

49 extract_path = self.extraction_path or get_default_cache() 

50 target_path = os.path.join(extract_path, archive_name+'-tmp', *names) 

51 return target_path 

52 

53def postprocess(tempname, filename): 

54 pass 

55 

56def set_extraction_path(path): 

57 pass 

58 

59def cleanup_resources(force=False): 

60 pass 

61 

62def get_distribution(dist): 

63 return Distribution(dist) 

64 

65_namespace_packages = {} 

66""" 

67 ) 

68 

69 

70register_module_extender(AstroidManager(), "pkg_resources", pkg_resources_transform)