Skip to content

Commit

Permalink
Remove unused imports, other flake8 errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jwhitlock committed Nov 9, 2022
1 parent 84b8f1d commit a09fd3c
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 16 deletions.
2 changes: 1 addition & 1 deletion emails/cleaners.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from django.contrib.auth.models import User
from django.db.models import Count, Q

from privaterelay.cleaners import CleanerTask, CleanupData, Counts, DetectorTask
from privaterelay.cleaners import CleanerTask, CleanupData, Counts

from .models import DomainAddress, Profile, RelayAddress
from .signals import create_user_profile
Expand Down
4 changes: 2 additions & 2 deletions emails/tests/models_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,7 @@ def test_update_abuse_metric_flags_profile_when_emails_forwarded_abuse_threshold
baker.make(AbuseMetrics, user=user, num_email_forwarded_per_day=4)
profile = user.profile

assert profile.last_account_flagged == None
assert profile.last_account_flagged is None
profile.update_abuse_metric(email_forwarded=True)

abuse_metrics = AbuseMetrics.objects.get(user=user)
Expand Down Expand Up @@ -979,7 +979,7 @@ def test_update_abuse_metric_flags_profile_when_forwarded_email_size_abuse_thres
baker.make(AbuseMetrics, user=user, forwarded_email_size_per_day=50)
profile = user.profile

assert profile.last_account_flagged == None
assert profile.last_account_flagged is None
profile.update_abuse_metric(forwarded_email_size=50)

abuse_metrics = AbuseMetrics.objects.get(user=user)
Expand Down
4 changes: 2 additions & 2 deletions emails/tests/views_tests.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from copy import deepcopy
from datetime import datetime, timezone
from email.message import EmailMessage
from unittest.mock import patch, Mock
from unittest.mock import patch
import glob
import io
import json
Expand Down Expand Up @@ -231,7 +231,7 @@ def test_sns_message_with_soft_bounce(self):
def test_sns_message_with_spam_bounce_sets_auto_block_spam(self):
_sns_notification(BOUNCE_SNS_BODIES["spam"])
self.user.refresh_from_db()
assert self.user.profile.auto_block_spam == True
assert self.user.profile.auto_block_spam


class ComplaintHandlingTest(TestCase):
Expand Down
3 changes: 1 addition & 2 deletions privaterelay/tests/views_tests.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import json
from unittest.mock import call, patch
from unittest.mock import patch

from django.contrib.auth.models import User
from django.test import TestCase
Expand All @@ -9,7 +9,6 @@
from model_bakery import baker
import pytest

from emails.models import Profile
from ..views import _update_all_data, NoSocialToken


Expand Down
11 changes: 2 additions & 9 deletions privaterelay/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import json
import logging
import os
import requests
from rest_framework.decorators import api_view, schema

# from silk.profiling.profiler import silk_profile
Expand All @@ -17,23 +16,17 @@

from django.apps import apps
from django.conf import settings
from django.contrib import messages
from django.db import IntegrityError, connections, transaction
from django.http import HttpResponse, JsonResponse
from django.shortcuts import render, redirect
from django.shortcuts import redirect
from django.urls import reverse
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http import require_http_methods

from allauth.socialaccount.models import SocialAccount, SocialApp
from allauth.socialaccount.providers.fxa.views import FirefoxAccountsOAuth2Adapter

from emails.models import (
CannotMakeSubdomainException,
DomainAddress,
RelayAddress,
valid_available_subdomain,
)
from emails.models import CannotMakeSubdomainException, valid_available_subdomain
from emails.utils import incr_if_enabled


Expand Down

0 comments on commit a09fd3c

Please sign in to comment.