File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -32,10 +32,14 @@ class MaskValueItem(BaseModel):
3232 model_config = ConfigDict (
3333 extra = 'forbid' ,
3434 )
35+ value : int = Field (..., description = 'Specifies the numerical mask value.' )
3536 description : Optional [str ] = Field (
3637 None , description = 'Specifies a summary description of the mask value function.'
3738 )
3839
40+ def __int__ (self ):
41+ return self .value
42+
3943
4044class MaskValue (RootModel [Union [int , MaskValueItem ]]):
4145 root : Union [int , MaskValueItem ]
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ def _id_camel_to_snake(id: str):
4141 return _camel_to_snake_regex .sub ("_" , id ).lower ()
4242
4343
44- def _create_bit_parser (mask : Union [ int , MaskValueItem ] ):
44+ def _create_bit_parser (mask : int ):
4545 def parser (xs : Series ) -> Series :
4646 return (xs & mask ) != 0
4747
@@ -50,7 +50,7 @@ def parser(xs: Series) -> Series:
5050
5151def _create_bitmask_parser (bitMask : BitMask ):
5252 lookup = [
53- (_id_camel_to_snake (k ), _create_bit_parser (v .root ))
53+ (_id_camel_to_snake (k ), _create_bit_parser (int ( v .root ) ))
5454 for k , v in bitMask .bits .items ()
5555 ]
5656
@@ -61,7 +61,7 @@ def parser(df: DataFrame):
6161
6262
6363def _create_groupmask_lookup (groupMask : GroupMask ):
64- return {v .root : n for n , v in groupMask .values .items ()}
64+ return {int ( v .root ) : n for n , v in groupMask .values .items ()}
6565
6666
6767def _create_groupmask_parser (name : str , groupMask : GroupMask ):
You can’t perform that action at this time.
0 commit comments