Skip to content

Commit a5f22e7

Browse files
authored
chore(core): clean up docstring mismatch and redundant logic in langchain-core (#35064)
## Description Fixes #35046 Two minor cleanups in `langchain-core`: 1. **Fix docstring mismatch in `mustache.render()`**: The docstring incorrectly documented `partials_path` and `partials_ext` parameters that do not exist in the function signature. These were likely carried over from the original [chevron](https://github.com/noahmorrison/chevron) library but were never part of this adapted implementation. 2. **Remove redundant logic in `Blob.from_path()`**: The expression `mimetypes.guess_type(path)[0] if guess_type else None` had a redundant `if guess_type` ternary since the outer condition `if mime_type is None and guess_type:` already guarantees `guess_type` is `True` at that point. Simplified to just `mimetypes.guess_type(path)[0]`. ## AI Disclaimer An AI coding assistant was used to help identify and implement these changes.
1 parent 97ee14c commit a5f22e7

2 files changed

Lines changed: 1 addition & 9 deletions

File tree

libs/core/langchain_core/documents/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ def from_path(
234234
`Blob` instance
235235
"""
236236
if mime_type is None and guess_type:
237-
mimetype = mimetypes.guess_type(path)[0] if guess_type else None
237+
mimetype = mimetypes.guess_type(path)[0]
238238
else:
239239
mimetype = mime_type
240240
# We do not load the data immediately, instead we treat the blob as a

libs/core/langchain_core/utils/mustache.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -481,14 +481,6 @@ def render(
481481
Args:
482482
template: A file-like object or a string containing the template.
483483
data: A python dictionary with your data scope.
484-
partials_path: The path to where your partials are stored.
485-
486-
If set to None, then partials won't be loaded from the file system
487-
488-
Defaults to `'.'`.
489-
partials_ext: The extension that you want the parser to look for
490-
491-
Defaults to `'mustache'`.
492484
partials_dict: A python dictionary which will be search for partials
493485
before the filesystem is.
494486

0 commit comments

Comments
 (0)