@@ -90,6 +90,11 @@ def __repr__(self):
9090
9191
9292class AgnosticBaseProperties (AgnosticBase ):
93+ # Allow the use of generics at runtime.
94+ @classmethod
95+ def __class_getitem__ (cls , key : str ) -> object :
96+ return cls
97+
9398 codec_options = ReadOnlyProperty ()
9499 read_preference = ReadOnlyProperty ()
95100 read_concern = ReadOnlyProperty ()
@@ -1376,6 +1381,11 @@ def get_io_loop(self):
13761381class AgnosticBaseCursor (AgnosticBase ):
13771382 """Base class for AgnosticCursor and AgnosticCommandCursor"""
13781383
1384+ # Allow the use of generics at runtime.
1385+ @classmethod
1386+ def __class_getitem__ (cls , key : str ) -> object :
1387+ return cls
1388+
13791389 _async_close = AsyncRead (attr_name = "close" )
13801390 _refresh = AsyncRead ()
13811391 address = ReadOnlyProperty ()
@@ -1940,6 +1950,11 @@ class AgnosticChangeStream(AgnosticBase):
19401950
19411951 resume_token = ReadOnlyProperty ()
19421952
1953+ # Allow the use of generics at runtime.
1954+ @classmethod
1955+ def __class_getitem__ (cls , key : str ) -> object :
1956+ return cls
1957+
19431958 def __init__ (
19441959 self ,
19451960 target ,
@@ -2131,6 +2146,11 @@ class AgnosticClientEncryption(AgnosticBase):
21312146 get_key_by_alt_name = AsyncCommand ()
21322147 remove_key_alt_name = AsyncCommand ()
21332148
2149+ # Allow the use of generics at runtime.
2150+ @classmethod
2151+ def __class_getitem__ (cls , key : str ) -> object :
2152+ return cls
2153+
21342154 def __init__ (
21352155 self ,
21362156 kms_providers ,
0 commit comments