Skip to content

Commit 1c3ed8d

Browse files
committed
refactor: simplify DocMapConfig initialization and improve type checking for pathspec
1 parent 7969179 commit 1c3ed8d

File tree

1 file changed

+4
-23
lines changed

1 file changed

+4
-23
lines changed

src/codemapper/docmap.py

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,18 @@
1212

1313
import os
1414
import logging
15-
from typing import Optional
15+
from typing import Optional, TYPE_CHECKING
1616
from dataclasses import dataclass
17-
import pathspec
18-
1917
from .config import DOC_DIRECTORIES, BaseMapConfig
2018
from .utils import (
2119
read_file_content,
2220
generate_file_tree,
2321
collect_file_paths,
2422
)
2523

24+
if TYPE_CHECKING:
25+
from .config import pathspec
26+
2627
logger = logging.getLogger(__name__)
2728

2829
# Documentation type mapping
@@ -47,26 +48,6 @@ class DocMapConfig(BaseMapConfig):
4748

4849
doc_dir: Optional[str] = None
4950

50-
def __init__(
51-
self,
52-
directory_path: str,
53-
gitignore_spec: pathspec.PathSpec,
54-
include_ignored: bool = False,
55-
source: str = "",
56-
base_name: str = "",
57-
exclude_dirs: Optional[list[str]] = None,
58-
doc_dir: Optional[str] = None,
59-
):
60-
super().__init__(
61-
directory_path=directory_path,
62-
gitignore_spec=gitignore_spec,
63-
include_ignored=include_ignored,
64-
source=source,
65-
base_name=base_name,
66-
exclude_dirs=exclude_dirs,
67-
)
68-
self.doc_dir = doc_dir
69-
7051

7152
def find_documentation_directory(base_path: str, custom_dir: Optional[str] = None) -> Optional[str]:
7253
"""

0 commit comments

Comments
 (0)