Skip to content

Commit c0aa8ea

Browse files
authored
Add ruff rules for comprehensions (#550)
1 parent 20c9034 commit c0aa8ea

File tree

6 files changed

+20
-10
lines changed

6 files changed

+20
-10
lines changed

libs/colbert/tests/unit_tests/test_colbert_baseline_embeddings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"Future Directions in Arctic Botanical Studies": "The future of Arctic botany lies in interdisciplinary research, combining traditional knowledge with modern scientific techniques. As the Arctic undergoes rapid changes, understanding the ecological, cultural, and climatic dimensions of Arctic flora becomes increasingly important. Future research will need to address the challenges of climate change, explore the potential for Arctic plants in biotechnology, and continue to conserve this unique biome. The resilience of Arctic flora offers lessons in adaptation and survival relevant to global challenges.", # noqa: E501
3535
}
3636

37-
arctic_botany_chunks = [text for text in arctic_botany_dict.values()]
37+
arctic_botany_chunks = list(arctic_botany_dict.values())
3838

3939

4040
# a uility function to evaluate similarity of two embeddings at per token level

libs/knowledge-graph/ragstack_knowledge_graph/knowledge_graph.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def _parse_node(row) -> Node:
2525
type=row.type,
2626
properties=_deserialize_md_dict(row.properties_json)
2727
if row.properties_json
28-
else dict(),
28+
else {},
2929
)
3030

3131

libs/knowledge-store/ragstack_knowledge_store/graph_store.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ def _get_adjacent(
595595
List of adjacent edges.
596596
"""
597597

598-
targets = dict()
598+
targets = {}
599599

600600
def add_sources(rows):
601601
for row in rows:

libs/langchain/tests/integration_tests/test_graph_store.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def embed_query(self, text: str) -> List[float]:
108108

109109

110110
def _result_ids(docs: Iterable[Document]) -> List[str]:
111-
return list(map(lambda d: d.metadata[METADATA_CONTENT_ID_KEY], docs))
111+
return [d.metadata[METADATA_CONTENT_ID_KEY] for d in docs]
112112

113113

114114
@pytest.mark.parametrize("gs_factory", ["cassandra", "astra_db"])

libs/ragulate/ragstack_ragulate/analysis.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,14 +133,22 @@ def output_box_plots_by_dataset(self, df: DataFrame, metrics: List[str]):
133133
boxmode="group",
134134
height=height,
135135
width=900,
136-
title=dict(
137-
text=dataset, x=0.03, y=0.03, xanchor="left", yanchor="bottom"
138-
),
136+
title={
137+
"text": dataset,
138+
"x": 0.03,
139+
"y": 0.03,
140+
"xanchor": "left",
141+
"yanchor": "bottom",
142+
},
139143
yaxis_title="metric",
140144
xaxis_title="score",
141-
legend=dict(
142-
orientation="h", yanchor="bottom", y=1.02, xanchor="right", x=1
143-
),
145+
legend={
146+
"orientation": "h",
147+
"yanchor": "bottom",
148+
"y": 1.02,
149+
"xanchor": "right",
150+
"x": 1,
151+
},
144152
)
145153

146154
write_image(fig, f"./{dataset}_box_plot.png")

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ ignore = [
6363
]
6464

6565
select = [
66+
"ASYNC",
6667
"B",
68+
"C4",
6769
"E",
6870
"F",
6971
"FLY",

0 commit comments

Comments
 (0)