Skip to content

Commit

Permalink
Supporting mypy local usage with venv (run-llama#7952)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesbraza authored Oct 3, 2023
1 parent e3e2062 commit ca09272
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions experimental/splitter_playground/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
from langchain.text_splitter import (
CharacterTextSplitter,
RecursiveCharacterTextSplitter,
)
from langchain.text_splitter import (
TextSplitter as LCSplitter,
)
from langchain.text_splitter import TokenTextSplitter as LCTokenTextSplitter
Expand All @@ -29,16 +31,14 @@
@st.cache_resource(ttl="1h")
def load_document(uploaded_files: List[UploadedFile]) -> List[Document]:
# Read documents
docs = []
temp_dir = tempfile.TemporaryDirectory()
for file in uploaded_files:
temp_filepath = os.path.join(temp_dir.name, file.name)
with open(temp_filepath, "wb") as f:
f.write(file.getvalue())

reader = SimpleDirectoryReader(input_dir=temp_dir.name)
docs = reader.load_data()
return docs
return reader.load_data()


if uploaded_files:
Expand Down
7 changes: 4 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[tool.mypy]
ignore_missing_imports = "True"
disallow_untyped_defs = "True"
exclude = ["notebooks", "build", "examples"]
disallow_untyped_defs = true
# Remove venv skip when integrated with pre-commit
exclude = ["build", "examples", "notebooks", "venv"]
ignore_missing_imports = true

[tool.ruff]
exclude = [
Expand Down

0 comments on commit ca09272

Please sign in to comment.