Skip to content

Commit 574077c

Browse files
committed
chore: Refactor function names for better readability and consistency
1 parent 3bed285 commit 574077c

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

function_schema/core.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def __init__(self, documentation: str, /):
2424

2525
__all__ = ("get_function_schema", "guess_type", "Doc")
2626

27-
def is_documentation(obj):
27+
def is_doc_meta(obj):
2828
"""
2929
Check if the given object is a documentation object.
3030
Parameters:
@@ -33,12 +33,12 @@ def is_documentation(obj):
3333
bool: True if the object is a documentation object, False otherwise.
3434
3535
Example:
36-
>>> is_documentation(Doc("This is a documentation object"))
36+
>>> is_doc_meta(Doc("This is a documentation object"))
3737
True
3838
"""
3939
return getattr(obj, '__class__') == Doc and hasattr(obj, 'documentation')
4040

41-
def unref_doc(obj: Doc | str):
41+
def unwrap_doc(obj: Doc | str):
4242
"""
4343
Get the documentation string from the given object.
4444
Parameters:
@@ -47,12 +47,12 @@ def unref_doc(obj: Doc | str):
4747
str: The documentation string.
4848
4949
Example:
50-
>>> unref_doc(Doc("This is a documentation object"))
51-
'This is a documentation object
52-
>>> unref_doc("This is a documentation string")
50+
>>> unwrap_doc(Doc("This is a documentation object"))
51+
'This is a documentation object'
52+
>>> unwrap_doc("This is a documentation string")
5353
'This is a documentation string'
5454
"""
55-
if is_documentation(obj):
55+
if is_doc_meta(obj):
5656
return obj.documentation
5757
return str(obj)
5858

@@ -127,7 +127,7 @@ def get_function_schema(
127127

128128
# find description in param_args tuple
129129
description = next(
130-
(unref_doc(arg) for arg in param_args if isinstance(arg, (Doc, str))),
130+
(unwrap_doc(arg) for arg in param_args if isinstance(arg, (Doc, str))),
131131
f"The {name} parameter",
132132
)
133133

0 commit comments

Comments
 (0)