nirfmxpulse 26.3.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,106 @@
1
+ """nirfmxpulse package."""
2
+
3
+ __version__ = "26.3.0"
4
+
5
+ from nirfmxpulse.attributes import * # noqa: F403
6
+ from nirfmxpulse.enums import * # noqa: F403
7
+ from nirfmxpulse.grpc_session_options import * # noqa: F403
8
+ from nirfmxpulse.pulse import Pulse, _PulseSignalConfiguration
9
+
10
+
11
+ def get_diagnostic_information():
12
+ """Get diagnostic information about the system state that is suitable for printing or logging.
13
+ returns: dict
14
+ note: Python bitness may be incorrect when running in a virtual environment.
15
+ """
16
+ import importlib.metadata
17
+ import os
18
+ import platform
19
+ import struct
20
+ import sys
21
+
22
+ def is_python_64bit():
23
+ return struct.calcsize("P") == 8
24
+
25
+ def is_os_64bit():
26
+ return platform.machine().endswith("64")
27
+
28
+ def is_venv():
29
+ return "VIRTUAL_ENV" in os.environ
30
+
31
+ info = {} # type: ignore
32
+ info["os"] = {}
33
+ info["python"] = {}
34
+ info["driver"] = {}
35
+ info["module"] = {}
36
+ if platform.system() == "Windows":
37
+ try:
38
+ import winreg as winreg
39
+ except ImportError:
40
+ import _winreg as winreg # type: ignore
41
+
42
+ os_name = "Windows"
43
+ try:
44
+ driver_version_key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\National Instruments\RFmx\Pulse\C Runtime Support") # type: ignore
45
+ driver_version = winreg.QueryValueEx(driver_version_key, "Version")[0] # type: ignore
46
+ except WindowsError: # type: ignore
47
+ driver_version = "Unknown"
48
+ else:
49
+ raise SystemError("Unsupported platform: {}".format(platform.system()))
50
+
51
+ if sys.version_info[1] >= 10:
52
+ installed_packages_names = [
53
+ name
54
+ for name_list in importlib.metadata.packages_distributions().values()
55
+ for name in name_list
56
+ ]
57
+ installed_packages_names = set(installed_packages_names) # type: ignore
58
+ installed_packages_list = [
59
+ {"name": name, "version": importlib.metadata.distribution(name).version}
60
+ for name in sorted(installed_packages_names)
61
+ ]
62
+ else:
63
+ import pkg_resources
64
+
65
+ installed_packages = pkg_resources.working_set
66
+ installed_packages_list = [
67
+ {
68
+ "name": i.key,
69
+ "version": i.version,
70
+ }
71
+ for i in installed_packages
72
+ ]
73
+
74
+ info["os"]["name"] = os_name
75
+ info["os"]["version"] = platform.version()
76
+ info["os"]["bits"] = "64" if is_os_64bit() else "32" # type: ignore
77
+ info["driver"]["name"] = "RFmx Pulse"
78
+ info["driver"]["version"] = driver_version
79
+ info["module"]["name"] = "nirfmxpulse"
80
+ info["module"]["version"] = "26.3.0"
81
+ info["python"]["version"] = sys.version
82
+ info["python"]["bits"] = "64" if is_python_64bit() else "32" # type: ignore
83
+ info["python"]["is_venv"] = is_venv() # type: ignore
84
+ info["python"]["packages"] = installed_packages_list
85
+
86
+ return info
87
+
88
+
89
+ def print_diagnostic_information():
90
+ """Print diagnostic information in a format suitable for issue report.
91
+ note: Python bitness may be incorrect when running in a virtual environment.
92
+ """
93
+ info = get_diagnostic_information() # type: ignore
94
+
95
+ row_format = " {:<10"
96
+ for type in ["OS", "Driver", "Module", "Python"]:
97
+ typename = type.lower()
98
+ print(type + ":")
99
+ for item in info[typename]:
100
+ if item != "packages":
101
+ print(row_format.format(item.title() + ":", info[typename][item]))
102
+ print(" Installed Packages:")
103
+ for p in info["python"]["packages"]:
104
+ print((" " * 8) + p["name"] + "==" + p["version"])
105
+
106
+ return info