Skip to content

Commit 3015487

Browse files
move CloneConfig to its own file
1 parent e79a9a4 commit 3015487

File tree

4 files changed

+46
-39
lines changed

4 files changed

+46
-39
lines changed

src/gitingest/schemas/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Module containing the schemas for the Gitingest package."""
22

3+
from gitingest.schemas.cloning import CloneConfig
34
from gitingest.schemas.filesystem import FileSystemNode, FileSystemNodeType, FileSystemStats
4-
from gitingest.schemas.ingestion import CloneConfig, IngestionQuery
5+
from gitingest.schemas.ingestion import IngestionQuery
56

67
__all__ = ["CloneConfig", "FileSystemNode", "FileSystemNodeType", "FileSystemStats", "IngestionQuery"]

src/gitingest/schemas/cloning.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
"""Schema for the cloning process."""
2+
3+
from __future__ import annotations
4+
5+
from pydantic import BaseModel, Field
6+
7+
8+
class CloneConfig(BaseModel): # pylint: disable=too-many-instance-attributes
9+
"""Configuration for cloning a Git repository.
10+
11+
This model holds the necessary parameters for cloning a repository to a local path, including
12+
the repository's URL, the target local path, and optional parameters for a specific commit, branch, or tag.
13+
14+
Attributes
15+
----------
16+
url : str
17+
The URL of the Git repository to clone.
18+
local_path : str
19+
The local directory where the repository will be cloned.
20+
commit : str | None
21+
The specific commit hash to check out after cloning.
22+
branch : str | None
23+
The branch to clone.
24+
tag : str | None
25+
The tag to clone.
26+
subpath : str
27+
The subpath to clone from the repository (default: ``"/"``).
28+
blob : bool
29+
Whether the repository is a blob (default: ``False``).
30+
include_submodules : bool
31+
Whether to clone submodules (default: ``False``).
32+
33+
"""
34+
35+
url: str
36+
local_path: str
37+
commit: str | None = None
38+
branch: str | None = None
39+
tag: str | None = None
40+
subpath: str = Field(default="/")
41+
blob: bool = Field(default=False)
42+
include_submodules: bool = Field(default=False)

src/gitingest/schemas/filesystem.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Define the schema for the filesystem representation."""
1+
"""Schema for the filesystem representation."""
22

33
from __future__ import annotations
44

src/gitingest/schemas/ingestion.py

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -7,43 +7,7 @@
77
from pydantic import BaseModel, Field
88

99
from gitingest.config import MAX_FILE_SIZE
10-
11-
12-
class CloneConfig(BaseModel): # pylint: disable=too-many-instance-attributes
13-
"""Configuration for cloning a Git repository.
14-
15-
This model holds the necessary parameters for cloning a repository to a local path, including
16-
the repository's URL, the target local path, and optional parameters for a specific commit, branch, or tag.
17-
18-
Attributes
19-
----------
20-
url : str
21-
The URL of the Git repository to clone.
22-
local_path : str
23-
The local directory where the repository will be cloned.
24-
commit : str | None
25-
The specific commit hash to check out after cloning.
26-
branch : str | None
27-
The branch to clone.
28-
tag : str | None
29-
The tag to clone.
30-
subpath : str
31-
The subpath to clone from the repository (default: ``"/"``).
32-
blob : bool
33-
Whether the repository is a blob (default: ``False``).
34-
include_submodules : bool
35-
Whether to clone submodules (default: ``False``).
36-
37-
"""
38-
39-
url: str
40-
local_path: str
41-
commit: str | None = None
42-
branch: str | None = None
43-
tag: str | None = None
44-
subpath: str = Field(default="/")
45-
blob: bool = Field(default=False)
46-
include_submodules: bool = Field(default=False)
10+
from gitingest.schemas.cloning import CloneConfig
4711

4812

4913
class IngestionQuery(BaseModel): # pylint: disable=too-many-instance-attributes

0 commit comments

Comments
 (0)