Skip to content

Commit

Permalink
refactor: simplify DocMapConfig initialization and improve type check…
Browse files Browse the repository at this point in the history
…ing for pathspec
  • Loading branch information
shaneholloman committed Dec 30, 2024
1 parent 7969179 commit 1c3ed8d
Showing 1 changed file with 4 additions and 23 deletions.
27 changes: 4 additions & 23 deletions src/codemapper/docmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,18 @@

import os
import logging
from typing import Optional
from typing import Optional, TYPE_CHECKING
from dataclasses import dataclass
import pathspec

from .config import DOC_DIRECTORIES, BaseMapConfig
from .utils import (
read_file_content,
generate_file_tree,
collect_file_paths,
)

if TYPE_CHECKING:
from .config import pathspec

logger = logging.getLogger(__name__)

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

doc_dir: Optional[str] = None

def __init__(
self,
directory_path: str,
gitignore_spec: pathspec.PathSpec,
include_ignored: bool = False,
source: str = "",
base_name: str = "",
exclude_dirs: Optional[list[str]] = None,
doc_dir: Optional[str] = None,
):
super().__init__(
directory_path=directory_path,
gitignore_spec=gitignore_spec,
include_ignored=include_ignored,
source=source,
base_name=base_name,
exclude_dirs=exclude_dirs,
)
self.doc_dir = doc_dir


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

0 comments on commit 1c3ed8d

Please sign in to comment.