Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removed unused imports and fixed deprecation warning #224

Merged
merged 1 commit into from
Oct 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions captcha/client.py
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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