Skip to content

Commit 30b3c5b

Browse files
committed
Replace Optional and Union types with | syntax
1 parent 3f3d352 commit 30b3c5b

File tree

140 files changed

+1104
-1129
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+1104
-1129
lines changed

nisystemlink/clients/artifact/_artifact_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Implementation of ArtifactClient"""
22

3-
from typing import BinaryIO, Optional
3+
from typing import BinaryIO
44

55
from nisystemlink.clients import core
66
from nisystemlink.clients.core._uplink._base_client import BaseClient
@@ -18,7 +18,7 @@
1818

1919

2020
class ArtifactClient(BaseClient):
21-
def __init__(self, configuration: Optional[core.HttpConfiguration] = None):
21+
def __init__(self, configuration: core.HttpConfiguration | None = None):
2222
"""Initialize an instance.
2323
2424
Args:

nisystemlink/clients/assetmanagement/_asset_management_client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Implementation of AssetManagementClient."""
22

3-
from typing import List, Optional
3+
from typing import List
44

55
from nisystemlink.clients import core
66
from nisystemlink.clients.core._http_configuration import HttpConfiguration
@@ -17,7 +17,7 @@
1717
on_exception=retry.CONNECTION_ERROR,
1818
)
1919
class AssetManagementClient(BaseClient):
20-
def __init__(self, configuration: Optional[HttpConfiguration] = None):
20+
def __init__(self, configuration: HttpConfiguration | None = None):
2121
"""Initialize an instance.
2222
2323
Args:
@@ -126,7 +126,7 @@ def delete_assets(self, ids: List[str]) -> models.DeleteAssetsResponse:
126126
@post("assets/{assetId}/file", args=[Path("assetId"), Field("fileIds")])
127127
def link_files(
128128
self, asset_id: str, file_ids: List[str]
129-
) -> Optional[models.LinkFilesPartialSuccessResponse]:
129+
) -> models.LinkFilesPartialSuccessResponse | None:
130130
"""Link files to an asset.
131131
132132
Args:
Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from datetime import datetime
2-
from typing import Dict, List, Optional
2+
from typing import Dict, List
33

44
from nisystemlink.clients.core._uplink._json_model import JsonModel
55
from pydantic import Field
@@ -17,98 +17,98 @@
1717
class Asset(JsonModel):
1818
"""Model for an object describing an asset with all of its properties."""
1919

20-
model_name: Optional[str] = None
20+
model_name: str | None = None
2121
"""Gets or sets model name of the asset."""
2222

23-
model_number: Optional[int] = None
23+
model_number: int | None = None
2424
"""Gets or sets model number of the asset."""
2525

26-
serial_number: Optional[str] = None
26+
serial_number: str | None = None
2727
"""Gets or sets serial number of the asset."""
2828

29-
vendor_name: Optional[str] = None
29+
vendor_name: str | None = None
3030
"""Gets or sets vendor name of the asset."""
3131

32-
vendor_number: Optional[int] = None
32+
vendor_number: int | None = None
3333
"""Gets or sets vendor number of the asset."""
3434

35-
bus_type: Optional[AssetBusType] = None
35+
bus_type: AssetBusType | None = None
3636
"""Gets or sets all supported bus types for an asset."""
3737

38-
name: Optional[str] = None
38+
name: str | None = None
3939
"""Gets or sets name of the asset."""
4040

41-
asset_type: Optional[AssetType] = None
41+
asset_type: AssetType | None = None
4242
"""Gets or sets all supported asset types."""
4343

44-
discovery_type: Optional[AssetDiscoveryType] = None
44+
discovery_type: AssetDiscoveryType | None = None
4545
"""Gets or sets the discovery type."""
4646

47-
firmware_version: Optional[str] = None
47+
firmware_version: str | None = None
4848
"""Gets or sets firmware version of the asset."""
4949

50-
hardware_version: Optional[str] = None
50+
hardware_version: str | None = None
5151
"""Gets or sets hardware version of the asset."""
5252

53-
visa_resource_name: Optional[str] = None
53+
visa_resource_name: str | None = None
5454
"""Gets or sets VISA resource name of the asset."""
5555

56-
temperature_sensors: Optional[List[TemperatureSensor]] = None
56+
temperature_sensors: List[TemperatureSensor] | None = None
5757
"""Gets or sets an array of temperature sensor information."""
5858

59-
supports_self_calibration: Optional[bool] = None
59+
supports_self_calibration: bool | None = None
6060
"""Gets or sets whether the asset supports self-calibration."""
6161

62-
supports_external_calibration: Optional[bool] = None
62+
supports_external_calibration: bool | None = None
6363
"""Gets or sets whether the asset supports external calibration."""
6464

65-
custom_calibration_interval: Optional[int] = None
65+
custom_calibration_interval: int | None = None
6666
"""Gets or sets the interval represented in months used for computing calibration due date."""
6767

68-
self_calibration: Optional[SelfCalibration] = None
68+
self_calibration: SelfCalibration | None = None
6969
"""Gets or sets the last self-calibration of the asset."""
7070

71-
is_NI_asset: Optional[bool] = Field(alias="isNIAsset", default=None)
71+
is_NI_asset: bool | None = Field(alias="isNIAsset", default=None)
7272
"""Gets or sets whether this asset is an NI asset (true) or a third-party asset (false)."""
7373

74-
id: Optional[str] = None
74+
id: str | None = None
7575
"""Gets or sets unique identifier of the asset."""
7676

77-
location: Optional[AssetLocation] = None
77+
location: AssetLocation | None = None
7878
"""Model for information about the asset location, presence and the connection status of the system"""
7979

80-
calibration_status: Optional[CalibrationStatus] = None
80+
calibration_status: CalibrationStatus | None = None
8181
"""Gets or sets the calibration category the asset belongs to based on the next due calibration date."""
8282

83-
is_system_controller: Optional[bool] = None
83+
is_system_controller: bool | None = None
8484
"""Gets or sets whether this asset represents a System Controller."""
8585

86-
external_calibration: Optional[ExternalCalibration] = None
86+
external_calibration: ExternalCalibration | None = None
8787
"""Gets or sets the last external calibration of the asset."""
8888

89-
workspace: Optional[str] = None
89+
workspace: str | None = None
9090
"""Gets or sets the ID of the workspace."""
9191

92-
properties: Optional[Dict[str, str]] = None
92+
properties: Dict[str, str] | None = None
9393
""" Gets or sets key-value-pair metadata associated with an asset."""
9494

95-
keywords: Optional[List[str]] = None
95+
keywords: List[str] | None = None
9696
"""Gets or sets words or phrases associated with an asset."""
9797

98-
last_updated_timestamp: Optional[datetime] = None
98+
last_updated_timestamp: datetime | None = None
9999
"""Gets or sets ISO-8601 formatted timestamp specifying the last date that the asset has had a property update."""
100100

101-
file_ids: Optional[List[str]] = None
101+
file_ids: List[str] | None = None
102102
"""Gets or sets all files linked to the asset."""
103103

104-
supports_self_test: Optional[bool] = None
104+
supports_self_test: bool | None = None
105105
"""Gets or sets whether the asset supports self-test."""
106106

107-
supports_reset: Optional[bool] = None
107+
supports_reset: bool | None = None
108108
"""Gets or sets whether the asset supports reset."""
109109

110-
part_number: Optional[str] = None
110+
part_number: str | None = None
111111
"""Gets or sets part number of the asset."""
112112

113-
out_for_calibration: Optional[bool] = None
113+
out_for_calibration: bool | None = None
114114
"""Get or set whether the asset is out for calibration."""

nisystemlink/clients/assetmanagement/models/_asset_calibration.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from datetime import datetime
44
from enum import Enum
5-
from typing import List, Optional
5+
from typing import List
66

77
from nisystemlink.clients.core._uplink._json_model import JsonModel
88

@@ -19,18 +19,18 @@ class CalibrationStatus(Enum):
1919
class TemperatureSensor(JsonModel):
2020
"""Temperature sensor information."""
2121

22-
name: Optional[str] = None
22+
name: str | None = None
2323
"""Gets or sets sensor name."""
2424

2525
reading: float
2626
"""Gets or sets sensor reading."""
2727

2828

2929
class SelfCalibration(JsonModel):
30-
temperature_sensors: Optional[List[TemperatureSensor]] = None
30+
temperature_sensors: List[TemperatureSensor] | None = None
3131
"""Gets or sets an array of temperature sensor information."""
3232

33-
is_limited: Optional[bool] = None
33+
is_limited: bool | None = None
3434
"""Gets or sets whether the last self-calibration of the asset was a limited calibration."""
3535

3636
date: datetime
@@ -45,10 +45,10 @@ class CalibrationMode(Enum):
4545

4646

4747
class ExternalCalibration(JsonModel):
48-
temperature_sensors: Optional[List[TemperatureSensor]] = None
48+
temperature_sensors: List[TemperatureSensor] | None = None
4949
"""Gets or sets an array of temperature sensor information."""
5050

51-
is_limited: Optional[bool] = None
51+
is_limited: bool | None = None
5252
"""Gets or sets whether the last external calibration of the asset was a limited calibration."""
5353

5454
date: datetime
@@ -60,14 +60,14 @@ class ExternalCalibration(JsonModel):
6060
next_recommended_date: datetime
6161
"""Gets or sets ISO-8601 formatted timestamp specifying the recommended date for the next external calibration."""
6262

63-
next_custom_due_date: Optional[datetime] = None
63+
next_custom_due_date: datetime | None = None
6464
"""Gets or sets ISO-8601 formatted timestamp specifying the date for the next external calibration."""
6565

66-
resolved_due_date: Optional[datetime] = None
66+
resolved_due_date: datetime | None = None
6767
"""Gets ISO-8601 formatted timestamp specifying the resolved due date for external calibration."""
6868

69-
comments: Optional[str] = None
69+
comments: str | None = None
7070
"""Gets or sets calibration comments provided by an operator."""
7171

72-
entry_type: Optional[CalibrationMode] = None
72+
entry_type: CalibrationMode | None = None
7373
"""Gets or sets whether automatically discovered the calibration data for an asset or manually entered."""

nisystemlink/clients/assetmanagement/models/_asset_location.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from enum import Enum
2-
from typing import Optional
32

43
from nisystemlink.clients.core._uplink._json_model import JsonModel
54

@@ -36,7 +35,7 @@ class AssetPresenceWithSystemConnection(JsonModel):
3635
asset_presence: AssetPresenceStatus
3736
"""Gets or sets the status of an asset's presence in a system."""
3837

39-
system_connection: Optional[SystemConnection] = None
38+
system_connection: SystemConnection | None = None
4039
"""Gets or sets whether or not the minion is connected to the server and has updated the server with its data."""
4140

4241

@@ -50,19 +49,19 @@ class AssetPresence(JsonModel):
5049
class _AssetLocation(JsonModel):
5150
"""local model for information about the asset location, presence and the connection status of the system."""
5251

53-
minion_id: Optional[str] = None
52+
minion_id: str | None = None
5453
"""Gets or sets identifier of the minion where the asset is located."""
5554

56-
physical_location: Optional[str] = None
55+
physical_location: str | None = None
5756
"""Gets or sets the physical location of the asset."""
5857

59-
parent: Optional[str] = None
58+
parent: str | None = None
6059
"""Gets or sets the parent of the asset."""
6160

62-
resource_uri: Optional[str] = None
61+
resource_uri: str | None = None
6362
"""Gets or sets identifier of a resource."""
6463

65-
slot_number: Optional[int] = None
64+
slot_number: int | None = None
6665
"""Gets or sets the number of the slot in which the asset is located."""
6766

6867

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Dict, List, Optional
1+
from typing import Dict, List
22

33
from nisystemlink.clients.core._uplink._json_model import JsonModel
44
from pydantic import Field
@@ -17,83 +17,83 @@
1717
class CreateAssetRequest(JsonModel):
1818
"""Model for an object describing the properties for creating an asset."""
1919

20-
model_name: Optional[str] = None
20+
model_name: str | None = None
2121
"""Gets or sets model name of the asset."""
2222

23-
model_number: Optional[int] = None
23+
model_number: int | None = None
2424
"""Gets or sets model number of the asset."""
2525

26-
serial_number: Optional[str] = None
26+
serial_number: str | None = None
2727
"""Gets or sets serial number of the asset."""
2828

29-
vendor_name: Optional[str] = None
29+
vendor_name: str | None = None
3030
"""Gets or sets vendor name of the asset."""
3131

32-
vendor_number: Optional[int] = None
32+
vendor_number: int | None = None
3333
"""Gets or sets vendor number of the asset."""
3434

35-
bus_type: Optional[AssetBusType] = None
35+
bus_type: AssetBusType | None = None
3636
"""Gets or sets all supported bus types for an asset."""
3737

38-
name: Optional[str] = None
38+
name: str | None = None
3939
"""Gets or sets name of the asset."""
4040

41-
asset_type: Optional[AssetType] = None
41+
asset_type: AssetType | None = None
4242
"""Gets or sets all supported asset types."""
4343

44-
firmware_version: Optional[str] = None
44+
firmware_version: str | None = None
4545
"""Gets or sets firmware version of the asset."""
4646

47-
hardware_version: Optional[str] = None
47+
hardware_version: str | None = None
4848
"""Gets or sets hardware version of the asset."""
4949

50-
visa_resource_name: Optional[str] = None
50+
visa_resource_name: str | None = None
5151
"""Gets or sets VISA resource name of the asset."""
5252

53-
temperature_sensors: Optional[List[TemperatureSensor]] = None
53+
temperature_sensors: List[TemperatureSensor] | None = None
5454
"""Gets or sets an array of temperature sensor information."""
5555

56-
supports_self_calibration: Optional[bool] = None
56+
supports_self_calibration: bool | None = None
5757
"""Gets or sets whether the asset supports self-calibration."""
5858

59-
supports_external_calibration: Optional[bool] = None
59+
supports_external_calibration: bool | None = None
6060
"""Gets or sets whether the asset supports external calibration."""
6161

62-
custom_calibration_interval: Optional[int] = None
62+
custom_calibration_interval: int | None = None
6363
"""Gets or sets the interval represented in months used for computing calibration due date."""
6464

65-
self_calibration: Optional[SelfCalibration] = None
65+
self_calibration: SelfCalibration | None = None
6666
"""Gets or sets the last self-calibration of the asset."""
6767

68-
is_NI_asset: Optional[bool] = Field(alias="isNIAsset", default=None)
68+
is_NI_asset: bool | None = Field(alias="isNIAsset", default=None)
6969
"""Gets or sets whether this asset is an NI asset (true) or a third-party asset (false)."""
7070

71-
workspace: Optional[str] = None
71+
workspace: str | None = None
7272
"""Gets or sets the ID of the workspace."""
7373

7474
location: AssetLocationForCreate
7575
"""Model for information about the asset location, presence and the connection status of the system"""
7676

77-
external_calibration: Optional[ExternalCalibration] = None
77+
external_calibration: ExternalCalibration | None = None
7878
"""Gets or sets the last external calibration of the asset."""
7979

80-
properties: Optional[Dict[str, str]] = None
80+
properties: Dict[str, str] | None = None
8181
""" Gets or sets key-value-pair metadata associated with an asset."""
8282

83-
keywords: Optional[List[str]] = None
83+
keywords: List[str] | None = None
8484
"""Gets or sets words or phrases associated with an asset."""
8585

86-
discovery_type: Optional[AssetDiscoveryType] = None
86+
discovery_type: AssetDiscoveryType | None = None
8787
"""Gets or sets the discovery type."""
8888

89-
file_ids: Optional[List[str]] = None
89+
file_ids: List[str] | None = None
9090
"""Gets or sets all files linked to the asset."""
9191

92-
supports_self_test: Optional[bool] = None
92+
supports_self_test: bool | None = None
9393
"""Gets or sets whether the asset supports self-test."""
9494

95-
supports_reset: Optional[bool] = None
95+
supports_reset: bool | None = None
9696
"""Gets or sets whether the asset supports reset."""
9797

98-
part_number: Optional[str] = None
98+
part_number: str | None = None
9999
"""Gets or sets part number of the asset."""

0 commit comments

Comments
 (0)