FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
function-schema/function_schema/utils.py at main · comfuture/function-schema · GitHub
comfuture
/
function-schema
Public
Notifications
You must be signed in to change notification settings
Fork
3
Star
18
Code
Issues
3
Pull requests
1
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
function-schema
/
function_schema
/
utils.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
31 lines (26 loc) · 818 Bytes
Breadcrumbs
function-schema
/
function_schema
/
utils.py
Copy path
File metadata and controls
31 lines (26 loc) · 818 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from
typing
import
Annotated
,
Union
from
.
types
import
Doc
def
is_support_uniontype
():
"""Check if current python version supports UnionType or not"""
try
:
from
types
import
UnionType
# noqa
except
ImportError
:
return
False
return
True
def
unwrap_doc
(
obj
:
Annotated
[
Union
[
Doc
,
str
],
Doc
(
"The object to get the documentation string from."
)
],
)
->
Annotated
[
str
,
Doc
(
"The documentation string."
)]:
"""
Get the documentation string from the given object.
Example:
>>> unwrap_doc(Doc("This is a documentation object"))
'This is a documentation object'
>>> unwrap_doc("This is a documentation string")
'This is a documentation string'
"""
if
isinstance
(
obj
,
Doc
):
return
obj
.
documentation
return
str
(
obj
)
Back
|
FazBrowse Home
|
New Git URL