Skip to content

Commit

Permalink
Add .obignore file
Browse files Browse the repository at this point in the history
  • Loading branch information
EdwardJXLi committed Oct 23, 2023
1 parent ae01293 commit 84b2054
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"nargs",
"nbtlib",
"nologging",
"obignore",
"objclass",
"obsidianworld",
"peername",
Expand Down
8 changes: 6 additions & 2 deletions obsidian/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,13 +275,17 @@ def recursiveModuleLoader(path: Path):
Logger.verbose(f"Directory {relative_path.as_posix()} In Ignore List. Skipping!", module="module-import")
return

# If a .obignore file exists in the folder, ignore the entire folder
if Path(path, ".obignore").exists():
Logger.verbose(f"Directory {relative_path.as_posix()} has '.obignore' file. Skipping!", module="module-import")
return
# If __init__.py is defined in the folder, treat the entire directory as the module
if Path(path, "__init__.py").exists():
elif Path(path, "__init__.py").exists():
Logger.debug(f"Detected __init__.py in {path}. Treating as module.", module="module-import")
# abs_import is already in the correct format to load the module
loadModule(abs_import)
# Treat the directory as a collection of modules
else:
# Treat the directory as a collection of modules
for _, moduleName, _ in pkgutil.iter_modules(
path=[str(path)],
prefix=abs_import + "."
Expand Down

0 comments on commit 84b2054

Please sign in to comment.