refactor: replace bare dict with dict[str, Any] in dataset and external_knowledge services#35073
Merged
asukaminato0721 merged 1 commit intolanggenius:mainfrom Apr 13, 2026
Conversation
…al_knowledge services
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-04-13 14:40:38.611394652 +0000
+++ /tmp/pyrefly_pr.txt 2026-04-13 14:40:28.866470621 +0000
@@ -6249,7 +6249,7 @@
--> tests/unit_tests/services/test_external_dataset_service.py:116:60
ERROR Argument `str` is not assignable to parameter `type` with type `Literal['api-key', 'no-auth']` in function `services.entities.external_knowledge_entities.external_knowledge_entities.Authorization.__init__` [bad-argument-type]
--> tests/unit_tests/services/test_external_dataset_service.py:117:35
-ERROR Argument `None` is not assignable to parameter `api_settings` with type `dict[Unknown, Unknown]` in function `services.external_knowledge_service.ExternalDatasetService.validate_api_list` [bad-argument-type]
+ERROR Argument `None` is not assignable to parameter `api_settings` with type `dict[str, Any]` in function `services.external_knowledge_service.ExternalDatasetService.validate_api_list` [bad-argument-type]
--> tests/unit_tests/services/test_external_dataset_service.py:401:54
ERROR Argument `str | None` is not assignable to parameter `s` with type `bytearray | bytes | str` in function `json.loads` [bad-argument-type]
--> tests/unit_tests/services/test_external_dataset_service.py:880:31
|
asukaminato0721
approved these changes
Apr 13, 2026
HanqingZ
pushed a commit
to HanqingZ/dify
that referenced
this pull request
Apr 23, 2026
…al_knowledge services (langgenius#35073)
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.
Summary
Tighten bare
dictannotations in dataset and external knowledge services:services/dataset_service.py—summary_index_setting,data_source_info,estimate_args_validate.args,segment_create_args_validate.args,create_segment.argsservices/external_knowledge_service.py—validate_api_list.api_settings,create_external_knowledge_api.args,check_endpoint_and_api_key.settings,document_create_args_validate.process_parameter,assembling_headers.headers,get_external_knowledge_api_settings.settings,create_external_dataset.args,external_retrieval_parametersAll are dynamic API/datasource configurations or parsed request payloads, so
dict[str, Any]is the correct shape.Anyis already imported in both files.No behavior change — types only.
Part of #22651.
Test plan
make lintpassesmake type-check-corepasses