Skip to content

Commit

Permalink
Merge pull request #224 from julienc91/develop
Browse files Browse the repository at this point in the history
removed unused imports and fixed deprecation warning
  • Loading branch information
AltusBarry committed Oct 19, 2020
2 parents ca4c827 + faf4818 commit 40a6978
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 20 deletions.
3 changes: 1 addition & 2 deletions captcha/client.py
Expand Up @@ -3,10 +3,9 @@
from django.conf import settings

from captcha._compat import (
build_opener, ProxyHandler, PY2, Request, urlencode, urlopen
build_opener, ProxyHandler, PY2, Request, urlencode
)
from captcha.constants import DEFAULT_RECAPTCHA_DOMAIN
from captcha.decorators import generic_deprecation


RECAPTCHA_SUPPORTED_LANUAGES = ("en", "nl", "fr", "de", "pt", "ru", "es", "tr")
Expand Down
15 changes: 8 additions & 7 deletions captcha/fields.py
@@ -1,20 +1,21 @@
import logging
import os
import socket
import sys
import warnings

import django
from django import forms
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.exceptions import ValidationError
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _

if django.VERSION[0] < 2:
from django.utils.translation import ugettext_lazy as _
else:
from django.utils.translation import gettext_lazy as _

from captcha import client
from captcha._compat import HTTPError, urlencode
from captcha._compat import HTTPError
from captcha.constants import TEST_PRIVATE_KEY, TEST_PUBLIC_KEY
from captcha.widgets import ReCaptchaV2Checkbox, ReCaptchaBase, ReCaptchaV3
from captcha.widgets import ReCaptchaV2Checkbox, ReCaptchaBase


logger = logging.getLogger(__name__)
Expand Down
3 changes: 1 addition & 2 deletions captcha/tests/test_client.py
Expand Up @@ -6,10 +6,9 @@
from mock import patch, PropertyMock, MagicMock

from django import forms
from django.conf import settings
from django.test import TestCase, override_settings

from captcha import client, constants, fields
from captcha import client, fields


class DefaultForm(forms.Form):
Expand Down
6 changes: 1 addition & 5 deletions captcha/tests/test_fields.py
@@ -1,7 +1,3 @@
import os
import uuid
import warnings

try:
from unittest.mock import patch, PropertyMock, MagicMock
except ImportError:
Expand All @@ -11,7 +7,7 @@
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase, override_settings

from captcha import fields, widgets, constants
from captcha import fields, widgets
from captcha._compat import HTTPError
from captcha.client import RecaptchaResponse

Expand Down
1 change: 0 additions & 1 deletion captcha/tests/tests.py
Expand Up @@ -3,7 +3,6 @@
except ImportError:
pass

from django.conf import settings
from django.core.checks import Error
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase, override_settings
Expand Down
3 changes: 0 additions & 3 deletions captcha/widgets.py
@@ -1,10 +1,7 @@
import json
import uuid

from django.conf import settings
from django.forms import widgets
from django.utils.safestring import mark_safe
from django.utils.translation import get_language

from captcha._compat import urlencode
from captcha.constants import DEFAULT_RECAPTCHA_DOMAIN
Expand Down

0 comments on commit 40a6978

Please sign in to comment.