mirror of
https://github.com/Hopiu/django-model-utils.git
synced 2026-04-09 14:20:59 +00:00
Use callable() builtin function over isinstance(..., Callable)
This is slightly more compact, but the main motivation is to work around the following mypy bug: https://github.com/python/mypy/issues/3060
This commit is contained in:
parent
e34de65480
commit
6c5ed66ef2
1 changed files with 1 additions and 2 deletions
|
|
@ -1,7 +1,6 @@
|
|||
import secrets
|
||||
import uuid
|
||||
import warnings
|
||||
from collections.abc import Callable
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.exceptions import ValidationError
|
||||
|
|
@ -346,7 +345,7 @@ class UrlsafeTokenField(models.CharField):
|
|||
non-callable value for factory is not supported.
|
||||
"""
|
||||
|
||||
if factory is not None and not isinstance(factory, Callable):
|
||||
if factory is not None and not callable(factory):
|
||||
raise TypeError("'factory' should either be a callable or 'None'")
|
||||
self._factory = factory
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue