Skip to content

Commit 72a63ec

Browse files
committed
refactor: Remove unused imports and update Python version range in lock file. Also, fixed linting issues.
1 parent 745b38c commit 72a63ec

13 files changed

Lines changed: 12 additions & 389 deletions

scripts/generate_changelog.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import os
21
import subprocess
32
import sys
43
from datetime import datetime
@@ -72,8 +71,10 @@ def generate_entry(commits):
7271
output.append("")
7372
# Determine intent from the most common type or the first commit
7473
focus = "Routine Maintenance"
75-
if 'feat' in groups: focus = "Feature Development"
76-
if 'fix' in groups: focus = "Bug Fixes"
74+
if 'feat' in groups:
75+
focus = "Feature Development"
76+
if 'fix' in groups:
77+
focus = "Bug Fixes"
7778

7879
output.append(f"**Focus:** {focus}")
7980
output.append("")

src/knowcode/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from knowcode.context_synthesizer import ContextSynthesizer
1212
from knowcode.graph_builder import GraphBuilder
1313
from knowcode.knowledge_store import KnowledgeStore
14-
from knowcode.models import EntityKind, RelationshipKind
14+
from knowcode.models import EntityKind
1515

1616

1717
@click.group()

src/knowcode/parsers/base.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from pathlib import Path
44
from typing import Any, Optional
55

6-
from tree_sitter import Language, Parser, Tree
6+
from tree_sitter import Parser
77
import tree_sitter_languages
88

99
from knowcode.models import (
@@ -12,7 +12,6 @@
1212
Location,
1313
ParseResult,
1414
Relationship,
15-
RelationshipKind,
1615
)
1716

1817

src/knowcode/parsers/java_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def _extract_entities(
2626
entities: list[Entity] = []
2727
relationships: list[Relationship] = []
2828

29-
is_top_level = parent_id.endswith("::" + file_path.stem)
29+
3030

3131
# In Java, file usually maps to a class, but we have a module entity for the file anyway.
3232
# Package declaration defines the logic module/package.

src/knowcode/parsers/javascript_parser.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,9 @@ def _extract_entities(
2626
entities: list[Entity] = []
2727
relationships: list[Relationship] = []
2828

29-
is_top_level = parent_id.endswith("::" + file_path.stem)
29+
3030

3131
# Traverse children
32-
cursor = node.walk()
3332

3433
# We need to iterate over all children. walk() gives a cursor.
3534
# Tree-sitter cursors are stateful.
@@ -114,7 +113,6 @@ def _parse_class(
114113
class_id = f"{file_path}::{qualified_name}"
115114

116115
# Check parent info for inheritance
117-
extends_clause = node.child_by_field_name("super_class")
118116
# In tree-sitter-javascript: class_heritage -> extends_clause -> call_expression or identifier
119117
# Actually structure is class_declaration -> class_heritage -> extends_clause
120118
# Let's check node children for "class_heritage"
@@ -263,7 +261,8 @@ def _walk_for_calls(self, node, source_id):
263261
def _extract_call(self, node, source_id):
264262
# call_expression: function: (identifier) arguments: (arguments)
265263
func_node = node.child_by_field_name("function")
266-
if not func_node: return None
264+
if not func_node:
265+
return None
267266

268267
callee_name = self._get_text(func_node, None)
269268
# Verify it's not a keyword/syntax

src/knowcode/signals.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import xml.etree.ElementTree as ET
44
from pathlib import Path
5-
from typing import Optional
65

76
from knowcode.models import (
87
Entity,

src/knowcode/temporal.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
from datetime import datetime, timezone
44
from pathlib import Path
5-
from typing import Iterator
65

76
from git import Repo
87

src/knowcode/token_counter.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
"""Token counting utility using tiktoken."""
22

3-
from functools import lru_cache
4-
from typing import Optional
53

64
import tiktoken
75

tests/test_basic.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@
33
import tempfile
44
from pathlib import Path
55

6-
import pytest
76

87
from knowcode.graph_builder import GraphBuilder
98
from knowcode.knowledge_store import KnowledgeStore
10-
from knowcode.models import EntityKind
119

1210

1311
def test_python_parsing() -> None:

tests/test_signals.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"""Tests for Signal Ingestion."""
22

33
import pytest
4-
from pathlib import Path
54
from knowcode.signals import CoverageProcessor
65
from knowcode.models import EntityKind, RelationshipKind
76

0 commit comments

Comments
 (0)