Skip to content

Commit

Permalink
Merge pull request #10 from sendbird/CPLAT-4620/fix_collection_imports
Browse files Browse the repository at this point in the history
CPLAT-4620 fix collection imports
daniel-lee-sb authored Nov 14, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents e274927 + a741938 commit 6f441c7
Showing 3 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion django/core/paginator.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import collections

import warnings
from math import ceil

7 changes: 5 additions & 2 deletions django/db/migrations/serializer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from __future__ import unicode_literals

import collections
try:
from collections.abc import Iterable
except ImportError:
from collections import Iterable
import datetime
import decimal
import functools
@@ -384,7 +387,7 @@ def serializer_factory(value):
return FunctoolsPartialSerializer(value)
if isinstance(value, (types.FunctionType, types.BuiltinFunctionType, types.MethodType)):
return FunctionTypeSerializer(value)
if isinstance(value, collections.Iterable):
if isinstance(value, Iterable):
return IterableSerializer(value)
if isinstance(value, (COMPILED_REGEX_TYPE, RegexObject)):
return RegexSerializer(value)
9 changes: 6 additions & 3 deletions django/db/models/fields/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import collections
try:
from collections.abc import Iterator, Iterable
except ImportError:
from collections import Iterator, Iterable
import copy
import datetime
import decimal
@@ -163,7 +166,7 @@ def __init__(self, verbose_name=None, name=None, primary_key=False,
self.unique_for_date = unique_for_date
self.unique_for_month = unique_for_month
self.unique_for_year = unique_for_year
if isinstance(choices, collections.Iterator):
if isinstance(choices, Iterator):
choices = list(choices)
self.choices = choices or []
self.help_text = help_text
@@ -433,7 +436,7 @@ def deconstruct(self):
for name, default in possibles.items():
value = getattr(self, attr_overrides.get(name, name))
# Unroll anything iterable for choices into a concrete list
if name == "choices" and isinstance(value, collections.Iterable):
if name == "choices" and isinstance(value, Iterable):
value = list(value)
# Do correct kind of comparison
if name in equals_comparison:

0 comments on commit 6f441c7

Please sign in to comment.