Skip to content

Commit 4959714

Browse files
Use plain assert rather than if-clause.
Co-authored-by: Marcel Martin <marcel.martin@scilifelab.se>
1 parent 4647fd1 commit 4959714

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/xopen/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -655,8 +655,7 @@ def _detect_format_from_extension(filename: Union[str, bytes]) -> Optional[str]:
655655
def _file_or_path_to_binary_stream(
656656
file_or_path: FileOrPath, binary_mode: str
657657
) -> Tuple[BinaryIO, bool]:
658-
if binary_mode not in ("rb", "wb", "ab"):
659-
raise AssertionError()
658+
assert binary_mode in ("rb", "wb", "ab")
660659
if file_or_path == "-":
661660
return _open_stdin_or_out(binary_mode), False
662661
if isinstance(file_or_path, (str, bytes)) or hasattr(file_or_path, "__fspath__"):

0 commit comments

Comments
 (0)