refactor: remove __getattr__ reflection in keyword_factory#35983
Open
Ruthwik-Data wants to merge 2 commits into
Open
refactor: remove __getattr__ reflection in keyword_factory#35983Ruthwik-Data wants to merge 2 commits into
Ruthwik-Data wants to merge 2 commits into
Conversation
Removed dynamic attribute access for keyword processor.
Add feature file for creating knowledge base datasets with scenarios for dataset creation and navigation.
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-05-09 17:26:59.144129294 +0000
+++ /tmp/pyrefly_pr.txt 2026-05-09 17:26:47.032073332 +0000
@@ -4443,8 +4443,14 @@
--> tests/unit_tests/core/rag/datasource/keyword/test_keyword_factory.py:37:23
ERROR `test_keyword_getattr_returns_callable_and_raises_for_invalid_attributes.Processor` is not assignable to attribute `_keyword_processor` with type `BaseKeyword` [bad-assignment]
--> tests/unit_tests/core/rag/datasource/keyword/test_keyword_factory.py:75:34
+ERROR Object of class `Keyword` has no attribute `custom` [missing-attribute]
+ --> tests/unit_tests/core/rag/datasource/keyword/test_keyword_factory.py:77:12
+ERROR Object of class `Keyword` has no attribute `value` [missing-attribute]
+ --> tests/unit_tests/core/rag/datasource/keyword/test_keyword_factory.py:80:13
ERROR `None` is not assignable to attribute `_keyword_processor` with type `BaseKeyword` [bad-assignment]
--> tests/unit_tests/core/rag/datasource/keyword/test_keyword_factory.py:82:34
+ERROR Object of class `Keyword` has no attribute `missing_method` [missing-attribute]
+ --> tests/unit_tests/core/rag/datasource/keyword/test_keyword_factory.py:84:13
ERROR Class member `_DummyVector.add_texts` overrides parent class `BaseVector` in an inconsistent manner [bad-override]
--> tests/unit_tests/core/rag/datasource/vdb/test_vector_base.py:20:9
ERROR Argument `list[Document | SimpleNamespace]` is not assignable to parameter `texts` with type `list[Document]` in function `core.rag.datasource.vdb.vector_base.BaseVector._filter_duplicate_texts` [bad-argument-type]
|
Contributor
Pyrefly Type Coverage
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Removes the
__getattr__magic method from theKeywordclass inkeyword_factory.py.All methods (
create,add_texts,text_exists,delete_by_ids,delete,search) are already explicitly defined on the class, making the dynamic reflection viagetattrunnecessary. Removing it improves type safety and makes bugs easier to catch.Closes #24487
Closes #34278