Skip to content

Commit 629faef

Browse files
committed
refactor: Simplify field definitions in DiscoveredFile dataclass
1 parent 9b0c632 commit 629faef

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

src/codeweaver/core/discovery.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,11 @@ class DiscoveredFile(DataclassSerializationMixin):
5050
_file_hash: Annotated[
5151
BlakeHashKey | None,
5252
Field(
53-
default_factory=lambda data: get_blake_hash(data["path"].read_bytes()),
54-
description="""blake3 hash of the file contents. File hashes are from non-normalized content, so two files with different line endings, white spaces, unicode characters, etc. will have different hashes.""",
55-
init=False,
53+
description="""blake3 hash of the file contents. File hashes are from non-normalized content, so two files with different line endings, white spaces, unicode characters, etc. will have different hashes."""
5654
),
5755
] = None
5856
_git_branch: Annotated[
59-
str | Missing,
60-
Field(
61-
init=False,
62-
default_factory=lambda data: get_git_branch(data["path"]),
63-
description="""Git branch the file was discovered in, if detected.""",
64-
),
57+
str | Missing, Field(description="""Git branch the file was discovered in, if detected.""")
6558
] = Missing # type: ignore
6659

6760
source_id: Annotated[

0 commit comments

Comments
 (0)