88from typing import Any , Callable , Dict , List , Type , Union , Optional
99
1010# EXT
11- import dill # type: ignore
12- import multiprocess # type: ignore
11+ import dill
12+ import multiprocess
1313
1414# Types
1515AlarmHandler = Union [Callable [[int , Optional [FrameType ]], Any ], int , signal .Handlers , None ]
@@ -42,7 +42,7 @@ def __init__(
4242 self .args = args
4343 self .kwargs = kwargs
4444
45- self .dec_timeout_float = 0.0 # type: float
45+ self .dec_timeout_float : float = 0.0
4646 self .old_alarm_handler : AlarmHandler = None
4747 self .child_conn : "multiprocess.Pipe" = None
4848
@@ -120,7 +120,7 @@ def detect_unpickable_objects_and_reraise(object_to_pickle: Any) -> None:
120120def detect_unpickable_objects (object_to_pickle : Any , dill_trace : bool = True , log_warning : bool = True ) -> Dict [str , Union [str , List [Any ]]]:
121121 if log_warning :
122122 logger .warning ('always remember that the "object_to_pickle" should not be defined within the main context' )
123- dict_result = dict () # type : Dict[str, Union[str, List[Any]]]
123+ dict_result : Dict [str , Union [str , List [Any ]]] = dict ()
124124 dict_result ["object_name" ] = ""
125125 dict_result ["bad_items" ] = list ()
126126 dict_result ["bad_objects" ] = list ()
@@ -150,7 +150,7 @@ def get_object_name(object_to_pickle: object) -> str:
150150
151151
152152def get_bad_pickling_types (object_to_pickle : object ) -> List [Any ]:
153- bad_types = list () # type : List[Any]
153+ bad_types : List [Any ] = list ()
154154 # noinspection PyBroadException
155155 try :
156156 bad_types = dill .detect .badtypes (object_to_pickle )
@@ -161,7 +161,7 @@ def get_bad_pickling_types(object_to_pickle: object) -> List[Any]:
161161
162162
163163def get_bad_pickling_objects (object_to_pickle : Any ) -> Any :
164- bad_objects = list () # type : List[object]
164+ bad_objects : List [object ] = list ()
165165 # noinspection PyBroadException
166166 try :
167167 bad_objects = dill .detect .badobjects (object_to_pickle )
0 commit comments