@@ -267,7 +267,7 @@ def getfuncprops(func, f):
267
267
return fprops
268
268
269
269
270
- def is_eval_safe_name (string ) :
270
+ def is_eval_safe_name (string : str ) -> bool :
271
271
return all (
272
272
part .isidentifier () and not keyword .iskeyword (part )
273
273
for part in string .split ("." )
@@ -334,7 +334,7 @@ def get_argspec_from_signature(f):
334
334
get_encoding_line_re = LazyReCompile (r"^.*coding[:=]\s*([-\w.]+).*$" )
335
335
336
336
337
- def get_encoding (obj ):
337
+ def get_encoding (obj ) -> str :
338
338
"""Try to obtain encoding information of the source of an object."""
339
339
for line in inspect .findsource (obj )[0 ][:2 ]:
340
340
m = get_encoding_line_re .search (line )
@@ -354,7 +354,7 @@ def get_encoding_file(fname: str) -> str:
354
354
return "utf8"
355
355
356
356
357
- def getattr_safe (obj : Any , name : str ):
357
+ def getattr_safe (obj : Any , name : str ) -> Any :
358
358
"""side effect free getattr (calls getattr_static)."""
359
359
result = inspect .getattr_static (obj , name )
360
360
# Slots are a MemberDescriptorType
@@ -371,6 +371,6 @@ def hasattr_safe(obj: Any, name: str) -> bool:
371
371
return False
372
372
373
373
374
- def get_source_unicode (obj ):
374
+ def get_source_unicode (obj ) -> str :
375
375
"""Returns a decoded source of object"""
376
376
return inspect .getsource (obj )
0 commit comments