Skip to content

Commit

Permalink
Update scikit-learn script
Browse files Browse the repository at this point in the history
  • Loading branch information
lutzroeder committed Dec 31, 2024
1 parent 298c314 commit dd5dbb8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tools/sklearn_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import os
import pydoc
import re
import sys

def _split_docstring(value):
headers = {}
Expand Down Expand Up @@ -57,6 +58,7 @@ def _find_attribute(schema, name):
return attribute

def _update_attributes(schema, lines):
doc_indent = ' ' if sys.version_info[:2] >= (3, 13) else ' '
while len(lines) > 0:
line = lines.pop(0)
match = re.match(r'\s*(\w*)\s*:\s*(.*)\s*', line)
Expand All @@ -83,7 +85,7 @@ def _update_attributes(schema, lines):
if default_value:
attribute['default'] = _attribute_value(attribute_type, default_value)
description = []
while len(lines) > 0 and (len(lines[0].strip(' ')) == 0 or lines[0].startswith(' ')):
while len(lines) > 0 and (len(lines[0].strip(' ')) == 0 or lines[0].startswith(doc_indent)):
line = lines.pop(0).lstrip(' ')
description.append(line)
attribute['description'] = '\n'.join(description)
Expand Down

0 comments on commit dd5dbb8

Please sign in to comment.