ni.measurementlink.sessionmanagement.v1.client 1.1.0__tar.gz
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.
- ni_measurementlink_sessionmanagement_v1_client-1.1.0/PKG-INFO +81 -0
- ni_measurementlink_sessionmanagement_v1_client-1.1.0/README.md +26 -0
- ni_measurementlink_sessionmanagement_v1_client-1.1.0/pyproject.toml +167 -0
- ni_measurementlink_sessionmanagement_v1_client-1.1.0/src/ni/measurementlink/sessionmanagement/v1/client/__init__.py +107 -0
- ni_measurementlink_sessionmanagement_v1_client-1.1.0/src/ni/measurementlink/sessionmanagement/v1/client/_annotations.py +81 -0
- ni_measurementlink_sessionmanagement_v1_client-1.1.0/src/ni/measurementlink/sessionmanagement/v1/client/_client.py +397 -0
- ni_measurementlink_sessionmanagement_v1_client-1.1.0/src/ni/measurementlink/sessionmanagement/v1/client/_client_base.py +135 -0
- ni_measurementlink_sessionmanagement_v1_client-1.1.0/src/ni/measurementlink/sessionmanagement/v1/client/_constants.py +32 -0
- ni_measurementlink_sessionmanagement_v1_client-1.1.0/src/ni/measurementlink/sessionmanagement/v1/client/_drivers/__init__.py +46 -0
- ni_measurementlink_sessionmanagement_v1_client-1.1.0/src/ni/measurementlink/sessionmanagement/v1/client/_drivers/_configuration.py +112 -0
- ni_measurementlink_sessionmanagement_v1_client-1.1.0/src/ni/measurementlink/sessionmanagement/v1/client/_drivers/_dotenvpath.py +73 -0
- ni_measurementlink_sessionmanagement_v1_client-1.1.0/src/ni/measurementlink/sessionmanagement/v1/client/_drivers/_grpcdevice.py +96 -0
- ni_measurementlink_sessionmanagement_v1_client-1.1.0/src/ni/measurementlink/sessionmanagement/v1/client/_drivers/_nidaqmx.py +54 -0
- ni_measurementlink_sessionmanagement_v1_client-1.1.0/src/ni/measurementlink/sessionmanagement/v1/client/_drivers/_nidcpower.py +63 -0
- ni_measurementlink_sessionmanagement_v1_client-1.1.0/src/ni/measurementlink/sessionmanagement/v1/client/_drivers/_nidigital.py +64 -0
- ni_measurementlink_sessionmanagement_v1_client-1.1.0/src/ni/measurementlink/sessionmanagement/v1/client/_drivers/_nidmm.py +64 -0
- ni_measurementlink_sessionmanagement_v1_client-1.1.0/src/ni/measurementlink/sessionmanagement/v1/client/_drivers/_nifgen.py +63 -0
- ni_measurementlink_sessionmanagement_v1_client-1.1.0/src/ni/measurementlink/sessionmanagement/v1/client/_drivers/_niscope.py +64 -0
- ni_measurementlink_sessionmanagement_v1_client-1.1.0/src/ni/measurementlink/sessionmanagement/v1/client/_drivers/_niswitch.py +82 -0
- ni_measurementlink_sessionmanagement_v1_client-1.1.0/src/ni/measurementlink/sessionmanagement/v1/client/_reservation.py +2769 -0
- ni_measurementlink_sessionmanagement_v1_client-1.1.0/src/ni/measurementlink/sessionmanagement/v1/client/_types.py +525 -0
- ni_measurementlink_sessionmanagement_v1_client-1.1.0/src/ni/measurementlink/sessionmanagement/v1/client/py.typed +0 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: ni.measurementlink.sessionmanagement.v1.client
|
|
3
|
+
Version: 1.1.0
|
|
4
|
+
Summary: Client gRPC APIs for the session management service
|
|
5
|
+
License: MIT
|
|
6
|
+
Keywords: ni-apis,sessionmanagement
|
|
7
|
+
Author: NI
|
|
8
|
+
Author-email: opensource@ni.com
|
|
9
|
+
Maintainer: Joe Friedrichsen
|
|
10
|
+
Maintainer-email: joe.friedrichsen@emerson.com
|
|
11
|
+
Requires-Python: >=3.10,<4.0
|
|
12
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: Manufacturing
|
|
15
|
+
Classifier: Intended Audience :: Science/Research
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
18
|
+
Classifier: Operating System :: POSIX
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
25
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
26
|
+
Provides-Extra: drivers
|
|
27
|
+
Provides-Extra: nidaqmx
|
|
28
|
+
Provides-Extra: nidcpower
|
|
29
|
+
Provides-Extra: nidigital
|
|
30
|
+
Provides-Extra: nidmm
|
|
31
|
+
Provides-Extra: nifgen
|
|
32
|
+
Provides-Extra: niscope
|
|
33
|
+
Provides-Extra: niswitch
|
|
34
|
+
Requires-Dist: deprecation (>=2.1)
|
|
35
|
+
Requires-Dist: ni-grpc-extensions (>=1.1.0)
|
|
36
|
+
Requires-Dist: ni-grpcdevice-v1-proto (>=1.1.0)
|
|
37
|
+
Requires-Dist: ni-measurementlink-discovery-v1-client (>=1.1.0)
|
|
38
|
+
Requires-Dist: ni-measurementlink-pinmap-v1-proto (>=1.1.0)
|
|
39
|
+
Requires-Dist: ni-measurementlink-proto (>=1.1.0)
|
|
40
|
+
Requires-Dist: ni-measurementlink-sessionmanagement-v1-proto (>=1.1.0)
|
|
41
|
+
Requires-Dist: nidaqmx[grpc] (>=0.8.0) ; extra == "drivers" or extra == "nidaqmx"
|
|
42
|
+
Requires-Dist: nidcpower[grpc] (>=1.4.4) ; extra == "drivers" or extra == "nidcpower"
|
|
43
|
+
Requires-Dist: nidigital[grpc] (>=1.4.4) ; extra == "drivers" or extra == "nidigital"
|
|
44
|
+
Requires-Dist: nidmm[grpc] (>=1.4.4) ; extra == "drivers" or extra == "nidmm"
|
|
45
|
+
Requires-Dist: nifgen[grpc] (>=1.4.4) ; extra == "drivers" or extra == "nifgen"
|
|
46
|
+
Requires-Dist: niscope[grpc] (>=1.4.4) ; extra == "drivers" or extra == "niscope"
|
|
47
|
+
Requires-Dist: niswitch[grpc] (>=1.4.4) ; extra == "drivers" or extra == "niswitch"
|
|
48
|
+
Requires-Dist: protobuf (>=4.21)
|
|
49
|
+
Requires-Dist: python-decouple (>=3.8)
|
|
50
|
+
Requires-Dist: pywin32 (>=303) ; sys_platform == "win32"
|
|
51
|
+
Requires-Dist: traceloggingdynamic (>=1.0) ; sys_platform == "win32"
|
|
52
|
+
Project-URL: Documentation, https://nimeasurementlinksessionmanagementclient.readthedocs.io/en/latest/
|
|
53
|
+
Project-URL: Repository, https://github.com/ni/ni-apis-python
|
|
54
|
+
Description-Content-Type: text/markdown
|
|
55
|
+
|
|
56
|
+
# Table of Contents
|
|
57
|
+
|
|
58
|
+
- [Table of Contents](#table-of-contents)
|
|
59
|
+
- [About](#about)
|
|
60
|
+
- [Operating System Support](#operating-system-support)
|
|
61
|
+
- [Python Version Support](#python-version-support)
|
|
62
|
+
|
|
63
|
+
# About
|
|
64
|
+
|
|
65
|
+
`ni.measurementlink.sessionmanagement.v1.client` is a Python package that provides a client API for
|
|
66
|
+
the [ni.measurementlink.sessionmanagement.v1 package](https://github.com/ni/ni-apis/tree/main/ni/measurementlink/sessionmanagement/v1).
|
|
67
|
+
|
|
68
|
+
NI created and supports this package.
|
|
69
|
+
|
|
70
|
+
## Operating System Support
|
|
71
|
+
|
|
72
|
+
`ni.measurementlink.sessionmanagement.v1.client` supports Windows and Linux operating systems.
|
|
73
|
+
|
|
74
|
+
## Python Version Support
|
|
75
|
+
|
|
76
|
+
`ni.measurementlink.sessionmanagement.v1.client` supports CPython 3.10+.
|
|
77
|
+
|
|
78
|
+
## Installation
|
|
79
|
+
|
|
80
|
+
You can directly install the `ni.measurementlink.sessionmanagement.v1.client` package using `pip` or by listing it as a
|
|
81
|
+
dependency in your project's `pyproject.toml` file.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Table of Contents
|
|
2
|
+
|
|
3
|
+
- [Table of Contents](#table-of-contents)
|
|
4
|
+
- [About](#about)
|
|
5
|
+
- [Operating System Support](#operating-system-support)
|
|
6
|
+
- [Python Version Support](#python-version-support)
|
|
7
|
+
|
|
8
|
+
# About
|
|
9
|
+
|
|
10
|
+
`ni.measurementlink.sessionmanagement.v1.client` is a Python package that provides a client API for
|
|
11
|
+
the [ni.measurementlink.sessionmanagement.v1 package](https://github.com/ni/ni-apis/tree/main/ni/measurementlink/sessionmanagement/v1).
|
|
12
|
+
|
|
13
|
+
NI created and supports this package.
|
|
14
|
+
|
|
15
|
+
## Operating System Support
|
|
16
|
+
|
|
17
|
+
`ni.measurementlink.sessionmanagement.v1.client` supports Windows and Linux operating systems.
|
|
18
|
+
|
|
19
|
+
## Python Version Support
|
|
20
|
+
|
|
21
|
+
`ni.measurementlink.sessionmanagement.v1.client` supports CPython 3.10+.
|
|
22
|
+
|
|
23
|
+
## Installation
|
|
24
|
+
|
|
25
|
+
You can directly install the `ni.measurementlink.sessionmanagement.v1.client` package using `pip` or by listing it as a
|
|
26
|
+
dependency in your project's `pyproject.toml` file.
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "ni.measurementlink.sessionmanagement.v1.client"
|
|
3
|
+
version = "1.1.0"
|
|
4
|
+
license = "MIT"
|
|
5
|
+
description = "Client gRPC APIs for the session management service"
|
|
6
|
+
authors = [{name = "NI", email = "opensource@ni.com"}]
|
|
7
|
+
maintainers = [
|
|
8
|
+
{name = "Joe Friedrichsen", email = "joe.friedrichsen@emerson.com"},
|
|
9
|
+
{name = "Brad Keryan", email = "brad.keryan@emerson.com"}
|
|
10
|
+
]
|
|
11
|
+
readme = "README.md"
|
|
12
|
+
keywords = ["ni-apis", "sessionmanagement"]
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Development Status :: 5 - Production/Stable",
|
|
15
|
+
"Intended Audience :: Developers",
|
|
16
|
+
"Intended Audience :: Manufacturing",
|
|
17
|
+
"Intended Audience :: Science/Research",
|
|
18
|
+
"License :: OSI Approved :: MIT License",
|
|
19
|
+
"Operating System :: Microsoft :: Windows",
|
|
20
|
+
"Operating System :: POSIX",
|
|
21
|
+
"Programming Language :: Python :: 3",
|
|
22
|
+
"Programming Language :: Python :: 3.10",
|
|
23
|
+
"Programming Language :: Python :: 3.11",
|
|
24
|
+
"Programming Language :: Python :: 3.12",
|
|
25
|
+
"Programming Language :: Python :: 3.13",
|
|
26
|
+
"Programming Language :: Python :: 3.14",
|
|
27
|
+
"Programming Language :: Python :: Implementation :: CPython",
|
|
28
|
+
]
|
|
29
|
+
dynamic = ["dependencies"]
|
|
30
|
+
requires-python = '>=3.10,<4.0'
|
|
31
|
+
|
|
32
|
+
[project.urls]
|
|
33
|
+
repository = "https://github.com/ni/ni-apis-python"
|
|
34
|
+
documentation = "https://nimeasurementlinksessionmanagementclient.readthedocs.io/en/latest/"
|
|
35
|
+
|
|
36
|
+
[tool.poetry]
|
|
37
|
+
packages = [{include = "ni", from = "src"}]
|
|
38
|
+
requires-poetry = '>=2.1,<3.0'
|
|
39
|
+
|
|
40
|
+
[tool.poetry.dependencies]
|
|
41
|
+
protobuf = {version=">=4.21"}
|
|
42
|
+
pywin32 = { version = ">=303", platform = "win32" }
|
|
43
|
+
deprecation = ">=2.1"
|
|
44
|
+
traceloggingdynamic = { version = ">=1.0", platform = "win32" }
|
|
45
|
+
python-decouple = ">=3.8"
|
|
46
|
+
nidaqmx = { version = ">=0.8.0", extras = ["grpc"], optional = true }
|
|
47
|
+
nidcpower = { version = ">=1.4.4", extras = ["grpc"], optional = true }
|
|
48
|
+
nidigital = { version = ">=1.4.4", extras = ["grpc"], optional = true }
|
|
49
|
+
nidmm = { version = ">=1.4.4", extras = ["grpc"], optional = true }
|
|
50
|
+
nifgen = { version = ">=1.4.4", extras = ["grpc"], optional = true }
|
|
51
|
+
niscope = { version = ">=1.4.4", extras = ["grpc"], optional = true }
|
|
52
|
+
niswitch = { version = ">=1.4.4", extras = ["grpc"], optional = true }
|
|
53
|
+
ni-measurementlink-sessionmanagement-v1-proto = { version = ">=1.1.0" }
|
|
54
|
+
ni-measurementlink-pinmap-v1-proto = { version = ">=1.1.0" }
|
|
55
|
+
ni-measurementlink-proto = { version = ">=1.1.0" }
|
|
56
|
+
ni-grpcdevice-v1-proto = { version = ">=1.1.0" }
|
|
57
|
+
ni-grpc-extensions = { version = ">=1.1.0" }
|
|
58
|
+
ni-measurementlink-discovery-v1-client = { version = ">=1.1.0" }
|
|
59
|
+
|
|
60
|
+
[tool.poetry.group.dev.dependencies]
|
|
61
|
+
types-grpcio = ">=1.0"
|
|
62
|
+
types-protobuf = ">=4.21"
|
|
63
|
+
types-pywin32 = ">=311.0.0.20250822"
|
|
64
|
+
|
|
65
|
+
[tool.poetry.group.lint.dependencies]
|
|
66
|
+
bandit = { version = ">=1.7", extras = ["toml"] }
|
|
67
|
+
ni-python-styleguide = ">=0.4.1"
|
|
68
|
+
mypy = ">=1.0"
|
|
69
|
+
pyright = { version = ">=1.1.400", extras = ["nodejs"] }
|
|
70
|
+
|
|
71
|
+
[tool.poetry.group.test.dependencies]
|
|
72
|
+
pytest = ">=7.2"
|
|
73
|
+
pytest-cov = ">=4.0"
|
|
74
|
+
pytest-doctestplus = ">=1.4"
|
|
75
|
+
pytest-mock = ">=3.0"
|
|
76
|
+
# Use a prerelease version of hightime for testing.
|
|
77
|
+
hightime = { version = ">=0.3.0.dev0", allow-prereleases = true }
|
|
78
|
+
|
|
79
|
+
[tool.poetry.extras]
|
|
80
|
+
drivers = [
|
|
81
|
+
"nidaqmx",
|
|
82
|
+
"nidcpower",
|
|
83
|
+
"nidigital",
|
|
84
|
+
"nidmm",
|
|
85
|
+
"nifgen",
|
|
86
|
+
"niscope",
|
|
87
|
+
"niswitch",
|
|
88
|
+
]
|
|
89
|
+
nidaqmx = ["nidaqmx"]
|
|
90
|
+
nidcpower = ["nidcpower"]
|
|
91
|
+
nidigital = ["nidigital"]
|
|
92
|
+
nidmm = ["nidmm"]
|
|
93
|
+
nifgen = ["nifgen"]
|
|
94
|
+
niscope = ["niscope"]
|
|
95
|
+
niswitch = ["niswitch"]
|
|
96
|
+
|
|
97
|
+
[tool.poetry.group.docs]
|
|
98
|
+
optional = true
|
|
99
|
+
|
|
100
|
+
[tool.poetry.group.docs.dependencies]
|
|
101
|
+
# The latest Sphinx requires a recent Python version.
|
|
102
|
+
Sphinx = [
|
|
103
|
+
{ version = ">=8.1", python = ">=3.10,<3.11" },
|
|
104
|
+
{ version = ">=8.2", python = "^3.11" },
|
|
105
|
+
]
|
|
106
|
+
sphinx-rtd-theme = ">=1.0.0"
|
|
107
|
+
sphinx-autoapi = ">=1.8.4"
|
|
108
|
+
m2r2 = ">=0.3.2"
|
|
109
|
+
toml = ">=0.10.2"
|
|
110
|
+
|
|
111
|
+
[build-system]
|
|
112
|
+
requires = ["poetry-core>=2.1.0,<3.0"]
|
|
113
|
+
build-backend = "poetry.core.masonry.api"
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
[tool.bandit]
|
|
117
|
+
skips = [
|
|
118
|
+
"B101", # assert_used
|
|
119
|
+
]
|
|
120
|
+
|
|
121
|
+
[tool.ni-python-styleguide]
|
|
122
|
+
extend_exclude = "docs,*_pb2_grpc.py,*_pb2_grpc.pyi,*_pb2.py,*_pb2.pyi"
|
|
123
|
+
application-import-names = "ni.measurementlink.sessionmanagement.v1.client"
|
|
124
|
+
|
|
125
|
+
[tool.black]
|
|
126
|
+
extend-exclude = 'docs/|_pb2(_grpc)?\.(py|pyi)$'
|
|
127
|
+
line-length = 100
|
|
128
|
+
|
|
129
|
+
[tool.mypy]
|
|
130
|
+
mypy_path = "src"
|
|
131
|
+
files = "."
|
|
132
|
+
namespace_packages = true
|
|
133
|
+
strict = true
|
|
134
|
+
explicit_package_bases = true
|
|
135
|
+
exclude = ["docs"]
|
|
136
|
+
|
|
137
|
+
[[tool.mypy.overrides]]
|
|
138
|
+
module = [
|
|
139
|
+
"decouple",
|
|
140
|
+
"deprecation",
|
|
141
|
+
"ni_grpc_extensions.channelpool",
|
|
142
|
+
"nidaqmx",
|
|
143
|
+
"nidcpower",
|
|
144
|
+
"nidigital",
|
|
145
|
+
"nidmm",
|
|
146
|
+
"nifgen",
|
|
147
|
+
"niscope",
|
|
148
|
+
"niswitch"
|
|
149
|
+
]
|
|
150
|
+
ignore_missing_imports = true
|
|
151
|
+
|
|
152
|
+
[[tool.mypy.overrides]]
|
|
153
|
+
module = "ni.measurementlink.sessionmanagement.v1.client._drivers._grpcdevice"
|
|
154
|
+
disable_error_code = ["no-any-return"]
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
[[tool.mypy.overrides]]
|
|
158
|
+
module = "ni_grpc_extensions.channelpool"
|
|
159
|
+
ignore_missing_imports = true
|
|
160
|
+
|
|
161
|
+
[tool.pyright]
|
|
162
|
+
include = ["src/"]
|
|
163
|
+
exclude = ["**/*_pb2_grpc.py", "**/*_pb2_grpc.pyi", "**/*_pb2.py", "**/*_pb2.pyi"]
|
|
164
|
+
|
|
165
|
+
[tool.pytest.ini_options]
|
|
166
|
+
addopts = "--doctest-modules --doctest-plus --strict-markers"
|
|
167
|
+
testpaths = ["tests"]
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"""Public API for accessing the measurement plug-in management service."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import warnings
|
|
6
|
+
from typing import Any
|
|
7
|
+
|
|
8
|
+
from deprecation import DeprecatedWarning
|
|
9
|
+
|
|
10
|
+
from ni.measurementlink.sessionmanagement.v1.client._client import (
|
|
11
|
+
SessionManagementClient,
|
|
12
|
+
)
|
|
13
|
+
from ni.measurementlink.sessionmanagement.v1.client._constants import (
|
|
14
|
+
GRPC_SERVICE_CLASS,
|
|
15
|
+
GRPC_SERVICE_INTERFACE_NAME,
|
|
16
|
+
INSTRUMENT_TYPE_NI_DAQMX,
|
|
17
|
+
INSTRUMENT_TYPE_NI_DCPOWER,
|
|
18
|
+
INSTRUMENT_TYPE_NI_DIGITAL_PATTERN,
|
|
19
|
+
INSTRUMENT_TYPE_NI_DMM,
|
|
20
|
+
INSTRUMENT_TYPE_NI_FGEN,
|
|
21
|
+
INSTRUMENT_TYPE_NI_HSDIO,
|
|
22
|
+
INSTRUMENT_TYPE_NI_MODEL_BASED_INSTRUMENT,
|
|
23
|
+
INSTRUMENT_TYPE_NI_RELAY_DRIVER,
|
|
24
|
+
INSTRUMENT_TYPE_NI_RFMX,
|
|
25
|
+
INSTRUMENT_TYPE_NI_RFPM,
|
|
26
|
+
INSTRUMENT_TYPE_NI_RFSA,
|
|
27
|
+
INSTRUMENT_TYPE_NI_RFSG,
|
|
28
|
+
INSTRUMENT_TYPE_NI_SCOPE,
|
|
29
|
+
INSTRUMENT_TYPE_NI_SWITCH_EXECUTIVE_VIRTUAL_DEVICE,
|
|
30
|
+
INSTRUMENT_TYPE_NONE,
|
|
31
|
+
SITE_SYSTEM_PINS,
|
|
32
|
+
)
|
|
33
|
+
from ni.measurementlink.sessionmanagement.v1.client._reservation import (
|
|
34
|
+
BaseReservation,
|
|
35
|
+
MultiplexerSessionContainer,
|
|
36
|
+
MultiSessionReservation,
|
|
37
|
+
SingleSessionReservation,
|
|
38
|
+
)
|
|
39
|
+
from ni.measurementlink.sessionmanagement.v1.client._types import (
|
|
40
|
+
ChannelMapping,
|
|
41
|
+
Connection,
|
|
42
|
+
MultiplexerSessionInformation,
|
|
43
|
+
PinMapContext,
|
|
44
|
+
SessionInformation,
|
|
45
|
+
SessionInitializationBehavior,
|
|
46
|
+
TypedConnection,
|
|
47
|
+
TypedConnectionWithMultiplexer,
|
|
48
|
+
TypedMultiplexerSessionInformation,
|
|
49
|
+
TypedSessionInformation,
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
__all__ = [
|
|
53
|
+
"BaseReservation",
|
|
54
|
+
"ChannelMapping",
|
|
55
|
+
"Client",
|
|
56
|
+
"Connection",
|
|
57
|
+
"GRPC_SERVICE_CLASS",
|
|
58
|
+
"GRPC_SERVICE_INTERFACE_NAME",
|
|
59
|
+
"INSTRUMENT_TYPE_NI_DAQMX",
|
|
60
|
+
"INSTRUMENT_TYPE_NI_DCPOWER",
|
|
61
|
+
"INSTRUMENT_TYPE_NI_DIGITAL_PATTERN",
|
|
62
|
+
"INSTRUMENT_TYPE_NI_DMM",
|
|
63
|
+
"INSTRUMENT_TYPE_NI_FGEN",
|
|
64
|
+
"INSTRUMENT_TYPE_NI_HSDIO",
|
|
65
|
+
"INSTRUMENT_TYPE_NI_MODEL_BASED_INSTRUMENT",
|
|
66
|
+
"INSTRUMENT_TYPE_NI_RELAY_DRIVER",
|
|
67
|
+
"INSTRUMENT_TYPE_NI_RFMX",
|
|
68
|
+
"INSTRUMENT_TYPE_NI_RFPM",
|
|
69
|
+
"INSTRUMENT_TYPE_NI_RFSA",
|
|
70
|
+
"INSTRUMENT_TYPE_NI_RFSG",
|
|
71
|
+
"INSTRUMENT_TYPE_NI_SCOPE",
|
|
72
|
+
"INSTRUMENT_TYPE_NI_SWITCH_EXECUTIVE_VIRTUAL_DEVICE",
|
|
73
|
+
"INSTRUMENT_TYPE_NONE",
|
|
74
|
+
"MultiSessionReservation",
|
|
75
|
+
"PinMapContext",
|
|
76
|
+
"MultiplexerSessionContainer",
|
|
77
|
+
"MultiplexerSessionInformation",
|
|
78
|
+
"SessionInformation",
|
|
79
|
+
"SessionInitializationBehavior",
|
|
80
|
+
"SessionManagementClient",
|
|
81
|
+
"SingleSessionReservation",
|
|
82
|
+
"SITE_SYSTEM_PINS",
|
|
83
|
+
"TypedConnection",
|
|
84
|
+
"TypedConnectionWithMultiplexer",
|
|
85
|
+
"TypedMultiplexerSessionInformation",
|
|
86
|
+
"TypedSessionInformation",
|
|
87
|
+
]
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def __getattr__(name: str) -> Any:
|
|
91
|
+
if name == "Reservation":
|
|
92
|
+
warnings.warn(
|
|
93
|
+
DeprecatedWarning(
|
|
94
|
+
name,
|
|
95
|
+
deprecated_in="1.1.0",
|
|
96
|
+
removed_in=None,
|
|
97
|
+
details="Use MultiSessionReservation instead.",
|
|
98
|
+
),
|
|
99
|
+
stacklevel=2,
|
|
100
|
+
)
|
|
101
|
+
return MultiSessionReservation
|
|
102
|
+
else:
|
|
103
|
+
raise AttributeError(f"module {__name__} has no attribute {name}")
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
Client = SessionManagementClient
|
|
107
|
+
"""Alias for compatibility with code that uses session_management.Client."""
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import socket
|
|
5
|
+
import sys
|
|
6
|
+
|
|
7
|
+
from ni.measurementlink.sessionmanagement.v1.annotations import (
|
|
8
|
+
REGISTERED_HOSTNAME,
|
|
9
|
+
REGISTERED_IPADDRESS,
|
|
10
|
+
REGISTERED_USERNAME,
|
|
11
|
+
RESERVED_HOSTNAME,
|
|
12
|
+
RESERVED_IPADDRESS,
|
|
13
|
+
RESERVED_USERNAME,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def get_machine_details() -> tuple[dict[str, str], dict[str, str]]:
|
|
18
|
+
"""Get the machine details for reserved and registered annotations."""
|
|
19
|
+
hostname = _get_hostname()
|
|
20
|
+
username = _get_username()
|
|
21
|
+
ip_address = _get_ip_address()
|
|
22
|
+
|
|
23
|
+
reserved = {
|
|
24
|
+
RESERVED_HOSTNAME: hostname,
|
|
25
|
+
RESERVED_USERNAME: username,
|
|
26
|
+
RESERVED_IPADDRESS: ip_address,
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
registered = {
|
|
30
|
+
REGISTERED_HOSTNAME: hostname,
|
|
31
|
+
REGISTERED_USERNAME: username,
|
|
32
|
+
REGISTERED_IPADDRESS: ip_address,
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return reserved, registered
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def remove_reservation_annotations(annotations: dict[str, str] | None) -> dict[str, str]:
|
|
39
|
+
"""Remove reserved annotations from the provided annotations."""
|
|
40
|
+
if annotations is None:
|
|
41
|
+
return {}
|
|
42
|
+
reservation_keys = {
|
|
43
|
+
RESERVED_HOSTNAME,
|
|
44
|
+
RESERVED_USERNAME,
|
|
45
|
+
RESERVED_IPADDRESS,
|
|
46
|
+
}
|
|
47
|
+
return {k: v for k, v in annotations.items() if k not in reservation_keys}
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def _get_hostname() -> str:
|
|
51
|
+
if sys.platform == "win32":
|
|
52
|
+
try:
|
|
53
|
+
import win32api # pyright: ignore[reportMissingModuleSource]
|
|
54
|
+
|
|
55
|
+
return win32api.GetComputerName()
|
|
56
|
+
except Exception:
|
|
57
|
+
return ""
|
|
58
|
+
else:
|
|
59
|
+
return socket.gethostname()
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def _get_username() -> str:
|
|
63
|
+
if sys.platform == "win32":
|
|
64
|
+
try:
|
|
65
|
+
import win32api # pyright: ignore[reportMissingModuleSource]
|
|
66
|
+
|
|
67
|
+
return win32api.GetUserName()
|
|
68
|
+
except Exception:
|
|
69
|
+
return ""
|
|
70
|
+
else:
|
|
71
|
+
return os.environ.get("USER", "")
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def _get_ip_address() -> str:
|
|
75
|
+
try:
|
|
76
|
+
ipv4_addresses = [
|
|
77
|
+
info[4][0] for info in socket.getaddrinfo(socket.gethostname(), None, socket.AF_INET)
|
|
78
|
+
]
|
|
79
|
+
return str(ipv4_addresses[0]) if ipv4_addresses else ""
|
|
80
|
+
except Exception:
|
|
81
|
+
return ""
|