File tree Expand file tree Collapse file tree 7 files changed +20
-44
lines changed Expand file tree Collapse file tree 7 files changed +20
-44
lines changed Original file line number Diff line number Diff line change @@ -313,9 +313,10 @@ async def inner(*args: Any, **kwargs: Any) -> Any:
313
313
return cast (F , inner )
314
314
315
315
316
- async def anext (cls : Any ) -> Any :
317
- """Compatibility function until we drop 3.9 support: https://docs.python.org/3/library/functions.html#anext."""
318
- if sys .version_info >= (3 , 10 ):
319
- return await builtins .anext (cls )
320
- else :
316
+ if sys .version_info >= (3 , 10 ):
317
+ anext = builtins .anext
318
+ else :
319
+
320
+ async def anext (cls : Any ) -> Any :
321
+ """Compatibility function until we drop 3.9 support: https://docs.python.org/3/library/functions.html#anext."""
321
322
return await cls .__anext__ ()
Original file line number Diff line number Diff line change 112
112
from pymongo .write_concern import DEFAULT_WRITE_CONCERN , WriteConcern
113
113
114
114
if TYPE_CHECKING :
115
- import sys
116
115
from types import TracebackType
117
116
118
117
from bson .objectid import ObjectId
126
125
from pymongo .asynchronous .server_selectors import Selection
127
126
from pymongo .read_concern import ReadConcern
128
127
129
- if sys .version_info [:2 ] >= (3 , 9 ):
130
- pass
131
- else :
132
- # Deprecated since version 3.9: collections.abc.Generator now supports [].
133
- pass
134
128
135
129
T = TypeVar ("T" )
136
130
Original file line number Diff line number Diff line change @@ -194,14 +194,9 @@ def _set_keepalive_times(sock: socket.socket) -> None:
194
194
_METADATA : dict [str , Any ] = {"driver" : {"name" : "PyMongo" , "version" : __version__ }}
195
195
196
196
if sys .platform .startswith ("linux" ):
197
- # platform.linux_distribution was deprecated in Python 3.5
198
- # and removed in Python 3.8. Starting in Python 3.5 it
199
- # raises DeprecationWarning
200
- # DeprecationWarning: dist() and linux_distribution() functions are deprecated in Python 3.5
201
- _name = platform .system ()
202
197
_METADATA ["os" ] = {
203
- "type" : _name ,
204
- "name" : _name ,
198
+ "type" : platform . system () ,
199
+ "name" : platform . system () ,
205
200
"architecture" : platform .machine (),
206
201
# Kernel version (e.g. 4.4.0-17-generic).
207
202
"version" : platform .release (),
Original file line number Diff line number Diff line change @@ -313,9 +313,10 @@ def inner(*args: Any, **kwargs: Any) -> Any:
313
313
return cast (F , inner )
314
314
315
315
316
- def next (cls : Any ) -> Any :
317
- """Compatibility function until we drop 3.9 support: https://docs.python.org/3/library/functions.html#anext."""
318
- if sys .version_info >= (3 , 10 ):
319
- return builtins .next (cls )
320
- else :
316
+ if sys .version_info >= (3 , 10 ):
317
+ next = builtins .next
318
+ else :
319
+
320
+ def next (cls : Any ) -> Any :
321
+ """Compatibility function until we drop 3.9 support: https://docs.python.org/3/library/functions.html#anext."""
321
322
return cls .__next__ ()
Original file line number Diff line number Diff line change 111
111
from pymongo .write_concern import DEFAULT_WRITE_CONCERN , WriteConcern
112
112
113
113
if TYPE_CHECKING :
114
- import sys
115
114
from types import TracebackType
116
115
117
116
from bson .objectid import ObjectId
125
124
from pymongo .synchronous .server import Server
126
125
from pymongo .synchronous .server_selectors import Selection
127
126
128
- if sys .version_info [:2 ] >= (3 , 9 ):
129
- pass
130
- else :
131
- # Deprecated since version 3.9: collections.abc.Generator now supports [].
132
- pass
133
127
134
128
T = TypeVar ("T" )
135
129
Original file line number Diff line number Diff line change @@ -194,14 +194,9 @@ def _set_keepalive_times(sock: socket.socket) -> None:
194
194
_METADATA : dict [str , Any ] = {"driver" : {"name" : "PyMongo" , "version" : __version__ }}
195
195
196
196
if sys .platform .startswith ("linux" ):
197
- # platform.linux_distribution was deprecated in Python 3.5
198
- # and removed in Python 3.8. Starting in Python 3.5 it
199
- # raises DeprecationWarning
200
- # DeprecationWarning: dist() and linux_distribution() functions are deprecated in Python 3.5
201
- _name = platform .system ()
202
197
_METADATA ["os" ] = {
203
- "type" : _name ,
204
- "name" : _name ,
198
+ "type" : platform . system () ,
199
+ "name" : platform . system () ,
205
200
"architecture" : platform .machine (),
206
201
# Kernel version (e.g. 4.4.0-17-generic).
207
202
"version" : platform .release (),
Original file line number Diff line number Diff line change @@ -195,14 +195,10 @@ def with_metaclass(meta, *bases):
195
195
# the actual metaclass.
196
196
class metaclass (type ):
197
197
def __new__ (cls , name , this_bases , d ):
198
- if sys .version_info [:2 ] >= (3 , 7 ): # noqa: UP036
199
- # This version introduced PEP 560 that requires a bit
200
- # of extra care (we mimic what is done by __build_class__).
201
- resolved_bases = types .resolve_bases (bases )
202
- if resolved_bases is not bases :
203
- d ["__orig_bases__" ] = bases
204
- else :
205
- resolved_bases = bases
198
+ # __orig_bases__ is required by PEP 560.
199
+ resolved_bases = types .resolve_bases (bases )
200
+ if resolved_bases is not bases :
201
+ d ["__orig_bases__" ] = bases
206
202
return meta (name , resolved_bases , d )
207
203
208
204
@classmethod
You can’t perform that action at this time.
0 commit comments