@@ -189,7 +189,14 @@ def receive(self) -> int | NaType:
189
189
return self .rx
190
190
191
191
192
- _VALUE_OMITTED : str = object () # type: ignore[assignment]
192
+ # pylint: disable-next=missing-class-docstring,too-few-public-methods
193
+ class ValueOmitted :
194
+ def __repr__ (self ) -> str :
195
+ return '<VALUE OMITTED>'
196
+
197
+
198
+ _VALUE_OMITTED : str = ValueOmitted () # type: ignore[assignment]
199
+ del ValueOmitted
193
200
194
201
195
202
class Device : # pylint: disable=too-many-instance-attributes,too-many-public-methods
@@ -2904,14 +2911,17 @@ class _PhysicalDeviceAttrs(NamedTuple):
2904
2911
support_mig_mode : bool
2905
2912
2906
2913
2907
- _PHYSICAL_DEVICE_ATTRS = None
2908
- _GLOBAL_PHYSICAL_DEVICE = None
2909
- _GLOBAL_PHYSICAL_DEVICE_LOCK = threading .RLock ()
2914
+ _PHYSICAL_DEVICE_ATTRS : OrderedDict [ str , _PhysicalDeviceAttrs ] | None = None
2915
+ _GLOBAL_PHYSICAL_DEVICE : PhysicalDevice | None = None
2916
+ _GLOBAL_PHYSICAL_DEVICE_LOCK : threading . RLock = threading .RLock ()
2910
2917
2911
2918
2912
- def _get_all_physical_device_attrs () -> dict [str , _PhysicalDeviceAttrs ]:
2919
+ def _get_all_physical_device_attrs () -> OrderedDict [str , _PhysicalDeviceAttrs ]:
2913
2920
global _PHYSICAL_DEVICE_ATTRS # pylint: disable=global-statement
2914
2921
2922
+ if _PHYSICAL_DEVICE_ATTRS is not None :
2923
+ return _PHYSICAL_DEVICE_ATTRS
2924
+
2915
2925
with _GLOBAL_PHYSICAL_DEVICE_LOCK :
2916
2926
if _PHYSICAL_DEVICE_ATTRS is None :
2917
2927
_PHYSICAL_DEVICE_ATTRS = OrderedDict (
@@ -3138,10 +3148,7 @@ def _parse_cuda_visible_devices_to_uuids(
3138
3148
parser .start ()
3139
3149
parser .join ()
3140
3150
finally :
3141
- try :
3142
- parser .kill () # requires Python 3.7+
3143
- except AttributeError :
3144
- pass
3151
+ parser .kill ()
3145
3152
result = queue .get ()
3146
3153
3147
3154
if isinstance (result , Exception ):
0 commit comments