Skip to content

Commit 2ba5de0

Browse files
committed
Add some return types
1 parent 29fc2a2 commit 2ba5de0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

bpython/inspection.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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):
334334
get_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

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy