1717import io
1818import math
1919import os
20- from typing import Any , Iterable , List , Mapping , Optional
20+ from typing import Any , Iterable , List , Mapping , NoReturn , Optional
2121
2222from bson .binary import Binary
2323from bson .int64 import Int64
@@ -298,7 +298,7 @@ def __flush(self) -> Any:
298298 except DuplicateKeyError :
299299 self ._raise_file_exists (self ._id )
300300
301- def _raise_file_exists (self , file_id : Any ) -> None :
301+ def _raise_file_exists (self , file_id : Any ) -> NoReturn :
302302 """Raise a FileExists exception for the given file_id."""
303303 raise FileExists ("file with _id %r already exists" % file_id )
304304
@@ -312,7 +312,7 @@ def close(self) -> None:
312312 self .__flush ()
313313 object .__setattr__ (self , "_closed" , True )
314314
315- def read (self , size : Optional [ int ] = - 1 ) -> None :
315+ def read (self , size : int = - 1 ) -> NoReturn :
316316 raise io .UnsupportedOperation ("read" )
317317
318318 def readable (self ) -> bool :
@@ -682,10 +682,10 @@ def close(self) -> None:
682682 self .__chunk_iter = None
683683 super ().close ()
684684
685- def write (self , value : Any ) -> None :
685+ def write (self , value : Any ) -> NoReturn :
686686 raise io .UnsupportedOperation ("write" )
687687
688- def writelines (self , lines : Any ) -> None :
688+ def writelines (self , lines : Any ) -> NoReturn :
689689 raise io .UnsupportedOperation ("writelines" )
690690
691691 def writable (self ) -> bool :
@@ -704,7 +704,7 @@ def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> Any:
704704 self .close ()
705705 return False
706706
707- def fileno (self ) -> int :
707+ def fileno (self ) -> NoReturn :
708708 raise io .UnsupportedOperation ("fileno" )
709709
710710 def flush (self ) -> None :
@@ -714,7 +714,7 @@ def flush(self) -> None:
714714 def isatty (self ) -> bool :
715715 return False
716716
717- def truncate (self , size : Optional [int ] = None ) -> int :
717+ def truncate (self , size : Optional [int ] = None ) -> NoReturn :
718718 # See https://docs.python.org/3/library/io.html#io.IOBase.writable
719719 # for why truncate has to raise.
720720 raise io .UnsupportedOperation ("truncate" )
@@ -891,10 +891,10 @@ def next(self) -> GridOut:
891891
892892 __next__ = next
893893
894- def add_option (self , * args : Any , ** kwargs : Any ) -> None : # type: ignore[override]
894+ def add_option (self , * args : Any , ** kwargs : Any ) -> NoReturn :
895895 raise NotImplementedError ("Method does not exist for GridOutCursor" )
896896
897- def remove_option (self , * args : Any , ** kwargs : Any ) -> None : # type: ignore[override]
897+ def remove_option (self , * args : Any , ** kwargs : Any ) -> NoReturn :
898898 raise NotImplementedError ("Method does not exist for GridOutCursor" )
899899
900900 def _clone_base (self , session : ClientSession ) -> "GridOutCursor" :
0 commit comments