Skip to content

Commit 3a7367c

Browse files
chore: lint fix (#4)
* chore: lint fix * chore: update pyproject.toml instead or changing isort command on github workflow
1 parent d41b309 commit 3a7367c

File tree

8 files changed

+55
-25
lines changed

8 files changed

+55
-25
lines changed

docs/property_graph_store.ipynb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,9 @@
318318
"metadata": {},
319319
"outputs": [],
320320
"source": [
321-
"# This allows running nested event loop \n",
321+
"# This allows running nested event loop\n",
322322
"import nest_asyncio\n",
323+
"\n",
323324
"nest_asyncio.apply()"
324325
]
325326
},

pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,9 @@ ipykernel = "^6.29.5"
2525
[build-system]
2626
requires = ["poetry-core"]
2727
build-backend = "poetry.core.masonry.api"
28+
29+
[tool.black]
30+
target-version = ['py39']
31+
32+
[tool.isort]
33+
profile = "black"

src/llama_index_spanner/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
from .graph_retriever import (SpannerGraphCustomRetriever,
16-
SpannerGraphTextToGQLRetriever)
15+
from .graph_retriever import SpannerGraphCustomRetriever, SpannerGraphTextToGQLRetriever
1716
from .property_graph_store import SpannerPropertyGraphStore
1817
from .version import __version__
1918

src/llama_index_spanner/graph_retriever.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,18 @@
2121
from llama_index.core.output_parsers import PydanticOutputParser
2222
from llama_index.core.postprocessor.llm_rerank import LLMRerank
2323
from llama_index.core.prompts import PromptType
24-
from llama_index.core.retrievers import (CustomPGRetriever,
25-
VectorContextRetriever)
24+
from llama_index.core.retrievers import CustomPGRetriever, VectorContextRetriever
2625
from llama_index.core.schema import NodeWithScore, QueryBundle, TextNode
2726
from llama_index.core.vector_stores.types import VectorStore
2827
from pydantic import BaseModel
2928

3029
from .graph_utils import extract_gql, fix_gql_syntax
31-
from .prompts import (DEFAULT_GQL_FIX_TEMPLATE, DEFAULT_GQL_VERIFY_TEMPLATE,
32-
DEFAULT_SPANNER_GQL_TEMPLATE, DEFAULT_SUMMARY_TEMPLATE)
30+
from .prompts import (
31+
DEFAULT_GQL_FIX_TEMPLATE,
32+
DEFAULT_GQL_VERIFY_TEMPLATE,
33+
DEFAULT_SPANNER_GQL_TEMPLATE,
34+
DEFAULT_SUMMARY_TEMPLATE,
35+
)
3336
from .property_graph_store import SpannerPropertyGraphStore
3437

3538
GQL_GENERATION_PROMPT = PromptTemplate(

src/llama_index_spanner/property_graph_store.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,25 @@
1717
from typing import Any, Dict, List, Optional, Tuple
1818

1919
from google.cloud import spanner
20-
from llama_index.core.graph_stores.types import (ChunkNode, EntityNode,
21-
LabelledNode,
22-
PropertyGraphStore, Relation,
23-
Triplet)
20+
from llama_index.core.graph_stores.types import (
21+
ChunkNode,
22+
EntityNode,
23+
LabelledNode,
24+
PropertyGraphStore,
25+
Relation,
26+
Triplet,
27+
)
2428
from llama_index.core.prompts import PromptTemplate, PromptType
2529
from llama_index.core.vector_stores.types import VectorStoreQuery
2630

2731
from .prompts import DEFAULT_SPANNER_GQL_TEMPLATE
28-
from .schema import (ElementSchema, GraphDocumentUtility, SpannerGraphSchema,
29-
group_edges, group_nodes)
32+
from .schema import (
33+
ElementSchema,
34+
GraphDocumentUtility,
35+
SpannerGraphSchema,
36+
group_edges,
37+
group_nodes,
38+
)
3039
from .spanner import SpannerImpl, SpannerInterface, client_with_user_agent
3140
from .version import __version__
3241

src/llama_index_spanner/schema.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,12 @@
1919
from typing import Any, Dict, Generator, Iterable, List, Optional, Tuple
2020

2121
from google.cloud.spanner_v1 import JsonObject, param_types
22-
from llama_index.core.graph_stores.types import (ChunkNode, EntityNode,
23-
LabelledNode, Relation)
22+
from llama_index.core.graph_stores.types import (
23+
ChunkNode,
24+
EntityNode,
25+
LabelledNode,
26+
Relation,
27+
)
2428
from requests.structures import CaseInsensitiveDict
2529

2630
from .type_utils import TypeUtility

tests/test_graph_retriever.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
from llama_index.readers.wikipedia import WikipediaReader
2121

2222
from llama_index_spanner.graph_retriever import (
23-
SpannerGraphCustomRetriever, SpannerGraphTextToGQLRetriever)
23+
SpannerGraphCustomRetriever,
24+
SpannerGraphTextToGQLRetriever,
25+
)
2426
from tests.utils import get_resources
2527

2628

tests/test_spanner_property_graph_store.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,24 @@
1616

1717
import pytest
1818
from llama_index.core.graph_stores.types import ChunkNode, EntityNode, Relation
19-
from llama_index.core.vector_stores.types import (ExactMatchFilter,
20-
FilterCondition,
21-
FilterOperator,
22-
MetadataFilter,
23-
MetadataFilters,
24-
VectorStoreQuery)
19+
from llama_index.core.vector_stores.types import (
20+
ExactMatchFilter,
21+
FilterCondition,
22+
FilterOperator,
23+
MetadataFilter,
24+
MetadataFilters,
25+
VectorStoreQuery,
26+
)
2527

2628
from llama_index_spanner.property_graph_store import SpannerPropertyGraphStore
2729
from llama_index_spanner.schema import ElementSchema
28-
from tests.utils import (get_random_suffix, get_spanner_property_graph_store,
29-
spanner_database_id, spanner_graph_name,
30-
spanner_instance_id)
30+
from tests.utils import (
31+
get_random_suffix,
32+
get_spanner_property_graph_store,
33+
spanner_database_id,
34+
spanner_graph_name,
35+
spanner_instance_id,
36+
)
3137

3238
pytestmark = pytest.mark.skipif(
3339
(not spanner_instance_id or not spanner_database_id or not spanner_graph_name),

0 commit comments

Comments
 (0)