tags by spaces
if tag.lower() in ("br", "div"):
self.fed.append(" ")
@@ -30,14 +32,14 @@ def handle_starttag(self, tag, attrs) -> None:
if tag.lower() in HTMLTagStripper.strippedTags:
self.strip_tag_contents_mode = True
- def handle_endtag(self, tag) -> None:
+ def handle_endtag(self, tag) -> None: # type: ignore[no-untyped-def]
self.strip_tag_contents_mode = False
- def handle_data(self, d) -> None:
+ def handle_data(self, d) -> None: # type: ignore[no-untyped-def]
if not self.strip_tag_contents_mode:
self.fed.append(d)
- def handle_entityref(self, d) -> None:
+ def handle_entityref(self, d) -> None: # type: ignore[no-untyped-def]
try:
val = chr(name2codepoint[d])
except KeyError:
@@ -84,7 +86,7 @@ def strip_tags(html: str) -> str:
def plaintext2html(text: str, tabstop: int = 4) -> str:
assert "\r" not in text, "newlines not normalized"
- def do_sub(m):
+ def do_sub(m): # type: ignore[no-untyped-def]
c = m.groupdict()
if c["htmlchars"]:
return html_escape(c["htmlchars"], quote=False)
diff --git a/inbox/util/itert.py b/inbox/util/itert.py
index 09514d6fa..b4d683289 100644
--- a/inbox/util/itert.py
+++ b/inbox/util/itert.py
@@ -1,7 +1,7 @@
import itertools
-def chunk(iterable, size): # noqa: ANN201
+def chunk(iterable, size): # type: ignore[no-untyped-def] # noqa: ANN201
"""
Yield chunks of an iterable.
diff --git a/inbox/util/misc.py b/inbox/util/misc.py
index d0220150b..d0a519105 100644
--- a/inbox/util/misc.py
+++ b/inbox/util/misc.py
@@ -10,10 +10,10 @@
class DummyContextManager:
- def __enter__(self): # noqa: ANN204
+ def __enter__(self): # type: ignore[no-untyped-def] # noqa: ANN204
return None
- def __exit__(
+ def __exit__( # type: ignore[exit-return]
self,
exc_type: type[BaseException] | None,
exc_value: BaseException | None,
@@ -22,7 +22,7 @@ def __exit__(
return False
-def or_none(value, selector): # noqa: ANN201
+def or_none(value, selector): # type: ignore[no-untyped-def] # noqa: ANN201
if value is None:
return None
else:
@@ -63,7 +63,7 @@ def parse_references(references: str, in_reply_to: str) -> list[str]:
return reference_list
-def dt_to_timestamp(dt): # noqa: ANN201
+def dt_to_timestamp(dt): # type: ignore[no-untyped-def] # noqa: ANN201
return int((dt - datetime(1970, 1, 1)).total_seconds())
@@ -83,7 +83,7 @@ def get_internaldate(date: str | None, received: str | None) -> datetime:
# Based on: http://stackoverflow.com/a/8556471
-def load_modules(base_name, base_path): # noqa: ANN201
+def load_modules(base_name, base_path): # type: ignore[no-untyped-def] # noqa: ANN201
"""
Imports all modules underneath `base_module` in the module tree.
@@ -106,7 +106,7 @@ def load_modules(base_name, base_path): # noqa: ANN201
return modules
-def register_backends(base_name, base_path): # noqa: ANN201
+def register_backends(base_name, base_path): # type: ignore[no-untyped-def] # noqa: ANN201
"""
Dynamically loads all packages contained within thread
backends module, including those by other module install paths
@@ -129,7 +129,7 @@ def register_backends(base_name, base_path): # noqa: ANN201
return mod_for
-def cleanup_subject(subject_str): # noqa: ANN201
+def cleanup_subject(subject_str): # type: ignore[no-untyped-def] # noqa: ANN201
"""
Clean-up a message subject-line, including whitespace.
For instance, 'Re: Re: Re: Birthday party' becomes 'Birthday party'
@@ -148,7 +148,7 @@ def cleanup_subject(subject_str): # noqa: ANN201
# IMAP doesn't support nested folders and instead encodes paths inside folder
# names.
# imap_folder_path converts a "/" delimited path to an IMAP compatible path.
-def imap_folder_path( # noqa: ANN201
+def imap_folder_path( # type: ignore[no-untyped-def] # noqa: ANN201
path, separator: str = ".", prefix: str = ""
):
folders = [folder for folder in path.split("/") if folder != ""]
@@ -169,7 +169,7 @@ def imap_folder_path( # noqa: ANN201
return res
-def strip_prefix(path, prefix): # noqa: ANN201
+def strip_prefix(path, prefix): # type: ignore[no-untyped-def] # noqa: ANN201
if path.startswith(prefix):
return path[len(prefix) :]
@@ -177,7 +177,7 @@ def strip_prefix(path, prefix): # noqa: ANN201
# fs_folder_path converts an IMAP compatible path to a "/" delimited path.
-def fs_folder_path( # noqa: ANN201
+def fs_folder_path( # type: ignore[no-untyped-def] # noqa: ANN201
path, separator: str = ".", prefix: str = ""
):
if prefix:
diff --git a/inbox/util/rdb.py b/inbox/util/rdb.py
index eaeefff16..d489a8374 100644
--- a/inbox/util/rdb.py
+++ b/inbox/util/rdb.py
@@ -15,16 +15,18 @@
class RemoteConsole(InteractiveConsole):
- def __init__(self, socket, locals=None) -> None:
+ def __init__( # type: ignore[no-untyped-def]
+ self, socket, locals=None
+ ) -> None:
self.socket = socket
self.handle = socket.makefile("rw")
InteractiveConsole.__init__(self, locals=locals)
self.handle.write(doc)
- def write(self, data) -> None:
+ def write(self, data) -> None: # type: ignore[no-untyped-def]
self.handle.write(data)
- def runcode(self, code) -> None:
+ def runcode(self, code) -> None: # type: ignore[no-untyped-def]
# preserve stdout/stderr
oldstdout = sys.stdout
oldstderr = sys.stderr
@@ -36,7 +38,9 @@ def runcode(self, code) -> None:
sys.stdout = oldstdout
sys.stderr = oldstderr
- def interact(self, banner=None) -> None:
+ def interact( # type: ignore[no-untyped-def, override]
+ self, banner=None
+ ) -> None:
"""
Closely emulate the interactive Python console.
@@ -73,7 +77,7 @@ def interact(self, banner=None) -> None:
else:
prompt = sys.ps1
try:
- line = self.raw_input(prompt)
+ line = self.raw_input(prompt) # type: ignore[arg-type]
self.handle.flush()
# Can be None if sys.stdin was redefined
encoding = getattr(sys.stdin, "encoding", None)
@@ -99,13 +103,15 @@ def terminate(self) -> None:
except OSError:
return
- def raw_input(self, prompt: str = ""): # noqa: ANN201
+ def raw_input(self, prompt: str = ""): # type: ignore[no-untyped-def] # noqa: ANN201
self.handle.write(prompt)
self.handle.flush()
return self.handle.readline()
-def break_to_interpreter(host: str = "localhost", port=None) -> None:
+def break_to_interpreter( # type: ignore[no-untyped-def]
+ host: str = "localhost", port=None
+) -> None:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
diff --git a/inbox/util/sharding.py b/inbox/util/sharding.py
index 1b6045f73..dae6e2d47 100644
--- a/inbox/util/sharding.py
+++ b/inbox/util/sharding.py
@@ -1,7 +1,7 @@
from inbox.config import config
-def get_shard_schemas(): # noqa: ANN201
+def get_shard_schemas(): # type: ignore[no-untyped-def] # noqa: ANN201
# Can't use engine_manager.engines here because it does not track
# shard schemas.
shard_schemas = {}
diff --git a/inbox/util/startup.py b/inbox/util/startup.py
index 50b86a733..3e32f7d16 100644
--- a/inbox/util/startup.py
+++ b/inbox/util/startup.py
@@ -47,7 +47,9 @@ def check_tz() -> None:
sys.exit(_TZ_ERROR_TEXT)
-def load_overrides(file_path, loaded_config=config) -> None:
+def load_overrides( # type: ignore[no-untyped-def]
+ file_path, loaded_config=config
+) -> None:
"""
Convenience function for overriding default configuration.
diff --git a/inbox/util/stats.py b/inbox/util/stats.py
index 02a221515..9cd4572b5 100644
--- a/inbox/util/stats.py
+++ b/inbox/util/stats.py
@@ -1,9 +1,9 @@
-import statsd
+import statsd # type: ignore[import-untyped]
from inbox.config import config
-def get_statsd_client(): # noqa: ANN201
+def get_statsd_client(): # type: ignore[no-untyped-def] # noqa: ANN201
return statsd.StatsClient(
str(config.get("STATSD_HOST", "localhost")),
config.get("STATSD_PORT", 8125),
diff --git a/inbox/util/testutils.py b/inbox/util/testutils.py
index ef9d9f472..47de44335 100644
--- a/inbox/util/testutils.py
+++ b/inbox/util/testutils.py
@@ -7,7 +7,7 @@
import attr
import dns
-import pytest
+import pytest # type: ignore[import-not-found]
from inbox.exceptions import ValidationError
from inbox.util.file import get_data
@@ -74,7 +74,7 @@ def setup_test_db() -> None:
@attr.s
class MockAnswer:
- exchange = attr.ib()
+ exchange = attr.ib() # type: ignore[var-annotated]
class MockDNSResolver:
@@ -83,10 +83,10 @@ def __init__(self) -> None:
Literal["mx", "ns"], dict[str, dict[str, str] | list[str]]
] = {"mx": {}, "ns": {}}
- def _load_records(self, filename) -> None:
+ def _load_records(self, filename) -> None: # type: ignore[no-untyped-def]
self._registry = json.loads(get_data(filename))
- def query(self, domain, record_type): # noqa: ANN201
+ def query(self, domain, record_type): # type: ignore[no-untyped-def] # noqa: ANN201
record_type = record_type.lower()
entry = self._registry[record_type][domain]
if isinstance(entry, dict):
@@ -100,7 +100,7 @@ def query(self, domain, record_type): # noqa: ANN201
@pytest.fixture
-def mock_dns_resolver(monkeypatch): # noqa: ANN201
+def mock_dns_resolver(monkeypatch): # type: ignore[no-untyped-def] # noqa: ANN201
dns_resolver = MockDNSResolver()
monkeypatch.setattr("inbox.util.url.dns_resolver", dns_resolver)
yield dns_resolver
@@ -114,46 +114,54 @@ class MockIMAPClient:
"""
def __init__(self) -> None:
- self._data = {}
+ self._data = {} # type: ignore[var-annotated]
self.selected_folder = None
self.uidvalidity = 1
- self.logins = {}
+ self.logins = {} # type: ignore[var-annotated]
self.error_message = ""
- def _add_login(self, email, password) -> None:
+ def _add_login( # type: ignore[no-untyped-def]
+ self, email, password
+ ) -> None:
self.logins[email] = password
- def _set_error_message(self, message) -> None:
+ def _set_error_message( # type: ignore[no-untyped-def]
+ self, message
+ ) -> None:
self.error_message = message
- def login(self, email, password) -> None:
+ def login(self, email, password) -> None: # type: ignore[no-untyped-def]
if email not in self.logins or self.logins[email] != password:
raise ValidationError(self.error_message)
def logout(self) -> None:
pass
- def list_folders( # noqa: ANN201
+ def list_folders( # type: ignore[no-untyped-def] # noqa: ANN201
self, directory: str = "", pattern: str = "*"
):
return [(b"\\All", b"/", "[Gmail]/All Mail")]
- def has_capability(self, capability) -> bool:
+ def has_capability( # type: ignore[no-untyped-def]
+ self, capability
+ ) -> bool:
return False
- def idle_check(self, timeout=None): # noqa: ANN201
+ def idle_check(self, timeout=None): # type: ignore[no-untyped-def] # noqa: ANN201
return []
- def idle_done(self): # noqa: ANN201
+ def idle_done(self): # type: ignore[no-untyped-def] # noqa: ANN201
return ("Idle terminated", [])
- def add_folder_data(self, folder_name, uids) -> None:
+ def add_folder_data( # type: ignore[no-untyped-def]
+ self, folder_name, uids
+ ) -> None:
"""Adds fake UID data for the given folder.""" # noqa: D401
self._data[folder_name] = uids
- def search(self, criteria): # noqa: ANN201
+ def search(self, criteria): # type: ignore[no-untyped-def] # noqa: ANN201
assert self.selected_folder is not None
- assert isinstance(criteria, list)
+ assert isinstance(criteria, list) # type: ignore[unreachable]
uid_dict = self._data[self.selected_folder]
if criteria == ["ALL"]:
return list(uid_dict)
@@ -179,15 +187,19 @@ def search(self, criteria): # noqa: ANN201
return [u for u, v in uid_dict.items() if v[criteria[0]] == thrid]
raise ValueError(f"unsupported test criteria: {criteria!r}")
- def select_folder( # noqa: ANN201
+ def select_folder( # type: ignore[no-untyped-def] # noqa: ANN201
self, folder_name, readonly: bool = False
):
self.selected_folder = folder_name
return self.folder_status(folder_name)
- def fetch(self, items, data, modifiers=None): # noqa: ANN201
+ def fetch( # type: ignore[no-untyped-def] # noqa: ANN201
+ self, items, data, modifiers=None
+ ):
assert self.selected_folder is not None
- uid_dict = self._data[self.selected_folder]
+ uid_dict = self._data[ # type: ignore[unreachable]
+ self.selected_folder
+ ]
resp = {}
if "BODY.PEEK[]" in data:
data.remove("BODY.PEEK[]")
@@ -214,7 +226,7 @@ def fetch(self, items, data, modifiers=None): # noqa: ANN201
}
return resp
- def append(
+ def append( # type: ignore[no-untyped-def]
self,
folder_name,
mimemsg,
@@ -235,7 +247,9 @@ def append(
b"X-GM-THRID": x_gm_thrid,
}
- def copy(self, matching_uids, folder_name) -> None:
+ def copy( # type: ignore[no-untyped-def]
+ self, matching_uids, folder_name
+ ) -> None:
"""
Note: _moves_ one or more messages from the currently selected folder
to folder_name
@@ -244,10 +258,12 @@ def copy(self, matching_uids, folder_name) -> None:
self._data[folder_name][u] = self._data[self.selected_folder][u]
self.delete_messages(matching_uids)
- def capabilities(self): # noqa: ANN201
+ def capabilities(self): # type: ignore[no-untyped-def] # noqa: ANN201
return []
- def folder_status(self, folder_name, data=None): # noqa: ANN201
+ def folder_status( # type: ignore[no-untyped-def] # noqa: ANN201
+ self, folder_name, data=None
+ ):
folder_data = self._data[folder_name]
lastuid = max(folder_data) if folder_data else 0
resp = {b"UIDNEXT": lastuid + 1, b"UIDVALIDITY": self.uidvalidity}
@@ -257,25 +273,33 @@ def folder_status(self, folder_name, data=None): # noqa: ANN201
)
return resp
- def delete_messages(self, uids, silent: bool = False) -> None:
+ def delete_messages( # type: ignore[no-untyped-def]
+ self, uids, silent: bool = False
+ ) -> None:
for u in uids:
del self._data[self.selected_folder][u]
- def remove_flags(self, uids, flags) -> None:
+ def remove_flags( # type: ignore[no-untyped-def]
+ self, uids, flags
+ ) -> None:
pass
- def remove_gmail_labels(self, uids, labels) -> None:
+ def remove_gmail_labels( # type: ignore[no-untyped-def]
+ self, uids, labels
+ ) -> None:
pass
def expunge(self) -> None:
pass
- def oauth2_login(self, email, token) -> None:
+ def oauth2_login( # type: ignore[no-untyped-def]
+ self, email, token
+ ) -> None:
pass
@pytest.fixture
-def mock_imapclient(monkeypatch): # noqa: ANN201
+def mock_imapclient(monkeypatch): # type: ignore[no-untyped-def] # noqa: ANN201
conn = MockIMAPClient()
monkeypatch.setattr(
"inbox.crispin.CrispinConnectionPool._new_raw_connection",
@@ -293,11 +317,11 @@ class MockSMTPClient:
@pytest.fixture
-def mock_smtp_get_connection(monkeypatch): # noqa: ANN201
+def mock_smtp_get_connection(monkeypatch): # type: ignore[no-untyped-def] # noqa: ANN201
client = MockSMTPClient()
@contextlib.contextmanager
- def get_connection(account):
+ def get_connection(account): # type: ignore[no-untyped-def]
yield client
monkeypatch.setattr(
@@ -308,7 +332,7 @@ def get_connection(account):
@pytest.fixture
-def files(db): # noqa: ANN201
+def files(db): # type: ignore[no-untyped-def] # noqa: ANN201
filenames = FILENAMES
data = []
for filename in filenames:
@@ -325,7 +349,7 @@ def files(db): # noqa: ANN201
@pytest.fixture
-def uploaded_file_ids(api_client, files): # noqa: ANN201
+def uploaded_file_ids(api_client, files): # type: ignore[no-untyped-def] # noqa: ANN201
file_ids = []
upload_path = "/files"
for filename, path in files:
diff --git a/inbox/util/threading.py b/inbox/util/threading.py
index e97821927..9b3bc0719 100644
--- a/inbox/util/threading.py
+++ b/inbox/util/threading.py
@@ -1,7 +1,10 @@
from operator import attrgetter
-from sqlalchemy import desc
-from sqlalchemy.orm import contains_eager, load_only
+from sqlalchemy import desc # type: ignore[import-untyped]
+from sqlalchemy.orm import ( # type: ignore[import-untyped]
+ contains_eager,
+ load_only,
+)
from inbox.models.message import Message
from inbox.models.thread import Thread
@@ -11,7 +14,7 @@
MAX_MESSAGES_SCANNED = 20000
-def fetch_corresponding_thread( # noqa: ANN201
+def fetch_corresponding_thread( # type: ignore[no-untyped-def] # noqa: ANN201
db_session, namespace_id, message
):
"""
@@ -41,11 +44,13 @@ def fetch_corresponding_thread( # noqa: ANN201
Thread.namespace_id == namespace_id,
Thread._cleaned_subject == clean_subject,
)
- .outerjoin(Message, Thread.messages)
+ .outerjoin(Message, Thread.messages) # type: ignore[attr-defined]
.order_by(desc(Thread.id))
.options(
load_only("id", "discriminator"),
- contains_eager(Thread.messages).load_only(
+ contains_eager(
+ Thread.messages # type: ignore[attr-defined]
+ ).load_only(
"from_addr", "to_addr", "bcc_addr", "cc_addr", "received_date"
),
)
diff --git a/inbox/util/url.py b/inbox/util/url.py
index a71cff78b..9dfceec13 100644
--- a/inbox/util/url.py
+++ b/inbox/util/url.py
@@ -4,7 +4,7 @@
import dns
from dns.resolver import NXDOMAIN, NoAnswer, NoNameservers, Resolver, Timeout
-from tldextract import extract as tld_extract
+from tldextract import extract as tld_extract # type: ignore[import-untyped]
from inbox.logging import get_logger
@@ -27,11 +27,11 @@ class InvalidEmailAddressError(Exception):
pass
-def _dns_resolver():
+def _dns_resolver(): # type: ignore[no-untyped-def]
return dns_resolver
-def _fallback_get_mx_domains(domain):
+def _fallback_get_mx_domains(domain): # type: ignore[no-untyped-def]
"""
Sometimes dns.resolver.Resolver fails to return what we want. See
http://stackoverflow.com/questions/18898847. In such cases, try using
@@ -46,7 +46,9 @@ def _fallback_get_mx_domains(domain):
return []
-def get_mx_domains(domain, dns_resolver=_dns_resolver): # noqa: ANN201
+def get_mx_domains( # type: ignore[no-untyped-def] # noqa: ANN201
+ domain, dns_resolver=_dns_resolver
+):
"""Retrieve and return the MX records for a domain."""
mx_records = []
try:
@@ -65,7 +67,9 @@ def get_mx_domains(domain, dns_resolver=_dns_resolver): # noqa: ANN201
return [str(rdata.exchange).lower() for rdata in mx_records]
-def mx_match(mx_domains, match_domains) -> bool:
+def mx_match( # type: ignore[no-untyped-def]
+ mx_domains, match_domains
+) -> bool:
"""
Return True if any of the `mx_domains` matches an mx_domain
in `match_domains`.
@@ -91,7 +95,7 @@ def mx_match(mx_domains, match_domains) -> bool:
return False
-def provider_from_address( # noqa: ANN201
+def provider_from_address( # type: ignore[no-untyped-def] # noqa: ANN201
email_address, dns_resolver=_dns_resolver
):
if not EMAIL_REGEX.match(email_address):
@@ -141,7 +145,7 @@ def provider_from_address( # noqa: ANN201
# From tornado.httputil
-def url_concat(url, args, fragments=None): # noqa: ANN201
+def url_concat(url, args, fragments=None): # type: ignore[no-untyped-def] # noqa: ANN201
"""
Concatenate url and argument dictionary regardless of whether
url has existing query parameters.
@@ -170,18 +174,18 @@ def url_concat(url, args, fragments=None): # noqa: ANN201
return url + args_tail + fragment_tail
-def resolve_hostname(addr): # noqa: ANN201
+def resolve_hostname(addr): # type: ignore[no-untyped-def] # noqa: ANN201
try:
return socket.gethostbyname(addr)
except OSError:
return None
-def parent_domain(domain): # noqa: ANN201
+def parent_domain(domain): # type: ignore[no-untyped-def] # noqa: ANN201
return tld_extract(domain).registered_domain
-def naked_domain(url): # noqa: ANN201
+def naked_domain(url): # type: ignore[no-untyped-def] # noqa: ANN201
# This function extracts the domain name part of an URL.
# It works indiscriminately on URLs or plain domains.
res = tld_extract(url)
@@ -192,7 +196,9 @@ def naked_domain(url): # noqa: ANN201
return ".".join([res.subdomain, res.registered_domain])
-def matching_subdomains(new_value, old_value) -> bool:
+def matching_subdomains( # type: ignore[no-untyped-def]
+ new_value, old_value
+) -> bool:
"""
We allow our customers to update their server addresses,
provided that the new server has:
diff --git a/inbox/webhooks/google_notifications.py b/inbox/webhooks/google_notifications.py
index 1cf0ea4e2..860d27ef4 100644
--- a/inbox/webhooks/google_notifications.py
+++ b/inbox/webhooks/google_notifications.py
@@ -1,12 +1,12 @@
from flask import Blueprint, g, jsonify, make_response, request
-from sqlalchemy.orm.exc import NoResultFound
+from sqlalchemy.orm.exc import NoResultFound # type: ignore[import-untyped]
from inbox.api.err import APIException, InputError, NotFoundError
from inbox.api.validation import valid_public_id
from inbox.logging import get_logger
log = get_logger()
-import limitlion # noqa: E402
+import limitlion # type: ignore[import-untyped] # noqa: E402
from inbox.models import Calendar # noqa: E402
from inbox.models.backends.gmail import GmailAccount # noqa: E402
@@ -19,19 +19,19 @@
GOOGLE_RESOURCE_ID_STRING = "X-Goog-Resource-ID"
-def resp(http_code, message=None, **kwargs): # noqa: ANN201
+def resp(http_code, message=None, **kwargs): # type: ignore[no-untyped-def] # noqa: ANN201
resp = kwargs
if message:
resp["message"] = message
if http_code == 204:
body = ""
else:
- body = jsonify(resp)
+ body = jsonify(resp) # type: ignore[assignment]
return make_response(body, http_code)
@app.before_request
-def start(): # noqa: ANN201
+def start(): # type: ignore[no-untyped-def] # noqa: ANN201
try:
watch_state = request.headers[GOOGLE_RESOURCE_STATE_STRING]
g.watch_channel_id = request.headers[GOOGLE_CHANNEL_ID_STRING]
@@ -53,14 +53,14 @@ def start(): # noqa: ANN201
@app.errorhandler(APIException)
-def handle_input_error(error): # noqa: ANN201
+def handle_input_error(error): # type: ignore[no-untyped-def] # noqa: ANN201
response = jsonify(message=error.message, type="invalid_request_error")
response.status_code = error.status_code
return response
@app.route("/calendar_list_update/
", methods=["POST"])
-def calendar_update(account_public_id): # noqa: ANN201
+def calendar_update(account_public_id): # type: ignore[no-untyped-def] # noqa: ANN201
request.environ["log_context"]["account_public_id"] = account_public_id
try:
valid_public_id(account_public_id)
@@ -86,7 +86,7 @@ def calendar_update(account_public_id): # noqa: ANN201
@app.route("/calendar_update/", methods=["POST"])
-def event_update(calendar_public_id): # noqa: ANN201
+def event_update(calendar_public_id): # type: ignore[no-untyped-def] # noqa: ANN201
request.environ["log_context"]["calendar_public_id"] = calendar_public_id
try:
valid_public_id(calendar_public_id)
diff --git a/inbox/webhooks/microsoft_notifications.py b/inbox/webhooks/microsoft_notifications.py
index 196e3bbff..50a42056f 100644
--- a/inbox/webhooks/microsoft_notifications.py
+++ b/inbox/webhooks/microsoft_notifications.py
@@ -2,7 +2,7 @@
from typing import cast
from flask import Blueprint, make_response, request
-from sqlalchemy.orm.exc import NoResultFound
+from sqlalchemy.orm.exc import NoResultFound # type: ignore[import-untyped]
from werkzeug.exceptions import UnsupportedMediaType
from inbox.config import config
@@ -21,9 +21,13 @@
)
-def handle_initial_validation_response(view_function): # noqa: ANN201
+def handle_initial_validation_response( # type: ignore[no-untyped-def] # noqa: ANN201
+ view_function,
+):
@wraps(view_function)
- def _handle_initial_validation_response(*args, **kwargs):
+ def _handle_initial_validation_response( # type: ignore[no-untyped-def]
+ *args, **kwargs
+ ):
"""
Handle initial validation of webhook endpoint.
@@ -48,10 +52,16 @@ def _handle_initial_validation_response(*args, **kwargs):
return _handle_initial_validation_response
-def validate_webhook_payload_factory(type: MsGraphType): # noqa: ANN201
- def validate_webhook_payload(view_function):
+def validate_webhook_payload_factory( # type: ignore[no-untyped-def] # noqa: ANN201
+ type: MsGraphType,
+):
+ def validate_webhook_payload( # type: ignore[no-untyped-def]
+ view_function,
+ ):
@wraps(view_function)
- def _validate_webhook_payload(*args, **kwargs):
+ def _validate_webhook_payload( # type: ignore[no-untyped-def]
+ *args, **kwargs
+ ):
"""
Validate webhook payload.
@@ -96,7 +106,7 @@ def _validate_webhook_payload(*args, **kwargs):
@app.route("/calendar_list_update/", methods=["POST"])
@handle_initial_validation_response
@validate_webhook_payload_factory("#Microsoft.Graph.Calendar")
-def calendar_update(account_public_id): # noqa: ANN201
+def calendar_update(account_public_id): # type: ignore[no-untyped-def] # noqa: ANN201
"""Handle calendar list update for given account."""
with global_session_scope() as db_session:
try:
@@ -117,7 +127,7 @@ def calendar_update(account_public_id): # noqa: ANN201
@app.route("/calendar_update/", methods=["POST"])
@handle_initial_validation_response
@validate_webhook_payload_factory("#Microsoft.Graph.Event")
-def event_update(calendar_public_id): # noqa: ANN201
+def event_update(calendar_public_id): # type: ignore[no-untyped-def] # noqa: ANN201
"""Handle events update for given calendar."""
with global_session_scope() as db_session:
try:
@@ -168,7 +178,9 @@ def handle_event_deletions(
for deleted_event in deleted_events:
deleted_event.status = "cancelled"
if isinstance(deleted_event, RecurringEvent):
- for override in deleted_event.overrides:
+ for (
+ override
+ ) in deleted_event.overrides: # type: ignore[attr-defined]
override.status = "cancelled"
db_session.commit()
diff --git a/migrations/env.py b/migrations/env.py
index b87e8bfdb..e072d31bb 100644
--- a/migrations/env.py
+++ b/migrations/env.py
@@ -4,14 +4,14 @@
# Interpret the config file for Python logging.
# This line sets up loggers basically.
-fileConfig(context.config.config_file_name)
+fileConfig(context.config.config_file_name) # type: ignore[arg-type]
# add your model's MetaData object here
# for 'autogenerate' support
# from myapp import mymodel
from inbox.models.base import MailSyncBase
-target_metadata = MailSyncBase.metadata
+target_metadata = MailSyncBase.metadata # type: ignore[attr-defined]
from inbox.config import config
from inbox.ignition import EngineManager
diff --git a/migrations/versions/000_g_msgid_g_thrid_as_integers.py b/migrations/versions/000_g_msgid_g_thrid_as_integers.py
index 6be7ecbfc..184efc81c 100644
--- a/migrations/versions/000_g_msgid_g_thrid_as_integers.py
+++ b/migrations/versions/000_g_msgid_g_thrid_as_integers.py
@@ -9,10 +9,10 @@
# revision identifiers, used by Alembic.
revision = "2605b23e1fe6"
-down_revision = None
+down_revision: str | None = None
from alembic import op
-from sqlalchemy.dialects import mysql
+from sqlalchemy.dialects import mysql # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/002_store_g_thrid_as_biginteger_instead_of_.py b/migrations/versions/002_store_g_thrid_as_biginteger_instead_of_.py
index 5d153db4e..1e5bf28d4 100644
--- a/migrations/versions/002_store_g_thrid_as_biginteger_instead_of_.py
+++ b/migrations/versions/002_store_g_thrid_as_biginteger_instead_of_.py
@@ -11,9 +11,9 @@
revision = "297aa1e1acc7"
down_revision = "217431caacc7"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
-from sqlalchemy.dialects import mysql
+from sqlalchemy.dialects import mysql # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/003_expand_littlejson.py b/migrations/versions/003_expand_littlejson.py
index a1081435c..a10bbb53e 100644
--- a/migrations/versions/003_expand_littlejson.py
+++ b/migrations/versions/003_expand_littlejson.py
@@ -11,7 +11,7 @@
revision = "269247bc37d3"
down_revision = "297aa1e1acc7"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/004_drafts_as_required_folder.py b/migrations/versions/004_drafts_as_required_folder.py
index 91847d331..5c29a0e72 100644
--- a/migrations/versions/004_drafts_as_required_folder.py
+++ b/migrations/versions/004_drafts_as_required_folder.py
@@ -11,7 +11,7 @@
revision = "41a7e825d108"
down_revision = "269247bc37d3"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/005_import_old_accounts.py b/migrations/versions/005_import_old_accounts.py
index db399845d..73ba8c05c 100644
--- a/migrations/versions/005_import_old_accounts.py
+++ b/migrations/versions/005_import_old_accounts.py
@@ -14,17 +14,19 @@
import os.path
from alembic import op
-from sqlalchemy.ext.declarative import declarative_base
+from sqlalchemy.ext.declarative import ( # type: ignore[import-untyped]
+ declarative_base,
+)
SQL_DUMP_FILENAME = "alphasync_rds_inbox_imapaccount.sql"
def upgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
from inbox.models.session import session_scope
engine = main_engine(pool_size=1, max_overflow=0)
- from inbox.auth import gmail
+ from inbox.auth import gmail # type: ignore[attr-defined]
from inbox.models.backends.imap import ImapAccount
# Assert we have the dump file
@@ -45,10 +47,10 @@ def upgrade() -> None:
Base = declarative_base() # noqa: N806
Base.metadata.reflect(engine)
- class ImapAccount_Old(Base): # noqa: N801
+ class ImapAccount_Old(Base): # type: ignore[misc, valid-type] # noqa: N801
__table__ = Base.metadata.tables["imapaccount_old"]
- with session_scope() as db_session:
+ with session_scope() as db_session: # type: ignore[call-arg]
migrated_accounts = []
for acct in db_session.query(ImapAccount_Old):
diff --git a/migrations/versions/006_add_search_tokens.py b/migrations/versions/006_add_search_tokens.py
index 58e06d67d..e0485d872 100644
--- a/migrations/versions/006_add_search_tokens.py
+++ b/migrations/versions/006_add_search_tokens.py
@@ -11,7 +11,7 @@
revision = "482338e7a7d6"
down_revision = "adc646e1f11"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/007_per_provider_table_split.py b/migrations/versions/007_per_provider_table_split.py
index 77c9f54cd..68818cb49 100644
--- a/migrations/versions/007_per_provider_table_split.py
+++ b/migrations/versions/007_per_provider_table_split.py
@@ -11,10 +11,12 @@
revision = "1c3f1812f2d9"
down_revision = "482338e7a7d6"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
-from sqlalchemy.ext.declarative import declarative_base
-from sqlalchemy.sql import column, table
+from sqlalchemy.ext.declarative import ( # type: ignore[import-untyped]
+ declarative_base,
+)
+from sqlalchemy.sql import column, table # type: ignore[import-untyped]
def upgrade() -> None:
@@ -31,18 +33,18 @@ def downgrade() -> None:
# Upgrade funtions:
def genericize_imapaccount() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
from inbox.models.session import session_scope
engine = main_engine(pool_size=1, max_overflow=0)
Base = declarative_base() # noqa: N806
Base.metadata.reflect(engine)
- class ImapAccount_(Base): # noqa: N801
+ class ImapAccount_(Base): # type: ignore[misc, valid-type] # noqa: N801
__table__ = Base.metadata.tables["imapaccount"]
# Get data from columns-to-be-dropped
- with session_scope() as db_session:
+ with session_scope() as db_session: # type: ignore[call-arg]
results = db_session.query(
ImapAccount_.id, ImapAccount_.imap_host
).all()
@@ -77,18 +79,18 @@ class ImapAccount_(Base): # noqa: N801
def genericize_thread() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
from inbox.models.session import session_scope
engine = main_engine(pool_size=1, max_overflow=0)
Base = declarative_base() # noqa: N806
Base.metadata.reflect(engine)
- class Thread_(Base): # noqa: N801
+ class Thread_(Base): # type: ignore[misc, valid-type] # noqa: N801
__table__ = Base.metadata.tables["thread"]
# Get data from columns-to-be-dropped
- with session_scope() as db_session:
+ with session_scope() as db_session: # type: ignore[call-arg]
results = db_session.query(Thread_.id, Thread_.g_thrid).all()
to_insert = [dict(id=r[0], g_thrid=r[1]) for r in results]
@@ -179,18 +181,18 @@ def genericize_namespace_contact_foldersync() -> None:
# Downgrade functions:
def downgrade_imapaccount() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
from inbox.models.session import session_scope
engine = main_engine(pool_size=1, max_overflow=0)
Base = declarative_base() # noqa: N806
Base.metadata.reflect(engine)
- class ImapAccount_(Base): # noqa: N801
+ class ImapAccount_(Base): # type: ignore[misc, valid-type] # noqa: N801
__table__ = Base.metadata.tables["imapaccount"]
# Get data from table-to-be-dropped
- with session_scope() as db_session:
+ with session_scope() as db_session: # type: ignore[call-arg]
results = db_session.query(
ImapAccount_.id, ImapAccount_.imap_host
).all()
@@ -248,18 +250,18 @@ class ImapAccount_(Base): # noqa: N801
def downgrade_imapthread() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
from inbox.models.session import session_scope
engine = main_engine(pool_size=1, max_overflow=0)
Base = declarative_base() # noqa: N806
Base.metadata.reflect(engine)
- class ImapThread_(Base): # noqa: N801
+ class ImapThread_(Base): # type: ignore[misc, valid-type] # noqa: N801
__table__ = Base.metadata.tables["imapthread"]
# Get data from table-to-be-dropped
- with session_scope() as db_session:
+ with session_scope() as db_session: # type: ignore[call-arg]
results = db_session.query(ImapThread_.id, ImapThread_.g_thrid).all()
to_insert = [dict(id=r[0], g_thrid=r[1]) for r in results]
diff --git a/migrations/versions/008_store_userinfo_from_oauth.py b/migrations/versions/008_store_userinfo_from_oauth.py
index ff28b2861..716c6308b 100644
--- a/migrations/versions/008_store_userinfo_from_oauth.py
+++ b/migrations/versions/008_store_userinfo_from_oauth.py
@@ -11,7 +11,7 @@
revision = "3c11391b5eb0"
down_revision = "1c3f1812f2d9"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/009_multiple_contact_providers.py b/migrations/versions/009_multiple_contact_providers.py
index f661b3d87..626dbdb03 100644
--- a/migrations/versions/009_multiple_contact_providers.py
+++ b/migrations/versions/009_multiple_contact_providers.py
@@ -11,7 +11,7 @@
revision = "169cac0cd87e"
down_revision = "3c11391b5eb0"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/010_store_raw_contact_data.py b/migrations/versions/010_store_raw_contact_data.py
index aa0d5c7dd..e3a27eb1a 100644
--- a/migrations/versions/010_store_raw_contact_data.py
+++ b/migrations/versions/010_store_raw_contact_data.py
@@ -11,7 +11,7 @@
revision = "3b511977a01f"
down_revision = "169cac0cd87e"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/011_use_server_default.py b/migrations/versions/011_use_server_default.py
index 800d51050..24de475f0 100644
--- a/migrations/versions/011_use_server_default.py
+++ b/migrations/versions/011_use_server_default.py
@@ -11,7 +11,7 @@
revision = "3237b6b1ee03"
down_revision = "3b511977a01f"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/012_move_google_userinfo_fields_to_.py b/migrations/versions/012_move_google_userinfo_fields_to_.py
index 153a32b88..e10cf151f 100644
--- a/migrations/versions/012_move_google_userinfo_fields_to_.py
+++ b/migrations/versions/012_move_google_userinfo_fields_to_.py
@@ -11,14 +11,16 @@
revision = "193802835c33"
down_revision = "3237b6b1ee03"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
-from sqlalchemy.ext.declarative import declarative_base
-from sqlalchemy.sql import column, table
+from sqlalchemy.ext.declarative import ( # type: ignore[import-untyped]
+ declarative_base,
+)
+from sqlalchemy.sql import column, table # type: ignore[import-untyped]
def upgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
from inbox.models.session import session_scope
engine = main_engine(pool_size=1, max_overflow=0)
@@ -55,10 +57,10 @@ def upgrade() -> None:
)
# MOVE:
- class Account_(Base): # noqa: N801
+ class Account_(Base): # type: ignore[misc, valid-type] # noqa: N801
__table__ = Base.metadata.tables["account"]
- with session_scope() as db_session:
+ with session_scope() as db_session: # type: ignore[call-arg]
results = db_session.query(
Account_.id,
Account_.family_name,
@@ -110,7 +112,7 @@ class Account_(Base): # noqa: N801
def downgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
from inbox.models.session import session_scope
engine = main_engine(pool_size=1, max_overflow=0)
@@ -144,10 +146,10 @@ def downgrade() -> None:
)
# MOVE:
- class ImapAccount_(Base): # noqa: N801
+ class ImapAccount_(Base): # type: ignore[misc, valid-type] # noqa: N801
__table__ = Base.metadata.tables["imapaccount"]
- with session_scope() as db_session:
+ with session_scope() as db_session: # type: ignore[call-arg]
results = db_session.query(
ImapAccount_.id,
ImapAccount_.family_name,
diff --git a/migrations/versions/013_add_spool_msg.py b/migrations/versions/013_add_spool_msg.py
index d46dd2e95..09a5060c8 100644
--- a/migrations/versions/013_add_spool_msg.py
+++ b/migrations/versions/013_add_spool_msg.py
@@ -11,7 +11,7 @@
revision = "f7dbd9bf4a6"
down_revision = "193802835c33"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/014_contact_ranking_signals.py b/migrations/versions/014_contact_ranking_signals.py
index b1dfb94f8..e5a4aa2ee 100644
--- a/migrations/versions/014_contact_ranking_signals.py
+++ b/migrations/versions/014_contact_ranking_signals.py
@@ -11,7 +11,7 @@
revision = "563d405d1f99"
down_revision = "f7dbd9bf4a6"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/015_generalize_from_sender_header_field.py b/migrations/versions/015_generalize_from_sender_header_field.py
index d16a4f628..18c3bd3cd 100644
--- a/migrations/versions/015_generalize_from_sender_header_field.py
+++ b/migrations/versions/015_generalize_from_sender_header_field.py
@@ -16,7 +16,7 @@ def upgrade() -> None:
from inbox.models import Message
from inbox.models.session import session_scope
- with session_scope() as db_session:
+ with session_scope() as db_session: # type: ignore[call-arg]
results = db_session.query(Message).all()
for message in results:
message.from_addr = [message.from_addr]
@@ -28,7 +28,7 @@ def downgrade() -> None:
from inbox.models import Message
from inbox.models.session import session_scope
- with session_scope() as db_session:
+ with session_scope() as db_session: # type: ignore[call-arg]
results = db_session.query(Message).all()
for message in results:
if message.from_addr:
diff --git a/migrations/versions/016_extra_transaction_data.py b/migrations/versions/016_extra_transaction_data.py
index 65a6c5308..1c2201bc8 100644
--- a/migrations/versions/016_extra_transaction_data.py
+++ b/migrations/versions/016_extra_transaction_data.py
@@ -11,7 +11,7 @@
revision = "5093433b073"
down_revision = "3fee2f161614"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/017_haspublicid.py b/migrations/versions/017_haspublicid.py
index 5c3d1d203..0fb5f1b81 100644
--- a/migrations/versions/017_haspublicid.py
+++ b/migrations/versions/017_haspublicid.py
@@ -14,16 +14,16 @@
import sys
from gc import collect as garbage_collect
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
-from sqlalchemy.dialects import mysql
+from sqlalchemy.dialects import mysql # type: ignore[import-untyped]
chunk_size = 500
def upgrade() -> None:
# These all inherit HasPublicID
- from inbox.models import (
+ from inbox.models import ( # type: ignore[attr-defined]
Account,
Block,
Contact,
@@ -72,7 +72,7 @@ def upgrade() -> None:
print("Finished adding columns. \nNow generating public_ids")
- with session_scope() as db_session:
+ with session_scope() as db_session: # type: ignore[call-arg]
count = 0
for c in classes:
garbage_collect()
@@ -99,7 +99,7 @@ def upgrade() -> None:
def downgrade() -> None:
# These all inherit HasPublicID
- from inbox.models import (
+ from inbox.models import ( # type: ignore[attr-defined]
Account,
Block,
Contact,
diff --git a/migrations/versions/018_message_contact_association.py b/migrations/versions/018_message_contact_association.py
index 2ef45dc0e..a54614098 100644
--- a/migrations/versions/018_message_contact_association.py
+++ b/migrations/versions/018_message_contact_association.py
@@ -12,7 +12,7 @@
down_revision = "2c9f3a06de09"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
@@ -38,7 +38,9 @@ def upgrade() -> None:
import sys
sys.path.append("./tools")
- from rerank_contacts import rerank_contacts
+ from rerank_contacts import ( # type: ignore[import-not-found]
+ rerank_contacts,
+ )
rerank_contacts()
diff --git a/migrations/versions/019_blocks_to_parts.py b/migrations/versions/019_blocks_to_parts.py
index f43c9f8ae..271600328 100644
--- a/migrations/versions/019_blocks_to_parts.py
+++ b/migrations/versions/019_blocks_to_parts.py
@@ -14,15 +14,17 @@
from typing import Never
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
-from sqlalchemy.ext.declarative import declarative_base
+from sqlalchemy.ext.declarative import ( # type: ignore[import-untyped]
+ declarative_base,
+)
chunk_size = 250
def upgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
from inbox.models.session import Session, session_scope
engine = main_engine(pool_size=1, max_overflow=0)
@@ -62,7 +64,7 @@ def upgrade() -> None:
Base.metadata.reflect(engine)
class Block_( # noqa: N801
- Base
+ Base # type: ignore[misc, valid-type]
): # old schema, reflected from database table
__table__ = Base.metadata.tables["block"]
@@ -73,17 +75,17 @@ class Block_( # noqa: N801
print("Migrating from blocks to parts")
new_parts = []
- with session_scope() as db_session:
+ with session_scope() as db_session: # type: ignore[call-arg]
for block in db_session.query(Block_).yield_per(chunk_size):
# Move relevant fields
p = Part()
- p.size = block.size
- p.data_sha256 = block.data_sha256
+ p.size = block.size # type: ignore[attr-defined]
+ p.data_sha256 = block.data_sha256 # type: ignore[attr-defined]
p.message_id = block.message_id
p.walk_index = block.walk_index
p.content_disposition = block.content_disposition
p.content_id = block.content_id
- p.misc_keyval = block.misc_keyval
+ p.misc_keyval = block.misc_keyval # type: ignore[attr-defined]
p.is_inboxapp_attachment # noqa: B018
old_namespace = (
@@ -92,7 +94,7 @@ class Block_( # noqa: N801
.filter(Message.id == block.message_id)
.one()
)
- p.namespace_id = old_namespace.id
+ p.namespace_id = old_namespace.id # type: ignore[attr-defined]
# Commit after column modifications
new_parts.append(p)
diff --git a/migrations/versions/020_store_webhook_parameters.py b/migrations/versions/020_store_webhook_parameters.py
index c71c42b95..9d45bb7d5 100644
--- a/migrations/versions/020_store_webhook_parameters.py
+++ b/migrations/versions/020_store_webhook_parameters.py
@@ -11,9 +11,9 @@
revision = "10ef1d46f016"
down_revision = "5a787816e2bc"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
-from sqlalchemy.dialects import mysql
+from sqlalchemy.dialects import mysql # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/021_add_references_column_to_message_table.py b/migrations/versions/021_add_references_column_to_message_table.py
index 2c33e9ccb..a53050680 100644
--- a/migrations/versions/021_add_references_column_to_message_table.py
+++ b/migrations/versions/021_add_references_column_to_message_table.py
@@ -11,7 +11,7 @@
revision = "4fd291c6940c"
down_revision = "10ef1d46f016"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/022_store_imapuid_msg_uid_as_biginteger_.py b/migrations/versions/022_store_imapuid_msg_uid_as_biginteger_.py
index 586b5f535..fe09bdfc2 100644
--- a/migrations/versions/022_store_imapuid_msg_uid_as_biginteger_.py
+++ b/migrations/versions/022_store_imapuid_msg_uid_as_biginteger_.py
@@ -11,9 +11,9 @@
revision = "519e462df171"
down_revision = "4fd291c6940c"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
-from sqlalchemy.dialects import mysql
+from sqlalchemy.dialects import mysql # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/022_webhooks_and_filters.py b/migrations/versions/022_webhooks_and_filters.py
index 808b59744..f90548a06 100644
--- a/migrations/versions/022_webhooks_and_filters.py
+++ b/migrations/versions/022_webhooks_and_filters.py
@@ -16,7 +16,7 @@
from typing import Never
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/023_tighten_nullable_constraints_on_.py b/migrations/versions/023_tighten_nullable_constraints_on_.py
index d3bc55e58..136e0958e 100644
--- a/migrations/versions/023_tighten_nullable_constraints_on_.py
+++ b/migrations/versions/023_tighten_nullable_constraints_on_.py
@@ -14,13 +14,15 @@
revision = "4e04f752b7ad"
down_revision = "2c313b6ddd9b"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
-from sqlalchemy.ext.declarative import declarative_base
+from sqlalchemy.ext.declarative import ( # type: ignore[import-untyped]
+ declarative_base,
+)
def upgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
from inbox.models.session import session_scope
engine = main_engine(pool_size=1, max_overflow=0)
@@ -28,12 +30,12 @@ def upgrade() -> None:
Base = declarative_base() # noqa: N806
Base.metadata.reflect(engine)
- class ImapUid(Base):
+ class ImapUid(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["imapuid"]
print("Deleting imapuid objects with NULL message_id...")
- with session_scope(versioned=False) as session:
+ with session_scope(versioned=False) as session: # type: ignore[call-arg]
session.query(ImapUid).filter_by(message_id=None).delete()
session.commit()
diff --git a/migrations/versions/024_remote_folders_and_inbox_tags_split.py b/migrations/versions/024_remote_folders_and_inbox_tags_split.py
index f3e7da760..73a2d8eff 100644
--- a/migrations/versions/024_remote_folders_and_inbox_tags_split.py
+++ b/migrations/versions/024_remote_folders_and_inbox_tags_split.py
@@ -13,11 +13,16 @@
from typing import Never
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
-from sqlalchemy.dialects import mysql
-from sqlalchemy.ext.declarative import declarative_base
-from sqlalchemy.orm import backref, relationship
+from sqlalchemy.dialects import mysql # type: ignore[import-untyped]
+from sqlalchemy.ext.declarative import ( # type: ignore[import-untyped]
+ declarative_base,
+)
+from sqlalchemy.orm import ( # type: ignore[import-untyped]
+ backref,
+ relationship,
+)
CHUNK_SIZE = 250
@@ -137,7 +142,7 @@ def upgrade() -> None:
"imapuid_ibfk_3", "imapuid", "folder", ["folder_id"], ["id"]
)
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
from inbox.models.session import session_scope
engine = main_engine(pool_size=1, max_overflow=0)
@@ -177,17 +182,17 @@ def upgrade() -> None:
Base = declarative_base() # noqa: N806
Base.metadata.reflect(engine)
- class Folder(Base):
+ class Folder(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["folder"]
account = relationship(
"Account", foreign_keys="Folder.account_id", backref="folders"
)
- class FolderItem(Base):
+ class FolderItem(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["folderitem"]
folder = relationship("Folder", backref="threads", lazy="joined")
- class Thread(Base):
+ class Thread(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["thread"]
folderitems = relationship(
"FolderItem",
@@ -197,13 +202,13 @@ class Thread(Base):
)
namespace = relationship("Namespace", backref="threads")
- class Namespace(Base):
+ class Namespace(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["namespace"]
account = relationship(
"Account", backref=backref("namespace", uselist=False)
)
- class Account(Base):
+ class Account(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["account"]
inbox_folder = relationship(
"Folder", foreign_keys="Account.inbox_folder_id"
@@ -230,13 +235,13 @@ class Account(Base):
"Folder", foreign_keys="Account.all_folder_id"
)
- class ImapUid(Base):
+ class ImapUid(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["imapuid"]
folder = relationship("Folder", backref="imapuids", lazy="joined")
if easupdate:
- class EASUid(Base):
+ class EASUid(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["easuid"]
folder = relationship(
"Folder",
@@ -247,7 +252,9 @@ class EASUid(Base):
print("Creating Folder rows and migrating FolderItems...")
# not many folders per account, so shouldn't grow that big
- with session_scope(versioned=False) as db_session:
+ with session_scope( # type: ignore[call-arg]
+ versioned=False
+ ) as db_session:
folders = dict(
[
((i.account_id, i.name), i)
@@ -272,7 +279,10 @@ class EASUid(Base):
elif folderitem.thread.namespace.account.provider == "eas":
new_folder_name = folderitem.folder_name.title()
- if (account_id, new_folder_name) in folders:
+ if (
+ account_id,
+ new_folder_name, # type: ignore[possibly-undefined]
+ ) in folders:
f = folders[(account_id, new_folder_name)]
else:
f = Folder(account_id=account_id, name=new_folder_name)
@@ -306,7 +316,9 @@ class EASUid(Base):
if easupdate:
print("Migrating EASUids to reference Folder rows...")
- for easuid in db_session.query(EASUid).yield_per(CHUNK_SIZE):
+ for easuid in db_session.query(
+ EASUid # type: ignore[possibly-undefined]
+ ).yield_per(CHUNK_SIZE):
account_id = easuid.easaccount_id
new_folder_name = easuid.folder_name
diff --git a/migrations/versions/026_add_audit_timestamps_to_all_objects.py b/migrations/versions/026_add_audit_timestamps_to_all_objects.py
index 469345491..18c0a1c55 100644
--- a/migrations/versions/026_add_audit_timestamps_to_all_objects.py
+++ b/migrations/versions/026_add_audit_timestamps_to_all_objects.py
@@ -13,10 +13,12 @@
from datetime import datetime
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
-from sqlalchemy.ext.declarative import declarative_base
-from sqlalchemy.sql import column, table
+from sqlalchemy.ext.declarative import ( # type: ignore[import-untyped]
+ declarative_base,
+)
+from sqlalchemy.sql import column, table # type: ignore[import-untyped]
table_names = {
"account",
@@ -41,7 +43,7 @@
def add_eas_tables() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine(pool_size=1, max_overflow=0)
Base = declarative_base() # noqa: N806
diff --git a/migrations/versions/027_imapuid_soft_deletes.py b/migrations/versions/027_imapuid_soft_deletes.py
index 4d6877249..8af5a386c 100644
--- a/migrations/versions/027_imapuid_soft_deletes.py
+++ b/migrations/versions/027_imapuid_soft_deletes.py
@@ -14,9 +14,9 @@
revision = "924ffd092832"
down_revision = "146b1817e4a8"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
-from sqlalchemy.sql import column, table
+from sqlalchemy.sql import column, table # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/028_tag_api_migration.py b/migrations/versions/028_tag_api_migration.py
index 09b11e0c3..07af51fc9 100644
--- a/migrations/versions/028_tag_api_migration.py
+++ b/migrations/versions/028_tag_api_migration.py
@@ -15,22 +15,27 @@
from datetime import datetime
from typing import Never
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
-from sqlalchemy.ext.declarative import declarative_base
-from sqlalchemy.orm import relationship, sessionmaker
-from sqlalchemy.orm.exc import NoResultFound
+from sqlalchemy.ext.declarative import ( # type: ignore[import-untyped]
+ declarative_base,
+)
+from sqlalchemy.orm import ( # type: ignore[import-untyped]
+ relationship,
+ sessionmaker,
+)
+from sqlalchemy.orm.exc import NoResultFound # type: ignore[import-untyped]
def upgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine(pool_size=1, max_overflow=0)
Session = sessionmaker(bind=engine) # noqa: N806
@contextmanager
- def basic_session():
+ def basic_session(): # type: ignore[no-untyped-def]
# Using the new_session is kind of a pain in this migration, so let's
# just roll with a normal sqlalchemy session.
session = Session(autoflush=True, autocommit=False)
@@ -79,17 +84,17 @@ def basic_session():
Base = declarative_base() # noqa: N806
Base.metadata.reflect(engine)
- class Folder(Base):
+ class Folder(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["folder"]
account = relationship(
"Account", foreign_keys="Folder.account_id", backref="folders"
)
- class FolderItem(Base):
+ class FolderItem(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["folderitem"]
folder = relationship("Folder", backref="threads", lazy="joined")
- class Account(Base):
+ class Account(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["account"]
print("setting provider_prefix for current accounts")
diff --git a/migrations/versions/029_set_inbox_folder_exposed_name.py b/migrations/versions/029_set_inbox_folder_exposed_name.py
index bba8014d8..ac543aa41 100644
--- a/migrations/versions/029_set_inbox_folder_exposed_name.py
+++ b/migrations/versions/029_set_inbox_folder_exposed_name.py
@@ -11,21 +11,25 @@
revision = "52a9a976a2e0"
down_revision = "40629415951c"
-from sqlalchemy.ext.declarative import declarative_base
+from sqlalchemy.ext.declarative import ( # type: ignore[import-untyped]
+ declarative_base,
+)
def upgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
from inbox.models.session import session_scope
engine = main_engine(pool_size=1, max_overflow=0)
Base = declarative_base() # noqa: N806
Base.metadata.reflect(engine)
- class Folder(Base):
+ class Folder(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["folder"]
- with session_scope(versioned=False) as db_session:
+ with session_scope( # type: ignore[call-arg]
+ versioned=False
+ ) as db_session:
for folder in db_session.query(Folder).filter(Folder.name == "Inbox"):
folder.public_id = "inbox"
folder.exposed_name = "inbox"
diff --git a/migrations/versions/030_add_is_read_attribute_to_messages.py b/migrations/versions/030_add_is_read_attribute_to_messages.py
index d5f40b640..352111119 100644
--- a/migrations/versions/030_add_is_read_attribute_to_messages.py
+++ b/migrations/versions/030_add_is_read_attribute_to_messages.py
@@ -11,11 +11,16 @@
revision = "1b6ceae51b43"
down_revision = "52a9a976a2e0"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
-from sqlalchemy.dialects import mysql
-from sqlalchemy.ext.declarative import declarative_base
-from sqlalchemy.orm import backref, relationship
+from sqlalchemy.dialects import mysql # type: ignore[import-untyped]
+from sqlalchemy.ext.declarative import ( # type: ignore[import-untyped]
+ declarative_base,
+)
+from sqlalchemy.orm import ( # type: ignore[import-untyped]
+ backref,
+ relationship,
+)
def upgrade() -> None:
@@ -42,17 +47,17 @@ def upgrade() -> None:
nullable=False,
)
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
from inbox.models.session import session_scope
engine = main_engine(pool_size=1, max_overflow=0)
Base = declarative_base() # noqa: N806
Base.metadata.reflect(engine)
- class Message(Base):
+ class Message(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["message"]
- class ImapUid(Base):
+ class ImapUid(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["imapuid"]
message = relationship(
"Message",
@@ -67,7 +72,9 @@ class ImapUid(Base):
"Message.deleted_at == None)",
)
- with session_scope(versioned=False) as db_session:
+ with session_scope( # type: ignore[call-arg]
+ versioned=False
+ ) as db_session:
for uid in db_session.query(ImapUid).yield_per(500):
if uid.is_seen:
uid.message.is_read = True
diff --git a/migrations/versions/031_add_indexes_to_timestamps.py b/migrations/versions/031_add_indexes_to_timestamps.py
index 9ba04ee1f..18a39c433 100644
--- a/migrations/versions/031_add_indexes_to_timestamps.py
+++ b/migrations/versions/031_add_indexes_to_timestamps.py
@@ -12,11 +12,13 @@
down_revision = "1b6ceae51b43"
from alembic import op
-from sqlalchemy.ext.declarative import declarative_base
+from sqlalchemy.ext.declarative import ( # type: ignore[import-untyped]
+ declarative_base,
+)
def upgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine(pool_size=1, max_overflow=0)
Base = declarative_base() # noqa: N806
@@ -352,7 +354,7 @@ def downgrade() -> None:
op.drop_index("ix_folder_deleted_at", table_name="folder")
op.drop_index("ix_folder_created_at", table_name="folder")
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine(pool_size=1, max_overflow=0)
Base = declarative_base() # noqa: N806
diff --git a/migrations/versions/032_tighten_easuid.py b/migrations/versions/032_tighten_easuid.py
index 4c3a38a48..7f7375940 100644
--- a/migrations/versions/032_tighten_easuid.py
+++ b/migrations/versions/032_tighten_easuid.py
@@ -11,13 +11,15 @@
revision = "3f96e92953e1"
down_revision = "55f0ff54c776"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
-from sqlalchemy.ext.declarative import declarative_base
+from sqlalchemy.ext.declarative import ( # type: ignore[import-untyped]
+ declarative_base,
+)
def upgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine(pool_size=1, max_overflow=0)
Base = declarative_base() # noqa: N806
@@ -51,7 +53,7 @@ def upgrade() -> None:
def downgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine(pool_size=1, max_overflow=0)
Base = declarative_base() # noqa: N806
diff --git a/migrations/versions/033_add_more_indexes.py b/migrations/versions/033_add_more_indexes.py
index 57e1b45a4..bf68fe55c 100644
--- a/migrations/versions/033_add_more_indexes.py
+++ b/migrations/versions/033_add_more_indexes.py
@@ -12,11 +12,13 @@
down_revision = "3f96e92953e1"
from alembic import op
-from sqlalchemy.ext.declarative import declarative_base
+from sqlalchemy.ext.declarative import ( # type: ignore[import-untyped]
+ declarative_base,
+)
def upgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine(pool_size=1, max_overflow=0)
Base = declarative_base() # noqa: N806
@@ -37,7 +39,7 @@ def upgrade() -> None:
def downgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine(pool_size=1, max_overflow=0)
Base = declarative_base() # noqa: N806
diff --git a/migrations/versions/035_add_columns_for_drafts_support_to_.py b/migrations/versions/035_add_columns_for_drafts_support_to_.py
index e9571a745..e47ea9039 100644
--- a/migrations/versions/035_add_columns_for_drafts_support_to_.py
+++ b/migrations/versions/035_add_columns_for_drafts_support_to_.py
@@ -11,9 +11,9 @@
revision = "24e085e152c0"
down_revision = "350a08df27ee"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
-from sqlalchemy.dialects import mysql
+from sqlalchemy.dialects import mysql # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/036_replace_usertag_by_generic_tag.py b/migrations/versions/036_replace_usertag_by_generic_tag.py
index ac7c6a76a..e2ccfa391 100644
--- a/migrations/versions/036_replace_usertag_by_generic_tag.py
+++ b/migrations/versions/036_replace_usertag_by_generic_tag.py
@@ -13,7 +13,7 @@
from typing import Never
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
@@ -87,10 +87,16 @@ def upgrade() -> None:
# of this commit. However, the alternative is to have a crazy long,
# involved and error-prone recreation of the models and their behavior
# here. (I tried it, and decided this way was better.)
- from inbox.models import FolderItem, Namespace, Tag
+ from inbox.models import ( # type: ignore[attr-defined]
+ FolderItem,
+ Namespace,
+ Tag,
+ )
from inbox.models.session import session_scope
- with session_scope(versioned=False) as db_session:
+ with session_scope( # type: ignore[call-arg]
+ versioned=False
+ ) as db_session:
# create canonical tags that don't already exist.
CANONICAL_TAG_NAMES = [ # noqa: N806
"inbox",
diff --git a/migrations/versions/037_shorten_addresses.py b/migrations/versions/037_shorten_addresses.py
index 98854faa2..734106c37 100644
--- a/migrations/versions/037_shorten_addresses.py
+++ b/migrations/versions/037_shorten_addresses.py
@@ -12,7 +12,7 @@
down_revision = "21878b1b3d4b"
from alembic import op
-from sqlalchemy.dialects import mysql
+from sqlalchemy.dialects import mysql # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/038_add_public_ids_to_transactions.py b/migrations/versions/038_add_public_ids_to_transactions.py
index cc19a11f7..5bf7e3798 100644
--- a/migrations/versions/038_add_public_ids_to_transactions.py
+++ b/migrations/versions/038_add_public_ids_to_transactions.py
@@ -14,10 +14,12 @@
import sys
from gc import collect as garbage_collect
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
-from sqlalchemy.dialects import mysql
-from sqlalchemy.ext.declarative import declarative_base
+from sqlalchemy.dialects import mysql # type: ignore[import-untyped]
+from sqlalchemy.ext.declarative import ( # type: ignore[import-untyped]
+ declarative_base,
+)
def upgrade() -> None:
@@ -33,7 +35,7 @@ def upgrade() -> None:
)
# TODO(emfree) reflect
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
from inbox.models.session import session_scope
from inbox.sqlalchemy_ext.util import b36_to_bin, generate_public_id
@@ -41,10 +43,12 @@ def upgrade() -> None:
Base = declarative_base() # noqa: N806
Base.metadata.reflect(engine)
- class Transaction(Base):
+ class Transaction(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["transaction"]
- with session_scope(versioned=False) as db_session:
+ with session_scope( # type: ignore[call-arg]
+ versioned=False
+ ) as db_session:
count = 0
(num_transactions,) = db_session.query(
sa.func.max(Transaction.id)
diff --git a/migrations/versions/039_change_easfoldersync_unique_constraint.py b/migrations/versions/039_change_easfoldersync_unique_constraint.py
index d405d8594..ba824b502 100644
--- a/migrations/versions/039_change_easfoldersync_unique_constraint.py
+++ b/migrations/versions/039_change_easfoldersync_unique_constraint.py
@@ -12,11 +12,13 @@
down_revision = "1edbd63582c2"
from alembic import op
-from sqlalchemy.ext.declarative import declarative_base
+from sqlalchemy.ext.declarative import ( # type: ignore[import-untyped]
+ declarative_base,
+)
def upgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine(pool_size=1, max_overflow=0)
Base = declarative_base() # noqa: N806
@@ -32,7 +34,7 @@ def upgrade() -> None:
def downgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine(pool_size=1, max_overflow=0)
Base = declarative_base() # noqa: N806
diff --git a/migrations/versions/040_gmailaccount.py b/migrations/versions/040_gmailaccount.py
index 26ea023f7..0fe72938a 100644
--- a/migrations/versions/040_gmailaccount.py
+++ b/migrations/versions/040_gmailaccount.py
@@ -13,7 +13,7 @@
from typing import Never
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
@@ -46,9 +46,11 @@ def upgrade() -> None:
sa.PrimaryKeyConstraint("id"),
)
- from sqlalchemy.ext.declarative import declarative_base
+ from sqlalchemy.ext.declarative import ( # type: ignore[import-untyped]
+ declarative_base,
+ )
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine(pool_size=1, max_overflow=0)
from inbox.models.session import session_scope
@@ -56,16 +58,18 @@ def upgrade() -> None:
Base = declarative_base() # noqa: N806
Base.metadata.reflect(engine)
- class Account(Base):
+ class Account(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["account"]
- class ImapAccount(Base):
+ class ImapAccount(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["imapaccount"]
- class GmailAccount(Base):
+ class GmailAccount(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["gmailaccount"]
- with session_scope(versioned=False) as db_session:
+ with session_scope( # type: ignore[call-arg]
+ versioned=False
+ ) as db_session:
for acct in db_session.query(Account):
if acct.provider == "Gmail":
imap_acct = (
diff --git a/migrations/versions/041_add_sync_status_columns_to_foldersync.py b/migrations/versions/041_add_sync_status_columns_to_foldersync.py
index 3995f848a..8570559f9 100644
--- a/migrations/versions/041_add_sync_status_columns_to_foldersync.py
+++ b/migrations/versions/041_add_sync_status_columns_to_foldersync.py
@@ -11,13 +11,15 @@
revision = "159609404baf"
down_revision = "4085dd542739"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
-from sqlalchemy.ext.declarative import declarative_base
+from sqlalchemy.ext.declarative import ( # type: ignore[import-untyped]
+ declarative_base,
+)
def upgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine(pool_size=1, max_overflow=0)
from inbox.sqlalchemy_ext.util import JSON, MutableDict
@@ -42,7 +44,7 @@ def upgrade() -> None:
def downgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine(pool_size=1, max_overflow=0)
Base = declarative_base() # noqa: N806
diff --git a/migrations/versions/042_simplify_tags_schema.py b/migrations/versions/042_simplify_tags_schema.py
index f52f1bae1..b0d01bb7b 100644
--- a/migrations/versions/042_simplify_tags_schema.py
+++ b/migrations/versions/042_simplify_tags_schema.py
@@ -11,9 +11,9 @@
revision = "459dbc29648"
down_revision = "159609404baf"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
-from sqlalchemy.dialects import mysql
+from sqlalchemy.dialects import mysql # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/043_columns_for_sync_running_stopped_killed.py b/migrations/versions/043_columns_for_sync_running_stopped_killed.py
index f93364564..c0aff25da 100644
--- a/migrations/versions/043_columns_for_sync_running_stopped_killed.py
+++ b/migrations/versions/043_columns_for_sync_running_stopped_killed.py
@@ -11,7 +11,7 @@
revision = "5a136610b50b"
down_revision = "459dbc29648"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/044_update_drafts_schema.py b/migrations/versions/044_update_drafts_schema.py
index ffb728b92..26ae4f629 100644
--- a/migrations/versions/044_update_drafts_schema.py
+++ b/migrations/versions/044_update_drafts_schema.py
@@ -11,9 +11,9 @@
revision = "247cd689758c"
down_revision = "5a136610b50b"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
-from sqlalchemy.dialects import mysql
+from sqlalchemy.dialects import mysql # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/045_new_password_storage.py b/migrations/versions/045_new_password_storage.py
index 79004fa34..29c50e762 100644
--- a/migrations/versions/045_new_password_storage.py
+++ b/migrations/versions/045_new_password_storage.py
@@ -14,7 +14,7 @@
import os
from typing import Never
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
# We're deleting this value from the config, so need to explicitly give it for
@@ -26,15 +26,15 @@
# Copied from deprecated inbox.util.cryptography module.
# Needed to port passwords to new storage method.
-def decrypt_aes(ciphertext, key): # noqa: ANN201
+def decrypt_aes(ciphertext, key): # type: ignore[no-untyped-def] # noqa: ANN201
"""
Decrypts a ciphertext that was AES-encrypted with the given key.
The function expects the ciphertext as a byte string and it returns the
decrypted message as a byte string.
"""
- from Crypto.Cipher import AES
+ from Crypto.Cipher import AES # type: ignore[import-not-found]
- def unpad(s):
+ def unpad(s): # type: ignore[no-untyped-def]
return s[: -ord(s[-1])]
iv = ciphertext[: AES.block_size]
@@ -44,13 +44,13 @@ def unpad(s):
def upgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
from inbox.models.session import session_scope
engine = main_engine(pool_size=1, max_overflow=0)
from hashlib import sha256
- from inbox.util.file import mkdirp
+ from inbox.util.file import mkdirp # type: ignore[attr-defined]
OriginalBase = sa.ext.declarative.declarative_base() # noqa: N806
OriginalBase.metadata.reflect(engine)
@@ -62,14 +62,16 @@ def upgrade() -> None:
Base = sa.ext.declarative.declarative_base() # noqa: N806
Base.metadata.reflect(engine)
- class Account(Base):
+ class Account(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["account"]
class EASAccount(Account):
__table__ = Base.metadata.tables["easaccount"]
@property
- def _keyfile(self, create_dir: bool = True): # noqa: PLR0206
+ def _keyfile( # type: ignore[no-untyped-def] # noqa: PLR0206
+ self, create_dir: bool = True
+ ):
assert self.key
assert KEY_DIR
@@ -78,7 +80,7 @@ def _keyfile(self, create_dir: bool = True): # noqa: PLR0206
key_filename = f"{sha256(self.key).hexdigest()}"
return os.path.join(KEY_DIR, key_filename) # noqa: PTH118
- def get_old_password(self):
+ def get_old_password(self): # type: ignore[no-untyped-def]
if self.password_aes is not None:
with open(self._keyfile) as f: # noqa: PTH123
key = f.read()
@@ -87,7 +89,7 @@ def get_old_password(self):
return decrypt_aes(self.password_aes, key)
return None
- with session_scope() as db_session:
+ with session_scope() as db_session: # type: ignore[call-arg]
for account in db_session.query(EASAccount):
account.password = account.get_old_password()
db_session.add(account)
diff --git a/migrations/versions/046_yahoo.py b/migrations/versions/046_yahoo.py
index 60b42a334..ba8026d36 100644
--- a/migrations/versions/046_yahoo.py
+++ b/migrations/versions/046_yahoo.py
@@ -11,7 +11,7 @@
revision = "38d78543f8be"
down_revision = "7a117720554"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/047_store_more_on_threads.py b/migrations/versions/047_store_more_on_threads.py
index e27cd1a13..ebd05b71f 100644
--- a/migrations/versions/047_store_more_on_threads.py
+++ b/migrations/versions/047_store_more_on_threads.py
@@ -13,7 +13,7 @@
import itertools
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
@@ -31,7 +31,9 @@ def upgrade() -> None:
from inbox.models import Thread
from inbox.models.session import session_scope
- with session_scope(versioned=False) as db_session:
+ with session_scope( # type: ignore[call-arg]
+ versioned=False
+ ) as db_session:
(num_threads,) = db_session.query(sa.func.max(Thread.id)).one()
if num_threads is None:
# There aren't actually any threads to update.
diff --git a/migrations/versions/048_remove_storage_of_access_token.py b/migrations/versions/048_remove_storage_of_access_token.py
index c40aff849..3ea2e6fdc 100644
--- a/migrations/versions/048_remove_storage_of_access_token.py
+++ b/migrations/versions/048_remove_storage_of_access_token.py
@@ -11,7 +11,7 @@
revision = "4e44216e9830"
down_revision = "161b88c17615"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/050_imap_table_cleanups.py b/migrations/versions/050_imap_table_cleanups.py
index 86b1ed688..ed072558c 100644
--- a/migrations/versions/050_imap_table_cleanups.py
+++ b/migrations/versions/050_imap_table_cleanups.py
@@ -13,12 +13,12 @@
from typing import Never
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
def upgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
from inbox.models.folder import Folder
from inbox.models.session import session_scope
from inbox.sqlalchemy_ext.util import JSON
@@ -112,16 +112,18 @@ def upgrade() -> None:
)
Base.metadata.reflect(engine)
- class EASFolderSyncStatus(Base):
+ class EASFolderSyncStatus(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["easfoldersyncstatus"]
- class ImapFolderSyncStatus(Base):
+ class ImapFolderSyncStatus(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["imapfoldersyncstatus"]
- class ImapFolderInfo(Base):
+ class ImapFolderInfo(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["imapfolderinfo"]
- with session_scope(versioned=False) as db_session:
+ with session_scope( # type: ignore[call-arg]
+ versioned=False
+ ) as db_session:
folder_id_for = dict(
[
((account_id, name.lower()), id_)
@@ -137,7 +139,9 @@ class ImapFolderInfo(Base):
]
db_session.commit()
if "easfoldersyncstatus" in Base.metadata.tables:
- for status in db_session.query(EASFolderSyncStatus):
+ for status in db_session.query(
+ EASFolderSyncStatus # type: ignore[possibly-undefined]
+ ):
print("migrating", status.folder_name)
folder_id = folder_id_for.get(
(status.account_id, status.folder_name.lower())
@@ -146,7 +150,7 @@ class ImapFolderInfo(Base):
status.folder_id = folder_id
else:
# EAS folder rows *may* not exist if have no messages
- folder = Folder(
+ folder = Folder( # type: ignore[call-arg]
account_id=status.account_id, name=status.folder_name
)
db_session.add(folder)
@@ -206,7 +210,9 @@ class ImapFolderInfo(Base):
"account_id", "imapfoldersyncstatus", ["account_id", "folder_id"]
)
- with session_scope(versioned=False) as db_session:
+ with session_scope( # type: ignore[call-arg]
+ versioned=False
+ ) as db_session:
for info in db_session.query(ImapFolderInfo):
print("migrating", info.folder_name)
info.folder_id = folder_id_for[
diff --git a/migrations/versions/051_store_secrets_in_local_vault.py b/migrations/versions/051_store_secrets_in_local_vault.py
index 3d362b18f..17c4bea77 100644
--- a/migrations/versions/051_store_secrets_in_local_vault.py
+++ b/migrations/versions/051_store_secrets_in_local_vault.py
@@ -13,14 +13,16 @@
from datetime import datetime
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
def upgrade() -> None:
- from sqlalchemy.ext.declarative import declarative_base
+ from sqlalchemy.ext.declarative import ( # type: ignore[import-untyped]
+ declarative_base,
+ )
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
from inbox.models.session import session_scope
engine = main_engine(pool_size=1, max_overflow=0)
@@ -43,19 +45,21 @@ def upgrade() -> None:
Base = declarative_base() # noqa: N806
Base.metadata.reflect(engine)
- class Account(Base):
+ class Account(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["account"]
- class ImapAccount(Base):
+ class ImapAccount(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["imapaccount"]
- class GmailAccount(Base):
+ class GmailAccount(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["gmailaccount"]
- class Secret(Base):
+ class Secret(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["secret"]
- with session_scope(versioned=False) as db_session:
+ with session_scope( # type: ignore[call-arg]
+ versioned=False
+ ) as db_session:
for acct in db_session.query(GmailAccount):
secret = Secret(
acl_id=0,
@@ -92,23 +96,23 @@ class Secret(Base):
def downgrade() -> None:
from sqlalchemy.ext.declarative import declarative_base
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
from inbox.models.session import session_scope
engine = main_engine(pool_size=1, max_overflow=0)
Base = declarative_base() # noqa: N806
Base.metadata.reflect(engine)
- class Account(Base):
+ class Account(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["account"]
- class ImapAccount(Base):
+ class ImapAccount(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["imapaccount"]
- class GmailAccount(Base):
+ class GmailAccount(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["gmailaccount"]
- class Secret(Base):
+ class Secret(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["secret"]
op.add_column(
@@ -116,7 +120,9 @@ class Secret(Base):
sa.Column("refresh_token", sa.String(length=512), nullable=True),
)
- with session_scope(versioned=False) as db_session:
+ with session_scope( # type: ignore[call-arg]
+ versioned=False
+ ) as db_session:
for acct in db_session.query(GmailAccount):
secret = (
db_session.query(Secret)
diff --git a/migrations/versions/052_store_google_client_id_and_secret_on_.py b/migrations/versions/052_store_google_client_id_and_secret_on_.py
index 394e66a19..de8c3b40b 100644
--- a/migrations/versions/052_store_google_client_id_and_secret_on_.py
+++ b/migrations/versions/052_store_google_client_id_and_secret_on_.py
@@ -11,7 +11,7 @@
revision = "358d0320397f"
down_revision = "1925c535a52d"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/053_canonicalize_addresses.py b/migrations/versions/053_canonicalize_addresses.py
index f6c02a00c..251650f5a 100644
--- a/migrations/versions/053_canonicalize_addresses.py
+++ b/migrations/versions/053_canonicalize_addresses.py
@@ -11,9 +11,9 @@
revision = "3795b2a97af1"
down_revision = "358d0320397f"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
-from sqlalchemy.dialects import mysql
+from sqlalchemy.dialects import mysql # type: ignore[import-untyped]
def upgrade() -> None:
@@ -57,19 +57,21 @@ def upgrade() -> None:
"ix_contact__raw_address", "contact", ["_raw_address"], unique=False
)
- from flanker.addresslib import address
+ from flanker.addresslib import address # type: ignore[import-untyped]
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine(pool_size=1, max_overflow=0)
- from sqlalchemy.ext.declarative import declarative_base
+ from sqlalchemy.ext.declarative import ( # type: ignore[import-untyped]
+ declarative_base,
+ )
from inbox.models.session import session_scope
Base = declarative_base() # noqa: N806
Base.metadata.reflect(engine)
- def canonicalize_address(addr):
+ def canonicalize_address(addr): # type: ignore[no-untyped-def]
"""Gmail addresses with and without periods are the same."""
parsed_address = address.parse(addr, addr_spec_only=True)
if not isinstance(parsed_address, address.EmailAddress):
@@ -79,13 +81,15 @@ def canonicalize_address(addr):
local_part = local_part.replace(".", "")
return "@".join((local_part, parsed_address.hostname))
- class Account(Base):
+ class Account(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["account"]
- class Contact(Base):
+ class Contact(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["contact"]
- with session_scope(versioned=False) as db_session:
+ with session_scope( # type: ignore[call-arg]
+ versioned=False
+ ) as db_session:
for acct in db_session.query(Account):
acct._raw_address = acct.email_address
acct._canonicalized_address = canonicalize_address(
@@ -122,7 +126,7 @@ def downgrade() -> None:
op.create_index(
"ix_contact_email_address", "contact", ["email_address"], unique=False
)
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine(pool_size=1, max_overflow=0)
from sqlalchemy.ext.declarative import declarative_base
@@ -132,13 +136,15 @@ def downgrade() -> None:
Base = declarative_base() # noqa: N806
Base.metadata.reflect(engine)
- class Account(Base):
+ class Account(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["account"]
- class Contact(Base):
+ class Contact(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["contact"]
- with session_scope(versioned=False) as db_session:
+ with session_scope( # type: ignore[call-arg]
+ versioned=False
+ ) as db_session:
for acct in db_session.query(Account):
acct.email_address = acct._raw_address
db_session.commit()
diff --git a/migrations/versions/054_dont_specially_store_mailing_list_.py b/migrations/versions/054_dont_specially_store_mailing_list_.py
index 503ba424c..93c4c843f 100644
--- a/migrations/versions/054_dont_specially_store_mailing_list_.py
+++ b/migrations/versions/054_dont_specially_store_mailing_list_.py
@@ -11,9 +11,9 @@
revision = "5143154fb1a2"
down_revision = "3795b2a97af1"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
-from sqlalchemy.dialects import mysql
+from sqlalchemy.dialects import mysql # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/055_add_account_liveness.py b/migrations/versions/055_add_account_liveness.py
index fdf111fc7..da93dbc7d 100644
--- a/migrations/versions/055_add_account_liveness.py
+++ b/migrations/versions/055_add_account_liveness.py
@@ -11,7 +11,7 @@
revision = "4b4674f1a726"
down_revision = "5143154fb1a2"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/056_message_unique_constraint.py b/migrations/versions/056_message_unique_constraint.py
index f44d261c3..ec2b8a14f 100644
--- a/migrations/versions/056_message_unique_constraint.py
+++ b/migrations/versions/056_message_unique_constraint.py
@@ -12,7 +12,7 @@
down_revision = "4b4674f1a726"
from alembic import op
-from sqlalchemy import func
+from sqlalchemy import func # type: ignore[import-untyped]
def upgrade() -> None:
@@ -54,7 +54,9 @@ def upgrade() -> None:
from inbox.models import Message
from inbox.models.session import session_scope
- with session_scope(versioned=False) as db_session:
+ with session_scope( # type: ignore[call-arg]
+ versioned=False
+ ) as db_session:
groups = (
db_session.query(Message.id, Message.thread_id, Message.g_msgid)
.filter(~Message.g_msgid.is_(None))
diff --git a/migrations/versions/057_consolidate_account_sync_status_columns.py b/migrations/versions/057_consolidate_account_sync_status_columns.py
index 5170c682a..026658add 100644
--- a/migrations/versions/057_consolidate_account_sync_status_columns.py
+++ b/migrations/versions/057_consolidate_account_sync_status_columns.py
@@ -13,18 +13,20 @@
from typing import Never
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
from inbox.sqlalchemy_ext import json_util
def upgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
from inbox.sqlalchemy_ext.util import JSON, MutableDict
engine = main_engine(pool_size=1, max_overflow=0)
- from sqlalchemy.ext.declarative import declarative_base
+ from sqlalchemy.ext.declarative import ( # type: ignore[import-untyped]
+ declarative_base,
+ )
from inbox.models.session import session_scope
@@ -41,10 +43,12 @@ def upgrade() -> None:
Base = declarative_base() # noqa: N806
Base.metadata.reflect(engine)
- class Account(Base):
+ class Account(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["account"]
- with session_scope(versioned=False) as db_session:
+ with session_scope( # type: ignore[call-arg]
+ versioned=False
+ ) as db_session:
for acct in db_session.query(Account):
d = dict(
sync_start_time=str(acct.sync_start_time),
diff --git a/migrations/versions/058_enforce_length_limit_of_255_on_message_.py b/migrations/versions/058_enforce_length_limit_of_255_on_message_.py
index e906f3959..ae4f83abd 100644
--- a/migrations/versions/058_enforce_length_limit_of_255_on_message_.py
+++ b/migrations/versions/058_enforce_length_limit_of_255_on_message_.py
@@ -13,11 +13,11 @@
from typing import Never
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
-def truncate_subject(obj) -> None:
+def truncate_subject(obj) -> None: # type: ignore[no-untyped-def]
if obj.subject is None:
return
if len(obj.subject) > 255:
@@ -26,23 +26,27 @@ def truncate_subject(obj) -> None:
def upgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
from inbox.models.session import session_scope
engine = main_engine(pool_size=1, max_overflow=0)
- from sqlalchemy.ext.declarative import declarative_base
+ from sqlalchemy.ext.declarative import ( # type: ignore[import-untyped]
+ declarative_base,
+ )
Base = declarative_base() # noqa: N806
Base.metadata.reflect(engine)
- class Message(Base):
+ class Message(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["message"]
- class Thread(Base):
+ class Thread(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["thread"]
- with session_scope(versioned=False) as db_session:
+ with session_scope( # type: ignore[call-arg]
+ versioned=False
+ ) as db_session:
count = 0
for msg in (
db_session.query(Message)
diff --git a/migrations/versions/059_add_action_log.py b/migrations/versions/059_add_action_log.py
index d126eba37..513f11646 100644
--- a/migrations/versions/059_add_action_log.py
+++ b/migrations/versions/059_add_action_log.py
@@ -11,7 +11,7 @@
revision = "15dfc756a1b0"
down_revision = "4af5952e8a5b"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/060_cascade_folder_deletes_to_easuid.py b/migrations/versions/060_cascade_folder_deletes_to_easuid.py
index 36f98804b..54f6fe1d5 100644
--- a/migrations/versions/060_cascade_folder_deletes_to_easuid.py
+++ b/migrations/versions/060_cascade_folder_deletes_to_easuid.py
@@ -15,10 +15,12 @@
def upgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine(pool_size=1, max_overflow=0)
- from sqlalchemy.ext.declarative import declarative_base
+ from sqlalchemy.ext.declarative import ( # type: ignore[import-untyped]
+ declarative_base,
+ )
Base = declarative_base() # noqa: N806
Base.metadata.reflect(engine)
diff --git a/migrations/versions/061_remove_easfoldersyncstatus_folder_rows_.py b/migrations/versions/061_remove_easfoldersyncstatus_folder_rows_.py
index 628677bb8..968119815 100644
--- a/migrations/versions/061_remove_easfoldersyncstatus_folder_rows_.py
+++ b/migrations/versions/061_remove_easfoldersyncstatus_folder_rows_.py
@@ -15,22 +15,35 @@
def upgrade() -> None:
- if "easfoldersyncstatus" in Base.metadata.tables: # noqa: F821
- from inbox.ignition import main_engine
+ if (
+ "easfoldersyncstatus"
+ in Base.metadata.tables # type: ignore[has-type, used-before-def] # noqa: F821
+ ):
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine(pool_size=1, max_overflow=0)
- from sqlalchemy.ext.declarative import declarative_base
- from sqlalchemy.orm.exc import NoResultFound
+ from sqlalchemy.ext.declarative import ( # type: ignore[import-untyped]
+ declarative_base,
+ )
+ from sqlalchemy.orm.exc import ( # type: ignore[import-untyped]
+ NoResultFound,
+ )
from inbox.models.session import session_scope
Base = declarative_base() # noqa: N806
Base.metadata.reflect(engine)
from inbox.models import Folder
- from inbox.models.backends.eas import EASFolderSyncStatus
- from inbox.util.eas.constants import SKIP_FOLDERS
+ from inbox.models.backends.eas import ( # type: ignore[import-not-found]
+ EASFolderSyncStatus,
+ )
+ from inbox.util.eas.constants import ( # type: ignore[import-not-found]
+ SKIP_FOLDERS,
+ )
- with session_scope(versioned=False) as db_session:
+ with session_scope( # type: ignore[call-arg]
+ versioned=False
+ ) as db_session:
statuses = (
db_session.query(EASFolderSyncStatus)
.filter(EASFolderSyncStatus.eas_folder_type.in_(SKIP_FOLDERS))
diff --git a/migrations/versions/062_up_max_length_of_message_message_id_header.py b/migrations/versions/062_up_max_length_of_message_message_id_header.py
index da9c98aee..efcc31c49 100644
--- a/migrations/versions/062_up_max_length_of_message_message_id_header.py
+++ b/migrations/versions/062_up_max_length_of_message_message_id_header.py
@@ -15,7 +15,7 @@
revision = "4c03aaa1fa47"
down_revision = "bb4f204f192"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/064_make_address_fields_non_null.py b/migrations/versions/064_make_address_fields_non_null.py
index 5f8633c3e..128531642 100644
--- a/migrations/versions/064_make_address_fields_non_null.py
+++ b/migrations/versions/064_make_address_fields_non_null.py
@@ -12,25 +12,29 @@
down_revision = "4fd3fcd46a3b"
from alembic import op
-from sqlalchemy import func, or_
-from sqlalchemy.dialects import mysql
+from sqlalchemy import func, or_ # type: ignore[import-untyped]
+from sqlalchemy.dialects import mysql # type: ignore[import-untyped]
def upgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine(pool_size=1, max_overflow=0)
- from sqlalchemy.ext.declarative import declarative_base
+ from sqlalchemy.ext.declarative import ( # type: ignore[import-untyped]
+ declarative_base,
+ )
from inbox.models.session import session_scope
Base = declarative_base() # noqa: N806
Base.metadata.reflect(engine)
- class Message(Base):
+ class Message(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["message"]
- with session_scope(versioned=False) as db_session:
+ with session_scope( # type: ignore[call-arg]
+ versioned=False
+ ) as db_session:
null_field_count = (
db_session.query(func.count(Message.id))
.filter(
diff --git a/migrations/versions/066_kill_spoolmessage.py b/migrations/versions/066_kill_spoolmessage.py
index 94c342786..d18e23229 100644
--- a/migrations/versions/066_kill_spoolmessage.py
+++ b/migrations/versions/066_kill_spoolmessage.py
@@ -13,14 +13,16 @@
from typing import Never
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
def upgrade() -> None:
- from sqlalchemy.ext.declarative import declarative_base
+ from sqlalchemy.ext.declarative import ( # type: ignore[import-untyped]
+ declarative_base,
+ )
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
from inbox.models.session import session_scope
engine = main_engine(pool_size=1, max_overflow=0)
@@ -67,13 +69,15 @@ def upgrade() -> None:
Base = declarative_base() # noqa: N806
Base.metadata.reflect(engine)
- class Message(Base):
+ class Message(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["message"]
- class SpoolMessage(Base):
+ class SpoolMessage(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["spoolmessage"]
- with session_scope(versioned=False) as db_session:
+ with session_scope( # type: ignore[call-arg]
+ versioned=False
+ ) as db_session:
for sm in db_session.query(SpoolMessage).yield_per(250):
m = db_session.query(Message).get(sm.id)
diff --git a/migrations/versions/067_add_executed_status_to_action_log.py b/migrations/versions/067_add_executed_status_to_action_log.py
index 9b68fa787..740db5348 100644
--- a/migrations/versions/067_add_executed_status_to_action_log.py
+++ b/migrations/versions/067_add_executed_status_to_action_log.py
@@ -11,7 +11,7 @@
revision = "322c2800c401"
down_revision = "4f3a1f6eaee3"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/068_outlook.py b/migrations/versions/068_outlook.py
index 80b23ae07..ba50d1a1e 100644
--- a/migrations/versions/068_outlook.py
+++ b/migrations/versions/068_outlook.py
@@ -11,7 +11,7 @@
revision = "1ceff61ec112"
down_revision = "322c2800c401"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/069_aol.py b/migrations/versions/069_aol.py
index dd7fee88c..55e80d4e7 100644
--- a/migrations/versions/069_aol.py
+++ b/migrations/versions/069_aol.py
@@ -11,7 +11,7 @@
revision = "479b3b84a73e"
down_revision = "1ceff61ec112"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/070_fix_folder_easfoldersyncstatus_unique_constraints.py b/migrations/versions/070_fix_folder_easfoldersyncstatus_unique_constraints.py
index 1cdf795da..800501398 100644
--- a/migrations/versions/070_fix_folder_easfoldersyncstatus_unique_constraints.py
+++ b/migrations/versions/070_fix_folder_easfoldersyncstatus_unique_constraints.py
@@ -13,12 +13,12 @@
from typing import Never
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
def upgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine(pool_size=1, max_overflow=0)
diff --git a/migrations/versions/071_more_sync_states.py b/migrations/versions/071_more_sync_states.py
index bc2ceee4a..fc841383e 100644
--- a/migrations/versions/071_more_sync_states.py
+++ b/migrations/versions/071_more_sync_states.py
@@ -11,7 +11,7 @@
revision = "3bb5d61c895c"
down_revision = "2525c5245cc2"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/072_recompute_snippets.py b/migrations/versions/072_recompute_snippets.py
index f07beabad..4b3203560 100644
--- a/migrations/versions/072_recompute_snippets.py
+++ b/migrations/versions/072_recompute_snippets.py
@@ -11,11 +11,13 @@
revision = "4e93522b5b62"
down_revision = "3bb5d61c895c"
-from sqlalchemy.ext.declarative import declarative_base
+from sqlalchemy.ext.declarative import ( # type: ignore[import-untyped]
+ declarative_base,
+)
# solution from http://stackoverflow.com/a/1217947
-def page_query(q): # noqa: ANN201
+def page_query(q): # type: ignore[no-untyped-def] # noqa: ANN201
CHUNK_SIZE = 1000 # noqa: N806
offset = 0
while True:
@@ -29,7 +31,7 @@ def page_query(q): # noqa: ANN201
def upgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
from inbox.models.session import session_scope
from inbox.util.html import strip_tags
@@ -39,10 +41,12 @@ def upgrade() -> None:
SNIPPET_LENGTH = 191 # noqa: N806
- class Message(Base):
+ class Message(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["message"]
- def calculate_html_snippet(msg, text) -> None:
+ def calculate_html_snippet( # type: ignore[no-untyped-def]
+ msg, text
+ ) -> None:
text = (
text.replace("
", " ")
.replace("
", " ")
@@ -51,10 +55,14 @@ def calculate_html_snippet(msg, text) -> None:
text = strip_tags(text)
calculate_plaintext_snippet(msg, text)
- def calculate_plaintext_snippet(msg, text) -> None:
+ def calculate_plaintext_snippet( # type: ignore[no-untyped-def]
+ msg, text
+ ) -> None:
msg.snippet = " ".join(text.split())[:SNIPPET_LENGTH]
- with session_scope(versioned=False) as db_session:
+ with session_scope( # type: ignore[call-arg]
+ versioned=False
+ ) as db_session:
for message in page_query(db_session.query(Message)):
if not message.decode_error:
calculate_html_snippet(message, message.sanitized_body)
diff --git a/migrations/versions/073_generic_providers.py b/migrations/versions/073_generic_providers.py
index d8f040324..92f60a456 100644
--- a/migrations/versions/073_generic_providers.py
+++ b/migrations/versions/073_generic_providers.py
@@ -15,14 +15,16 @@
from datetime import datetime
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
def upgrade() -> None:
- from sqlalchemy.ext.declarative import declarative_base
+ from sqlalchemy.ext.declarative import ( # type: ignore[import-untyped]
+ declarative_base,
+ )
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
from inbox.models.session import session_scope
engine = main_engine(pool_size=1, max_overflow=0)
@@ -40,25 +42,27 @@ def upgrade() -> None:
Base = declarative_base() # noqa: N806
Base.metadata.reflect(engine)
- class Account(Base):
+ class Account(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["account"]
- class ImapAccount(Base):
+ class ImapAccount(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["imapaccount"]
- class YahooAccount(Base):
+ class YahooAccount(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["yahooaccount"]
- class AOLAccount(Base):
+ class AOLAccount(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["aolaccount"]
- class GenericAccount(Base):
+ class GenericAccount(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["genericaccount"]
- class Secret(Base):
+ class Secret(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["secret"]
- with session_scope(versioned=False) as db_session:
+ with session_scope( # type: ignore[call-arg]
+ versioned=False
+ ) as db_session:
for acct in db_session.query(YahooAccount):
secret = Secret(
acl_id=0,
@@ -102,7 +106,7 @@ class Secret(Base):
def downgrade() -> None:
from sqlalchemy.ext.declarative import declarative_base
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
from inbox.models.session import session_scope
engine = main_engine(pool_size=1, max_overflow=0)
@@ -129,25 +133,27 @@ def downgrade() -> None:
Base = declarative_base() # noqa: N806
Base.metadata.reflect(engine)
- class Account(Base):
+ class Account(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["account"]
- class ImapAccount(Base):
+ class ImapAccount(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["imapaccount"]
- class YahooAccount(Base):
+ class YahooAccount(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["yahooaccount"]
- class AOLAccount(Base):
+ class AOLAccount(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["aolaccount"]
- class GenericAccount(Base):
+ class GenericAccount(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["genericaccount"]
- with session_scope(versioned=False) as db_session:
+ with session_scope( # type: ignore[call-arg]
+ versioned=False
+ ) as db_session:
for acct in db_session.query(GenericAccount):
secret = (
- db_session.query(Secret) # noqa: F821
+ db_session.query(Secret) # type: ignore[name-defined] # noqa: F821
.filter_by(id=acct.password_id)
.one()
)
diff --git a/migrations/versions/074_add_eas_thrid_index.py b/migrations/versions/074_add_eas_thrid_index.py
index 5d4a570b4..caa98cb4c 100644
--- a/migrations/versions/074_add_eas_thrid_index.py
+++ b/migrations/versions/074_add_eas_thrid_index.py
@@ -11,12 +11,12 @@
revision = "3c02d8204335"
down_revision = "43cd2de5ad85"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
def upgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine()
Base = sa.ext.declarative.declarative_base() # noqa: N806
@@ -33,7 +33,7 @@ def upgrade() -> None:
def downgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine()
Base = sa.ext.declarative.declarative_base() # noqa: N806
diff --git a/migrations/versions/076_add_thread_order_column.py b/migrations/versions/076_add_thread_order_column.py
index 9f0a59ed6..35daa0cdf 100644
--- a/migrations/versions/076_add_thread_order_column.py
+++ b/migrations/versions/076_add_thread_order_column.py
@@ -11,7 +11,7 @@
revision = "3de3979f94bd"
down_revision = "1763103db266"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/077_add_supports_condstore_column_to_.py b/migrations/versions/077_add_supports_condstore_column_to_.py
index eae14efd3..1a88a6f23 100644
--- a/migrations/versions/077_add_supports_condstore_column_to_.py
+++ b/migrations/versions/077_add_supports_condstore_column_to_.py
@@ -11,7 +11,7 @@
revision = "3c74cbe7882e"
down_revision = "3de3979f94bd"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/078_events.py b/migrations/versions/078_events.py
index 8de835c92..b9253ea91 100644
--- a/migrations/versions/078_events.py
+++ b/migrations/versions/078_events.py
@@ -11,7 +11,7 @@
revision = "1c2253a0e997"
down_revision = "3c74cbe7882e"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/079_events_longer_uids.py b/migrations/versions/079_events_longer_uids.py
index 70f50f1de..ce74c2bee 100644
--- a/migrations/versions/079_events_longer_uids.py
+++ b/migrations/versions/079_events_longer_uids.py
@@ -11,13 +11,15 @@
revision = "5901bf556d83"
down_revision = "1c2253a0e997"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
-from sqlalchemy.ext.declarative import declarative_base
+from sqlalchemy.ext.declarative import ( # type: ignore[import-untyped]
+ declarative_base,
+)
def upgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine(pool_size=1, max_overflow=0)
Base = declarative_base() # noqa: N806
diff --git a/migrations/versions/080_longer_event_summaries.py b/migrations/versions/080_longer_event_summaries.py
index 4608f0832..1d6c0c77c 100644
--- a/migrations/versions/080_longer_event_summaries.py
+++ b/migrations/versions/080_longer_event_summaries.py
@@ -11,7 +11,7 @@
revision = "4e3e8abea884"
down_revision = "5901bf556d83"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/081_move_imapfolder_highestmodseq_to_bigint.py b/migrations/versions/081_move_imapfolder_highestmodseq_to_bigint.py
index 9a3fe623d..555405b0d 100644
--- a/migrations/versions/081_move_imapfolder_highestmodseq_to_bigint.py
+++ b/migrations/versions/081_move_imapfolder_highestmodseq_to_bigint.py
@@ -11,7 +11,7 @@
revision = "1bc2536b8bc6"
down_revision = "4e3e8abea884"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/082_event_participants.py b/migrations/versions/082_event_participants.py
index fdf5fbf05..88bbc22f9 100644
--- a/migrations/versions/082_event_participants.py
+++ b/migrations/versions/082_event_participants.py
@@ -11,7 +11,7 @@
revision = "1322d3787305"
down_revision = "1bc2536b8bc6"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/083_calendars_event_owners.py b/migrations/versions/083_calendars_event_owners.py
index 144247225..1ef24e9ef 100644
--- a/migrations/versions/083_calendars_event_owners.py
+++ b/migrations/versions/083_calendars_event_owners.py
@@ -11,9 +11,9 @@
revision = "10a1129fe685"
down_revision = "1322d3787305"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
-from sqlalchemy.sql import table
+from sqlalchemy.sql import table # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/084_mutable_drafts.py b/migrations/versions/084_mutable_drafts.py
index 431877363..25b50a0b7 100644
--- a/migrations/versions/084_mutable_drafts.py
+++ b/migrations/versions/084_mutable_drafts.py
@@ -13,9 +13,9 @@
from typing import Never
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
-from sqlalchemy.sql import text
+from sqlalchemy.sql import text # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/085_add_attachment_tag.py b/migrations/versions/085_add_attachment_tag.py
index e749431a2..0381f6d11 100644
--- a/migrations/versions/085_add_attachment_tag.py
+++ b/migrations/versions/085_add_attachment_tag.py
@@ -12,14 +12,14 @@
down_revision = "10db12da2005"
from alembic import op
-from sqlalchemy.sql import text
+from sqlalchemy.sql import text # type: ignore[import-untyped]
def upgrade() -> None:
from inbox.models import Namespace
from inbox.models.session import session_scope
- with session_scope() as db_session:
+ with session_scope() as db_session: # type: ignore[call-arg]
# Create the attachment tag
print("creating canonical tags...")
for ns in db_session.query(Namespace):
diff --git a/migrations/versions/086_event_date_times.py b/migrations/versions/086_event_date_times.py
index 5025081b9..da4fc2bf6 100644
--- a/migrations/versions/086_event_date_times.py
+++ b/migrations/versions/086_event_date_times.py
@@ -11,13 +11,15 @@
revision = "1ac03cab7a24"
down_revision = "294200d809c8"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
-from sqlalchemy.ext.declarative import declarative_base
+from sqlalchemy.ext.declarative import ( # type: ignore[import-untyped]
+ declarative_base,
+)
def upgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine(pool_size=1, max_overflow=0)
Base = declarative_base() # noqa: N806
diff --git a/migrations/versions/087_fix_account_foreign_keys.py b/migrations/versions/087_fix_account_foreign_keys.py
index 6e17649fb..b2d45f524 100644
--- a/migrations/versions/087_fix_account_foreign_keys.py
+++ b/migrations/versions/087_fix_account_foreign_keys.py
@@ -13,12 +13,12 @@
from typing import Never
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
def upgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine(pool_size=1, max_overflow=0)
inspector = sa.inspect(engine)
diff --git a/migrations/versions/088_calendar_descriptions.py b/migrations/versions/088_calendar_descriptions.py
index f4bf4370d..f7dd0337c 100644
--- a/migrations/versions/088_calendar_descriptions.py
+++ b/migrations/versions/088_calendar_descriptions.py
@@ -11,14 +11,16 @@
revision = "24e9afe91349"
down_revision = "565c7325c51d"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
def upgrade() -> None:
- from sqlalchemy.ext.declarative import declarative_base
+ from sqlalchemy.ext.declarative import ( # type: ignore[import-untyped]
+ declarative_base,
+ )
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
from inbox.models.session import session_scope
engine = main_engine(pool_size=1, max_overflow=0)
@@ -63,13 +65,15 @@ def upgrade() -> None:
Base = declarative_base() # noqa: N806
Base.metadata.reflect(engine)
- class Calendar(Base):
+ class Calendar(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["calendar"]
- class Event(Base):
+ class Event(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["event"]
- with session_scope(versioned=False) as db_session:
+ with session_scope( # type: ignore[call-arg]
+ versioned=False
+ ) as db_session:
for calendar in db_session.query(Calendar):
if calendar.name and "-" in calendar.name:
provider_name, name = calendar.name.split("-")
diff --git a/migrations/versions/089_revert_encryption.py b/migrations/versions/089_revert_encryption.py
index 30663a982..3630cd587 100644
--- a/migrations/versions/089_revert_encryption.py
+++ b/migrations/versions/089_revert_encryption.py
@@ -12,7 +12,7 @@
down_revision = "24e9afe91349"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
@@ -39,7 +39,7 @@ def upgrade() -> None:
import nacl.utils
from inbox.config import config
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
from inbox.models.session import session_scope
engine = main_engine(pool_size=1, max_overflow=0)
@@ -48,10 +48,12 @@ def upgrade() -> None:
key = config.get_required("SECRET_ENCRYPTION_KEY")
- class Secret(Base):
+ class Secret(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["secret"]
- with session_scope(versioned=False) as db_session:
+ with session_scope( # type: ignore[call-arg]
+ versioned=False
+ ) as db_session:
secrets = (
db_session.query(Secret)
.filter(Secret.encryption_scheme == 1, Secret._secret.isnot(None))
diff --git a/migrations/versions/090_parts_block_ids.py b/migrations/versions/090_parts_block_ids.py
index 17376bf01..f12f1fab5 100644
--- a/migrations/versions/090_parts_block_ids.py
+++ b/migrations/versions/090_parts_block_ids.py
@@ -13,9 +13,9 @@
from datetime import datetime
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
-from sqlalchemy.sql import text
+from sqlalchemy.sql import text # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/091_remove_webhooks.py b/migrations/versions/091_remove_webhooks.py
index b4d86698d..589b9a569 100644
--- a/migrations/versions/091_remove_webhooks.py
+++ b/migrations/versions/091_remove_webhooks.py
@@ -11,9 +11,9 @@
revision = "4b07b67498e1"
down_revision = "2b89164aa9cd"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
-from sqlalchemy.dialects import mysql
+from sqlalchemy.dialects import mysql # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/092_fix_outlookaccount_typo.py b/migrations/versions/092_fix_outlookaccount_typo.py
index 5ce2869da..51f1cda00 100644
--- a/migrations/versions/092_fix_outlookaccount_typo.py
+++ b/migrations/versions/092_fix_outlookaccount_typo.py
@@ -12,7 +12,7 @@
down_revision = "4b07b67498e1"
from alembic import op
-from sqlalchemy.sql import text
+from sqlalchemy.sql import text # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/093_add_folder_identifier.py b/migrations/versions/093_add_folder_identifier.py
index c51f3eb63..902517372 100644
--- a/migrations/versions/093_add_folder_identifier.py
+++ b/migrations/versions/093_add_folder_identifier.py
@@ -14,7 +14,7 @@
from typing import Never
from alembic import op
-from sqlalchemy.sql import text
+from sqlalchemy.sql import text # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/094_eas_passwords.py b/migrations/versions/094_eas_passwords.py
index 0153aab3c..3b6d1e064 100644
--- a/migrations/versions/094_eas_passwords.py
+++ b/migrations/versions/094_eas_passwords.py
@@ -13,12 +13,12 @@
from datetime import datetime
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
def upgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine(pool_size=1, max_overflow=0)
# Do nothing if the affected table isn't present.
@@ -35,16 +35,18 @@ def upgrade() -> None:
Base.metadata.reflect(engine)
from inbox.models.session import session_scope
- class EASAccount(Base):
+ class EASAccount(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["easaccount"]
secret = sa.orm.relationship(
"Secret", primaryjoin="EASAccount.password_id == Secret.id"
)
- class Secret(Base):
+ class Secret(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["secret"]
- with session_scope(versioned=False) as db_session:
+ with session_scope( # type: ignore[call-arg]
+ versioned=False
+ ) as db_session:
accounts = db_session.query(EASAccount).all()
print("# EAS accounts: ", len(accounts))
@@ -67,7 +69,7 @@ class Secret(Base):
def downgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine(pool_size=1, max_overflow=0)
if not engine.has_table("easaccount"):
diff --git a/migrations/versions/095_secret_storage.py b/migrations/versions/095_secret_storage.py
index 20b5c4062..3808beee9 100644
--- a/migrations/versions/095_secret_storage.py
+++ b/migrations/versions/095_secret_storage.py
@@ -13,7 +13,7 @@
from typing import Never
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/096_migrate_secret_data.py b/migrations/versions/096_migrate_secret_data.py
index 50905f255..90f1e4083 100644
--- a/migrations/versions/096_migrate_secret_data.py
+++ b/migrations/versions/096_migrate_secret_data.py
@@ -11,7 +11,7 @@
revision = "38c29430efeb"
down_revision = "1683790906cf"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
def upgrade() -> None:
@@ -19,20 +19,22 @@ def upgrade() -> None:
import nacl.utils
from inbox.config import config
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
from inbox.models.session import session_scope
engine = main_engine(pool_size=1, max_overflow=0)
Base = sa.ext.declarative.declarative_base() # noqa: N806
Base.metadata.reflect(engine)
- class Secret(Base):
+ class Secret(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["secret"]
- class GenericAccount(Base):
+ class GenericAccount(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["genericaccount"]
- with session_scope(versioned=False) as db_session:
+ with session_scope( # type: ignore[call-arg]
+ versioned=False
+ ) as db_session:
secrets = (
db_session.query(Secret).filter(Secret.secret.isnot(None)).all()
)
@@ -47,7 +49,7 @@ class GenericAccount(Base):
password_secrets = [id_ for id_, in generic_query]
if engine.has_table("easaccount"):
- class EASAccount(Base):
+ class EASAccount(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["easaccount"]
eas_query = (
@@ -60,7 +62,7 @@ class EASAccount(Base):
for s in secrets:
plain = (
s.secret.encode("utf-8")
- if isinstance(s.secret, unicode) # noqa: F821
+ if isinstance(s.secret, unicode) # type: ignore[name-defined] # noqa: F821
else s.secret
)
if config.get_required("ENCRYPT_SECRETS"):
diff --git a/migrations/versions/097_secrets_endgame.py b/migrations/versions/097_secrets_endgame.py
index 749a2d799..5f628a9ec 100644
--- a/migrations/versions/097_secrets_endgame.py
+++ b/migrations/versions/097_secrets_endgame.py
@@ -17,7 +17,7 @@
def upgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine()
if engine.has_table("easaccount"):
diff --git a/migrations/versions/098_add_throttling_support.py b/migrations/versions/098_add_throttling_support.py
index ad19eb76c..49f788523 100644
--- a/migrations/versions/098_add_throttling_support.py
+++ b/migrations/versions/098_add_throttling_support.py
@@ -11,7 +11,7 @@
revision = "40b533a6f3e1"
down_revision = "248ec24a39f"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/099_add_namespace_id_to_message.py b/migrations/versions/099_add_namespace_id_to_message.py
index 60e35860b..f114abc31 100644
--- a/migrations/versions/099_add_namespace_id_to_message.py
+++ b/migrations/versions/099_add_namespace_id_to_message.py
@@ -12,7 +12,7 @@
down_revision = "40b533a6f3e1"
from alembic import op
-from sqlalchemy.sql import text
+from sqlalchemy.sql import text # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/100_make_message_namespace_id_nonnull.py b/migrations/versions/100_make_message_namespace_id_nonnull.py
index ef8a29237..40cab257d 100644
--- a/migrations/versions/100_make_message_namespace_id_nonnull.py
+++ b/migrations/versions/100_make_message_namespace_id_nonnull.py
@@ -11,7 +11,7 @@
revision = "5a68ac0e3e9"
down_revision = "e27104acb25"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/101_add_namespace_to_contacts.py b/migrations/versions/101_add_namespace_to_contacts.py
index 28c95c1f1..b741d387a 100644
--- a/migrations/versions/101_add_namespace_to_contacts.py
+++ b/migrations/versions/101_add_namespace_to_contacts.py
@@ -14,7 +14,7 @@
from typing import Never
from alembic import op
-from sqlalchemy.sql import text
+from sqlalchemy.sql import text # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/102_add_namespace_to_events.py b/migrations/versions/102_add_namespace_to_events.py
index 7d274cd48..0b0486b5c 100644
--- a/migrations/versions/102_add_namespace_to_events.py
+++ b/migrations/versions/102_add_namespace_to_events.py
@@ -14,7 +14,7 @@
from typing import Never
from alembic import op
-from sqlalchemy.sql import text
+from sqlalchemy.sql import text # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/103_add_namespace_to_calendars.py b/migrations/versions/103_add_namespace_to_calendars.py
index a21412edf..30b79d6e6 100644
--- a/migrations/versions/103_add_namespace_to_calendars.py
+++ b/migrations/versions/103_add_namespace_to_calendars.py
@@ -13,9 +13,9 @@
from typing import Never
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
-from sqlalchemy.sql import text
+from sqlalchemy.sql import text # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/107_drop_eas_state.py b/migrations/versions/107_drop_eas_state.py
index c74f59c6a..9a4531d80 100644
--- a/migrations/versions/107_drop_eas_state.py
+++ b/migrations/versions/107_drop_eas_state.py
@@ -13,12 +13,12 @@
from typing import Never
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
def upgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine()
Base = sa.ext.declarative.declarative_base() # noqa: N806
diff --git a/migrations/versions/108_easaccount_username.py b/migrations/versions/108_easaccount_username.py
index 8b6b43c6a..7105a1b80 100644
--- a/migrations/versions/108_easaccount_username.py
+++ b/migrations/versions/108_easaccount_username.py
@@ -11,12 +11,12 @@
revision = "2f97277cd86d"
down_revision = "3cea90bfcdea"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
def upgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine()
@@ -40,10 +40,12 @@ def upgrade() -> None:
Base.metadata.reflect(engine)
from inbox.models.session import session_scope
- class EASAccount(Base):
+ class EASAccount(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["easaccount"]
- with session_scope(versioned=False) as db_session:
+ with session_scope( # type: ignore[call-arg]
+ versioned=False
+ ) as db_session:
accts = db_session.query(EASAccount).all()
for a in accts:
@@ -61,7 +63,7 @@ class EASAccount(Base):
def downgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine()
diff --git a/migrations/versions/109_add_retries_column_to_the_actionlog.py b/migrations/versions/109_add_retries_column_to_the_actionlog.py
index 6b8071d4f..63ca0bb3d 100644
--- a/migrations/versions/109_add_retries_column_to_the_actionlog.py
+++ b/migrations/versions/109_add_retries_column_to_the_actionlog.py
@@ -13,9 +13,9 @@
from typing import Never
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
-from sqlalchemy.sql import text
+from sqlalchemy.sql import text # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/111_add_account_name_column.py b/migrations/versions/111_add_account_name_column.py
index f426f882c..de6798b86 100644
--- a/migrations/versions/111_add_account_name_column.py
+++ b/migrations/versions/111_add_account_name_column.py
@@ -13,7 +13,7 @@
from typing import Never
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/113_add_custom_imap_overrides.py b/migrations/versions/113_add_custom_imap_overrides.py
index 4c159ec6c..ec8ecc62f 100644
--- a/migrations/versions/113_add_custom_imap_overrides.py
+++ b/migrations/versions/113_add_custom_imap_overrides.py
@@ -11,7 +11,7 @@
revision = "26bfb2e45c47"
down_revision = "26911668870a"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/114_eas_twodevices_pledge.py b/migrations/versions/114_eas_twodevices_pledge.py
index f2728af74..81161ae6e 100644
--- a/migrations/versions/114_eas_twodevices_pledge.py
+++ b/migrations/versions/114_eas_twodevices_pledge.py
@@ -13,12 +13,12 @@
from typing import Never
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
def upgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine()
diff --git a/migrations/versions/115_eas_twodevices_turn.py b/migrations/versions/115_eas_twodevices_turn.py
index 9d6571ef7..c1f710511 100644
--- a/migrations/versions/115_eas_twodevices_turn.py
+++ b/migrations/versions/115_eas_twodevices_turn.py
@@ -14,13 +14,13 @@
from datetime import datetime
from typing import Never
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
-from sqlalchemy.sql import text
+from sqlalchemy.sql import text # type: ignore[import-untyped]
def upgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine()
@@ -32,7 +32,7 @@ def upgrade() -> None:
Base = sa.ext.declarative.declarative_base() # noqa: N806
Base.metadata.reflect(engine)
- class EASAccount(Base):
+ class EASAccount(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["easaccount"]
primary_device = sa.orm.relationship(
"EASDevice",
@@ -47,10 +47,12 @@ class EASAccount(Base):
uselist=False,
)
- class EASDevice(Base):
+ class EASDevice(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["easdevice"]
- with session_scope(versioned=False) as db_session:
+ with session_scope( # type: ignore[call-arg]
+ versioned=False
+ ) as db_session:
accts = db_session.query(EASAccount).all()
for a in accts:
diff --git a/migrations/versions/116_eas_twodevices_prestige.py b/migrations/versions/116_eas_twodevices_prestige.py
index b834263f7..e16a08954 100644
--- a/migrations/versions/116_eas_twodevices_prestige.py
+++ b/migrations/versions/116_eas_twodevices_prestige.py
@@ -13,7 +13,7 @@
from typing import Never
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/118_store_label_information_per_uid.py b/migrations/versions/118_store_label_information_per_uid.py
index 022fe7793..827eaf643 100644
--- a/migrations/versions/118_store_label_information_per_uid.py
+++ b/migrations/versions/118_store_label_information_per_uid.py
@@ -11,9 +11,9 @@
revision = "4634999269"
down_revision = "420bf3422c4f"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
-from sqlalchemy.sql import text
+from sqlalchemy.sql import text # type: ignore[import-untyped]
from inbox.sqlalchemy_ext.util import JSON
diff --git a/migrations/versions/119_store_full_message_body.py b/migrations/versions/119_store_full_message_body.py
index b08809e35..99097b3d1 100644
--- a/migrations/versions/119_store_full_message_body.py
+++ b/migrations/versions/119_store_full_message_body.py
@@ -11,7 +11,7 @@
revision = "58732bb5d14b"
down_revision = "4634999269"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/120_simplify_transaction_log.py b/migrations/versions/120_simplify_transaction_log.py
index cadb4416b..cac6d6d09 100644
--- a/migrations/versions/120_simplify_transaction_log.py
+++ b/migrations/versions/120_simplify_transaction_log.py
@@ -14,7 +14,7 @@
from typing import Never
from alembic import op
-from sqlalchemy.sql import text
+from sqlalchemy.sql import text # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/121_add_searchindexcursor.py b/migrations/versions/121_add_searchindexcursor.py
index 68b77c8c8..7366b62a2 100644
--- a/migrations/versions/121_add_searchindexcursor.py
+++ b/migrations/versions/121_add_searchindexcursor.py
@@ -11,7 +11,7 @@
revision = "526eefc1d600"
down_revision = "8c2406df6f8"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/122_add_easeventuid.py b/migrations/versions/122_add_easeventuid.py
index f68733f6c..d7af0daca 100644
--- a/migrations/versions/122_add_easeventuid.py
+++ b/migrations/versions/122_add_easeventuid.py
@@ -11,12 +11,12 @@
revision = "476c5185121b"
down_revision = "526eefc1d600"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
def upgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine()
diff --git a/migrations/versions/123_remove_gmail_inbox_syncs.py b/migrations/versions/123_remove_gmail_inbox_syncs.py
index 964b6df30..93bb797d9 100644
--- a/migrations/versions/123_remove_gmail_inbox_syncs.py
+++ b/migrations/versions/123_remove_gmail_inbox_syncs.py
@@ -16,13 +16,17 @@ def upgrade() -> None:
# Remove UIDs and sync status for inbox IMAP syncs -- otherwise
# archives/deletes may not be synced correctly.
from inbox.heartbeat.config import STATUS_DATABASE, get_redis_client
- from inbox.heartbeat.status import HeartbeatStatusKey
+ from inbox.heartbeat.status import ( # type: ignore[attr-defined]
+ HeartbeatStatusKey,
+ )
from inbox.models.backends.gmail import GmailAccount
from inbox.models.backends.imap import ImapFolderSyncStatus, ImapUid
from inbox.models.session import session_scope
redis_client = get_redis_client(STATUS_DATABASE)
- with session_scope(versioned=False) as db_session:
+ with session_scope( # type: ignore[call-arg]
+ versioned=False
+ ) as db_session:
for account in db_session.query(GmailAccount):
if account.inbox_folder is None:
# May be the case for accounts that we can't sync, e.g. due to
diff --git a/migrations/versions/125_refactor_participants_table.py b/migrations/versions/125_refactor_participants_table.py
index a7c7d79e5..10cb21cf3 100644
--- a/migrations/versions/125_refactor_participants_table.py
+++ b/migrations/versions/125_refactor_participants_table.py
@@ -13,9 +13,9 @@
from typing import Never
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
-from sqlalchemy.sql import text
+from sqlalchemy.sql import text # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/126_add_account_sync_contacts_events.py b/migrations/versions/126_add_account_sync_contacts_events.py
index d9410a069..9b05d7b7c 100644
--- a/migrations/versions/126_add_account_sync_contacts_events.py
+++ b/migrations/versions/126_add_account_sync_contacts_events.py
@@ -12,7 +12,7 @@
down_revision = "955792afd00"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/127_remove_easeventuid.py b/migrations/versions/127_remove_easeventuid.py
index b3a45242f..bc80b4fdd 100644
--- a/migrations/versions/127_remove_easeventuid.py
+++ b/migrations/versions/127_remove_easeventuid.py
@@ -17,7 +17,7 @@
def upgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine()
diff --git a/migrations/versions/137_add_versions.py b/migrations/versions/137_add_versions.py
index 4440e3ed7..9ec2931e2 100644
--- a/migrations/versions/137_add_versions.py
+++ b/migrations/versions/137_add_versions.py
@@ -11,7 +11,7 @@
revision = "1f746c93e8fd"
down_revision = "39fa82d3168e"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/138_add_participants_column.py b/migrations/versions/138_add_participants_column.py
index 49b302dff..5011cd745 100644
--- a/migrations/versions/138_add_participants_column.py
+++ b/migrations/versions/138_add_participants_column.py
@@ -8,7 +8,7 @@
"""
from alembic import op
-from sqlalchemy.sql import text
+from sqlalchemy.sql import text # type: ignore[import-untyped]
# revision identifiers, used by Alembic.
revision = "5305d4ae30b4"
diff --git a/migrations/versions/140_relax_participants_by_email_constraint.py b/migrations/versions/140_relax_participants_by_email_constraint.py
index 6004d4806..e03600cdb 100644
--- a/migrations/versions/140_relax_participants_by_email_constraint.py
+++ b/migrations/versions/140_relax_participants_by_email_constraint.py
@@ -12,7 +12,7 @@
down_revision = "1fd7b3e0b662"
from alembic import op
-from sqlalchemy.sql import text
+from sqlalchemy.sql import text # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/141_remote_remote_contacts.py b/migrations/versions/141_remote_remote_contacts.py
index 05cb23b21..a1d2d4267 100644
--- a/migrations/versions/141_remote_remote_contacts.py
+++ b/migrations/versions/141_remote_remote_contacts.py
@@ -14,23 +14,25 @@
from typing import Never
from alembic import op
-from sqlalchemy.ext.declarative import declarative_base
+from sqlalchemy.ext.declarative import ( # type: ignore[import-untyped]
+ declarative_base,
+)
def upgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
from inbox.models.session import session_scope
engine = main_engine(pool_size=1, max_overflow=0)
Base = declarative_base() # noqa: N806
Base.metadata.reflect(engine)
- class Contact_Old(Base): # noqa: N801
+ class Contact_Old(Base): # type: ignore[misc, valid-type] # noqa: N801
__table__ = Base.metadata.tables["contact"]
# Delete the "remote" contacts. This is just a server cache for comparing
# any changes, now handled by the previous "local" contacts
- with session_scope() as db_session:
+ with session_scope() as db_session: # type: ignore[call-arg]
db_session.query(Contact_Old).filter_by(source="remote").delete()
op.drop_column("contact", "source")
diff --git a/migrations/versions/142_add_sync_run_bit.py b/migrations/versions/142_add_sync_run_bit.py
index 4b3562576..3ed147b62 100644
--- a/migrations/versions/142_add_sync_run_bit.py
+++ b/migrations/versions/142_add_sync_run_bit.py
@@ -11,7 +11,7 @@
revision = "2d8a350b4885"
down_revision = "3ab34bc85c8d"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/147_add_cleaned_subject.py b/migrations/versions/147_add_cleaned_subject.py
index 0d3420127..dd9137a63 100644
--- a/migrations/versions/147_add_cleaned_subject.py
+++ b/migrations/versions/147_add_cleaned_subject.py
@@ -11,9 +11,9 @@
revision = "486c7fa5b533"
down_revision = "c77a90d524"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
-from sqlalchemy.sql import text
+from sqlalchemy.sql import text # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/148_add_last_modified_column_for_events.py b/migrations/versions/148_add_last_modified_column_for_events.py
index 3f7e6914b..f740157c3 100644
--- a/migrations/versions/148_add_last_modified_column_for_events.py
+++ b/migrations/versions/148_add_last_modified_column_for_events.py
@@ -12,7 +12,7 @@
down_revision = "486c7fa5b533"
from alembic import op
-from sqlalchemy.sql import text
+from sqlalchemy.sql import text # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/149_add_emailed_events_calendar.py b/migrations/versions/149_add_emailed_events_calendar.py
index fd0a8ca27..ccbe13353 100644
--- a/migrations/versions/149_add_emailed_events_calendar.py
+++ b/migrations/versions/149_add_emailed_events_calendar.py
@@ -12,7 +12,7 @@
down_revision = "54dcea22a268"
from alembic import op
-from sqlalchemy.sql import text
+from sqlalchemy.sql import text # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/150_add_polymorphic_events.py b/migrations/versions/150_add_polymorphic_events.py
index 34025846a..f1c82ef3b 100644
--- a/migrations/versions/150_add_polymorphic_events.py
+++ b/migrations/versions/150_add_polymorphic_events.py
@@ -15,7 +15,7 @@
import json
import sys
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
@@ -75,7 +75,7 @@ def populate() -> None:
)
from inbox.models.session import session_scope
- with session_scope() as db:
+ with session_scope() as db: # type: ignore[call-arg]
# Redo recurrence rule population, since we extended the column length
print("Repopulating max-length recurrences...", end=" ")
for e in db.query(Event).filter(
@@ -113,29 +113,35 @@ def populate() -> None:
c = 0
print("Expanding Overrides .", end=" ")
query = db.query(RecurringEventOverride)
- for e in query:
+ for e in query: # type: ignore[misc]
try:
# Some raw data is str(dict), other is json.dumps
- raw_data = json.loads(e.raw_data)
+ raw_data = json.loads(e.raw_data) # type: ignore[misc]
except: # noqa: E722
try:
- raw_data = ast.literal_eval(e.raw_data)
+ raw_data = ast.literal_eval(
+ e.raw_data # type: ignore[misc]
+ )
except: # noqa: E722
- print(f"Could not load raw data for event {e.id}")
+ print(
+ f"Could not load raw data for event {e.id}" # type: ignore[misc]
+ )
continue
rec_uid = raw_data.get("recurringEventId")
if rec_uid:
- e.master_event_uid = rec_uid
+ e.master_event_uid = rec_uid # type: ignore[misc]
ost = raw_data.get("originalStartTime")
if ost:
# this is a dictionary with one value
start_time = ost.values().pop()
- e.original_start_time = parse_datetime(start_time)
+ e.original_start_time = parse_datetime( # type: ignore[misc]
+ start_time
+ )
# attempt to get the ID for the event, if we can, and
# set the relationship appropriately
if raw_data.get("status") == "cancelled":
- e.cancelled = True
- link_events(db, e)
+ e.cancelled = True # type: ignore[misc]
+ link_events(db, e) # type: ignore[misc]
c += 1
if c % 100 == 0:
print(".", end=" ")
@@ -156,7 +162,9 @@ def populate() -> None:
try:
db.execute(create)
except Exception as e:
- print(f"Couldn't insert RecurringEvents: {e}")
+ print(
+ f"Couldn't insert RecurringEvents: {e}" # type: ignore[misc]
+ )
sys.exit(2)
print("done.")
diff --git a/migrations/versions/151_remove_message_thread_order.py b/migrations/versions/151_remove_message_thread_order.py
index c571b4e4c..2fc0e9dd3 100644
--- a/migrations/versions/151_remove_message_thread_order.py
+++ b/migrations/versions/151_remove_message_thread_order.py
@@ -11,9 +11,9 @@
revision = "2f3c8fa3fc3a"
down_revision = "1de526a15c5d"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
-from sqlalchemy.dialects import mysql
+from sqlalchemy.dialects import mysql # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/152_add_message_id_to_event.py b/migrations/versions/152_add_message_id_to_event.py
index f6089aefe..83d20165f 100644
--- a/migrations/versions/152_add_message_id_to_event.py
+++ b/migrations/versions/152_add_message_id_to_event.py
@@ -12,7 +12,7 @@
down_revision = "2f3c8fa3fc3a"
from alembic import op
-from sqlalchemy.sql import text
+from sqlalchemy.sql import text # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/155_add_status_column.py b/migrations/versions/155_add_status_column.py
index ad7b0e51d..ff8802bca 100644
--- a/migrations/versions/155_add_status_column.py
+++ b/migrations/versions/155_add_status_column.py
@@ -12,7 +12,7 @@
down_revision = "1f06c15ae796"
from alembic import op
-from sqlalchemy.sql import text
+from sqlalchemy.sql import text # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/156_drop_cancelled_column.py b/migrations/versions/156_drop_cancelled_column.py
index 1e0a3c76d..2ddd773e9 100644
--- a/migrations/versions/156_drop_cancelled_column.py
+++ b/migrations/versions/156_drop_cancelled_column.py
@@ -12,7 +12,7 @@
down_revision = "7de8a6ce8cd"
from alembic import op
-from sqlalchemy.sql import text
+from sqlalchemy.sql import text # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/157_update_eas_schema.py b/migrations/versions/157_update_eas_schema.py
index 9c82cadcd..0926733af 100644
--- a/migrations/versions/157_update_eas_schema.py
+++ b/migrations/versions/157_update_eas_schema.py
@@ -17,7 +17,7 @@
def upgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine(pool_size=1, max_overflow=0)
# Do nothing if the affected table isn't present.
diff --git a/migrations/versions/158_update_eas_schema_part_2.py b/migrations/versions/158_update_eas_schema_part_2.py
index 590d13994..27ae9328a 100644
--- a/migrations/versions/158_update_eas_schema_part_2.py
+++ b/migrations/versions/158_update_eas_schema_part_2.py
@@ -17,7 +17,7 @@
def upgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine(pool_size=1, max_overflow=0)
# Do nothing if the affected table isn't present.
diff --git a/migrations/versions/159_update_eas_schema_part_3.py b/migrations/versions/159_update_eas_schema_part_3.py
index 31cc9003b..2bb6f591b 100644
--- a/migrations/versions/159_update_eas_schema_part_3.py
+++ b/migrations/versions/159_update_eas_schema_part_3.py
@@ -17,7 +17,7 @@
def upgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine(pool_size=1, max_overflow=0)
# Do nothing if the affected table isn't present.
diff --git a/migrations/versions/160_split_actionlog.py b/migrations/versions/160_split_actionlog.py
index 242cce90d..91864837e 100644
--- a/migrations/versions/160_split_actionlog.py
+++ b/migrations/versions/160_split_actionlog.py
@@ -11,13 +11,13 @@
revision = "182f2b40fa36"
down_revision = "4e6eedda36af"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
-from sqlalchemy.orm import contains_eager
+from sqlalchemy.orm import contains_eager # type: ignore[import-untyped]
def upgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
op.add_column("actionlog", sa.Column("type", sa.String(16)))
@@ -25,7 +25,7 @@ def upgrade() -> None:
from inbox.models import Account, ActionLog, Namespace
from inbox.models.session import session_scope
- with session_scope() as db_session:
+ with session_scope() as db_session: # type: ignore[call-arg]
q = (
db_session.query(ActionLog)
.join(Namespace)
@@ -68,7 +68,7 @@ def upgrade() -> None:
def downgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
op.drop_column("actionlog", "type")
diff --git a/migrations/versions/161_update_eas_schema_part_3_for_prod.py b/migrations/versions/161_update_eas_schema_part_3_for_prod.py
index 7b76f09fb..59f731f1d 100644
--- a/migrations/versions/161_update_eas_schema_part_3_for_prod.py
+++ b/migrations/versions/161_update_eas_schema_part_3_for_prod.py
@@ -12,11 +12,11 @@
down_revision = "182f2b40fa36"
from alembic import op
-from sqlalchemy.schema import MetaData
+from sqlalchemy.schema import MetaData # type: ignore[import-untyped]
def upgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine(pool_size=1, max_overflow=0)
diff --git a/migrations/versions/165_add_compacted_body.py b/migrations/versions/165_add_compacted_body.py
index 866258c3a..dd35f4d78 100644
--- a/migrations/versions/165_add_compacted_body.py
+++ b/migrations/versions/165_add_compacted_body.py
@@ -11,9 +11,9 @@
revision = "29698176aa8d"
down_revision = "17dcbd7754e0"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
-from sqlalchemy.dialects import mysql
+from sqlalchemy.dialects import mysql # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/166_migrate_body_format.py b/migrations/versions/166_migrate_body_format.py
index 2e19d050b..a368d5ee5 100644
--- a/migrations/versions/166_migrate_body_format.py
+++ b/migrations/versions/166_migrate_body_format.py
@@ -11,15 +11,17 @@
revision = "3d4f5741e1d7"
down_revision = "29698176aa8d"
-import sqlalchemy as sa
-from sqlalchemy.ext.declarative import declarative_base
-from sqlalchemy.orm import load_only
+import sqlalchemy as sa # type: ignore[import-untyped]
+from sqlalchemy.ext.declarative import ( # type: ignore[import-untyped]
+ declarative_base,
+)
+from sqlalchemy.orm import load_only # type: ignore[import-untyped]
CHUNK_SIZE = 1000
def upgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
from inbox.models.session import session_scope
from inbox.security.blobstorage import encode_blob
@@ -27,10 +29,12 @@ def upgrade() -> None:
Base = declarative_base() # noqa: N806
Base.metadata.reflect(engine)
- class Message(Base):
+ class Message(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["message"]
- with session_scope(versioned=False) as db_session:
+ with session_scope( # type: ignore[call-arg]
+ versioned=False
+ ) as db_session:
(max_id,) = db_session.query(sa.func.max(Message.id)).one()
if max_id is None:
max_id = 0
diff --git a/migrations/versions/169_update_easuid_schema.py b/migrations/versions/169_update_easuid_schema.py
index 7d9a50de9..6f0cd4da9 100644
--- a/migrations/versions/169_update_easuid_schema.py
+++ b/migrations/versions/169_update_easuid_schema.py
@@ -15,7 +15,7 @@
def upgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine(pool_size=1, max_overflow=0)
if not engine.has_table("easuid"):
diff --git a/migrations/versions/170_update_easuid_schema_2.py b/migrations/versions/170_update_easuid_schema_2.py
index 53f3589fa..f14b17ec4 100644
--- a/migrations/versions/170_update_easuid_schema_2.py
+++ b/migrations/versions/170_update_easuid_schema_2.py
@@ -11,13 +11,15 @@
revision = "3ee78a8b1ac6"
down_revision = "281b07fa75bb"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
def upgrade() -> None:
- from sqlalchemy.ext.declarative import declarative_base
+ from sqlalchemy.ext.declarative import ( # type: ignore[import-untyped]
+ declarative_base,
+ )
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
from inbox.models.session import session_scope
engine = main_engine(pool_size=1, max_overflow=0)
@@ -26,13 +28,15 @@ def upgrade() -> None:
Base = declarative_base() # noqa: N806
Base.metadata.reflect(engine)
- class EASUid(Base):
+ class EASUid(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["easuid"]
- class EASFolderSyncStatus(Base):
+ class EASFolderSyncStatus(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["easfoldersyncstatus"]
- with session_scope(versioned=False) as db_session:
+ with session_scope( # type: ignore[call-arg]
+ versioned=False
+ ) as db_session:
max_easuid = db_session.query(sa.func.max(EASUid.id)).scalar()
if max_easuid is None:
return
diff --git a/migrations/versions/171_update_easuid_schema_3.py b/migrations/versions/171_update_easuid_schema_3.py
index abbbd0b23..43aadd4f4 100644
--- a/migrations/versions/171_update_easuid_schema_3.py
+++ b/migrations/versions/171_update_easuid_schema_3.py
@@ -11,13 +11,15 @@
revision = "584356bf23a3"
down_revision = "3ee78a8b1ac6"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
def upgrade() -> None:
- from sqlalchemy.ext.declarative import declarative_base
+ from sqlalchemy.ext.declarative import ( # type: ignore[import-untyped]
+ declarative_base,
+ )
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
from inbox.models.session import session_scope
engine = main_engine(pool_size=1, max_overflow=0)
@@ -27,10 +29,12 @@ def upgrade() -> None:
Base = declarative_base() # noqa: N806
Base.metadata.reflect(engine)
- class EASUid(Base):
+ class EASUid(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["easuid"]
- with session_scope(versioned=False) as db_session:
+ with session_scope( # type: ignore[call-arg]
+ versioned=False
+ ) as db_session:
# STOPSHIP(emfree): determine if we need to batch this update on large
# databases.
db_session.query(EASUid).update(
diff --git a/migrations/versions/172_update_easuid_schema_4.py b/migrations/versions/172_update_easuid_schema_4.py
index d2e2e5550..061f67407 100644
--- a/migrations/versions/172_update_easuid_schema_4.py
+++ b/migrations/versions/172_update_easuid_schema_4.py
@@ -17,7 +17,7 @@
def upgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine(pool_size=1, max_overflow=0)
if not engine.has_table("easuid"):
diff --git a/migrations/versions/173_add_owner2.py b/migrations/versions/173_add_owner2.py
index fc95d712d..5ed1a784e 100644
--- a/migrations/versions/173_add_owner2.py
+++ b/migrations/versions/173_add_owner2.py
@@ -13,7 +13,7 @@
down_revision = "d0427f9f3d1"
from alembic import op
-from sqlalchemy.sql import text
+from sqlalchemy.sql import text # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/174_backfill_owner2.py b/migrations/versions/174_backfill_owner2.py
index a12c0ed3d..a2787434b 100644
--- a/migrations/versions/174_backfill_owner2.py
+++ b/migrations/versions/174_backfill_owner2.py
@@ -14,7 +14,7 @@
from typing import Never
from alembic import op
-from sqlalchemy.sql import text
+from sqlalchemy.sql import text # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/175_fix_recurring_override_cascade.py b/migrations/versions/175_fix_recurring_override_cascade.py
index cc5fbadf7..b8f3852d0 100644
--- a/migrations/versions/175_fix_recurring_override_cascade.py
+++ b/migrations/versions/175_fix_recurring_override_cascade.py
@@ -12,7 +12,7 @@
down_revision = "4ef055945390"
from alembic import op
-from sqlalchemy.sql import text
+from sqlalchemy.sql import text # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/176_add_run_state_folderstatus.py b/migrations/versions/176_add_run_state_folderstatus.py
index baaf05b9f..d5bc6f3a8 100644
--- a/migrations/versions/176_add_run_state_folderstatus.py
+++ b/migrations/versions/176_add_run_state_folderstatus.py
@@ -11,7 +11,7 @@
revision = "48a1991e5dbd"
down_revision = "6e5b154d917"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/177_add_run_state_eas_folderstatus.py b/migrations/versions/177_add_run_state_eas_folderstatus.py
index 5e324b84c..75b93feaf 100644
--- a/migrations/versions/177_add_run_state_eas_folderstatus.py
+++ b/migrations/versions/177_add_run_state_eas_folderstatus.py
@@ -11,12 +11,12 @@
revision = "2b9dd6f7593a"
down_revision = "48a1991e5dbd"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
def upgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine(pool_size=1, max_overflow=0)
if not engine.has_table("easfoldersyncstatus"):
@@ -33,7 +33,7 @@ def upgrade() -> None:
def downgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine(pool_size=1, max_overflow=0)
if not engine.has_table("easfoldersyncstatus"):
diff --git a/migrations/versions/178_add_reply_to_messagecontactassociation.py b/migrations/versions/178_add_reply_to_messagecontactassociation.py
index be3599e87..8ac0836fa 100644
--- a/migrations/versions/178_add_reply_to_messagecontactassociation.py
+++ b/migrations/versions/178_add_reply_to_messagecontactassociation.py
@@ -11,7 +11,7 @@
revision = "41f957b595fc"
down_revision = "2b9dd6f7593a"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/179_longer_event_descriptions.py b/migrations/versions/179_longer_event_descriptions.py
index 542d414af..6f355a3a0 100644
--- a/migrations/versions/179_longer_event_descriptions.py
+++ b/migrations/versions/179_longer_event_descriptions.py
@@ -11,9 +11,9 @@
revision = "56500282e024"
down_revision = "41f957b595fc"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
-from sqlalchemy.dialects import mysql
+from sqlalchemy.dialects import mysql # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/182_add_data_processing_cache_table.py b/migrations/versions/182_add_data_processing_cache_table.py
index e8050bd42..4014e7f39 100644
--- a/migrations/versions/182_add_data_processing_cache_table.py
+++ b/migrations/versions/182_add_data_processing_cache_table.py
@@ -11,9 +11,9 @@
revision = "3857f395fb1d"
down_revision = "10da2e0bc3bb"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
-from sqlalchemy.dialects import mysql
+from sqlalchemy.dialects import mysql # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/183_change_event_sync_timestamp.py b/migrations/versions/183_change_event_sync_timestamp.py
index 0d8a33c7c..4a1467e31 100644
--- a/migrations/versions/183_change_event_sync_timestamp.py
+++ b/migrations/versions/183_change_event_sync_timestamp.py
@@ -11,7 +11,7 @@
revision = "3a58d466f61d"
down_revision = "3857f395fb1d"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/184_create_gmail_auth_credentials_table.py b/migrations/versions/184_create_gmail_auth_credentials_table.py
index 51e40d1e7..bed25ef02 100644
--- a/migrations/versions/184_create_gmail_auth_credentials_table.py
+++ b/migrations/versions/184_create_gmail_auth_credentials_table.py
@@ -11,9 +11,9 @@
revision = "2ac4e3c4e049"
down_revision = "3a58d466f61d"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
-from sqlalchemy.dialects import mysql
+from sqlalchemy.dialects import mysql # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/185_backfill_gmail_auth_credentials_table.py b/migrations/versions/185_backfill_gmail_auth_credentials_table.py
index 61d195545..97b6a1dba 100644
--- a/migrations/versions/185_backfill_gmail_auth_credentials_table.py
+++ b/migrations/versions/185_backfill_gmail_auth_credentials_table.py
@@ -15,11 +15,13 @@
def upgrade() -> None:
import datetime
- from sqlalchemy.ext.declarative import declarative_base
- from sqlalchemy.orm import relationship
+ from sqlalchemy.ext.declarative import ( # type: ignore[import-untyped]
+ declarative_base,
+ )
+ from sqlalchemy.orm import relationship # type: ignore[import-untyped]
from inbox.config import config
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
from inbox.models.session import session_scope
engine = main_engine()
@@ -28,17 +30,19 @@ def upgrade() -> None:
Base = declarative_base() # noqa: N806
Base.metadata.reflect(engine)
- class GmailAccount(Base):
+ class GmailAccount(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["gmailaccount"]
- class Secret(Base):
+ class Secret(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["secret"]
- class GmailAuthCredentials(Base):
+ class GmailAuthCredentials(Base): # type: ignore[misc, valid-type]
__table__ = Base.metadata.tables["gmailauthcredentials"]
secret = relationship(Secret)
- with session_scope(versioned=False) as db_session:
+ with session_scope( # type: ignore[call-arg]
+ versioned=False
+ ) as db_session:
for acc, sec in (
db_session.query(GmailAccount, Secret)
.filter(
diff --git a/migrations/versions/186_new_tables_for_folders_overhaul.py b/migrations/versions/186_new_tables_for_folders_overhaul.py
index ca5fc49d9..09ab015c1 100644
--- a/migrations/versions/186_new_tables_for_folders_overhaul.py
+++ b/migrations/versions/186_new_tables_for_folders_overhaul.py
@@ -13,7 +13,7 @@
from typing import Never
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
@@ -166,7 +166,7 @@ def upgrade() -> None:
"folder_ibfk_2", "folder", "category", ["category_id"], ["id"]
)
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine(pool_size=1, max_overflow=0)
if engine.has_table("easfoldersyncstatus"):
diff --git a/migrations/versions/187_migrate_data_for_folders_overhaul.py b/migrations/versions/187_migrate_data_for_folders_overhaul.py
index 3bd33c586..60285a8eb 100644
--- a/migrations/versions/187_migrate_data_for_folders_overhaul.py
+++ b/migrations/versions/187_migrate_data_for_folders_overhaul.py
@@ -11,8 +11,12 @@
revision = "334b33f18b4f"
down_revision = "23e204cd1d91"
-from sqlalchemy import asc
-from sqlalchemy.orm import joinedload, load_only, subqueryload
+from sqlalchemy import asc # type: ignore[import-untyped]
+from sqlalchemy.orm import ( # type: ignore[import-untyped]
+ joinedload,
+ load_only,
+ subqueryload,
+)
from inbox.config import config
from inbox.logging import configure_logging, get_logger
@@ -21,7 +25,9 @@
log = get_logger()
-def populate_labels(uid, account, db_session) -> None:
+def populate_labels( # type: ignore[no-untyped-def]
+ uid, account, db_session
+) -> None:
from inbox.models import Label
existing_labels = {(l.name, l.canonical_name): l for l in account.labels}
@@ -43,7 +49,7 @@ def populate_labels(uid, account, db_session) -> None:
(category_map[label_string], category_map[label_string])
)
else:
- remote_labels.add((label_string, None))
+ remote_labels.add((label_string, None)) # type: ignore[arg-type]
for key in remote_labels:
if key not in existing_labels:
@@ -54,20 +60,28 @@ def populate_labels(uid, account, db_session) -> None:
uid.labels.add(existing_labels[key])
-def set_labels_for_imapuids(account, db_session) -> None:
+def set_labels_for_imapuids( # type: ignore[no-untyped-def]
+ account, db_session
+) -> None:
from inbox.models.backends.imap import ImapUid
uids = (
db_session.query(ImapUid)
.filter(ImapUid.account_id == account.id)
- .options(subqueryload(ImapUid.labelitems).joinedload("label"))
+ .options(
+ subqueryload(
+ ImapUid.labelitems # type: ignore[attr-defined]
+ ).joinedload("label")
+ )
)
for uid in uids:
populate_labels(uid, account, db_session)
log.info("Updated UID labels", account_id=account.id, uid=uid.id)
-def create_categories_for_folders(account, db_session) -> None:
+def create_categories_for_folders( # type: ignore[no-untyped-def]
+ account, db_session
+) -> None:
from inbox.models import Category, Folder
for folder in db_session.query(Folder).filter(
@@ -84,19 +98,27 @@ def create_categories_for_folders(account, db_session) -> None:
db_session.commit()
-def create_categories_for_easfoldersyncstatuses(account, db_session) -> None:
- from inbox.mailsync.backends.eas.base.foldersync import save_categories
+def create_categories_for_easfoldersyncstatuses( # type: ignore[no-untyped-def]
+ account, db_session
+) -> None:
+ from inbox.mailsync.backends.eas.base.foldersync import ( # type: ignore[import-not-found]
+ save_categories,
+ )
save_categories(db_session, account, account.primary_device_id)
db_session.commit()
save_categories(db_session, account, account.secondary_device_id)
-def migrate_account_metadata(account_id) -> None:
+def migrate_account_metadata( # type: ignore[no-untyped-def]
+ account_id,
+) -> None:
from inbox.models import Account
from inbox.models.session import session_scope
- with session_scope(versioned=False) as db_session:
+ with session_scope( # type: ignore[call-arg]
+ versioned=False
+ ) as db_session:
account = db_session.query(Account).get(account_id)
if account.discriminator == "easaccount":
create_categories_for_easfoldersyncstatuses(account, db_session)
@@ -107,21 +129,25 @@ def migrate_account_metadata(account_id) -> None:
db_session.commit()
-def migrate_messages(account_id) -> None:
- from inbox.ignition import main_engine
+def migrate_messages(account_id) -> None: # type: ignore[no-untyped-def]
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
from inbox.models import Message, Namespace
from inbox.models.session import session_scope
engine = main_engine(pool_size=1, max_overflow=0)
- with session_scope(versioned=False) as db_session:
+ with session_scope( # type: ignore[call-arg]
+ versioned=False
+ ) as db_session:
namespace = (
db_session.query(Namespace).filter_by(account_id=account_id).one()
)
offset = 0
while True:
if engine.has_table("easuid"):
- additional_options = [subqueryload(Message.easuids)]
+ additional_options = [
+ subqueryload(Message.easuids) # type: ignore[attr-defined]
+ ]
else:
additional_options = []
@@ -136,8 +162,12 @@ def migrate_messages(account_id) -> None:
Message.is_draft,
),
joinedload(Message.namespace).load_only("id"),
- subqueryload(Message.imapuids),
- subqueryload(Message.messagecategories),
+ subqueryload(
+ Message.imapuids # type: ignore[attr-defined]
+ ),
+ subqueryload(
+ Message.messagecategories # type: ignore[attr-defined]
+ ),
*additional_options,
)
.with_hint(Message, "USE INDEX (ix_message_namespace_id)")
@@ -163,7 +193,7 @@ def migrate_messages(account_id) -> None:
offset += 1000
-def migrate_account(account_id) -> None:
+def migrate_account(account_id) -> None: # type: ignore[no-untyped-def]
migrate_account_metadata(account_id)
migrate_messages(account_id)
@@ -172,7 +202,7 @@ def upgrade() -> None:
from inbox.models import Account
from inbox.models.session import session_scope
- with session_scope() as db_session:
+ with session_scope() as db_session: # type: ignore[call-arg]
account_ids = [id_ for id_, in db_session.query(Account.id)]
for id_ in account_ids:
diff --git a/migrations/versions/188_create_sequence_number_column.py b/migrations/versions/188_create_sequence_number_column.py
index 9d58a4347..2e38fdff4 100644
--- a/migrations/versions/188_create_sequence_number_column.py
+++ b/migrations/versions/188_create_sequence_number_column.py
@@ -12,7 +12,7 @@
down_revision = "334b33f18b4f"
from alembic import op
-from sqlalchemy.sql import text
+from sqlalchemy.sql import text # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/189_add_initial_sync_start_end_column.py b/migrations/versions/189_add_initial_sync_start_end_column.py
index cf6f387d2..d52e90c7c 100644
--- a/migrations/versions/189_add_initial_sync_start_end_column.py
+++ b/migrations/versions/189_add_initial_sync_start_end_column.py
@@ -11,7 +11,7 @@
revision = "3b093f2d7419"
down_revision = "606447e78e7"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/190_eas_add_device_retirement.py b/migrations/versions/190_eas_add_device_retirement.py
index a65a5c2de..03fe52ac6 100644
--- a/migrations/versions/190_eas_add_device_retirement.py
+++ b/migrations/versions/190_eas_add_device_retirement.py
@@ -11,12 +11,12 @@
revision = "246a6bf050bc"
down_revision = "3b093f2d7419"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
def upgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine(pool_size=1, max_overflow=0)
if not engine.has_table("easdevice"):
@@ -33,7 +33,7 @@ def upgrade() -> None:
def downgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine(pool_size=1, max_overflow=0)
if not engine.has_table("easdevice"):
diff --git a/migrations/versions/191_add_new_events_and_calendars_flags.py b/migrations/versions/191_add_new_events_and_calendars_flags.py
index 6b07b3d9b..3c021ddec 100644
--- a/migrations/versions/191_add_new_events_and_calendars_flags.py
+++ b/migrations/versions/191_add_new_events_and_calendars_flags.py
@@ -11,7 +11,7 @@
revision = "47aec237051e"
down_revision = "246a6bf050bc"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/192_add_receivedrecentdate_column_to_threads.py b/migrations/versions/192_add_receivedrecentdate_column_to_threads.py
index 4eec70f41..281b89a58 100644
--- a/migrations/versions/192_add_receivedrecentdate_column_to_threads.py
+++ b/migrations/versions/192_add_receivedrecentdate_column_to_threads.py
@@ -11,12 +11,12 @@
revision = "2758cefad87d"
down_revision = "47aec237051e"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
def upgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine(pool_size=1, max_overflow=0)
if not engine.has_table("thread"):
@@ -39,7 +39,7 @@ def upgrade() -> None:
def downgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine(pool_size=1, max_overflow=0)
if not engine.has_table("thread"):
diff --git a/migrations/versions/193_calculate_receivedrecentdate_for_threads.py b/migrations/versions/193_calculate_receivedrecentdate_for_threads.py
index 140ff98c9..f86eac5da 100644
--- a/migrations/versions/193_calculate_receivedrecentdate_for_threads.py
+++ b/migrations/versions/193_calculate_receivedrecentdate_for_threads.py
@@ -13,7 +13,7 @@
# solution from http://stackoverflow.com/a/1217947
-def page_query(q): # noqa: ANN201
+def page_query(q): # type: ignore[no-untyped-def] # noqa: ANN201
CHUNK_SIZE = 500 # noqa: N806
offset = 0
while True:
@@ -27,13 +27,15 @@ def page_query(q): # noqa: ANN201
def upgrade() -> None:
- from sqlalchemy import desc
- from sqlalchemy.sql import not_
+ from sqlalchemy import desc # type: ignore[import-untyped]
+ from sqlalchemy.sql import not_ # type: ignore[import-untyped]
from inbox.models import Message, Thread
from inbox.models.session import session_scope
- with session_scope(versioned=False) as db_session:
+ with session_scope( # type: ignore[call-arg]
+ versioned=False
+ ) as db_session:
for thread in page_query(db_session.query(Thread)):
last_message = (
db_session.query(Message)
diff --git a/migrations/versions/194_extend_eas_folder_id.py b/migrations/versions/194_extend_eas_folder_id.py
index 0d3ec72df..9845e9b5d 100644
--- a/migrations/versions/194_extend_eas_folder_id.py
+++ b/migrations/versions/194_extend_eas_folder_id.py
@@ -12,15 +12,17 @@
down_revision = "691fa97024d"
from alembic import op
-from sqlalchemy.ext.declarative import declarative_base
-from sqlalchemy.sql import text
+from sqlalchemy.ext.declarative import ( # type: ignore[import-untyped]
+ declarative_base,
+)
+from sqlalchemy.sql import text # type: ignore[import-untyped]
def upgrade() -> None:
conn = op.get_bind()
conn.execute(text("set @@lock_wait_timeout = 20;"))
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine(pool_size=1, max_overflow=0)
Base = declarative_base() # noqa: N806
@@ -39,7 +41,7 @@ def downgrade() -> None:
conn = op.get_bind()
conn.execute(text("set @@lock_wait_timeout = 20;"))
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine(pool_size=1, max_overflow=0)
Base = declarative_base() # noqa: N806
diff --git a/migrations/versions/195_remove_receivedrecentdate_column.py b/migrations/versions/195_remove_receivedrecentdate_column.py
index 3940d2ea1..9e43ce6c0 100644
--- a/migrations/versions/195_remove_receivedrecentdate_column.py
+++ b/migrations/versions/195_remove_receivedrecentdate_column.py
@@ -11,7 +11,7 @@
revision = "51ad0922ad8e"
down_revision = "69e93aef3e9"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/196_create_outlook_account_column.py b/migrations/versions/196_create_outlook_account_column.py
index 4f73a0493..ded263aa4 100644
--- a/migrations/versions/196_create_outlook_account_column.py
+++ b/migrations/versions/196_create_outlook_account_column.py
@@ -12,15 +12,17 @@
down_revision = "51ad0922ad8e"
from alembic import op
-from sqlalchemy.ext.declarative import declarative_base
-from sqlalchemy.sql import text
+from sqlalchemy.ext.declarative import ( # type: ignore[import-untyped]
+ declarative_base,
+)
+from sqlalchemy.sql import text # type: ignore[import-untyped]
def upgrade() -> None:
conn = op.get_bind()
conn.execute(text("set @@lock_wait_timeout = 20;"))
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine(pool_size=1, max_overflow=0)
Base = declarative_base() # noqa: N806
@@ -36,7 +38,7 @@ def downgrade() -> None:
conn = op.get_bind()
conn.execute(text("set @@lock_wait_timeout = 20;"))
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine(pool_size=1, max_overflow=0)
Base = declarative_base() # noqa: N806
diff --git a/migrations/versions/197_add_message_categories_change_counter.py b/migrations/versions/197_add_message_categories_change_counter.py
index 053d2f33e..02037ee06 100644
--- a/migrations/versions/197_add_message_categories_change_counter.py
+++ b/migrations/versions/197_add_message_categories_change_counter.py
@@ -11,7 +11,7 @@
revision = "3cf51fb0e76a"
down_revision = "4fa0540482f8"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
@@ -30,7 +30,7 @@ def upgrade() -> None:
existing_type=sa.Enum("draft", "sending", "sending failed", "sent"),
)
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine(pool_size=1, max_overflow=0)
if not engine.has_table("easdevice"):
diff --git a/migrations/versions/198_eas_foldersyncstatus_startstop_columns.py b/migrations/versions/198_eas_foldersyncstatus_startstop_columns.py
index 507d1b443..9a438670f 100644
--- a/migrations/versions/198_eas_foldersyncstatus_startstop_columns.py
+++ b/migrations/versions/198_eas_foldersyncstatus_startstop_columns.py
@@ -11,12 +11,12 @@
revision = "301d22aa96b8"
down_revision = "3cf51fb0e76a"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
def upgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine(pool_size=1, max_overflow=0)
if not engine.has_table("easfoldersyncstatus"):
@@ -32,7 +32,7 @@ def upgrade() -> None:
def downgrade() -> None:
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine(pool_size=1, max_overflow=0)
if not engine.has_table("easfoldersyncstatus"):
diff --git a/migrations/versions/199_save_imap_uidnext.py b/migrations/versions/199_save_imap_uidnext.py
index d689b4cc8..3320e3b2e 100644
--- a/migrations/versions/199_save_imap_uidnext.py
+++ b/migrations/versions/199_save_imap_uidnext.py
@@ -11,7 +11,7 @@
revision = "3583211a4838"
down_revision = "301d22aa96b8"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/200_update_imapfolderinfo.py b/migrations/versions/200_update_imapfolderinfo.py
index 4acac9901..1610fa616 100644
--- a/migrations/versions/200_update_imapfolderinfo.py
+++ b/migrations/versions/200_update_imapfolderinfo.py
@@ -11,7 +11,7 @@
revision = "dbf45fac873"
down_revision = "3583211a4838"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/201_add_sync_email_bit_to_account.py b/migrations/versions/201_add_sync_email_bit_to_account.py
index 653429d33..960fba7be 100644
--- a/migrations/versions/201_add_sync_email_bit_to_account.py
+++ b/migrations/versions/201_add_sync_email_bit_to_account.py
@@ -11,7 +11,7 @@
revision = "527bbdc2b0fa"
down_revision = "dbf45fac873"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/202_drop_sync_raw_data_column.py b/migrations/versions/202_drop_sync_raw_data_column.py
index 403a0b30a..2e9638fad 100644
--- a/migrations/versions/202_drop_sync_raw_data_column.py
+++ b/migrations/versions/202_drop_sync_raw_data_column.py
@@ -11,9 +11,9 @@
revision = "2e515548043b"
down_revision = "527bbdc2b0fa"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
-from sqlalchemy.dialects import mysql
+from sqlalchemy.dialects import mysql # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/203_deleted_at_constraint.py b/migrations/versions/203_deleted_at_constraint.py
index d94077ad4..a50cdb410 100644
--- a/migrations/versions/203_deleted_at_constraint.py
+++ b/migrations/versions/203_deleted_at_constraint.py
@@ -12,7 +12,7 @@
down_revision = "2e515548043b"
from alembic import op
-from sqlalchemy.sql import text
+from sqlalchemy.sql import text # type: ignore[import-untyped]
def upgrade() -> None:
@@ -25,7 +25,7 @@ def upgrade() -> None:
["namespace_id", "name", "display_name", "deleted_at"],
)
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine(pool_size=1, max_overflow=0)
if not engine.has_table("easfoldersyncstatus"):
@@ -47,7 +47,7 @@ def downgrade() -> None:
"namespace_id", "category", ["namespace_id", "name", "display_name"]
)
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine(pool_size=1, max_overflow=0)
if not engine.has_table("easfoldersyncstatus"):
diff --git a/migrations/versions/204_remove_deleted_at_constraint.py b/migrations/versions/204_remove_deleted_at_constraint.py
index 71f68e3f0..07d357865 100644
--- a/migrations/versions/204_remove_deleted_at_constraint.py
+++ b/migrations/versions/204_remove_deleted_at_constraint.py
@@ -12,7 +12,7 @@
down_revision = "420ccbea2c5e"
from alembic import op
-from sqlalchemy.sql import text
+from sqlalchemy.sql import text # type: ignore[import-untyped]
def upgrade() -> None:
@@ -23,7 +23,7 @@ def upgrade() -> None:
"namespace_id", "category", ["namespace_id", "name", "display_name"]
)
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine(pool_size=1, max_overflow=0)
if not engine.has_table("easfoldersyncstatus"):
@@ -47,7 +47,7 @@ def downgrade() -> None:
["namespace_id", "name", "display_name", "deleted_at"],
)
- from inbox.ignition import main_engine
+ from inbox.ignition import main_engine # type: ignore[attr-defined]
engine = main_engine(pool_size=1, max_overflow=0)
if not engine.has_table("easfoldersyncstatus"):
diff --git a/migrations/versions/205_fix_categories_cascade.py b/migrations/versions/205_fix_categories_cascade.py
index 51b58ef3a..c34fe9b77 100644
--- a/migrations/versions/205_fix_categories_cascade.py
+++ b/migrations/versions/205_fix_categories_cascade.py
@@ -12,7 +12,7 @@
down_revision = "583e083d4512"
from alembic import op
-from sqlalchemy.sql import text
+from sqlalchemy.sql import text # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/206_add_phone_numbers_table.py b/migrations/versions/206_add_phone_numbers_table.py
index e23b0f542..1d792728c 100644
--- a/migrations/versions/206_add_phone_numbers_table.py
+++ b/migrations/versions/206_add_phone_numbers_table.py
@@ -11,9 +11,9 @@
revision = "gu8eqpm6f2x1n0fg"
down_revision = "302d9f6b22f3"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
-from sqlalchemy.dialects import mysql
+from sqlalchemy.dialects import mysql # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/207_add_contact_search_index_service_cursor_.py b/migrations/versions/207_add_contact_search_index_service_cursor_.py
index 8cc410fc6..6238b8b3c 100644
--- a/migrations/versions/207_add_contact_search_index_service_cursor_.py
+++ b/migrations/versions/207_add_contact_search_index_service_cursor_.py
@@ -11,9 +11,9 @@
revision = "4b225df49747"
down_revision = "gu8eqpm6f2x1n0fg"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
-from sqlalchemy.dialects import mysql
+from sqlalchemy.dialects import mysql # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/208_drop_easuid_uniqueconstraint.py b/migrations/versions/208_drop_easuid_uniqueconstraint.py
index cef632d7a..69793cde8 100644
--- a/migrations/versions/208_drop_easuid_uniqueconstraint.py
+++ b/migrations/versions/208_drop_easuid_uniqueconstraint.py
@@ -12,7 +12,7 @@
down_revision = "4b225df49747"
from alembic import op
-from sqlalchemy.sql import text
+from sqlalchemy.sql import text # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/209_recreate_easuid_index.py b/migrations/versions/209_recreate_easuid_index.py
index 8a4d93695..62be32bfe 100644
--- a/migrations/versions/209_recreate_easuid_index.py
+++ b/migrations/versions/209_recreate_easuid_index.py
@@ -12,7 +12,7 @@
down_revision = "1962d17d1c0a"
from alembic import op
-from sqlalchemy.sql import text
+from sqlalchemy.sql import text # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/212_add_columns_for_smtp_imap_specific_auth.py b/migrations/versions/212_add_columns_for_smtp_imap_specific_auth.py
index 4a03c8487..e0e3cbb8a 100644
--- a/migrations/versions/212_add_columns_for_smtp_imap_specific_auth.py
+++ b/migrations/versions/212_add_columns_for_smtp_imap_specific_auth.py
@@ -12,7 +12,7 @@
down_revision = "31aae1ecb374"
from alembic import context, op
-from sqlalchemy.sql import text
+from sqlalchemy.sql import text # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/213_add_metadata_table.py b/migrations/versions/213_add_metadata_table.py
index aef6d6c18..e4da48ca2 100644
--- a/migrations/versions/213_add_metadata_table.py
+++ b/migrations/versions/213_add_metadata_table.py
@@ -11,7 +11,7 @@
revision = "bc1119471fe"
down_revision = "501f6b2fef28"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import context, op
diff --git a/migrations/versions/214_introduce_accounttransaction.py b/migrations/versions/214_introduce_accounttransaction.py
index 372c928bd..8150a88e4 100644
--- a/migrations/versions/214_introduce_accounttransaction.py
+++ b/migrations/versions/214_introduce_accounttransaction.py
@@ -11,12 +11,14 @@
revision = "4b83e064dd49"
down_revision = "bc1119471fe"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import context, op
def upgrade() -> None:
- shard_id = int(context.config.get_main_option("shard_id"))
+ shard_id = int(
+ context.config.get_main_option("shard_id") # type: ignore[arg-type]
+ )
namespace_id_type = sa.Integer() if shard_id == 0 else sa.BigInteger()
op.create_table(
diff --git a/migrations/versions/216_add_folder_separator_column_for_generic_.py b/migrations/versions/216_add_folder_separator_column_for_generic_.py
index 19f7a186b..d886f507d 100644
--- a/migrations/versions/216_add_folder_separator_column_for_generic_.py
+++ b/migrations/versions/216_add_folder_separator_column_for_generic_.py
@@ -12,7 +12,7 @@
down_revision = "4bfecbcc7dbd"
from alembic import op
-from sqlalchemy.sql import text
+from sqlalchemy.sql import text # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/217_add_genericaccount_ssl_required.py b/migrations/versions/217_add_genericaccount_ssl_required.py
index 7599cc414..f83ce2c2c 100644
--- a/migrations/versions/217_add_genericaccount_ssl_required.py
+++ b/migrations/versions/217_add_genericaccount_ssl_required.py
@@ -12,7 +12,7 @@
down_revision = "4f8e995d1dba"
from alembic import op
-from sqlalchemy.sql import text
+from sqlalchemy.sql import text # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/219_accounttransaction_namespace_id_cascade.py b/migrations/versions/219_accounttransaction_namespace_id_cascade.py
index 43a870903..1f26abf6f 100644
--- a/migrations/versions/219_accounttransaction_namespace_id_cascade.py
+++ b/migrations/versions/219_accounttransaction_namespace_id_cascade.py
@@ -12,7 +12,7 @@
down_revision = "3b1cc8580fc2"
from alembic import op
-from sqlalchemy.sql import text
+from sqlalchemy.sql import text # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/220_folder_separators_again.py b/migrations/versions/220_folder_separators_again.py
index fc95b6436..b6c0611cb 100644
--- a/migrations/versions/220_folder_separators_again.py
+++ b/migrations/versions/220_folder_separators_again.py
@@ -12,7 +12,7 @@
down_revision = "2b2205db4964"
from alembic import op
-from sqlalchemy.sql import text
+from sqlalchemy.sql import text # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/221_fix_category_column_defaults.py b/migrations/versions/221_fix_category_column_defaults.py
index 4cd3b6eb8..0e657f8dc 100644
--- a/migrations/versions/221_fix_category_column_defaults.py
+++ b/migrations/versions/221_fix_category_column_defaults.py
@@ -12,7 +12,7 @@
down_revision = "59e1cc690da9"
from alembic import op
-from sqlalchemy.sql import text
+from sqlalchemy.sql import text # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/223_time_mixins_fix.py b/migrations/versions/223_time_mixins_fix.py
index 3852ee12d..9d7614ee8 100644
--- a/migrations/versions/223_time_mixins_fix.py
+++ b/migrations/versions/223_time_mixins_fix.py
@@ -11,10 +11,10 @@
revision = "539ce0291298"
down_revision = "361972a1de3e"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
-from sqlalchemy.dialects import mysql
-from sqlalchemy.sql import text
+from sqlalchemy.dialects import mysql # type: ignore[import-untyped]
+from sqlalchemy.sql import text # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/225_drop_messagecategory_foreign_keys.py b/migrations/versions/225_drop_messagecategory_foreign_keys.py
index 88069266f..6dbd0cf5a 100644
--- a/migrations/versions/225_drop_messagecategory_foreign_keys.py
+++ b/migrations/versions/225_drop_messagecategory_foreign_keys.py
@@ -12,7 +12,7 @@
down_revision = "29a1f2ef5653"
from alembic import op
-from sqlalchemy.sql import text
+from sqlalchemy.sql import text # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/226_add_queryable_value_column_to_metadata.py b/migrations/versions/226_add_queryable_value_column_to_metadata.py
index fcfeaab0b..4baf73f5e 100644
--- a/migrations/versions/226_add_queryable_value_column_to_metadata.py
+++ b/migrations/versions/226_add_queryable_value_column_to_metadata.py
@@ -11,7 +11,7 @@
revision = "2dbf6da0775b"
down_revision = "25129e0316d4"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/227_remove_message_foreignkeys.py b/migrations/versions/227_remove_message_foreignkeys.py
index c73e25c9b..6f39bfa56 100644
--- a/migrations/versions/227_remove_message_foreignkeys.py
+++ b/migrations/versions/227_remove_message_foreignkeys.py
@@ -12,7 +12,7 @@
down_revision = "2dbf6da0775b"
from alembic import op
-from sqlalchemy.sql import text
+from sqlalchemy.sql import text # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/228_increase_gmailaccount_token_length.py b/migrations/versions/228_increase_gmailaccount_token_length.py
index f2a5607a4..32eb9c911 100644
--- a/migrations/versions/228_increase_gmailaccount_token_length.py
+++ b/migrations/versions/228_increase_gmailaccount_token_length.py
@@ -11,7 +11,7 @@
revision = "3df39f4fbdec"
down_revision = "17b147c1d53c"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/229_drop_transaction_foreign_keys.py b/migrations/versions/229_drop_transaction_foreign_keys.py
index c9a3bcfc4..38140e905 100644
--- a/migrations/versions/229_drop_transaction_foreign_keys.py
+++ b/migrations/versions/229_drop_transaction_foreign_keys.py
@@ -12,7 +12,7 @@
down_revision = "3df39f4fbdec"
from alembic import op
-from sqlalchemy.sql import text
+from sqlalchemy.sql import text # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/230_drop_block_foreign_keys.py b/migrations/versions/230_drop_block_foreign_keys.py
index e79c2b350..81148055d 100644
--- a/migrations/versions/230_drop_block_foreign_keys.py
+++ b/migrations/versions/230_drop_block_foreign_keys.py
@@ -12,7 +12,7 @@
down_revision = "23ff7f0b506d"
from alembic import op
-from sqlalchemy.sql import text
+from sqlalchemy.sql import text # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/231_drop_contact_foreign_keys.py b/migrations/versions/231_drop_contact_foreign_keys.py
index 411e7a525..9ee85594f 100644
--- a/migrations/versions/231_drop_contact_foreign_keys.py
+++ b/migrations/versions/231_drop_contact_foreign_keys.py
@@ -12,7 +12,7 @@
down_revision = "4265dc58eec6"
from alembic import op
-from sqlalchemy.sql import text
+from sqlalchemy.sql import text # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/232_add_thread_deleted_at.py b/migrations/versions/232_add_thread_deleted_at.py
index d56e52e84..89507e9b7 100644
--- a/migrations/versions/232_add_thread_deleted_at.py
+++ b/migrations/versions/232_add_thread_deleted_at.py
@@ -11,7 +11,7 @@
revision = "4a44b06cd53b"
down_revision = "c48fc8dea1b"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/233_revert_drop_block_foreign_keys.py b/migrations/versions/233_revert_drop_block_foreign_keys.py
index 0b29e6479..009b7a36a 100644
--- a/migrations/versions/233_revert_drop_block_foreign_keys.py
+++ b/migrations/versions/233_revert_drop_block_foreign_keys.py
@@ -12,7 +12,7 @@
down_revision = "4a44b06cd53b"
from alembic import op
-from sqlalchemy.sql import text
+from sqlalchemy.sql import text # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/234_change_contact_uid_collation.py b/migrations/versions/234_change_contact_uid_collation.py
index 9f5e6e32c..45af0f79a 100644
--- a/migrations/versions/234_change_contact_uid_collation.py
+++ b/migrations/versions/234_change_contact_uid_collation.py
@@ -12,7 +12,7 @@
down_revision = "569ebe8e383d"
from alembic import op
-from sqlalchemy.sql import text
+from sqlalchemy.sql import text # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/235_change_imapfolderinfo_column.py b/migrations/versions/235_change_imapfolderinfo_column.py
index 9fb2d2965..14176b5a4 100644
--- a/migrations/versions/235_change_imapfolderinfo_column.py
+++ b/migrations/versions/235_change_imapfolderinfo_column.py
@@ -11,7 +11,7 @@
revision = "34815f9e639c"
down_revision = "53e6a7446c45"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/236_add_desired_sync_host.py b/migrations/versions/236_add_desired_sync_host.py
index 71a3ba508..15e2f464a 100644
--- a/migrations/versions/236_add_desired_sync_host.py
+++ b/migrations/versions/236_add_desired_sync_host.py
@@ -12,7 +12,7 @@
down_revision = "34815f9e639c"
from alembic import op
-from sqlalchemy.sql import text
+from sqlalchemy.sql import text # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/237_add_new_contacts_index.py b/migrations/versions/237_add_new_contacts_index.py
index 6a90e49ef..b4cf553b9 100644
--- a/migrations/versions/237_add_new_contacts_index.py
+++ b/migrations/versions/237_add_new_contacts_index.py
@@ -12,7 +12,7 @@
down_revision = "3eb4f30c8ed3"
from alembic import op
-from sqlalchemy.sql import text
+from sqlalchemy.sql import text # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/239_server_default_created_at.py b/migrations/versions/239_server_default_created_at.py
index 319bc2529..8ebb953a7 100644
--- a/migrations/versions/239_server_default_created_at.py
+++ b/migrations/versions/239_server_default_created_at.py
@@ -12,7 +12,7 @@
down_revision = "1b0b4e6fdf96"
from alembic import op
-from sqlalchemy.sql import text
+from sqlalchemy.sql import text # type: ignore[import-untyped]
# SELECT table_name FROM information_schema.columns WHERE table_schema='inbox' AND column_name='created_at'
TABLES = [
diff --git a/migrations/versions/247_add_event_visibility.py b/migrations/versions/247_add_event_visibility.py
index 3c2cd0bcc..43710ae8d 100644
--- a/migrations/versions/247_add_event_visibility.py
+++ b/migrations/versions/247_add_event_visibility.py
@@ -11,7 +11,7 @@
revision = "53b532fda984"
down_revision = "69c4b13c806"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/248_event_contact_association.py b/migrations/versions/248_event_contact_association.py
index 6ecaae5f8..3f764b04d 100644
--- a/migrations/versions/248_event_contact_association.py
+++ b/migrations/versions/248_event_contact_association.py
@@ -11,7 +11,7 @@
revision = "203ae9bf0ddd"
down_revision = "53b532fda984"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/250_add_secret_type.py b/migrations/versions/250_add_secret_type.py
index ab61b6e76..4d45c9e31 100644
--- a/migrations/versions/250_add_secret_type.py
+++ b/migrations/versions/250_add_secret_type.py
@@ -11,7 +11,7 @@
revision = "1d84676d7731"
down_revision = "36ce9c8635ef"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/251_drop_gmailauthcredentials.py b/migrations/versions/251_drop_gmailauthcredentials.py
index 428466c6e..a1bb916b9 100644
--- a/migrations/versions/251_drop_gmailauthcredentials.py
+++ b/migrations/versions/251_drop_gmailauthcredentials.py
@@ -11,9 +11,9 @@
revision = "50407c7fe030"
down_revision = "1d84676d7731"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
-from sqlalchemy.dialects import mysql
+from sqlalchemy.dialects import mysql # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/252_drop_gmailaccount_fields.py b/migrations/versions/252_drop_gmailaccount_fields.py
index cc9ed85ff..9b7bd73f6 100644
--- a/migrations/versions/252_drop_gmailaccount_fields.py
+++ b/migrations/versions/252_drop_gmailaccount_fields.py
@@ -11,9 +11,9 @@
revision = "32df3d8ff73e"
down_revision = "50407c7fe030"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
-from sqlalchemy.dialects import mysql
+from sqlalchemy.dialects import mysql # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/253_drop_require_ssl.py b/migrations/versions/253_drop_require_ssl.py
index 8cf0df802..0caacc3c2 100644
--- a/migrations/versions/253_drop_require_ssl.py
+++ b/migrations/versions/253_drop_require_ssl.py
@@ -11,9 +11,9 @@
revision = "52783469ee6c"
down_revision = "32df3d8ff73e"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
-from sqlalchemy.dialects import mysql
+from sqlalchemy.dialects import mysql # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/254_add_calendar_default.py b/migrations/versions/254_add_calendar_default.py
index 3632f9ba3..a321e8376 100644
--- a/migrations/versions/254_add_calendar_default.py
+++ b/migrations/versions/254_add_calendar_default.py
@@ -11,9 +11,9 @@
revision = "7bb5c0ca93de"
down_revision = "52783469ee6c"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
-from sqlalchemy.dialects import mysql
+from sqlalchemy.dialects import mysql # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/255_add_calendar_webhook_columns.py b/migrations/versions/255_add_calendar_webhook_columns.py
index b69d25457..9393e5df4 100644
--- a/migrations/versions/255_add_calendar_webhook_columns.py
+++ b/migrations/versions/255_add_calendar_webhook_columns.py
@@ -11,7 +11,7 @@
revision = "9ea81ca0f64b"
down_revision = "7bb5c0ca93de"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/256_add_account_webhook_columns.py b/migrations/versions/256_add_account_webhook_columns.py
index ec81e7fe2..435fcd490 100644
--- a/migrations/versions/256_add_account_webhook_columns.py
+++ b/migrations/versions/256_add_account_webhook_columns.py
@@ -11,7 +11,7 @@
revision = "93cc6f4ce113"
down_revision = "9ea81ca0f64b"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/257_remove_calendar_old_webhook_columns.py b/migrations/versions/257_remove_calendar_old_webhook_columns.py
index cf9d8b190..dbf68d689 100644
--- a/migrations/versions/257_remove_calendar_old_webhook_columns.py
+++ b/migrations/versions/257_remove_calendar_old_webhook_columns.py
@@ -11,9 +11,9 @@
revision = "4af0d2f17967"
down_revision = "93cc6f4ce113"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
-from sqlalchemy.dialects import mysql
+from sqlalchemy.dialects import mysql # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/258_remove_account_old_webhook_columns.py b/migrations/versions/258_remove_account_old_webhook_columns.py
index 4d8919a91..d867fdafa 100644
--- a/migrations/versions/258_remove_account_old_webhook_columns.py
+++ b/migrations/versions/258_remove_account_old_webhook_columns.py
@@ -11,9 +11,9 @@
revision = "e9e932c6c55e"
down_revision = "4af0d2f17967"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
-from sqlalchemy.dialects import mysql
+from sqlalchemy.dialects import mysql # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/259_add_calendar_sync_account_mixin.py b/migrations/versions/259_add_calendar_sync_account_mixin.py
index 61ea4fb7d..10c3e5247 100644
--- a/migrations/versions/259_add_calendar_sync_account_mixin.py
+++ b/migrations/versions/259_add_calendar_sync_account_mixin.py
@@ -11,9 +11,9 @@
revision = "f9dab5e44c0f"
down_revision = "e9e932c6c55e"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
-from sqlalchemy.dialects import mysql
+from sqlalchemy.dialects import mysql # type: ignore[import-untyped]
def upgrade() -> None:
diff --git a/migrations/versions/260_add_event_conference_data.py b/migrations/versions/260_add_event_conference_data.py
index 021ef5300..e27d89603 100644
--- a/migrations/versions/260_add_event_conference_data.py
+++ b/migrations/versions/260_add_event_conference_data.py
@@ -11,7 +11,7 @@
revision = "fe0488decbd1"
down_revision = "f9dab5e44c0f"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/migrations/versions/261_add_ix_imapuid_account_id_folder_id_msg_uid_desc.py b/migrations/versions/261_add_ix_imapuid_account_id_folder_id_msg_uid_desc.py
index 4d981a8f3..ac1b599d6 100644
--- a/migrations/versions/261_add_ix_imapuid_account_id_folder_id_msg_uid_desc.py
+++ b/migrations/versions/261_add_ix_imapuid_account_id_folder_id_msg_uid_desc.py
@@ -11,7 +11,7 @@
revision = "e3cf974d07a5"
down_revision = "fe0488decbd1"
-import sqlalchemy as sa
+import sqlalchemy as sa # type: ignore[import-untyped]
from alembic import op
diff --git a/pyproject.toml b/pyproject.toml
index c9bc46484..5a865eae4 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -153,3 +153,31 @@ unfixable = [
"bin/**.py" = ["T201", "E402", "N999"]
"migrations/**.py" = ["T201", "E402"]
"tests/**.py" = ["ANN"]
+
+[tool.mypy]
+python_version = "3.12"
+strict_equality = true
+warn_unreachable = true
+warn_unused_ignores = true
+warn_redundant_casts = true
+show_error_context = true
+enable_error_code = [
+ "unused-awaitable",
+ "redundant-self",
+ "redundant-expr",
+ "possibly-undefined",
+ "ignore-without-code",
+ "truthy-iterable",
+ "truthy-bool",
+]
+pretty = true
+files = [
+ "bin",
+ "inbox",
+ "migrations",
+]
+namespace_packages = true
+check_untyped_defs = true
+disallow_any_generics = true
+disallow_untyped_defs = true
+disallow_incomplete_defs = true
diff --git a/requirements/requirements-lint.in b/requirements/requirements-lint.in
index 951c3ba69..8875600e1 100644
--- a/requirements/requirements-lint.in
+++ b/requirements/requirements-lint.in
@@ -2,14 +2,15 @@
# This file should only contain dependencies we use directly.
# Indirect dependencies should be pinned in the autogenerated files.
-black==24.8.0
-mypy==1.13.0
-ruff==0.8.2
-typing_extensions==4.12.2
-mypy_extensions==1.0.0
-types-boto==2.49.18.20241019
-types-python-dateutil==2.9.0.20241003
-types-pytz==2024.2.0.20241003
-types-PyYAML==6.0.12.20240917
-types-redis==4.6.0.20241004
-types-requests==2.32.0.20241016
+-c requirements-prod.txt
+
+black
+mypy
+ruff
+typing_extensions
+types-boto
+types-python-dateutil
+types-pytz
+types-PyYAML
+types-redis
+types-requests
diff --git a/requirements/requirements-lint.txt b/requirements/requirements-lint.txt
index bad023e25..5ebfc4e67 100644
--- a/requirements/requirements-lint.txt
+++ b/requirements/requirements-lint.txt
@@ -96,42 +96,45 @@ cffi==1.17.1 \
--hash=sha256:f79fc4fc25f1c8698ff97788206bb3c2598949bfe0fef03d299eb1b5356ada99 \
--hash=sha256:f7f5baafcc48261359e14bcd6d9bff6d4b28d9103847c9e136694cb0501aef87 \
--hash=sha256:fc48c783f9c87e60831201f2cce7f3b2e4846bf4d8728eabe54d60700b318a0b
- # via cryptography
+ # via
+ # -c requirements-prod.txt
+ # cryptography
click==8.1.7 \
--hash=sha256:ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28 \
--hash=sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de
- # via black
-cryptography==44.0.0 \
- --hash=sha256:1923cb251c04be85eec9fda837661c67c1049063305d6be5721643c22dd4e2b7 \
- --hash=sha256:37d76e6863da3774cd9db5b409a9ecfd2c71c981c38788d3fcfaf177f447b731 \
- --hash=sha256:3c672a53c0fb4725a29c303be906d3c1fa99c32f58abe008a82705f9ee96f40b \
- --hash=sha256:404fdc66ee5f83a1388be54300ae978b2efd538018de18556dde92575e05defc \
- --hash=sha256:4ac4c9f37eba52cb6fbeaf5b59c152ea976726b865bd4cf87883a7e7006cc543 \
- --hash=sha256:60eb32934076fa07e4316b7b2742fa52cbb190b42c2df2863dbc4230a0a9b385 \
- --hash=sha256:62901fb618f74d7d81bf408c8719e9ec14d863086efe4185afd07c352aee1d2c \
- --hash=sha256:660cb7312a08bc38be15b696462fa7cc7cd85c3ed9c576e81f4dc4d8b2b31591 \
- --hash=sha256:708ee5f1bafe76d041b53a4f95eb28cdeb8d18da17e597d46d7833ee59b97ede \
- --hash=sha256:761817a3377ef15ac23cd7834715081791d4ec77f9297ee694ca1ee9c2c7e5eb \
- --hash=sha256:831c3c4d0774e488fdc83a1923b49b9957d33287de923d58ebd3cec47a0ae43f \
- --hash=sha256:84111ad4ff3f6253820e6d3e58be2cc2a00adb29335d4cacb5ab4d4d34f2a123 \
- --hash=sha256:8b3e6eae66cf54701ee7d9c83c30ac0a1e3fa17be486033000f2a73a12ab507c \
- --hash=sha256:9abcc2e083cbe8dde89124a47e5e53ec38751f0d7dfd36801008f316a127d7ba \
- --hash=sha256:9e6fc8a08e116fb7c7dd1f040074c9d7b51d74a8ea40d4df2fc7aa08b76b9e6c \
- --hash=sha256:a01956ddfa0a6790d594f5b34fc1bfa6098aca434696a03cfdbe469b8ed79285 \
- --hash=sha256:abc998e0c0eee3c8a1904221d3f67dcfa76422b23620173e28c11d3e626c21bd \
- --hash=sha256:b15492a11f9e1b62ba9d73c210e2416724633167de94607ec6069ef724fad092 \
- --hash=sha256:be4ce505894d15d5c5037167ffb7f0ae90b7be6f2a98f9a5c3442395501c32fa \
- --hash=sha256:c5eb858beed7835e5ad1faba59e865109f3e52b3783b9ac21e7e47dc5554e289 \
- --hash=sha256:cd4e834f340b4293430701e772ec543b0fbe6c2dea510a5286fe0acabe153a02 \
- --hash=sha256:d2436114e46b36d00f8b72ff57e598978b37399d2786fd39793c36c6d5cb1c64 \
- --hash=sha256:eb33480f1bad5b78233b0ad3e1b0be21e8ef1da745d8d2aecbb20671658b9053 \
- --hash=sha256:eca27345e1214d1b9f9490d200f9db5a874479be914199194e746c893788d417 \
- --hash=sha256:ed3534eb1090483c96178fcb0f8893719d96d5274dfde98aa6add34614e97c8e \
- --hash=sha256:f3f6fdfa89ee2d9d496e2c087cebef9d4fcbb0ad63c40e821b39f74bf48d9c5e \
- --hash=sha256:f53c2c87e0fb4b0c00fa9571082a057e37690a8f12233306161c8f4b819960b7 \
- --hash=sha256:f5e7cb1e5e56ca0933b4873c0220a78b773b24d40d186b6738080b73d3d0a756 \
- --hash=sha256:f677e1268c4e23420c3acade68fac427fffcb8d19d7df95ed7ad17cdef8404f4
# via
+ # -c requirements-prod.txt
+ # black
+cryptography==43.0.1 \
+ --hash=sha256:014f58110f53237ace6a408b5beb6c427b64e084eb451ef25a28308270086494 \
+ --hash=sha256:1bbcce1a551e262dfbafb6e6252f1ae36a248e615ca44ba302df077a846a8806 \
+ --hash=sha256:203e92a75716d8cfb491dc47c79e17d0d9207ccffcbcb35f598fbe463ae3444d \
+ --hash=sha256:27e613d7077ac613e399270253259d9d53872aaf657471473ebfc9a52935c062 \
+ --hash=sha256:2bd51274dcd59f09dd952afb696bf9c61a7a49dfc764c04dd33ef7a6b502a1e2 \
+ --hash=sha256:38926c50cff6f533f8a2dae3d7f19541432610d114a70808f0926d5aaa7121e4 \
+ --hash=sha256:511f4273808ab590912a93ddb4e3914dfd8a388fed883361b02dea3791f292e1 \
+ --hash=sha256:58d4e9129985185a06d849aa6df265bdd5a74ca6e1b736a77959b498e0505b85 \
+ --hash=sha256:5b43d1ea6b378b54a1dc99dd8a2b5be47658fe9a7ce0a58ff0b55f4b43ef2b84 \
+ --hash=sha256:61ec41068b7b74268fa86e3e9e12b9f0c21fcf65434571dbb13d954bceb08042 \
+ --hash=sha256:666ae11966643886c2987b3b721899d250855718d6d9ce41b521252a17985f4d \
+ --hash=sha256:68aaecc4178e90719e95298515979814bda0cbada1256a4485414860bd7ab962 \
+ --hash=sha256:7c05650fe8023c5ed0d46793d4b7d7e6cd9c04e68eabe5b0aeea836e37bdcec2 \
+ --hash=sha256:80eda8b3e173f0f247f711eef62be51b599b5d425c429b5d4ca6a05e9e856baa \
+ --hash=sha256:8385d98f6a3bf8bb2d65a73e17ed87a3ba84f6991c155691c51112075f9ffc5d \
+ --hash=sha256:88cce104c36870d70c49c7c8fd22885875d950d9ee6ab54df2745f83ba0dc365 \
+ --hash=sha256:9d3cdb25fa98afdd3d0892d132b8d7139e2c087da1712041f6b762e4f807cc96 \
+ --hash=sha256:a575913fb06e05e6b4b814d7f7468c2c660e8bb16d8d5a1faf9b33ccc569dd47 \
+ --hash=sha256:ac119bb76b9faa00f48128b7f5679e1d8d437365c5d26f1c2c3f0da4ce1b553d \
+ --hash=sha256:c1332724be35d23a854994ff0b66530119500b6053d0bd3363265f7e5e77288d \
+ --hash=sha256:d03a475165f3134f773d1388aeb19c2d25ba88b6a9733c5c590b9ff7bbfa2e0c \
+ --hash=sha256:d75601ad10b059ec832e78823b348bfa1a59f6b8d545db3a24fd44362a1564cb \
+ --hash=sha256:de41fd81a41e53267cb020bb3a7212861da53a7d39f863585d13ea11049cf277 \
+ --hash=sha256:e710bf40870f4db63c3d7d929aa9e09e4e7ee219e703f949ec4073b4294f6172 \
+ --hash=sha256:ea25acb556320250756e53f9e20a4177515f012c9eaea17eb7587a8c4d8ae034 \
+ --hash=sha256:f98bf604c82c416bc829e490c700ca1553eafdf2912a91e23a79d97d9801372a \
+ --hash=sha256:fba1007b3ef89946dbbb515aeeb41e30203b004f0b4b00e5e16078b518563289
+ # via
+ # -c requirements-prod.txt
# types-pyopenssl
# types-redis
mypy==1.13.0 \
@@ -172,13 +175,14 @@ mypy-extensions==1.0.0 \
--hash=sha256:4392f6c0eb8a5668a69e23d168ffa70f0be9ccfd32b5cc2d26a34ae5b844552d \
--hash=sha256:75dbf8955dc00442a438fc4d0666508a9a97b6bd41aa2f0ffe9d2f2725af0782
# via
- # -r requirements-lint.in
# black
# mypy
packaging==24.2 \
--hash=sha256:09abb1bccd265c01f4a3aa3f7a7db064b36514d2cba19a2f694fe6150451a759 \
--hash=sha256:c228a6dc5e932d346bc5739379109d49e8853dd8223571c7c5b55260edc0b97f
- # via black
+ # via
+ # -c requirements-prod.txt
+ # black
pathspec==0.12.1 \
--hash=sha256:a0d503e138a4c123b27490a4f7beda6a01c6f288df0e4a8b79c7eb0dc7b4cc08 \
--hash=sha256:a482d51503a1ab33b1c67a6c3813a26953dbdc71c31dacaef9a838c4e29f5712
@@ -187,10 +191,12 @@ platformdirs==4.3.6 \
--hash=sha256:357fb2acbc885b0419afd3ce3ed34564c13c9b95c89360cd9563f73aa5e2b907 \
--hash=sha256:73e575e1408ab8103900836b97580d5307456908a03e92031bab39e4554cc3fb
# via black
-pycparser==2.22 \
- --hash=sha256:491c8be9c040f5390f5bf44a5b07752bd07f56edf992381b05c701439eec10f6 \
- --hash=sha256:c3702b6d3dd8c7abc1afa565d7e63d53a1d0bd86cdc24edd75470f4de499cfcc
- # via cffi
+pycparser==2.21 \
+ --hash=sha256:8ee45429555515e1f6b185e78100aea234072576aa43ab53aefcae078162fca9 \
+ --hash=sha256:e644fdec12f7872f86c58ff790da456218b10f863970249516d60a5eaca77206
+ # via
+ # -c requirements-prod.txt
+ # cffi
ruff==0.8.2 \
--hash=sha256:1ca4e3a87496dc07d2427b7dd7ffa88a1e597c28dad65ae6433ecb9f2e4f022f \
--hash=sha256:2aae99ec70abf43372612a838d97bfe77d45146254568d94926e8ed5bbb409ea \
@@ -239,21 +245,22 @@ types-redis==4.6.0.20241004 \
--hash=sha256:5f17d2b3f9091ab75384153bfa276619ffa1cf6a38da60e10d5e6749cc5b902e \
--hash=sha256:ef5da68cb827e5f606c8f9c0b49eeee4c2669d6d97122f301d3a55dc6a63f6ed
# via -r requirements-lint.in
-types-requests==2.32.0.20241016 \
- --hash=sha256:0d9cad2f27515d0e3e3da7134a1b6f28fb97129d86b867f24d9c726452634d95 \
- --hash=sha256:4195d62d6d3e043a4eaaf08ff8a62184584d2e8684e9d2aa178c7915a7da3747
+types-requests==2.31.0.6 \
+ --hash=sha256:a2db9cb228a81da8348b49ad6db3f5519452dd20a9c1e1a868c83c5fe88fd1a9 \
+ --hash=sha256:cd74ce3b53c461f1228a9b783929ac73a666658f223e28ed29753771477b3bd0
# via -r requirements-lint.in
types-setuptools==75.6.0.20241126 \
--hash=sha256:7bf25ad4be39740e469f9268b6beddda6e088891fa5a27e985c6ce68bf62ace0 \
--hash=sha256:aaae310a0e27033c1da8457d4d26ac673b0c8a0de7272d6d4708e263f2ea3b9b
# via types-cffi
+types-urllib3==1.26.25.14 \
+ --hash=sha256:229b7f577c951b8c1b92c1bc2b2fdb0b49847bd2af6d1cc2a2e3dd340f3bda8f \
+ --hash=sha256:9683bbb7fb72e32bfe9d2be6e04875fbe1b3eeec3cbb4ea231435aa7fd6b4f0e
+ # via types-requests
typing-extensions==4.12.2 \
--hash=sha256:04e5ca0351e0f3f85c6853954072df659d0d13fac324d0072316b67d7794700d \
--hash=sha256:1a7ead55c7e559dd4dee8856e3a88b41225abfe1ce8df57b7c13915fe121ffb8
# via
+ # -c requirements-prod.txt
# -r requirements-lint.in
# mypy
-urllib3==2.2.3 \
- --hash=sha256:ca899ca043dcb1bafa3e262d73aa25c465bfb49e0bd9dd5d59f1d0acba2f8fac \
- --hash=sha256:e7d814a81dad81e6caf2ec9fdedb284ecc9c73076b62654547cc64ccdcae26e9
- # via types-requests
diff --git a/requirements/requirements-prod.in b/requirements/requirements-prod.in
index 5a8e1d47f..201c11482 100644
--- a/requirements/requirements-prod.in
+++ b/requirements/requirements-prod.in
@@ -82,7 +82,7 @@ stack-data==0.6.2
tldextract==3.1.2
structlog==21.4.0
traitlets==5.9.0
-typing_extensions==4.0.1
+typing_extensions
urllib3==1.26.20
vobject==0.9.6.1
wcwidth==0.2.6
diff --git a/requirements/requirements-prod.txt b/requirements/requirements-prod.txt
index 7a12fb87d..3b6a03ff1 100644
--- a/requirements/requirements-prod.txt
+++ b/requirements/requirements-prod.txt
@@ -1109,9 +1109,9 @@ traitlets==5.9.0 \
# -r requirements-prod.in
# ipython
# matplotlib-inline
-typing-extensions==4.0.1 \
- --hash=sha256:4ca091dea149f945ec56afb48dae714f21e8692ef22a395223bcd328961b6a0e \
- --hash=sha256:7f001e5ac290a0c0401508864c7ec868be4e701886d5b573a9528ed3973d9d3b
+typing-extensions==4.12.2 \
+ --hash=sha256:04e5ca0351e0f3f85c6853954072df659d0d13fac324d0072316b67d7794700d \
+ --hash=sha256:1a7ead55c7e559dd4dee8856e3a88b41225abfe1ce8df57b7c13915fe121ffb8
# via -r requirements-prod.in
urllib3==1.26.20 \
--hash=sha256:0ed14ccfbf1c30a9072c7ca157e4319b70d65f623e91e7b32fadb2853431016e \