file_system.py — langchain Source File
Architecture documentation for file_system.py, a python file in the langchain codebase. 7 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR ec342a82_f981_0c65_98b0_cb0bbff30851["file_system.py"] 9e98f0a7_ec6e_708f_4f1b_e9428b316e1c["os"] ec342a82_f981_0c65_98b0_cb0bbff30851 --> 9e98f0a7_ec6e_708f_4f1b_e9428b316e1c 67ec3255_645e_8b6e_1eff_1eb3c648ed95["re"] ec342a82_f981_0c65_98b0_cb0bbff30851 --> 67ec3255_645e_8b6e_1eff_1eb3c648ed95 0c1d9a1b_c553_0388_dbc1_58af49567aa2["time"] ec342a82_f981_0c65_98b0_cb0bbff30851 --> 0c1d9a1b_c553_0388_dbc1_58af49567aa2 cfe2bde5_180e_e3b0_df2b_55b3ebaca8e7["collections.abc"] ec342a82_f981_0c65_98b0_cb0bbff30851 --> cfe2bde5_180e_e3b0_df2b_55b3ebaca8e7 b6ee5de5_719a_eeb5_1e11_e9c63bc22ef8["pathlib"] ec342a82_f981_0c65_98b0_cb0bbff30851 --> b6ee5de5_719a_eeb5_1e11_e9c63bc22ef8 cf23aed0_f3dd_3cba_61aa_c00a3e5a1b92["langchain_core.stores"] ec342a82_f981_0c65_98b0_cb0bbff30851 --> cf23aed0_f3dd_3cba_61aa_c00a3e5a1b92 d8d987c9_00e9_2511_0fa8_5914d55b93d5["langchain_classic.storage.exceptions"] ec342a82_f981_0c65_98b0_cb0bbff30851 --> d8d987c9_00e9_2511_0fa8_5914d55b93d5 style ec342a82_f981_0c65_98b0_cb0bbff30851 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import os
import re
import time
from collections.abc import Iterator, Sequence
from pathlib import Path
from langchain_core.stores import ByteStore
from langchain_classic.storage.exceptions import InvalidKeyException
class LocalFileStore(ByteStore):
"""`BaseStore` interface that works on the local file system.
Examples:
Create a `LocalFileStore` instance and perform operations on it:
```python
from langchain_classic.storage import LocalFileStore
# Instantiate the LocalFileStore with the root path
file_store = LocalFileStore("/path/to/root")
# Set values for keys
file_store.mset([("key1", b"value1"), ("key2", b"value2")])
# Get values for keys
values = file_store.mget(["key1", "key2"]) # Returns [b"value1", b"value2"]
# Delete keys
file_store.mdelete(["key1"])
# Iterate over keys
for key in file_store.yield_keys():
print(key) # noqa: T201
```
"""
def __init__(
self,
root_path: str | Path,
*,
chmod_file: int | None = None,
chmod_dir: int | None = None,
update_atime: bool = False,
) -> None:
"""Implement the `BaseStore` interface for the local file system.
Args:
root_path: The root path of the file store. All keys are interpreted as
paths relative to this root.
chmod_file: Sets permissions for newly created files, overriding the
current `umask` if needed.
chmod_dir: Sets permissions for newly created dirs, overriding the
current `umask` if needed.
update_atime: Updates the filesystem access time (but not the modified
time) when a file is read. This allows MRU/LRU cache policies to be
implemented for filesystems where access time updates are disabled.
"""
self.root_path = Path(root_path).absolute()
// ... (105 more lines)
Domain
Subdomains
Classes
Dependencies
- collections.abc
- langchain_classic.storage.exceptions
- langchain_core.stores
- os
- pathlib
- re
- time
Source
Frequently Asked Questions
What does file_system.py do?
file_system.py is a source file in the langchain codebase, written in python. It belongs to the CoreAbstractions domain, MessageSchema subdomain.
What does file_system.py depend on?
file_system.py imports 7 module(s): collections.abc, langchain_classic.storage.exceptions, langchain_core.stores, os, pathlib, re, time.
Where is file_system.py in the architecture?
file_system.py is located at libs/langchain/langchain_classic/storage/file_system.py (domain: CoreAbstractions, subdomain: MessageSchema, directory: libs/langchain/langchain_classic/storage).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free