@@ -79,10 +79,10 @@ def __post_init__(self) -> None:
79
79
internal_point = odxrequire (scale .lower_limit ).value
80
80
physical_point = odxrequire (scale .compu_const ).value
81
81
82
- if not isinstance (internal_point , float | int ):
82
+ if not isinstance (internal_point , ( float , int ) ):
83
83
odxraise ("The type of values of tab-intp compumethods must "
84
84
"either int or float" )
85
- if not isinstance (physical_point , float | int ):
85
+ if not isinstance (physical_point , ( float , int ) ):
86
86
odxraise ("The type of values of tab-intp compumethods must "
87
87
"either int or float" )
88
88
@@ -140,13 +140,13 @@ def __piecewise_linear_interpolate(self, x: int | float, range_samples: list[int
140
140
return None
141
141
142
142
def convert_physical_to_internal (self , physical_value : AtomicOdxType ) -> AtomicOdxType :
143
- if not isinstance (physical_value , int | float ):
143
+ if not isinstance (physical_value , ( int , float ) ):
144
144
odxraise ("The type of values of tab-intp compumethods must "
145
145
"either int or float" , EncodeError )
146
146
return None
147
147
148
148
odxassert (
149
- isinstance (physical_value , int | float ),
149
+ isinstance (physical_value , ( int , float ) ),
150
150
"Only integers and floats can be piecewise linearly interpolated" , EncodeError )
151
151
result = self .__piecewise_linear_interpolate (physical_value , self ._physical_points ,
152
152
self ._internal_points )
@@ -161,14 +161,14 @@ def convert_physical_to_internal(self, physical_value: AtomicOdxType) -> AtomicO
161
161
return res
162
162
163
163
def convert_internal_to_physical (self , internal_value : AtomicOdxType ) -> AtomicOdxType :
164
- if not isinstance (internal_value , int | float ):
164
+ if not isinstance (internal_value , ( int , float ) ):
165
165
odxraise (
166
166
"The internal type of values of tab-intp compumethods must "
167
167
"either int or float" , EncodeError )
168
168
return None
169
169
170
170
odxassert (
171
- isinstance (internal_value , int | float ),
171
+ isinstance (internal_value , ( int , float ) ),
172
172
"Only integers and floats can be piecewise linearly interpolated" , DecodeError )
173
173
174
174
result = self .__piecewise_linear_interpolate (internal_value , self ._internal_points ,
@@ -185,14 +185,14 @@ def convert_internal_to_physical(self, internal_value: AtomicOdxType) -> AtomicO
185
185
return res
186
186
187
187
def is_valid_physical_value (self , physical_value : AtomicOdxType ) -> bool :
188
- if not isinstance (physical_value , int | float ):
188
+ if not isinstance (physical_value , ( int , float ) ):
189
189
return False
190
190
191
191
return min (self .physical_points ) <= physical_value and physical_value <= max (
192
192
self .physical_points )
193
193
194
194
def is_valid_internal_value (self , internal_value : AtomicOdxType ) -> bool :
195
- if not isinstance (internal_value , int | float ):
195
+ if not isinstance (internal_value , ( int , float ) ):
196
196
return False
197
197
198
198
return min (self .internal_points ) <= internal_value and internal_value <= max (
0 commit comments