mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-04 12:23:17 +03:00
Remove condition for unsupported Python versions
This commit is contained in:
parent
ed37745674
commit
7a698e80c2
|
@ -1,5 +1,4 @@
|
||||||
import contextlib
|
import contextlib
|
||||||
import sys
|
|
||||||
from collections.abc import Mapping, MutableMapping
|
from collections.abc import Mapping, MutableMapping
|
||||||
|
|
||||||
from django.utils.encoding import force_str
|
from django.utils.encoding import force_str
|
||||||
|
@ -29,21 +28,20 @@ class ReturnDict(dict):
|
||||||
# but preserve the raw data.
|
# but preserve the raw data.
|
||||||
return (dict, (dict(self),))
|
return (dict, (dict(self),))
|
||||||
|
|
||||||
if sys.version_info >= (3, 9):
|
# These are basically copied from OrderedDict, with `serializer` added.
|
||||||
# These are basically copied from OrderedDict, with `serializer` added.
|
def __or__(self, other):
|
||||||
def __or__(self, other):
|
if not isinstance(other, dict):
|
||||||
if not isinstance(other, dict):
|
return NotImplemented
|
||||||
return NotImplemented
|
new = self.__class__(self, serializer=self.serializer)
|
||||||
new = self.__class__(self, serializer=self.serializer)
|
new.update(other)
|
||||||
new.update(other)
|
return new
|
||||||
return new
|
|
||||||
|
|
||||||
def __ror__(self, other):
|
def __ror__(self, other):
|
||||||
if not isinstance(other, dict):
|
if not isinstance(other, dict):
|
||||||
return NotImplemented
|
return NotImplemented
|
||||||
new = self.__class__(other, serializer=self.serializer)
|
new = self.__class__(other, serializer=self.serializer)
|
||||||
new.update(self)
|
new.update(self)
|
||||||
return new
|
return new
|
||||||
|
|
||||||
|
|
||||||
class ReturnList(list):
|
class ReturnList(list):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user