Skip to content

Commit a6736f3

Browse files
committed
patch: implemented With condition for reading file contents + seek zero position at start of function
1 parent 67f86a2 commit a6736f3

3 files changed

Lines changed: 7 additions & 5 deletions

File tree

TextSpitter/core.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ def get_file_type(file):
3535
return mime_type.split("/")[1]
3636

3737
def get_contents(self):
38-
return self.file.read()
38+
with self.file as f:
39+
f.seek(0, 0)
40+
return f.read()
3941

4042
def PdfFileRead(self):
4143
"""This current code provides a workaround in case MuPDF (a dependency for

dev_requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# pip-compile dev_requirements.in
66
#
7-
anyio==3.3.2
7+
anyio==3.3.3
88
# via jupyter-server
99
argon2-cffi==21.1.0
1010
# via
@@ -28,7 +28,7 @@ cffi==1.14.6
2828
# via argon2-cffi
2929
charset-normalizer==2.0.6
3030
# via requests
31-
click==8.0.2
31+
click==8.0.3
3232
# via black
3333
colorama==0.4.4
3434
# via
@@ -81,7 +81,7 @@ jinja2==3.0.2
8181
# notebook
8282
json5==0.9.6
8383
# via jupyterlab-server
84-
jsonschema==4.0.1
84+
jsonschema==4.1.0
8585
# via
8686
# jupyterlab-server
8787
# nbformat

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setuptools.setup(
77
name="TextSpitter",
8-
version="0.3.5a4",
8+
version="0.3.5a5",
99
author="Francis Secada",
1010
author_email="francis.secada@gmail.com",
1111
description="Python package that spits out text from your document files!",

0 commit comments

Comments
 (0)