This repository was archived by the owner on Aug 25, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed
Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -205,16 +205,20 @@ def applicable_features(self, features):
205205
206206 def check_applicable_feature (self , feature ):
207207 # Check the data datatype is in the list of supported data types
208- if feature .dtype () not in self .DTYPES :
208+ self .check_feature_dtype (feature .dtype ())
209+ # Check that length (dimensions) of feature is supported
210+ self .check_feature_length (feature .length ())
211+ return True
212+
213+ def check_feature_dtype (self , dtype ):
214+ if dtype not in self .DTYPES :
209215 msg = f"{ self .__class__ .__qualname__ } only supports features "
210216 msg += f"with these data types: { self .DTYPES } "
211217 raise ValueError (msg )
218+
219+ def check_feature_length (self , length ):
212220 # If SUPPORTED_LENGTHS is None then all lengths are supported
213- if self .SUPPORTED_LENGTHS is None :
214- return True
215- # Check that length (dimensions) of feature is supported
216- if feature .length () not in self .SUPPORTED_LENGTHS :
221+ if self .SUPPORTED_LENGTHS and length not in self .SUPPORTED_LENGTHS :
217222 msg = f"{ self .__class__ .__qualname__ } only supports "
218223 msg += f"{ self .SUPPORTED_LENGTHS } dimensional values"
219224 raise ValueError (msg )
220- return True
You can’t perform that action at this time.
0 commit comments