Skip to content

Commit 2862f53

Browse files
Mask usernames in print_config function (#6471) (#6913)
Fixes #6471 ### Description A few sentences describing the changes proposed in this pull request. ### Types of changes <!--- Put an `x` in all the boxes that apply, and remove the not applicable items --> - [x] Non-breaking change (fix or new feature that would not break existing functionality). - [ ] Breaking change (fix or new feature that would cause existing functionality to change). - [ ] New tests added to cover the changes. - [ ] Integration tests passed locally by running `./runtests.sh -f -u --net --coverage`. - [ ] Quick tests passed locally by running `./runtests.sh --quick --unittests --disttests`. - [ ] In-line docstrings updated. - [ ] Documentation updated, tested `make html` command in the `docs/` folder. --------- Signed-off-by: monai-bot <monai.miccai2019@gmail.com> Co-authored-by: monai-bot <monai.miccai2019@gmail.com>
1 parent 40048d7 commit 2862f53

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

monai/config/deviceconfig.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,16 @@ def print_config(file=sys.stdout):
100100
print(f"{k} version: {v}", file=file, flush=True)
101101
print(f"MONAI flags: HAS_EXT = {HAS_EXT}, USE_COMPILED = {USE_COMPILED}, USE_META_DICT = {USE_META_DICT}")
102102
print(f"MONAI rev id: {monai.__revision_id__}")
103-
print(f"MONAI __file__: {monai.__file__}")
104-
103+
masked_file_path = re.sub(
104+
r"/home/\w+/",
105+
"/home/<username>/",
106+
re.sub(
107+
r"/Users/\w+/",
108+
"/Users/<username>/",
109+
re.sub(r"C:\\Users\\\w+\\", r"C:\\Users\\<username>\\", monai.__file__),
110+
),
111+
)
112+
print(f"MONAI __file__: {masked_file_path}", file=file, flush=True)
105113
print("\nOptional dependencies:", file=file, flush=True)
106114
for k, v in get_optional_config_values().items():
107115
print(f"{k} version: {v}", file=file, flush=True)

0 commit comments

Comments
 (0)