-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Update dependencies and fix import order in Python files
- Loading branch information
1 parent
4cff8ae
commit 2229b16
Showing
9 changed files
with
191 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import os | ||
import re | ||
|
||
def fix_docstrings(file_path): | ||
with open(file_path, 'r') as file: | ||
lines = file.readlines() | ||
|
||
fixed_lines = [] | ||
bullet_list_active = False | ||
in_directive = False | ||
directive_indent = 0 | ||
|
||
for line in lines: | ||
stripped_line = line.strip() | ||
|
||
if re.match(r'^- ', stripped_line): # Detect bullet points | ||
bullet_list_active = True | ||
indent_level = len(line) - len(line.lstrip()) | ||
elif bullet_list_active and (stripped_line == "" or not stripped_line.startswith('- ')): | ||
fixed_lines.append('\n') # Ensure a blank line after a list | ||
bullet_list_active = False | ||
elif re.match(r'^\.\. \w+::', stripped_line): # Check for directive start | ||
in_directive = True | ||
directive_indent = len(line) - len(line.lstrip()) | ||
elif in_directive and (len(line) - len(line.lstrip())) <= directive_indent: | ||
in_directive = False | ||
|
||
if 'unexpected indentation' in line or (in_directive and not stripped_line.startswith(' ')): | ||
continue # Skip adding lines with unexpected indentation | ||
|
||
if 'undefined substitution referenced' in line: | ||
line = '#' + line # Comment out lines with undefined substitutions | ||
|
||
fixed_lines.append(line) | ||
|
||
with open(file_path, 'w') as file: | ||
file.writelines(fixed_lines) | ||
|
||
def fix_rst_files(directory): | ||
for root, dirs, files in os.walk(directory): | ||
for file in files: | ||
if file.endswith('.rst'): | ||
fix_docstrings(os.path.join(root, file)) | ||
|
||
# Example usage: | ||
fix_rst_files('/Users/llacombe/CODE/quantmetry/MAPIE/doc') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
.. _calibration_examples: | ||
|
||
Calibration examples | ||
======================= | ||
==================== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
.. _general_examples: | ||
.. _multilabel_classification_examples: | ||
|
||
General examples | ||
================ | ||
Multilabel Classification examples | ||
================================== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters