Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Llama Index
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mirrored_repos
MachineLearning
run-llama
Llama Index
Commits
ca09272a
Unverified
Commit
ca09272a
authored
1 year ago
by
James Braza
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Supporting `mypy` local usage with `venv` (#7952)
parent
e3e20624
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
experimental/splitter_playground/app.py
+3
-3
3 additions, 3 deletions
experimental/splitter_playground/app.py
pyproject.toml
+4
-3
4 additions, 3 deletions
pyproject.toml
with
7 additions
and
6 deletions
experimental/splitter_playground/app.py
+
3
−
3
View file @
ca09272a
...
...
@@ -7,6 +7,8 @@ import tiktoken
from
langchain.text_splitter
import
(
CharacterTextSplitter
,
RecursiveCharacterTextSplitter
,
)
from
langchain.text_splitter
import
(
TextSplitter
as
LCSplitter
,
)
from
langchain.text_splitter
import
TokenTextSplitter
as
LCTokenTextSplitter
...
...
@@ -29,7 +31,6 @@ assert isinstance(n_cols, int)
@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
)
...
...
@@ -37,8 +38,7 @@ def load_document(uploaded_files: List[UploadedFile]) -> List[Document]:
f
.
write
(
file
.
getvalue
())
reader
=
SimpleDirectoryReader
(
input_dir
=
temp_dir
.
name
)
docs
=
reader
.
load_data
()
return
docs
return
reader
.
load_data
()
if
uploaded_files
:
...
...
This diff is collapsed.
Click to expand it.
pyproject.toml
+
4
−
3
View file @
ca09272a
[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
=
[
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment