Skip to content

Commit

Permalink
Add methods in slots attribute (#1012)
Browse files Browse the repository at this point in the history
Add methods that are in the slots attribute to the functions list

---------

Co-authored-by: Nick Huang <nickhuang@Nicks-MacBook-Pro.local>
  • Loading branch information
nhuang-lc and Nick Huang authored Sep 18, 2024
1 parent 6fc09b5 commit e8de067
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions python/docs/create_api_rst.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,18 @@ def _load_module_members(module_path: str, namespace: str) -> ModuleMembers:
else "Pydantic" if issubclass(type_, BaseModel) else "Regular"
)
)
if hasattr(type_, "__slots__"):
for func_name, func_type in inspect.getmembers(type_):
if inspect.isfunction(func_type):
functions.append(
FunctionInfo(
name=func_name,
qualified_name=f"{namespace}.{name}.{func_name}",
is_public=not func_name.startswith("_"),
is_deprecated=".. deprecated::"
in (func_type.__doc__ or ""),
)
)
classes_.append(
ClassInfo(
name=name,
Expand Down

0 comments on commit e8de067

Please sign in to comment.