Skip to content

Commit 7beef71

Browse files
Ran pre-commit on Vyaas99's branch for CI to pass
1 parent 5250f80 commit 7beef71

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
click>=8.0.0
22
fastapi-analytics
33
fastapi[standard]
4+
pypdf
45
python-dotenv
56
slowapi
67
starlette
78
tiktoken
89
uvicorn
9-
pypdf

src/gitingest/ingest_from_query.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import os
22
from fnmatch import fnmatch
33
from typing import Any
4-
from pypdf import PdfReader
54

65
import tiktoken
6+
from pypdf import PdfReader
77

88
MAX_FILE_SIZE = 10 * 1024 * 1024 # 10 MB
99
MAX_DIRECTORY_DEPTH = 20 # Maximum depth of directory traversal
@@ -98,6 +98,7 @@ def _is_safe_symlink(symlink_path: str, base_path: str) -> bool:
9898
# If there's any error resolving the paths, consider it unsafe
9999
return False
100100

101+
101102
def _is_pdf_file(file_path: str) -> bool:
102103
"""
103104
Check if the file is a PDF based on its extension.
@@ -114,6 +115,7 @@ def _is_pdf_file(file_path: str) -> bool:
114115
"""
115116
return file_path.lower().endswith(".pdf")
116117

118+
117119
def _is_text_file(file_path: str) -> bool:
118120
"""
119121
Determine if a file is likely a text file based on its content.
@@ -139,6 +141,7 @@ def _is_text_file(file_path: str) -> bool:
139141
except OSError:
140142
return False
141143

144+
142145
def _read_pdf_content(file_path: str) -> str:
143146
"""
144147
Extract text from a PDF file.
@@ -159,6 +162,7 @@ def _read_pdf_content(file_path: str) -> str:
159162
except Exception as e:
160163
return f"Error reading PDF file: {str(e)}"
161164

165+
162166
def _read_file_content(file_path: str) -> str:
163167
"""
164168
Reads the content of a file.

0 commit comments

Comments
 (0)