Skip to content

Commit

Permalink
change docstring impl
Browse files Browse the repository at this point in the history
  • Loading branch information
jakeichikawasalesforce committed Nov 21, 2024
1 parent 44f3dfa commit ec05b7e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions tabpy/tabpy_tools/client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import copy
import inspect
from re import compile
import time
import requests
Expand Down Expand Up @@ -379,6 +380,10 @@ def _gen_endpoint(self, name, obj, description, version=1, schema=None, is_publi
description = obj.__doc__.strip() or "" if isinstance(obj.__doc__, str) else ""

endpoint_object = CustomQueryObject(query=obj, description=description,)

docstring = "-- no docstring found in query function --"
if sys.platform != "win32":
docstring = inspect.getdoc(obj) or "-- no docstring found in query function --"

return {
"name": name,
Expand All @@ -390,7 +395,7 @@ def _gen_endpoint(self, name, obj, description, version=1, schema=None, is_publi
"methods": endpoint_object.get_methods(),
"required_files": [],
"required_packages": [],
"docstring": endpoint_object.get_doc_string(),
"docstring": docstring,
"schema": copy.copy(schema),
"is_public": is_public,
}
Expand Down Expand Up @@ -420,7 +425,6 @@ def _wait_for_endpoint_deployment(
logger.info(
f"Waiting for endpoint {endpoint_name} to deploy to " f"version {version}"
)
time.sleep(interval)
start = time.time()
while True:
ep_status = self.get_status()
Expand Down
2 changes: 1 addition & 1 deletion tabpy/tabpy_tools/custom_query_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def query(self, *args, **kwargs):

def get_doc_string(self):
"""Get doc string from customized query"""
if sys.platform != "win32" and self.custom_query.__doc__ is not None:
if self.custom_query.__doc__ is not None:
return self.custom_query.__doc__
else:
return "-- no docstring found in query function --"
Expand Down

0 comments on commit ec05b7e

Please sign in to comment.