Skip to content

xopen accepts filehandles #152

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 33 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
9a92cd6
add support for passing file handles to xopen routines instead of paths
geertvandeweyer Feb 8, 2024
80253fe
added tests for filehandle passing
geertvandeweyer Feb 8, 2024
3a373b9
working on file object support
geertvandeweyer Feb 17, 2024
3d0c0e1
merging upstream
geertvandeweyer Feb 17, 2024
75f2aeb
addressing PR comments
geertvandeweyer Feb 19, 2024
42f59a0
fix file/filename argument
geertvandeweyer Feb 19, 2024
a1dbaf5
remove file/filename argument in favor of filename only
geertvandeweyer Feb 19, 2024
865cb98
Throw OSError when unsupported mode is used
rhpvorderman Feb 20, 2024
b3dd998
Add test for BytesIO objects
rhpvorderman Feb 20, 2024
9a9838f
Work only with binary streams internally
rhpvorderman Feb 20, 2024
ec85410
Use a thread to feed an inpipe for reading
rhpvorderman Feb 20, 2024
b6ed080
Fix several test fails
rhpvorderman Feb 20, 2024
54a9519
Remove redundant test
rhpvorderman Feb 20, 2024
840e53f
Allow filenames for _PipedCompressionProgram for easier testing
rhpvorderman Feb 20, 2024
341969d
Good test for bytesio
rhpvorderman Mar 11, 2024
a05a61b
Use closefd argument
rhpvorderman Mar 11, 2024
76987fe
Resourcefixes
rhpvorderman Mar 11, 2024
6d140d0
Fix resourcewarnings
rhpvorderman Mar 11, 2024
2dd88ce
Fix mypy errors
rhpvorderman Mar 11, 2024
576e3dd
Update isal and zlib-ng versions to prevent errors with closing streams
rhpvorderman Mar 11, 2024
f61ecf2
Make filepath function private
rhpvorderman Mar 11, 2024
e07fbee
Reunite read and write processes for PipedCompressionProgram
rhpvorderman Mar 11, 2024
4a5057c
Correct typo and add clarification
rhpvorderman Mar 11, 2024
b24c396
Prevent python 3.8 errors
rhpvorderman Mar 11, 2024
1717d09
Also test threads for reading and writing filelike objects
rhpvorderman Mar 11, 2024
4647fd1
Add filelike objects acceptance to the changelog
rhpvorderman Mar 11, 2024
4959714
Use plain assert rather than if-clause.
rhpvorderman Mar 19, 2024
44d9a9d
Remove accidentally added file
rhpvorderman Mar 19, 2024
3cc8d1b
Add return type
rhpvorderman Mar 19, 2024
c47a5dc
Parametrize twice rather than using itertools
rhpvorderman Mar 19, 2024
15fe876
No else: raise at the end of function.
rhpvorderman Mar 19, 2024
da5f9ea
Simplify the decision tree for returning a binary filelike object
rhpvorderman Mar 19, 2024
3169423
Write a comment about the necessity of using a separate thread
rhpvorderman Mar 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,10 @@ Changelog

in-development
~~~~~~~~~~~~~~~~~~~

* #152: ``xopen()`` now accepts `file-like objects
<https://docs.python.org/3/glossary.html#term-file-object>`_ for its filename
argument.
* #146, #147, #148: Various refactors for better code size and readability:

* PipedCompressionReader/Writer are now combined _PipedCompressionProgram
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ classifiers = [
requires-python = ">=3.8"
dynamic = ["version"]
dependencies = [
'isal>=1.4.1; platform.machine == "x86_64" or platform.machine == "AMD64" or platform.machine == "aarch64"',
'zlib-ng>=0.4.0; platform.machine == "x86_64" or platform.machine == "AMD64" or platform.machine == "aarch64"'
'isal>=1.6.1; platform.machine == "x86_64" or platform.machine == "AMD64" or platform.machine == "aarch64"',
'zlib-ng>=0.4.1; platform.machine == "x86_64" or platform.machine == "AMD64" or platform.machine == "aarch64"'
]

[project.urls]
Expand Down
Loading