Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.9/dist-packages/numpy/__config__.py: 50%

28 statements  

« prev     ^ index     » next       coverage.py v7.3.1, created at 2023-09-23 06:43 +0000

1# This file is generated by numpy's build process 

2# It contains system_info results at the time of building this package. 

3from enum import Enum 

4from numpy.core._multiarray_umath import ( 

5 __cpu_features__, 

6 __cpu_baseline__, 

7 __cpu_dispatch__, 

8) 

9 

10__all__ = ["show"] 

11_built_with_meson = True 

12 

13 

14class DisplayModes(Enum): 

15 stdout = "stdout" 

16 dicts = "dicts" 

17 

18 

19def _cleanup(d): 

20 """ 

21 Removes empty values in a `dict` recursively 

22 This ensures we remove values that Meson could not provide to CONFIG 

23 """ 

24 if isinstance(d, dict): 

25 return {k: _cleanup(v) for k, v in d.items() if v and _cleanup(v)} 

26 else: 

27 return d 

28 

29 

30CONFIG = _cleanup( 

31 { 

32 "Compilers": { 

33 "c": { 

34 "name": "gcc", 

35 "linker": "ld.bfd", 

36 "version": "10.2.1", 

37 "commands": "cc", 

38 }, 

39 "cython": { 

40 "name": "cython", 

41 "linker": "cython", 

42 "version": "3.0.2", 

43 "commands": "cython", 

44 }, 

45 "c++": { 

46 "name": "gcc", 

47 "linker": "ld.bfd", 

48 "version": "10.2.1", 

49 "commands": "c++", 

50 }, 

51 }, 

52 "Machine Information": { 

53 "host": { 

54 "cpu": "x86_64", 

55 "family": "x86_64", 

56 "endian": "little", 

57 "system": "linux", 

58 }, 

59 "build": { 

60 "cpu": "x86_64", 

61 "family": "x86_64", 

62 "endian": "little", 

63 "system": "linux", 

64 }, 

65 "cross-compiled": bool("False".lower().replace("false", "")), 

66 }, 

67 "Build Dependencies": { 

68 "blas": { 

69 "name": "openblas64", 

70 "found": bool("True".lower().replace("false", "")), 

71 "version": "0.3.23.dev", 

72 "detection method": "pkgconfig", 

73 "include directory": r"/usr/local/include", 

74 "lib directory": r"/usr/local/lib", 

75 "openblas configuration": "USE_64BITINT=1 DYNAMIC_ARCH=1 DYNAMIC_OLDER= NO_CBLAS= NO_LAPACK= NO_LAPACKE= NO_AFFINITY=1 USE_OPENMP= SKYLAKEX MAX_THREADS=2", 

76 "pc file directory": r"/usr/local/lib/pkgconfig", 

77 }, 

78 "lapack": { 

79 "name": "openblas64", 

80 "found": bool("True".lower().replace("false", "")), 

81 "version": "0.3.23.dev", 

82 "detection method": "pkgconfig", 

83 "include directory": r"/usr/local/include", 

84 "lib directory": r"/usr/local/lib", 

85 "openblas configuration": "USE_64BITINT=1 DYNAMIC_ARCH=1 DYNAMIC_OLDER= NO_CBLAS= NO_LAPACK= NO_LAPACKE= NO_AFFINITY=1 USE_OPENMP= SKYLAKEX MAX_THREADS=2", 

86 "pc file directory": r"/usr/local/lib/pkgconfig", 

87 }, 

88 }, 

89 "Python Information": { 

90 "path": r"/opt/python/cp39-cp39/bin/python", 

91 "version": "3.9", 

92 }, 

93 "SIMD Extensions": { 

94 "baseline": __cpu_baseline__, 

95 "found": [ 

96 feature for feature in __cpu_dispatch__ if __cpu_features__[feature] 

97 ], 

98 "not found": [ 

99 feature for feature in __cpu_dispatch__ if not __cpu_features__[feature] 

100 ], 

101 }, 

102 } 

103) 

104 

105 

106def _check_pyyaml(): 

107 import yaml 

108 

109 return yaml 

110 

111 

112def show(mode=DisplayModes.stdout.value): 

113 """ 

114 Show libraries and system information on which NumPy was built 

115 and is being used 

116 

117 Parameters 

118 ---------- 

119 mode : {`'stdout'`, `'dicts'`}, optional. 

120 Indicates how to display the config information. 

121 `'stdout'` prints to console, `'dicts'` returns a dictionary 

122 of the configuration. 

123 

124 Returns 

125 ------- 

126 out : {`dict`, `None`} 

127 If mode is `'dicts'`, a dict is returned, else None 

128 

129 See Also 

130 -------- 

131 get_include : Returns the directory containing NumPy C 

132 header files. 

133 

134 Notes 

135 ----- 

136 1. The `'stdout'` mode will give more readable 

137 output if ``pyyaml`` is installed 

138 

139 """ 

140 if mode == DisplayModes.stdout.value: 

141 try: # Non-standard library, check import 

142 yaml = _check_pyyaml() 

143 

144 print(yaml.dump(CONFIG)) 

145 except ModuleNotFoundError: 

146 import warnings 

147 import json 

148 

149 warnings.warn("Install `pyyaml` for better output", stacklevel=1) 

150 print(json.dumps(CONFIG, indent=2)) 

151 elif mode == DisplayModes.dicts.value: 

152 return CONFIG 

153 else: 

154 raise AttributeError( 

155 f"Invalid `mode`, use one of: {', '.join([e.value for e in DisplayModes])}" 

156 )