Skip to content

Commit 94be0ac

Browse files
standardize docstrings
1 parent 979df2c commit 94be0ac

File tree

11 files changed

+23
-23
lines changed

11 files changed

+23
-23
lines changed

src/gitingest/clone.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ async def clone_repo(config: CloneConfig, token: str | None = None) -> None:
6565

6666
clone_cmd = ["git"]
6767
if token and is_github_host(url):
68-
clone_cmd += ["-c", create_git_auth_header(token, url)]
68+
clone_cmd += ["-c", create_git_auth_header(token, url=url)]
6969

7070
clone_cmd += ["clone", "--single-branch"]
7171
# TODO: Re-enable --recurse-submodules when submodule support is needed

src/gitingest/entrypoint.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ async def ingest_async(
8383

8484
repo_cloned = False
8585
try:
86-
await _clone_if_remote(query, token)
86+
await _clone_if_remote(query, token=token)
8787
repo_cloned = bool(query.url)
8888

8989
summary, tree, content = ingest_query(query)
@@ -183,7 +183,7 @@ async def _clone_if_remote(query: IngestionQuery, token: str | None) -> None:
183183
query : IngestionQuery
184184
The query to clone.
185185
token : str | None
186-
The token to use for the query.
186+
GitHub personal access token (PAT) for accessing private repositories.
187187
188188
Raises
189189
------

src/gitingest/output_formatter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ def _gather_file_contents(node: FileSystemNode) -> str:
118118

119119
def _create_tree_structure(
120120
query: IngestionQuery,
121-
node: FileSystemNode,
122121
*,
122+
node: FileSystemNode,
123123
prefix: str = "",
124124
is_last: bool = True,
125125
) -> str:

src/gitingest/utils/auth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def resolve_token(token: str | None) -> str | None:
1111
Parameters
1212
----------
1313
token : str | None
14-
The token to use for the query.
14+
GitHub personal access token (PAT) for accessing private repositories.
1515
1616
Returns
1717
-------

src/gitingest/utils/git_utils.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ async def fetch_remote_branch_list(url: str, token: str | None = None) -> list[s
253253

254254
# Add authentication if needed
255255
if token and is_github_host(url):
256-
fetch_branches_command += ["-c", create_git_auth_header(token, url)]
256+
fetch_branches_command += ["-c", create_git_auth_header(token, url=url)]
257257

258258
fetch_branches_command += ["ls-remote", "--heads", url]
259259

@@ -274,18 +274,18 @@ def create_git_command(base_cmd: list[str], local_path: str, url: str, token: st
274274
Parameters
275275
----------
276276
base_cmd : list[str]
277-
The base git command to start with
277+
The base git command to start with.
278278
local_path : str
279-
The local path where the git command should be executed
279+
The local path where the git command should be executed.
280280
url : str
281-
The repository URL to check if it's a GitHub repository
281+
The repository URL to check if it's a GitHub repository.
282282
token : str | None
283-
GitHub personal access token for authentication
283+
GitHub personal access token (PAT) for accessing private repositories.
284284
285285
Returns
286286
-------
287287
list[str]
288-
The git command with authentication if needed
288+
The git command with authentication if needed.
289289
290290
"""
291291
cmd = [*base_cmd, "-C", local_path]
@@ -301,15 +301,15 @@ def create_git_auth_header(token: str, url: str = "https://github.com") -> str:
301301
Parameters
302302
----------
303303
token : str
304-
GitHub personal access token
304+
GitHub personal access token (PAT) for accessing private repositories.
305305
url : str
306306
The GitHub URL to create the authentication header for.
307307
Defaults to "https://github.com" if not provided.
308308
309309
Returns
310310
-------
311311
str
312-
The git config command for setting the authentication header
312+
The git config command for setting the authentication header.
313313
314314
"""
315315
hostname = urlparse(url).hostname
@@ -323,12 +323,12 @@ def validate_github_token(token: str) -> None:
323323
Parameters
324324
----------
325325
token : str
326-
The GitHub token to validate
326+
GitHub personal access token (PAT) for accessing private repositories.
327327
328328
Raises
329329
------
330330
InvalidGitHubTokenError
331-
If the token format is invalid
331+
If the token format is invalid.
332332
333333
"""
334334
if not re.match(GITHUB_PAT_PATTERN, token):

src/gitingest/utils/os_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ async def ensure_directory(path: Path) -> None:
99
Parameters
1010
----------
1111
path : Path
12-
The path to ensure exists
12+
The path to ensure exists.
1313
1414
Raises
1515
------
1616
OSError
17-
If the directory cannot be created
17+
If the directory cannot be created.
1818
1919
"""
2020
try:

src/server/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class QueryForm(BaseModel):
2222
pattern : str
2323
Glob/regex pattern string.
2424
token : str | None
25-
GitHub personal-access token (``None`` if omitted).
25+
GitHub personal access token (PAT) for accessing private repositories.
2626
2727
"""
2828

@@ -54,7 +54,7 @@ def as_form(
5454
pattern : StrForm
5555
Glob/regex pattern string.
5656
token : OptStrForm
57-
GitHub personal-access token (``None`` if omitted).
57+
GitHub personal access token (PAT) for accessing private repositories.
5858
5959
Returns
6060
-------

src/server/query_processor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ async def process_query(
5252
is_index : bool
5353
Flag indicating whether the request is for the index page (default: ``False``).
5454
token : str | None
55-
GitHub personal-access token (PAT). Needed when the repository is private.
55+
GitHub personal access token (PAT) for accessing private repositories.
5656
5757
Returns
5858
-------

src/server/server_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ async def _remove_old_repositories(
8383
Parameters
8484
----------
8585
base_path : Path
86-
The path to the base directory where repositories are stored (default: ``TMP_BASE_PATH``)
86+
The path to the base directory where repositories are stored (default: ``TMP_BASE_PATH``).
8787
scan_interval : int
8888
The number of seconds between scans (default: 60).
8989
delete_after : int

tests/test_cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
def test_cli_writes_file(
3737
tmp_path: Path,
3838
monkeypatch: pytest.MonkeyPatch,
39-
cli_args: list[str],
4039
*,
40+
cli_args: list[str],
4141
expect_file: bool,
4242
) -> None:
4343
"""Run the CLI and verify that the SARIF file is created (or not)."""

0 commit comments

Comments
 (0)