@@ -267,7 +267,7 @@ def getfuncprops(func, f):
267267 return fprops
268268
269269
270- def is_eval_safe_name (string ) :
270+ def is_eval_safe_name (string : str ) -> bool :
271271 return all (
272272 part .isidentifier () and not keyword .iskeyword (part )
273273 for part in string .split ("." )
@@ -334,7 +334,7 @@ def get_argspec_from_signature(f):
334334get_encoding_line_re = LazyReCompile (r"^.*coding[:=]\s*([-\w.]+).*$" )
335335
336336
337- def get_encoding (obj ):
337+ def get_encoding (obj ) -> str :
338338 """Try to obtain encoding information of the source of an object."""
339339 for line in inspect .findsource (obj )[0 ][:2 ]:
340340 m = get_encoding_line_re .search (line )
@@ -354,7 +354,7 @@ def get_encoding_file(fname: str) -> str:
354354 return "utf8"
355355
356356
357- def getattr_safe (obj : Any , name : str ):
357+ def getattr_safe (obj : Any , name : str ) -> Any :
358358 """side effect free getattr (calls getattr_static)."""
359359 result = inspect .getattr_static (obj , name )
360360 # Slots are a MemberDescriptorType
@@ -371,6 +371,6 @@ def hasattr_safe(obj: Any, name: str) -> bool:
371371 return False
372372
373373
374- def get_source_unicode (obj ):
374+ def get_source_unicode (obj ) -> str :
375375 """Returns a decoded source of object"""
376376 return inspect .getsource (obj )
0 commit comments