Skip to content

Commit ebaad42

Browse files
committed
Update docs gen script
1 parent c057b73 commit ebaad42

1 file changed

Lines changed: 18 additions & 3 deletions

File tree

generate_docs.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,15 @@ def extract_all_documentation(self) -> Dict[str, ClientModuleInfo]:
126126

127127
return client_modules
128128

129+
def _is_property_method(self, node: ast.FunctionDef) -> bool:
130+
"""Check if a function is decorated with @property"""
131+
for decorator in node.decorator_list:
132+
if isinstance(decorator, ast.Name) and decorator.id == "property":
133+
return True
134+
elif isinstance(decorator, ast.Attribute) and decorator.attr == "property":
135+
return True
136+
return False
137+
129138
def _extract_main_client_info(self) -> ClientModuleInfo:
130139
# Read the main client file
131140
client_file = self.sdk_path / "client.py"
@@ -145,6 +154,9 @@ def _extract_main_client_info(self) -> ClientModuleInfo:
145154
if isinstance(node, ast.ClassDef) and node.name == "TrueFoundry":
146155
for child in node.body:
147156
if isinstance(child, ast.FunctionDef) and not child.name.startswith("_"):
157+
# Skip @property methods
158+
if self._is_property_method(child):
159+
continue
148160
method_info = self._extract_function_info(child, "client", is_method=True, all_types=self.types)
149161
if method_info and method_info.name not in methods_map:
150162
methods.append(method_info)
@@ -155,6 +167,9 @@ def _extract_main_client_info(self) -> ClientModuleInfo:
155167
if isinstance(node, ast.ClassDef) and node.name == "BaseTrueFoundry":
156168
for child in node.body:
157169
if isinstance(child, ast.FunctionDef) and not child.name.startswith("_"):
170+
# Skip @property methods
171+
if self._is_property_method(child):
172+
continue
158173
method_info = self._extract_function_info(child, "client", is_method=True, all_types=self.types)
159174
if method_info and method_info.name not in methods_map:
160175
methods.append(method_info)
@@ -1165,7 +1180,7 @@ def _generate_home_page(self, client_modules: Dict[str, ClientModuleInfo], outpu
11651180
11661181
## Quick Example
11671182
1168-
```python
1183+
```python lines
11691184
from truefoundry import TrueFoundry
11701185
11711186
# Initialize the client
@@ -1294,7 +1309,7 @@ def _generate_main_client_docs(self, client_info: ClientModuleInfo, output_path:
12941309
{%- if method.examples %}
12951310
#### Usage
12961311
{% for example in method.examples %}
1297-
```python
1312+
```python lines
12981313
{{ example | safe }}
12991314
```
13001315
{% endfor %}
@@ -1432,7 +1447,7 @@ def _generate_client_module_docs(self, module_info: ClientModuleInfo, output_pat
14321447
{%- if method.examples %}
14331448
#### Usage
14341449
{% for example in method.examples %}
1435-
```python
1450+
```python lines
14361451
{{ example | safe }}
14371452
```
14381453
{% endfor %}

0 commit comments

Comments
 (0)