Skip to content

Commit f8302b9

Browse files
committed
Comment fixes
Signed-off-by: Eric Kerfoot <17726042+ericspod@users.noreply.github.com>
1 parent 2770cb2 commit f8302b9

4 files changed

Lines changed: 29 additions & 7 deletions

File tree

.github/workflows/cicd_tests.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,15 @@ jobs:
6969
shell: bash
7070
run: |
7171
echo "skip=1" >> $GITHUB_OUTPUT
72+
7273
mkdir -p /tmp/check_changes
73-
git diff --name-only HEAD^..HEAD ':!docs' | while read i
74+
if ! git diff --name-only HEAD^..HEAD ':!docs' > /tmp/check_changes/changed_files
75+
then
76+
echo "skip=0" >> "$GITHUB_OUTPUT"
77+
exit 0
78+
fi
79+
80+
while read i
7481
do
7582
echo "Checking for changes: $i"
7683
if ! git show HEAD^:$i > /tmp/check_changes/$(basename $i)
@@ -85,7 +92,7 @@ jobs:
8592
8693
echo "skip=0" >> $GITHUB_OUTPUT
8794
break
88-
done
95+
done < /tmp/check_changes/changed_files
8996
9097
static-checks: # Perform static type and other checks using runtests.sh
9198
runs-on: ubuntu-latest

docs/source/utils.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,6 @@ Safe Evaluation
8787
:members:
8888

8989
Compare Sources
90-
--------------=
90+
---------------
9191
.. automodule:: monai.utils.compare_sources
9292
:members:

monai/utils/compare_sources.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@
1616
from __future__ import annotations
1717

1818
import ast
19+
import os
1920
import sys
2021
from os.path import splitext
2122

22-
from monai.config.type_definitions import PathLike
23+
PathLike = str | os.PathLike # needs to be duplicated here to avoid importing anything from MONAI inside actions
2324

2425
SKIP_EXTS = (".md", ".rst")
2526

@@ -54,8 +55,10 @@ def sources_equal(src1: str, src2: str) -> bool:
5455
"""
5556
remdoc = RemoveDocstrings()
5657

57-
m1: ast.Module = remdoc.generic_visit(ast.parse(src1))
58-
m2: ast.Module = remdoc.generic_visit(ast.parse(src2))
58+
m1 = ast.parse(src1)
59+
m2 = ast.parse(src2)
60+
remdoc.visit(m1)
61+
remdoc.visit(m2)
5962

6063
list1 = list(ast.walk(m1))
6164
list2 = list(ast.walk(m2))

tests/utils/test_compare_sources.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,19 @@ def method(self,arg1):
4848
return arg1
4949
"""
5050

51-
TEXT_EQUAL_PAIRS = [(text1, text2), (text1, text3), (text2, text3), ("", "")]
51+
text6 = """
52+
'''
53+
This is a module containing only a docstring.
54+
'''
55+
"""
56+
57+
text7 = """
58+
'''
59+
So is this but it's different.
60+
'''
61+
"""
62+
63+
TEXT_EQUAL_PAIRS = [(text1, text2), (text1, text3), (text2, text3), (text6, text7), (text6, ""), ("", "")]
5264

5365
TEXT_UNEQUAL_PAIRS = [(text1, text4), (text2, text4), (text3, text4), (text1, text5), (text1, "")]
5466

0 commit comments

Comments
 (0)