Skip to content

Commit 1aa823a

Browse files
committed
Ruff and Typos
1 parent fdd00d9 commit 1aa823a

File tree

4 files changed

+27
-25
lines changed

4 files changed

+27
-25
lines changed

graphrag/api/prompt_tune.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from pydantic import PositiveInt, validate_call
1818

1919
from graphrag.callbacks.noop_workflow_callbacks import NoopWorkflowCallbacks
20-
from graphrag.config.defaults import graphrag_config_defaults, language_model_defaults
20+
from graphrag.config.defaults import graphrag_config_defaults
2121
from graphrag.config.models.graph_rag_config import GraphRagConfig
2222
from graphrag.language_model.manager import ModelManager
2323
from graphrag.logger.base import ProgressLogger

graphrag/cli/main.py

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import re
88
from collections.abc import Callable
99
from pathlib import Path
10-
from typing import Annotated
1110

1211
import typer
1312

@@ -78,6 +77,20 @@ def completer(incomplete: str) -> list[str]:
7877
return completer
7978

8079

80+
CONFIG_AUTOCOMPLETE = path_autocomplete(
81+
file_okay=True,
82+
dir_okay=False,
83+
match_wildcard="*.yaml",
84+
readable=True,
85+
)
86+
87+
ROOT_AUTOCOMPLETE = path_autocomplete(
88+
file_okay=False,
89+
dir_okay=True,
90+
writable=True,
91+
match_wildcard="*",
92+
)
93+
8194
@app.command("init")
8295
def _initialize_cli(
8396
root: Path = typer.Option(
@@ -88,9 +101,7 @@ def _initialize_cli(
88101
dir_okay=True,
89102
writable=True,
90103
resolve_path=True,
91-
autocompletion=path_autocomplete(
92-
file_okay=False, dir_okay=True, writable=True, match_wildcard="*"
93-
),
104+
autocompletion=ROOT_AUTOCOMPLETE,
94105
),
95106
force: bool = typer.Option(
96107
False,
@@ -115,6 +126,7 @@ def _index_cli(
115126
exists=True,
116127
file_okay=True,
117128
readable=True,
129+
autocompletion=CONFIG_AUTOCOMPLETE,
118130
),
119131
root: Path = typer.Option(
120132
Path(),
@@ -125,9 +137,7 @@ def _index_cli(
125137
dir_okay=True,
126138
writable=True,
127139
resolve_path=True,
128-
autocompletion=path_autocomplete(
129-
file_okay=False, dir_okay=True, writable=True, match_wildcard="*"
130-
),
140+
autocompletion=ROOT_AUTOCOMPLETE,
131141
),
132142
method: IndexingMethod = typer.Option(
133143
IndexingMethod.Standard.value,
@@ -209,6 +219,7 @@ def _update_cli(
209219
exists=True,
210220
file_okay=True,
211221
readable=True,
222+
autocompletion=CONFIG_AUTOCOMPLETE,
212223
),
213224
root: Path = typer.Option(
214225
Path(),
@@ -219,6 +230,7 @@ def _update_cli(
219230
dir_okay=True,
220231
writable=True,
221232
resolve_path=True,
233+
autocompletion=ROOT_AUTOCOMPLETE,
222234
),
223235
method: IndexingMethod = typer.Option(
224236
IndexingMethod.Standard.value,
@@ -296,9 +308,7 @@ def _prompt_tune_cli(
296308
dir_okay=True,
297309
writable=True,
298310
resolve_path=True,
299-
autocompletion=path_autocomplete(
300-
file_okay=False, dir_okay=True, writable=True, match_wildcard="*"
301-
),
311+
autocompletion=ROOT_AUTOCOMPLETE,
302312
),
303313
config: Path | None = typer.Option(
304314
None,
@@ -308,9 +318,7 @@ def _prompt_tune_cli(
308318
exists=True,
309319
file_okay=True,
310320
readable=True,
311-
autocompletion=path_autocomplete(
312-
file_okay=True, dir_okay=False, match_wildcard="*"
313-
),
321+
autocompletion=CONFIG_AUTOCOMPLETE,
314322
),
315323
verbose: bool = typer.Option(
316324
False,
@@ -442,9 +450,7 @@ def _query_cli(
442450
exists=True,
443451
file_okay=True,
444452
readable=True,
445-
autocompletion=path_autocomplete(
446-
file_okay=True, dir_okay=False, match_wildcard="*"
447-
),
453+
autocompletion=CONFIG_AUTOCOMPLETE,
448454
),
449455
data: Path | None = typer.Option(
450456
None,
@@ -455,22 +461,18 @@ def _query_cli(
455461
dir_okay=True,
456462
readable=True,
457463
resolve_path=True,
458-
autocompletion=path_autocomplete(
459-
file_okay=False, dir_okay=True, match_wildcard="*"
460-
),
464+
autocompletion=ROOT_AUTOCOMPLETE,
461465
),
462466
root: Path = typer.Option(
463-
Path.cwd(),
467+
Path(),
464468
"--root",
465469
"-r",
466470
help="The project root directory.",
467471
exists=True,
468472
dir_okay=True,
469473
writable=True,
470474
resolve_path=True,
471-
autocompletion=path_autocomplete(
472-
file_okay=False, dir_okay=True, match_wildcard="*"
473-
),
475+
autocompletion=ROOT_AUTOCOMPLETE,
474476
),
475477
community_level: int = typer.Option(
476478
2,

graphrag/index/validate_config.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import sys
88

99
from graphrag.callbacks.noop_workflow_callbacks import NoopWorkflowCallbacks
10-
from graphrag.config.defaults import language_model_defaults
1110
from graphrag.config.models.graph_rag_config import GraphRagConfig
1211
from graphrag.language_model.manager import ModelManager
1312
from graphrag.logger.print_progress import ProgressLogger

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ ignore = [
245245
# TODO RE-Enable when we get bandwidth
246246
"PERF203", # Needs restructuring of errors, we should bail-out on first error
247247
"C901", # needs refactoring to remove cyclomatic complexity
248+
"B008", # Needs to restructure our cli params with Typer into constants
248249
]
249250

250251
[tool.ruff.lint.per-file-ignores]

0 commit comments

Comments
 (0)