1212from collections import abc
1313import datetime
1414from io import BytesIO , IOBase
15- from pathlib import Path
1615import os
16+ from pathlib import Path
1717import struct
1818import sys
19- from typing import (
20- Any ,
21- AnyStr ,
22- BinaryIO ,
23- Dict ,
24- IO ,
25- List ,
26- Optional ,
27- Sequence ,
28- Tuple ,
29- Union ,
30- )
19+ from typing import Any , AnyStr , BinaryIO , Dict , List , Optional , Sequence , Tuple , Union
3120import warnings
3221
3322from dateutil .relativedelta import relativedelta
@@ -762,7 +751,7 @@ class StataMissingValue:
762751 "float64" : struct .unpack ("<d" , float64_base )[0 ],
763752 }
764753
765- def __init__ (self , value : float ):
754+ def __init__ (self , value : Union [ int , float ] ):
766755 self ._value = value
767756 # Conversion to int to avoid hash issues on 32 bit platforms #8968
768757 value = int (value ) if value < 2147483648 else float (value )
@@ -781,7 +770,7 @@ def string(self) -> str:
781770 return self ._str
782771
783772 @property
784- def value (self ) -> float :
773+ def value (self ) -> Union [ int , float ] :
785774 """
786775 The binary representation of the missing value.
787776
@@ -806,7 +795,7 @@ def __eq__(self, other: Any) -> bool:
806795 )
807796
808797 @classmethod
809- def get_base_missing_value (cls , dtype : np .dtype ) -> float :
798+ def get_base_missing_value (cls , dtype : np .dtype ) -> Union [ int , float ] :
810799 if dtype == np .int8 :
811800 value = cls .BASE_MISSING_VALUES ["int8" ]
812801 elif dtype == np .int16 :
0 commit comments