Skip to content

Commit

Permalink
🐛 exclude dir startswith ._
Browse files Browse the repository at this point in the history
  • Loading branch information
yanyongyu authored Apr 11, 2023
1 parent 4d65688 commit a32f2f5
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
7 changes: 6 additions & 1 deletion nb_cli/cli/commands/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,12 @@ async def create(
ctx.exit()
if output_dir is None:
detected: List[Choice[None]] = [
Choice(str(x)) for x in Path(".").glob("**/adapters/") if x.is_dir()
Choice(str(x))
for x in Path(".").glob("**/adapters/")
if x.is_dir()
and not any(
p.name.startswith(".") or p.name.startswith("_") for p in x.parents
)
] or [
Choice(f"{x}/adapters/")
for x in Path(".").glob("*/")
Expand Down
7 changes: 6 additions & 1 deletion nb_cli/cli/commands/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,12 @@ async def create(

if output_dir is None:
detected: List[Choice[None]] = [
Choice(str(d)) for d in Path(".").glob("**/plugins/") if d.is_dir()
Choice(str(d))
for d in Path(".").glob("**/plugins/")
if d.is_dir()
and not any(
p.name.startswith("_") or p.name.startswith(".") for p in d.parents
)
]
try:
output_dir = (
Expand Down
1 change: 0 additions & 1 deletion nb_cli/cli/customize.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from pathlib import Path
from functools import partial
from collections import Counter
from typing import Dict, List, Optional
Expand Down
3 changes: 1 addition & 2 deletions nb_cli/handlers/reloader.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import sys
import asyncio
import logging
from pathlib import Path
from typing import IO, Any, List, Callable, Optional, Coroutine
from typing import Any, List, Callable, Optional, Coroutine

from watchfiles import awatch

Expand Down

0 comments on commit a32f2f5

Please sign in to comment.