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

Rename inbox.basicauth to inbox.exceptions #698

Merged
merged 2 commits into from
Mar 11, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ inbox/test/.cache
/src

# virtualenv
venv
.venv
virtualenv
Comment on lines +29 to +31
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI I also snuck in a commit ignoring these common virtualenv folder names in git. It seems to me that the convention this repo follows is to have the virtualenv in a venv folder, judging from the isort config:

[tool.isort]
skip = ['venv']

/include
/local
bin/py*
Expand Down
2 changes: 1 addition & 1 deletion bin/inbox-auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
setproctitle("inbox-auth")

from inbox.auth.base import handler_from_provider
from inbox.basicauth import NotSupportedError
from inbox.config import config
from inbox.error_handling import maybe_enable_rollbar
from inbox.exceptions import NotSupportedError
from inbox.logging import configure_logging
from inbox.models import Account
from inbox.models.session import session_scope
Expand Down
2 changes: 1 addition & 1 deletion inbox/auth/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

from imapclient import IMAPClient

from inbox.basicauth import NotSupportedError, UserRecoverableConfigError
from inbox.crispin import CrispinClient
from inbox.exceptions import NotSupportedError, UserRecoverableConfigError
from inbox.logging import get_logger
from inbox.sendmail.smtp.postel import SMTPClient

Expand Down
2 changes: 1 addition & 1 deletion inbox/auth/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from imapclient import IMAPClient

from inbox.auth.utils import auth_is_invalid, auth_requires_app_password
from inbox.basicauth import AppPasswordError, ValidationError
from inbox.exceptions import AppPasswordError, ValidationError
from inbox.logging import get_logger
from inbox.models import Namespace
from inbox.models.backends.generic import GenericAccount
Expand Down
2 changes: 1 addition & 1 deletion inbox/auth/google.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import attr

from inbox.basicauth import ImapSupportDisabledError, OAuthError
from inbox.config import config
from inbox.crispin import GmailCrispinClient
from inbox.exceptions import ImapSupportDisabledError, OAuthError
from inbox.logging import get_logger
from inbox.models import Namespace
from inbox.models.backends.gmail import GmailAccount
Expand Down
2 changes: 1 addition & 1 deletion inbox/auth/microsoft.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import attr

from inbox.basicauth import OAuthError
from inbox.config import config
from inbox.exceptions import OAuthError
from inbox.models import Namespace
from inbox.models.backends.outlook import OutlookAccount
from inbox.models.secret import SecretType
Expand Down
2 changes: 1 addition & 1 deletion inbox/auth/oauth.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
from authalligator_client.exceptions import AccountError
from imapclient import IMAPClient

from inbox.basicauth import ConnectionError, ImapSupportDisabledError, OAuthError
from inbox.config import config
from inbox.exceptions import ConnectionError, ImapSupportDisabledError, OAuthError
from inbox.logging import get_logger
from inbox.models.backends.oauth import OAuthAccount, token_manager
from inbox.models.secret import SecretType
Expand Down
2 changes: 1 addition & 1 deletion inbox/auth/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from imapclient import IMAPClient

from inbox.basicauth import SSLNotSupportedError
from inbox.exceptions import SSLNotSupportedError
from inbox.logging import get_logger

log = get_logger()
Expand Down
2 changes: 1 addition & 1 deletion inbox/contacts/google.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
import gevent

from inbox.auth.google import GoogleAuthHandler
from inbox.basicauth import ConnectionError, OAuthError, ValidationError
from inbox.contacts.abc import AbstractContactsProvider
from inbox.exceptions import ConnectionError, OAuthError, ValidationError
from inbox.logging import get_logger
from inbox.models import Contact
from inbox.models.backends.gmail import GmailAccount
Expand Down
2 changes: 1 addition & 1 deletion inbox/crispin.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
from gevent.queue import Queue
from sqlalchemy.orm import joinedload

from inbox.basicauth import GmailSettingError
from inbox.exceptions import GmailSettingError
from inbox.folder_edge_cases import localized_folder_names
from inbox.logging import get_logger
from inbox.models import Account
Expand Down
2 changes: 1 addition & 1 deletion inbox/events/google.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import requests

from inbox.auth.oauth import OAuthRequestsWrapper
from inbox.basicauth import AccessNotEnabledError, OAuthError
from inbox.config import config
from inbox.events.abstract import AbstractEventsProvider, CalendarGoneException
from inbox.events.util import (
Expand All @@ -24,6 +23,7 @@
parse_datetime,
parse_google_time,
)
from inbox.exceptions import AccessNotEnabledError, OAuthError
from inbox.models import Account, Calendar
from inbox.models.backends.oauth import token_manager
from inbox.models.event import EVENT_STATUSES, Event
Expand Down
2 changes: 1 addition & 1 deletion inbox/events/remote_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
import more_itertools
from requests.exceptions import HTTPError

from inbox.basicauth import AccessNotEnabledError, OAuthError
from inbox.config import config
from inbox.contacts.processing import update_contacts_from_event
from inbox.events.abstract import AbstractEventsProvider, CalendarGoneException
from inbox.events.google import URL_PREFIX
from inbox.events.recurring import link_events
from inbox.exceptions import AccessNotEnabledError, OAuthError
from inbox.logging import get_logger
from inbox.models import Calendar, Event
from inbox.models.account import Account
Expand Down
4 changes: 0 additions & 4 deletions inbox/basicauth.py → inbox/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# TODO(emfree): this is now legitimately just a grab-bag of nebulous
# exceptions. Rename module and clean up.


class AuthError(Exception):
pass

Expand Down
2 changes: 1 addition & 1 deletion inbox/mailsync/backends/imap/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
from sqlalchemy.exc import IntegrityError
from sqlalchemy.orm.exc import NoResultFound

from inbox.basicauth import ValidationError
from inbox.exceptions import ValidationError
from inbox.logging import get_logger
from inbox.util.concurrency import retry_with_logging
from inbox.util.debug import bind_context
Expand Down
2 changes: 1 addition & 1 deletion inbox/mailsync/backends/imap/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
from gevent.lock import BoundedSemaphore
from gevent.pool import Group

from inbox.basicauth import ValidationError
from inbox.crispin import connection_pool, retry_crispin
from inbox.exceptions import ValidationError
from inbox.logging import get_logger
from inbox.mailsync.backends.base import BaseMailSyncMonitor
from inbox.mailsync.backends.imap.generic import FolderSyncEngine
Expand Down
2 changes: 1 addition & 1 deletion inbox/models/backends/oauth.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from sqlalchemy.ext.declarative import declared_attr
from sqlalchemy.orm import relationship

from inbox.basicauth import OAuthError
from inbox.exceptions import OAuthError
from inbox.logging import get_logger
from inbox.models.secret import Secret, SecretType

Expand Down
2 changes: 1 addition & 1 deletion inbox/providers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Any, Dict

from inbox.basicauth import NotSupportedError
from inbox.exceptions import NotSupportedError

__all__ = ["provider_info", "providers"]

Expand Down
2 changes: 1 addition & 1 deletion inbox/search/backends/gmail.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from inbox.api.kellogs import APIEncoder
from inbox.auth.oauth import OAuthRequestsWrapper
from inbox.basicauth import OAuthError
from inbox.exceptions import OAuthError
from inbox.logging import get_logger
from inbox.models import Account, Message, Thread
from inbox.models.backends.oauth import token_manager
Expand Down
2 changes: 1 addition & 1 deletion inbox/search/backends/imap.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from sqlalchemy import desc

from inbox.api.kellogs import APIEncoder
from inbox.basicauth import NotSupportedError, ValidationError
from inbox.crispin import CrispinClient, FolderMissingError
from inbox.exceptions import NotSupportedError, ValidationError
from inbox.logging import get_logger
from inbox.mailsync.backends.imap.generic import UidInvalid, uidvalidity_cb
from inbox.models import Account, Folder, Message, Thread
Expand Down
2 changes: 1 addition & 1 deletion inbox/sendmail/smtp/postel.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from inbox.logging import get_logger

log = get_logger()
from inbox.basicauth import OAuthError
from inbox.exceptions import OAuthError
from inbox.models.backends.generic import GenericAccount
from inbox.models.backends.imap import ImapAccount
from inbox.models.backends.oauth import token_manager
Expand Down
2 changes: 1 addition & 1 deletion inbox/sync/base_sync.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from gevent import Greenlet, event, sleep

from inbox.basicauth import ConnectionError, ValidationError
from inbox.exceptions import ConnectionError, ValidationError
from inbox.heartbeat.store import HeartbeatStatusProxy
from inbox.logging import get_logger
from inbox.models import Account
Expand Down
2 changes: 1 addition & 1 deletion inbox/util/testutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import dns
import pytest

from inbox.basicauth import ValidationError
from inbox.exceptions import ValidationError
from inbox.util.file import get_data

FILENAMES = [
Expand Down
4 changes: 2 additions & 2 deletions tests/api/test_searching.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def imap_connection(monkeypatch):

@fixture
def invalid_imap_connection(monkeypatch):
from inbox.basicauth import ValidationError
from inbox.exceptions import ValidationError

def raise_401(*args):
raise ValidationError()
Expand Down Expand Up @@ -269,7 +269,7 @@ def patch_gmail_search_response():

@fixture
def invalid_gmail_token(monkeypatch):
from inbox.basicauth import OAuthError
from inbox.exceptions import OAuthError

def raise_401(*args):
raise OAuthError()
Expand Down
2 changes: 1 addition & 1 deletion tests/api/test_sending.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import inbox.api.ns_api
import inbox.logging
from inbox.basicauth import OAuthError
from inbox.exceptions import OAuthError
from inbox.models import Event, Message
from inbox.sendmail.smtp.postel import _substitute_bcc

Expand Down
2 changes: 1 addition & 1 deletion tests/auth/providers/mock_gmail.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"""

from inbox.auth.gmail import GmailAuthHandler
from inbox.basicauth import (
from inbox.exceptions import (
GmailSettingError,
ImapSupportDisabledError,
OAuthError,
Expand Down
2 changes: 1 addition & 1 deletion tests/auth/test_generic_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import pytest

from inbox.auth.generic import GenericAccountData, GenericAuthHandler
from inbox.basicauth import SettingUpdateError, ValidationError
from inbox.exceptions import SettingUpdateError, ValidationError
from inbox.models.account import Account
from inbox.util.url import parent_domain

Expand Down
2 changes: 1 addition & 1 deletion tests/auth/test_gmail_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import pytest

from inbox.auth.google import GoogleAccountData, GoogleAuthHandler
from inbox.basicauth import ImapSupportDisabledError
from inbox.exceptions import ImapSupportDisabledError
from inbox.models.account import Account
from inbox.models.secret import SecretType

Expand Down
2 changes: 1 addition & 1 deletion tests/events/test_google_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import requests

from inbox.api.kellogs import _encode
from inbox.basicauth import AccessNotEnabledError
from inbox.events.google import GoogleEventsProvider, parse_event_response
from inbox.exceptions import AccessNotEnabledError
from inbox.models import Calendar, Event
from inbox.models.event import RecurringEvent, RecurringEventOverride

Expand Down
2 changes: 1 addition & 1 deletion tests/general/test_provider_resolution.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from inbox.auth.base import handler_from_provider
from inbox.auth.generic import GenericAuthHandler
from inbox.auth.google import GoogleAuthHandler
from inbox.basicauth import NotSupportedError
from inbox.exceptions import NotSupportedError
from inbox.util.url import InvalidEmailAddressError, provider_from_address


Expand Down
2 changes: 1 addition & 1 deletion tests/general/test_required_folders.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import pytest

from inbox.auth.google import GoogleAuthHandler
from inbox.basicauth import GmailSettingError
from inbox.crispin import GmailCrispinClient
from inbox.exceptions import GmailSettingError


class AccountStub:
Expand Down
2 changes: 1 addition & 1 deletion tests/imap/test_full_imap_enabled.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from imapclient import IMAPClient

from inbox.auth.generic import GenericAuthHandler
from inbox.basicauth import UserRecoverableConfigError
from inbox.exceptions import UserRecoverableConfigError


class MockIMAPClient(IMAPClient):
Expand Down
Loading