99from pathlib import Path
1010
1111from gitingest .clone import clone_repo
12- from gitingest .config import TMP_BASE_PATH
12+ from gitingest .config import MAX_FILE_SIZE , TMP_BASE_PATH
1313from gitingest .ingestion import ingest_query
1414from gitingest .query_parser import IngestionQuery , parse_query
1515from gitingest .utils .async_compat import to_thread
2020async def ingest_async (
2121 source : str ,
2222 * ,
23- max_file_size : int = 10 * 1024 * 1024 , # 10 MB
23+ max_file_size : int = MAX_FILE_SIZE , # 10 MB
2424 include_patterns : str | set [str ] | None = None ,
2525 exclude_patterns : str | set [str ] | None = None ,
2626 branch : str | None = None ,
@@ -41,19 +41,20 @@ async def ingest_async(
4141 max_file_size : int
4242 Maximum allowed file size for file ingestion. Files larger than this size are ignored (default: 10 MB).
4343 include_patterns : str | set[str] | None
44- Pattern or set of patterns specifying which files to include. If * None* , all files are included.
44+ Pattern or set of patterns specifying which files to include. If `` None`` , all files are included.
4545 exclude_patterns : str | set[str] | None
46- Pattern or set of patterns specifying which files to exclude. If * None* , no files are excluded.
46+ Pattern or set of patterns specifying which files to exclude. If `` None`` , no files are excluded.
4747 branch : str | None
48- The branch to clone and ingest. If *None*, the default branch is used .
48+ The branch to clone and ingest (default: the default branch) .
4949 include_gitignored : bool
50- If * True* , include files ignored by ``.gitignore`` and ``.gitingestignore`` (default: ``False``).
50+ If `` True`` , include files ignored by ``.gitignore`` and ``.gitingestignore`` (default: ``False``).
5151 token : str | None
52- GitHub personal- access token (PAT). Needed when the repository is private.
53- Can also be set via the ``GITHUB_TOKEN`` env var .
52+ GitHub personal access token (PAT) for accessing private repositories .
53+ Can also be set via the ``GITHUB_TOKEN`` environment variable .
5454 output : str | None
55- File path where the summary and content should be written. If *"-"* (dash), the results are written to stdout.
56- If *None*, the results are not written to a file.
55+ File path where the summary and content should be written.
56+ If ``"-"`` (dash), the results are written to ``stdout``.
57+ If ``None``, the results are not written to a file.
5758
5859 Returns
5960 -------
@@ -99,7 +100,7 @@ async def ingest_async(
99100def ingest (
100101 source : str ,
101102 * ,
102- max_file_size : int = 10 * 1024 * 1024 , # 10 MB
103+ max_file_size : int = MAX_FILE_SIZE ,
103104 include_patterns : str | set [str ] | None = None ,
104105 exclude_patterns : str | set [str ] | None = None ,
105106 branch : str | None = None ,
@@ -120,19 +121,20 @@ def ingest(
120121 max_file_size : int
121122 Maximum allowed file size for file ingestion. Files larger than this size are ignored (default: 10 MB).
122123 include_patterns : str | set[str] | None
123- Pattern or set of patterns specifying which files to include. If * None* , all files are included.
124+ Pattern or set of patterns specifying which files to include. If `` None`` , all files are included.
124125 exclude_patterns : str | set[str] | None
125- Pattern or set of patterns specifying which files to exclude. If * None* , no files are excluded.
126+ Pattern or set of patterns specifying which files to exclude. If `` None`` , no files are excluded.
126127 branch : str | None
127128 The branch to clone and ingest (default: the default branch).
128129 include_gitignored : bool
129- If * True* , include files ignored by ``.gitignore`` and ``.gitingestignore`` (default: ``False``).
130+ If `` True`` , include files ignored by ``.gitignore`` and ``.gitingestignore`` (default: ``False``).
130131 token : str | None
131- GitHub personal- access token (PAT). Needed when the repository is private.
132- Can also be set via the ``GITHUB_TOKEN`` env var .
132+ GitHub personal access token (PAT) for accessing private repositories .
133+ Can also be set via the ``GITHUB_TOKEN`` environment variable .
133134 output : str | None
134- File path where the summary and content should be written. If *"-"* (dash), the results are written to stdout.
135- If *None*, the results are not written to a file.
135+ File path where the summary and content should be written.
136+ If ``"-"`` (dash), the results are written to ``stdout``.
137+ If ``None``, the results are not written to a file.
136138
137139 Returns
138140 -------
@@ -162,7 +164,7 @@ def ingest(
162164
163165
164166def _apply_gitignores (query : IngestionQuery ) -> None :
165- """Update `query.ignore_patterns` in-place.
167+ """Update `` query.ignore_patterns` ` in-place.
166168
167169 Parameters
168170 ----------
@@ -187,7 +189,7 @@ async def _clone_if_remote(query: IngestionQuery, token: str | None) -> None:
187189 Raises
188190 ------
189191 TypeError
190- If `clone_repo` does not return a coroutine.
192+ If `` clone_repo` ` does not return a coroutine.
191193
192194 """
193195 if not query .url : # local path ingestion
@@ -207,7 +209,7 @@ async def _clone_if_remote(query: IngestionQuery, token: str | None) -> None:
207209
208210
209211async def _write_output (tree : str , content : str , target : str | None ) -> None :
210- """Write combined output to * target* (`'-' ` ⇒ stdout).
212+ """Write combined output to `` target`` (``"-"` ` ⇒ stdout).
211213
212214 Parameters
213215 ----------
@@ -216,7 +218,7 @@ async def _write_output(tree: str, content: str, target: str | None) -> None:
216218 content : str
217219 The content of the files in the repository or directory.
218220 target : str | None
219- The path to the output file. If * None* , the results are not written to a file.
221+ The path to the output file. If `` None`` , the results are not written to a file.
220222
221223 """
222224 if target == "-" :
0 commit comments