Skip to content

Commit

Permalink
Should check for __init__.py in module_to_file_path
Browse files Browse the repository at this point in the history
  • Loading branch information
emdoyle committed Feb 8, 2024
1 parent ec9e21f commit 8451d14
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions modguard/parsing/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ def module_to_file_path(
member_name = fs_path[last_sep_index + 1 :]
return file_path, member_name

init_file_path = fs_path[:last_sep_index] + "/__init__.py"
if os.path.exists(init_file_path):
member_name = fs_path[last_sep_index + 1 :]
return init_file_path, member_name

raise errors.ModguardParseError(
f"Failed to translate module path {mod_path} into file path"
)

0 comments on commit 8451d14

Please sign in to comment.