id int64 0 458k | file_name stringlengths 4 119 | file_path stringlengths 14 227 | content stringlengths 24 9.96M | size int64 24 9.96M | language stringclasses 1
value | extension stringclasses 14
values | total_lines int64 1 219k | avg_line_length float64 2.52 4.63M | max_line_length int64 5 9.91M | alphanum_fraction float64 0 1 | repo_name stringlengths 7 101 | repo_stars int64 100 139k | repo_forks int64 0 26.4k | repo_open_issues int64 0 2.27k | repo_license stringclasses 12
values | repo_extraction_date stringclasses 433
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
33,600 | test_thread_versioning.py | nylas_sync-engine/inbox/test/transactions/test_thread_versioning.py | from inbox.test.util.base import add_fake_message, add_fake_category
def test_adding_and_removing_message_on_thread_increments_version(
db, thread, default_namespace):
assert thread.version == 0
message = add_fake_message(db.session, default_namespace.id, thread)
assert thread.version == 1
thr... | 1,664 | Python | .py | 37 | 38.945946 | 78 | 0.71995 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,601 | test_transaction_creation.py | nylas_sync-engine/inbox/test/transactions/test_transaction_creation.py | from datetime import datetime
from sqlalchemy import desc
from flanker import mime
from inbox.models import Transaction, AccountTransaction, Calendar
from inbox.models.mixins import HasRevisions
from inbox.models.util import transaction_objects
from inbox.test.util.base import (add_fake_message, add_fake_thread, add... | 14,946 | Python | .py | 278 | 41.935252 | 84 | 0.641444 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,602 | test_transaction_deletion.py | nylas_sync-engine/inbox/test/transactions/test_transaction_deletion.py | import random
import uuid
from datetime import datetime, timedelta
from sqlalchemy import desc
from inbox.models import Transaction
from inbox.models.util import purge_transactions
def get_latest_transaction(db_session, namespace_id):
return db_session.query(Transaction).filter(
Transaction.namespace_id... | 3,162 | Python | .py | 61 | 43.885246 | 79 | 0.677367 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,603 | test_action_scheduling.py | nylas_sync-engine/inbox/test/transactions/test_action_scheduling.py | from inbox.models.action_log import schedule_action, ActionLog
from inbox.test.util.base import add_fake_event
def test_action_scheduling(db, default_account):
event = add_fake_event(db.session, default_account.namespace.id)
schedule_action('create_event', event, default_account.namespace.id,
... | 1,363 | Python | .py | 26 | 43.961538 | 72 | 0.684488 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,604 | test_delta_sync.py | nylas_sync-engine/inbox/test/transactions/test_delta_sync.py | import datetime
import json
import time
from freezegun import freeze_time
from inbox.test.util.base import add_fake_message
from inbox.test.api.base import api_client
__all__ = ['api_client']
def add_account_with_different_namespace_id(db_session,
email_address='cypress@ya... | 8,563 | Python | .py | 176 | 40.8125 | 79 | 0.646798 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,605 | test_remote_sync.py | nylas_sync-engine/inbox/test/contacts/test_remote_sync.py | import pytest
from inbox.test.util.base import (contact_sync, contacts_provider,
ContactsProviderStub)
from inbox.models import Contact
__all__ = ['contact_sync', 'contacts_provider']
@pytest.fixture(scope='function')
def alternate_contacts_provider():
return ContactsProviderS... | 4,003 | Python | .py | 79 | 43.607595 | 112 | 0.702537 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,606 | test_process_mail.py | nylas_sync-engine/inbox/test/contacts/test_process_mail.py | """Sanity-check our logic for updating contact data from message addressees
during a sync."""
from inbox.models import Contact
from inbox.test.util.base import add_fake_message
def test_update_contacts_from_message(db, default_namespace, thread):
# Check that only one Contact is created for repeatedly-referenced
... | 3,092 | Python | .py | 58 | 44.293103 | 79 | 0.649785 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,607 | test_ignition.py | nylas_sync-engine/inbox/test/general/test_ignition.py | # flake8: noqa: F401
import pytest
from inbox.ignition import init_db, verify_db, reset_invalid_autoincrements
from inbox.util.sharding import get_shard_schemas
from inbox.models.session import session_scope_by_shard_id
from inbox.util.testutils import create_test_db, setup_test_db
@pytest.yield_fixture(scope='funct... | 1,993 | Python | .py | 48 | 31.395833 | 75 | 0.61419 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,608 | test_relationships.py | nylas_sync-engine/inbox/test/general/test_relationships.py | import json
from inbox.models import Category, Message, MessageCategory, Thread
from inbox.test.util.base import add_fake_message, add_fake_thread
from inbox.test.api.base import new_api_client
def test_category_delete(db, gmail_account):
""" Ensure that all associated MessageCategories are deleted
when... | 3,758 | Python | .py | 74 | 39.837838 | 76 | 0.617928 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,609 | test_thread_creation.py | nylas_sync-engine/inbox/test/general/test_thread_creation.py | # flake8: noqa: F401
# test that T441 doesn't reappear, ever.
import datetime
import pytest
from collections import namedtuple
from inbox.mailsync.backends.imap.generic import FolderSyncEngine
from inbox.models import Folder, Namespace
from inbox.models.backends.generic import GenericAccount
from inbox.models.backends.... | 3,343 | Python | .py | 72 | 37.083333 | 78 | 0.648557 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,610 | test_lock.py | nylas_sync-engine/inbox/test/general/test_lock.py | """ Tests for file lock implementation. """
import tempfile
import pytest
from gevent import spawn, sleep
from inbox.util.file import Lock
def lock(block, filename=None):
if filename is None:
handle, filename = tempfile.mkstemp()
return Lock(filename, block=block)
@pytest.fixture
def b_lock():
... | 1,572 | Python | .py | 45 | 29.4 | 77 | 0.667108 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,611 | test_provider_export.py | nylas_sync-engine/inbox/test/general/test_provider_export.py | from inbox.providers import providers
import json
def test_provider_export_as_json():
"""Provider dict should be exportable as json"""
assert json.dumps(dict(providers))
| 180 | Python | .py | 5 | 33 | 52 | 0.774566 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,612 | test_provider_resolution.py | nylas_sync-engine/inbox/test/general/test_provider_resolution.py | import pytest
from inbox.util.url import provider_from_address
from inbox.util.url import InvalidEmailAddressError
from inbox.auth.base import handler_from_provider
from inbox.auth.generic import GenericAuthHandler
from inbox.auth.gmail import GmailAuthHandler
from inbox.basicauth import NotSupportedError
def test_pr... | 2,672 | Python | .py | 57 | 39.947368 | 95 | 0.661556 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,613 | test_threading.py | nylas_sync-engine/inbox/test/general/test_threading.py | # -*- coding: utf-8 -*-
# flake8: noqa: F401
import pytest
from inbox.util.threading import fetch_corresponding_thread
from inbox.util.misc import cleanup_subject
from inbox.test.util.base import (add_fake_message, add_fake_thread,
add_fake_imapuid)
def test_message_cleanup():
assert ... | 3,785 | Python | .py | 64 | 46.8125 | 87 | 0.610871 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,614 | test_sync_engine_exit.py | nylas_sync-engine/inbox/test/general/test_sync_engine_exit.py | # flake8: noqa: F401
# test that we correctly exit a sync engine instance if the folder we are
# trying to sync comes back as deleted while syncing
import pytest
from sqlalchemy.exc import IntegrityError
from inbox.mailsync.backends.imap.monitor import ImapSyncMonitor
from inbox.mailsync.backends.imap.generic import ... | 2,286 | Python | .py | 50 | 39.22 | 77 | 0.716472 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,615 | test_util.py | nylas_sync-engine/inbox/test/general/test_util.py | # test_util.py --- test various utility functions.
import socket
from inbox.util.url import naked_domain, matching_subdomains
def test_naked_domain():
assert naked_domain(
'python.linux.com') == 'python.linux.com'
assert naked_domain(
'iplayer.forums.bbc.co.uk') == 'iplayer.forums.bbc.co.uk'
... | 2,149 | Python | .py | 43 | 44.023256 | 88 | 0.693263 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,616 | test_account.py | nylas_sync-engine/inbox/test/general/test_account.py | import pytest
from inbox.test.util.base import add_fake_gmail_account, add_generic_imap_account
def add_fake_imap_account(db_session, provider, email_address, password):
account = add_generic_imap_account(db_session)
account.provider = provider
account.email_address = email_address
account.imap_passw... | 1,143 | Python | .py | 27 | 35.185185 | 81 | 0.680794 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,617 | test_mutable_json_type.py | nylas_sync-engine/inbox/test/general/test_mutable_json_type.py | """ Tests for our mutable JSON column type. """
from datetime import datetime
def test_mutable_json_type(db, config, default_account, folder):
"""
Test that FolderSync._sync_status which is a mutable JSON column is
updated as expected.
"""
from inbox.models.backends.imap import ImapFolderSyncSta... | 1,231 | Python | .py | 29 | 35.206897 | 79 | 0.698319 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,618 | test_draft_creation.py | nylas_sync-engine/inbox/test/general/test_draft_creation.py | from inbox.sendmail.base import create_message_from_json, update_draft
def test_headers_presence(default_namespace, db):
data = {'subject': 'test draft', 'to': [{'email': 'karim@nylas.com'}]}
draft = create_message_from_json(data, default_namespace, db.session,
False)
... | 672 | Python | .py | 13 | 43.307692 | 74 | 0.67075 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,619 | test_category.py | nylas_sync-engine/inbox/test/general/test_category.py | # -*- coding: utf-8 -*-
from inbox.models import Folder, Label
from inbox.models.category import sanitize_name
from inbox.models.constants import MAX_INDEXABLE_LENGTH
from inbox.test.util.base import (add_fake_folder, add_fake_label, generic_account,
gmail_account, db)
__all__ = ['db', 'ge... | 1,833 | Python | .py | 36 | 45 | 83 | 0.673584 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,620 | test_message_parsing.py | nylas_sync-engine/inbox/test/general/test_message_parsing.py | # flake8: noqa: F401, F811
# -*- coding: utf-8 -*-
"""Sanity-check our construction of a Message object from raw synced data."""
import datetime
import pkgutil
import pytest
from flanker import mime
from inbox.models import Message, Block
from inbox.util.blockstore import get_from_blockstore
from inbox.util.addr imp... | 19,453 | Python | .py | 387 | 42.27907 | 94 | 0.655036 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,621 | test_paths.py | nylas_sync-engine/inbox/test/general/test_paths.py | # Test path conversion functions.
from inbox.util.misc import imap_folder_path, fs_folder_path
def test_imap_folder_path():
assert imap_folder_path('a/b') == 'a.b'
assert imap_folder_path('a/b', separator='?') == 'a?b'
assert imap_folder_path('/A/b') == 'A.b'
assert imap_folder_path('/INBOX/b') == 'I... | 1,361 | Python | .py | 22 | 57.227273 | 97 | 0.646882 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,622 | test_filename_truncation.py | nylas_sync-engine/inbox/test/general/test_filename_truncation.py | from inbox.models.message import _trim_filename
def test_filename_truncation():
# Note: test both 3-byte and 4-byte UTF8 chars to make sure truncation
# follows UTF8 boundaries.
uname = u'\U0001f1fa\U0001f1f8\u2678\U0001f602.txt'
assert _trim_filename(uname, 'a', max_len=8) == uname
assert _trim_f... | 1,208 | Python | .py | 19 | 58.736842 | 89 | 0.688345 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,623 | test_namespace.py | nylas_sync-engine/inbox/test/general/test_namespace.py | import random
import gevent
from requests import Response
from pytest import fixture
from freezegun import freeze_time
from inbox.models.namespace import Namespace
from inbox.test.util.base import (add_generic_imap_account, add_fake_thread, add_fake_message,
add_fake_calendar, add_fak... | 15,861 | Python | .py | 338 | 40.097633 | 98 | 0.68821 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,624 | test_address_canonicalization.py | nylas_sync-engine/inbox/test/general/test_address_canonicalization.py | def test_canonicalization(db):
from inbox.models import Namespace, Account
ns = Namespace()
account = Account(namespace=ns,
email_address='lambda.the.ultimate@gmail.com')
db.session.add(account)
db.session.add(ns)
db.session.commit()
assert account.email_address == 'lam... | 960 | Python | .py | 20 | 41.35 | 78 | 0.681964 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,625 | test_required_folders.py | nylas_sync-engine/inbox/test/general/test_required_folders.py | """ Test that the All Mail folder is enabled for Gmail. """
import pytest
from inbox.auth.gmail import GmailAuthHandler
from inbox.basicauth import GmailSettingError
from inbox.crispin import GmailCrispinClient
class AccountStub(object):
id = 0
email_address = 'bob@bob.com'
access_token = None
imap_e... | 1,439 | Python | .py | 41 | 28.804878 | 70 | 0.673188 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,626 | test_html_parsing.py | nylas_sync-engine/inbox/test/general/test_html_parsing.py | # -*- coding: utf-8 -*-
"""Regression tests for HTML parsing."""
from inbox.util.html import strip_tags
def test_strip_tags():
text = ('<div><script> AAH JAVASCRIPT</script><style> AAH CSS AHH</style>'
'check out this <a href="http://example.com">link</a> yo!</div>')
assert strip_tags(text).strip(... | 769 | Python | .py | 16 | 43.3125 | 78 | 0.66443 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,627 | test_concurrency.py | nylas_sync-engine/inbox/test/general/test_concurrency.py | import time
import pytest
import _mysql_exceptions
from gevent import GreenletExit
from gevent import socket
from sqlalchemy.exc import StatementError
from inbox.util.concurrency import retry_with_logging
class MockLogger(object):
def __init__(self):
self.call_count = 0
def error(self, *args, **kw... | 4,725 | Python | .py | 105 | 36.933333 | 86 | 0.671457 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,628 | test_actions.py | nylas_sync-engine/inbox/test/imap/test_actions.py | # flake8: noqa: F401, F811
# -*- coding: utf-8 -*-
import mock
import pytest
import gevent
from flanker import mime
from inbox.actions.base import (change_labels, save_draft, update_draft,
delete_draft, create_folder, update_folder,
delete_folder, create_l... | 9,303 | Python | .py | 174 | 43.747126 | 94 | 0.646574 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,629 | test_smtp.py | nylas_sync-engine/inbox/test/imap/test_smtp.py | import smtplib
import pytest
import mock
from inbox.sendmail.base import SendMailException
from inbox.sendmail.smtp.postel import SMTPConnection
from nylas.logging import get_logger
@pytest.mark.networkrequired
def test_use_smtp_over_ssl():
# Auth won't actually work but we just want to test connection
# ini... | 3,365 | Python | .py | 70 | 32.214286 | 73 | 0.551294 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,630 | test_save_folder_names.py | nylas_sync-engine/inbox/test/imap/test_save_folder_names.py | from inbox.crispin import RawFolder
from inbox.mailsync.backends.imap.monitor import ImapSyncMonitor
from inbox.mailsync.backends.gmail import GmailSyncMonitor
from inbox.models import Folder, Label, Category
from inbox.models.category import EPOCH
def test_imap_save_generic_folder_names(db, default_account):
mon... | 8,933 | Python | .py | 206 | 35.76699 | 77 | 0.643902 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,631 | test_crispin_client.py | nylas_sync-engine/inbox/test/imap/test_crispin_client.py | # -*- coding: utf-8 -*-
"""
Basic tests for GmailCrispinClient/CrispinClient methods. We replace
imapclient.IMAPClient._imap by a mock in order to test these. In particular, we
want to test that we handle unsolicited FETCH responses, which may be returned
by some providers (Gmail, Fastmail).
"""
from datetime import da... | 25,991 | Python | .py | 546 | 38.234432 | 79 | 0.577119 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,632 | test_full_imap_enabled.py | nylas_sync-engine/inbox/test/imap/test_full_imap_enabled.py | import pytest
from imapclient import IMAPClient
from mock import Mock
from inbox.auth.generic import GenericAuthHandler
from inbox.basicauth import UserRecoverableConfigError
class MockIMAPClient(IMAPClient):
def __init__(self):
super(MockIMAPClient, self).__init__('randomhost')
def _create_IMAP4(s... | 1,341 | Python | .py | 37 | 28.945946 | 66 | 0.660728 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,633 | test_folder_sync.py | nylas_sync-engine/inbox/test/imap/test_folder_sync.py | # flake8: noqa: F401, F811
import pytest
from hashlib import sha256
from gevent.lock import BoundedSemaphore
from sqlalchemy.orm.exc import ObjectDeletedError
from inbox.models import Folder, Message
from inbox.models.backends.imap import (ImapFolderSyncStatus, ImapUid,
ImapFolde... | 14,638 | Python | .py | 273 | 38.578755 | 87 | 0.584615 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,634 | test_update_metadata.py | nylas_sync-engine/inbox/test/imap/test_update_metadata.py | import pytest
import json
from inbox.crispin import GmailFlags, Flags
from inbox.models.backends.imap import ImapUid
from inbox.mailsync.backends.imap.common import (update_metadata,
update_message_metadata)
from inbox.test.util.base import (add_fake_message, add_fake_im... | 3,732 | Python | .py | 65 | 44.292308 | 79 | 0.593049 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,635 | test_delete_handling.py | nylas_sync-engine/inbox/test/imap/test_delete_handling.py | # flake8: noqa: F401, F811
from datetime import datetime, timedelta
import pytest
from sqlalchemy import desc
import gevent
from gevent.lock import Semaphore
from sqlalchemy.orm.exc import ObjectDeletedError
from inbox.crispin import GmailFlags
from inbox.mailsync.backends.imap.common import (remove_deleted_uids,
... | 12,521 | Python | .py | 243 | 39.415638 | 84 | 0.628866 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,636 | test_labels.py | nylas_sync-engine/inbox/test/imap/test_labels.py | import json
import pytest
from inbox.mailsync.backends.imap.common import update_message_metadata
from inbox.test.util.base import (default_account, add_fake_folder, add_fake_message,
add_fake_thread, add_fake_imapuid)
from inbox.test.api.base import api_client
__all__ = ['default_accou... | 11,067 | Python | .py | 223 | 43.017937 | 85 | 0.65339 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,637 | test_pooling.py | nylas_sync-engine/inbox/test/imap/test_pooling.py | import imaplib
import socket
import gevent
import pytest
import mock
from backports import ssl
from inbox.crispin import CrispinConnectionPool
class TestableConnectionPool(CrispinConnectionPool):
def _set_account_info(self):
pass
def _new_connection(self):
return mock.Mock()
def test_poo... | 1,871 | Python | .py | 52 | 30.557692 | 70 | 0.709695 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,638 | test_folder_state.py | nylas_sync-engine/inbox/test/imap/test_folder_state.py | from inbox.crispin import RawFolder
from inbox.models import Folder
from inbox.mailsync.backends.imap.monitor import ImapSyncMonitor
from inbox.models.backends.imap import ImapFolderInfo, ImapFolderSyncStatus
def add_imap_status_info_rows(folder_id, account_id, db_session):
"""Add placeholder ImapFolderSyncStatus... | 3,043 | Python | .py | 62 | 41.854839 | 79 | 0.706676 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,639 | data.py | nylas_sync-engine/inbox/test/imap/data.py | """This module defines strategies for generating test data for IMAP sync, all
well as a mock IMAPClient isntance that can be used to deterministically test
aspects of IMAP sync.
See https://hypothesis.readthedocs.org/en/latest/data.html for more information
about how this works."""
import string
import os
import tempf... | 2,704 | Python | .py | 79 | 30.037975 | 79 | 0.694434 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,640 | test_actions_syncback.py | nylas_sync-engine/inbox/test/imap/network/test_actions_syncback.py | from inbox.test.util.crispin import crispin_client
ACCOUNT_ID = 1
NAMESPACE_ID = 1
THREAD_ID = 2
# Unit tests for the functions, not the queue runners. These tests use a real
# Gmail test account and idempotently put the account back to the state it
# started in when the test is done. They intentionally make the loca... | 5,014 | Python | .py | 85 | 50.270588 | 78 | 0.693703 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,641 | test_drafts_syncback.py | nylas_sync-engine/inbox/test/imap/network/test_drafts_syncback.py | import uuid
from datetime import datetime
import pytest
from inbox.test.util.crispin import crispin_client
ACCOUNT_ID = 1
NAMESPACE_ID = 1
THREAD_ID = 2
# These tests use a real Gmail test account and idempotently put the account
# back to the state it started in when the test is done.
@pytest.fixture(scope='func... | 3,706 | Python | .py | 77 | 40.194805 | 79 | 0.668795 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,642 | test_send.py | nylas_sync-engine/inbox/test/imap/network/test_send.py | import json
from datetime import datetime
import pytest
from inbox.test.util.base import default_account
from inbox.test.util.crispin import crispin_client
from inbox.test.api.base import api_client
__all__ = ['default_account', 'api_client']
@pytest.fixture
def example_draft(db, default_account):
return {
... | 1,752 | Python | .py | 38 | 38.342105 | 78 | 0.647024 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,643 | test_secret.py | nylas_sync-engine/inbox/test/security/test_secret.py | # -*- coding: UTF-8 -*-
import pytest
from inbox.auth.gmail import GmailAuthHandler
from inbox.models.secret import Secret
SHARD_ID = 0
ACCOUNT_ID = 1
@pytest.mark.parametrize('encrypt', [True, False])
def test_secret(db, config, encrypt):
"""
If encryption is enabled, ensure that:
* secrets are encrypt... | 4,084 | Python | .py | 108 | 31.324074 | 77 | 0.6554 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,644 | test_blobstorage.py | nylas_sync-engine/inbox/test/security/test_blobstorage.py | import zlib
import hypothesis
from inbox.security.blobstorage import encode_blob, decode_blob
# This will run the test for a bunch of randomly-chosen values of sample_input.
@hypothesis.given(str, bool)
def test_blobstorage(config, sample_input, encrypt):
config['ENCRYPT_SECRETS'] = encrypt
assert decode_blob... | 1,158 | Python | .py | 28 | 37 | 79 | 0.732206 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,645 | test_smtp_ssl.py | nylas_sync-engine/inbox/test/security/test_smtp_ssl.py | # flake8: noqa: F811
import os
import sys
import ssl
import smtpd
import socket
import asyncore
import datetime
import pytest
import gevent
from inbox.test.util.base import default_account
from inbox.test.api.base import api_client, new_api_client
smtpd.DEBUGSTREAM = sys.stderr
__all__ = ['api_client', 'default_acc... | 3,315 | Python | .py | 76 | 34.013158 | 101 | 0.618187 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,646 | test_heartbeat.py | nylas_sync-engine/inbox/test/heartbeat/test_heartbeat.py | # flake8: noqa: F401, F811
import pytest
import json
import time
from datetime import datetime, timedelta
from inbox.heartbeat.store import (HeartbeatStore, HeartbeatStatusProxy,
HeartbeatStatusKey)
from inbox.heartbeat.status import (clear_heartbeat_status,
... | 4,639 | Python | .py | 113 | 34.309735 | 78 | 0.671263 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,647 | test_auth.py | nylas_sync-engine/inbox/test/api/test_auth.py | import json
from base64 import b64encode
from inbox.test.util.base import generic_account, db # noqa
from inbox.test.api.base import new_api_client # noqa
def test_no_auth(db, generic_account): # noqa
# Because we're using the generic_account namespace
api_client = new_api_client(db, generic_account.nam... | 1,866 | Python | .py | 38 | 43.578947 | 66 | 0.70155 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,648 | test_events.py | nylas_sync-engine/inbox/test/api/test_events.py | import json
from inbox.api.ns_api import API_VERSIONS
from inbox.sqlalchemy_ext.util import generate_public_id
from inbox.models import Event, Calendar
from inbox.test.util.base import db, calendar, add_fake_event
from inbox.test.api.base import api_client
__all__ = ['api_client', 'calendar', 'db']
def test_create_... | 13,364 | Python | .py | 299 | 37.732441 | 81 | 0.605038 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,649 | test_folders.py | nylas_sync-engine/inbox/test/api/test_folders.py | # flake8: noqa: F401, F811
import mock
import gevent
from inbox.test.api.base import imap_api_client
from inbox.test.util.base import add_fake_folder, add_fake_category
from inbox.util.testutils import mock_imapclient # noqa
# Check that folders of the form INBOX.A.B get converted by the API
# to A/B.
def test_fold... | 2,860 | Python | .py | 59 | 42.237288 | 78 | 0.695621 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,650 | test_data_processing.py | nylas_sync-engine/inbox/test/api/test_data_processing.py | import json
from inbox.models import DataProcessingCache
from sqlalchemy.orm.exc import NoResultFound
from inbox.test.util.base import (add_fake_thread,
add_fake_message, default_namespace)
from inbox.test.api.base import api_client
__all__ = ['api_client', 'default_namespace']
def test... | 5,604 | Python | .py | 125 | 33.768 | 73 | 0.567265 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,651 | test_contacts.py | nylas_sync-engine/inbox/test/api/test_contacts.py | from inbox.models import Contact
from inbox.test.util.base import contact_sync, contacts_provider
from inbox.test.api.base import api_client
__all__ = ['contacts_provider', 'contact_sync', 'api_client']
def test_api_list(contacts_provider, contact_sync, db, api_client,
default_namespace):
conta... | 2,046 | Python | .py | 42 | 39.357143 | 68 | 0.650402 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,652 | test_streaming.py | nylas_sync-engine/inbox/test/api/test_streaming.py | import json
import time
from gevent import Greenlet
import pytest
from inbox.test.util.base import add_fake_message
from inbox.util.url import url_concat
from inbox.test.api.base import api_client
GEVENT_EPSILON = .5 # Greenlet switching time. VMs on Macs suck :()
LONGPOLL_EPSILON = 2 + GEVENT_EPSILON # API impleme... | 6,715 | Python | .py | 140 | 37.657143 | 78 | 0.601039 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,653 | test_messages.py | nylas_sync-engine/inbox/test/api/test_messages.py | # flake8: noqa: F811
import json
import mock
import pytest
from inbox.api.ns_api import API_VERSIONS
from inbox.util.blockstore import get_from_blockstore
from inbox.test.util.base import (add_fake_message, default_namespace,
new_message_from_synced, mime_message, thread,
... | 11,021 | Python | .py | 222 | 40.432432 | 80 | 0.635457 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,654 | test_files.py | nylas_sync-engine/inbox/test/api/test_files.py | # -*- coding: utf-8 -*-
import os
import md5
import json
import mock
from datetime import datetime
import pytest
from inbox.models import Block, Part
from inbox.test.api.base import api_client
from inbox.util.testutils import FILENAMES
__all__ = ['api_client']
@pytest.fixture
def draft(db, default_account):
re... | 7,197 | Python | .py | 154 | 40.25974 | 91 | 0.664703 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,655 | test_searching.py | nylas_sync-engine/inbox/test/api/test_searching.py | # -*- coding: utf-8 -*-
# flake8: noqa: F401, F811
import datetime
import json
import mock
import requests
import pytest
from pytest import fixture
from inbox.models import Folder
from inbox.search.base import get_search_client
from inbox.search.backends.gmail import GmailSearchClient
from inbox.search.backends.imap im... | 18,827 | Python | .py | 367 | 35.569482 | 92 | 0.554635 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,656 | test_events_recurring.py | nylas_sync-engine/inbox/test/api/test_events_recurring.py | # flake8: noqa: F401
import arrow
import urllib
import pytest
from inbox.models import Event, Calendar
from inbox.test.api.base import api_client
from inbox.test.util.base import message
__all__ = ['api_client']
@pytest.fixture(params=[{"all_day": True}, {"all_day": False}])
def recurring_event(db, default_namespace... | 6,892 | Python | .py | 151 | 37.198675 | 76 | 0.624963 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,657 | test_drafts.py | nylas_sync-engine/inbox/test/api/test_drafts.py | # -*- coding: utf-8 -*-
"""Test local behavior for the drafts API. Doesn't test syncback or actual
sending."""
import json
import os
from datetime import datetime
from freezegun import freeze_time
import pytest
from inbox.test.util.base import add_fake_message, add_fake_thread
from inbox.test.api.base import api_clie... | 15,574 | Python | .py | 361 | 35.590028 | 82 | 0.618235 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,658 | test_event_when.py | nylas_sync-engine/inbox/test/api/test_event_when.py | import json
import pytest
import arrow
from inbox.test.api.base import api_client
__all__ = ['api_client']
class CreateError(Exception):
pass
def _verify_create(ns_id, api_client, e_data):
e_resp = api_client.post_data('/events', e_data)
if e_resp.status_code != 200:
raise CreateError("Expect... | 9,203 | Python | .py | 201 | 36.965174 | 77 | 0.596799 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,659 | test_invalid_account.py | nylas_sync-engine/inbox/test/api/test_invalid_account.py | import datetime
import json
import mock
import pytest
import requests
from inbox.test.util.base import db
from inbox.test.api.base import api_client
__all__ = ['api_client', 'db']
@pytest.fixture
def token_manager(monkeypatch):
monkeypatch.setattr(
'inbox.models.backends.gmail.g_token_manager.get_token... | 3,563 | Python | .py | 88 | 34.386364 | 77 | 0.649362 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,660 | test_calendars.py | nylas_sync-engine/inbox/test/api/test_calendars.py | from inbox.test.util.base import add_fake_event
from inbox.models import Calendar
from inbox.test.api.base import api_client
from inbox.test.util.base import db, default_namespace
__all__ = ['api_client', 'db', 'default_namespace']
def test_get_calendar(db, default_namespace, api_client):
cal = Calendar(
... | 3,006 | Python | .py | 74 | 33.243243 | 74 | 0.62706 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,661 | base.py | nylas_sync-engine/inbox/test/api/base.py | import json
from pytest import fixture, yield_fixture
from base64 import b64encode
def new_api_client(db, namespace):
from inbox.api.srv import app
app.config['TESTING'] = True
with app.test_client() as c:
return TestAPIClient(c, namespace.public_id)
@yield_fixture
def api_client(db, default_nam... | 2,007 | Python | .py | 44 | 37.681818 | 77 | 0.666153 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,662 | test_folders_labels.py | nylas_sync-engine/inbox/test/api/test_folders_labels.py | # flake8: noqa: F811
import json
from datetime import datetime
import pytest
from freezegun import freeze_time
from inbox.api.ns_api import API_VERSIONS
from inbox.models.category import Category, EPOCH
from inbox.test.util.base import (add_fake_message, thread, add_fake_thread,
generic_... | 12,102 | Python | .py | 243 | 41.432099 | 86 | 0.638244 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,663 | test_account.py | nylas_sync-engine/inbox/test/api/test_account.py | # flake8: noqa: F811
from inbox.test.util.base import (generic_account, gmail_account, db,
add_fake_yahoo_account)
from inbox.test.api.base import api_client, new_api_client
__all__ = ['db', 'api_client', 'generic_account', 'gmail_account']
def test_account(db, api_client, generic_accoun... | 3,554 | Python | .py | 72 | 43.597222 | 74 | 0.685335 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,664 | test_validation.py | nylas_sync-engine/inbox/test/api/test_validation.py | # -*- coding: utf-8 -*-
import json
from inbox.models import Namespace
from inbox.api.validation import noop_event_update, valid_email
from inbox.test.util.base import db, calendar, add_fake_event
from inbox.test.api.base import api_client
__all__ = ['api_client', 'db', 'calendar']
# TODO(emfree): Add more comprehen... | 3,246 | Python | .py | 63 | 43.984127 | 76 | 0.645662 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,665 | test_views.py | nylas_sync-engine/inbox/test/api/test_views.py | # flake8: noqa: F811
import pytest
from inbox.test.api.base import api_client, new_api_client
from inbox.test.util.base import generic_account
__all__ = ['api_client', 'generic_account']
# Label views should only work for Gmail accounts. folders 404
@pytest.mark.parametrize('resource_name',
... | 1,362 | Python | .py | 25 | 47.2 | 72 | 0.666416 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,666 | test_event_participants.py | nylas_sync-engine/inbox/test/api/test_event_participants.py | import pytest
import json
from inbox.test.util.base import calendar
from inbox.test.api.base import api_client
__all__ = ['calendar', 'api_client']
# TODO(emfree) WTF is all this crap anyways?
def test_api_create(db, api_client, calendar):
e_data = {
'title': 'Friday Office Party',
'when': {'t... | 15,338 | Python | .py | 353 | 34.209632 | 77 | 0.566069 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,667 | test_threads.py | nylas_sync-engine/inbox/test/api/test_threads.py | import json
import datetime
import pytest
from inbox.api.ns_api import API_VERSIONS
from inbox.test.util.base import (add_fake_message, default_account,
add_fake_thread, db)
from inbox.test.api.base import api_client
__all__ = ['db', 'api_client', 'default_account']
def test_thread_recei... | 6,085 | Python | .py | 113 | 43.99115 | 80 | 0.644205 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,668 | test_filtering.py | nylas_sync-engine/inbox/test/api/test_filtering.py | import json
import datetime
import calendar
from sqlalchemy import desc
from inbox.models import Message, Thread, Namespace, Block, Category
from inbox.util.misc import dt_to_timestamp
from inbox.test.util.base import (test_client, add_fake_message,
add_fake_thread)
from inbox.test.api.base... | 14,678 | Python | .py | 277 | 40.956679 | 84 | 0.591832 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,669 | test_sending.py | nylas_sync-engine/inbox/test/api/test_sending.py | # -*- coding: utf-8 -*-
# flake8: noqa: F811
import smtplib
import json
import time
import pytest
import re
import traceback
import contextlib
from flanker import mime
import nylas.logging
import inbox.api.ns_api
from inbox.basicauth import OAuthError
from inbox.models import Message, Event
from inbox.test.util.base im... | 38,121 | Python | .py | 777 | 37.184041 | 101 | 0.57541 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,670 | conftest.py | nylas_sync-engine/inbox/test/system/conftest.py | # This file contains pytest fixtures as well as some config
import os
import platform
API_BASE = "http://%s:%s" % (os.getenv("API_PORT_5555_TCP_ADDR", "localhost"), os.getenv("API_PORT_5555_TCP_PORT", "5555"))
TEST_MAX_DURATION_SECS = 360
TEST_GRANULARITY_CHECK_SECS = 0.1
from time import time, sleep
from client impo... | 3,467 | Python | .py | 77 | 35.896104 | 123 | 0.632 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,671 | test_auth.py | nylas_sync-engine/inbox/test/system/test_auth.py | import pytest
from inbox.models.session import session_scope
from client import NylasTestClient
from conftest import (timeout_loop, credentials, create_account, API_BASE)
try:
# If there's no broken accounts file, well, tough luck but don't crash.
# This should only be a problem locally; the jenkins jobs gene... | 2,080 | Python | .py | 50 | 36.08 | 77 | 0.693148 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,672 | client.py | nylas_sync-engine/inbox/test/system/client.py | import os
from inbox import APIClient
class NylasTestClient(APIClient):
def __init__(self, email_address=None, api_base=os.getenv("INBOX_API_PORT_5555_TCP_ADDR", "http://localhost:5555")):
self.email_address = email_address
APIClient.__init__(self, None, None, None, api_base)
@property
d... | 535 | Python | .py | 13 | 34 | 120 | 0.671815 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,673 | test_events.py | nylas_sync-engine/inbox/test/system/test_events.py | import pytest
import random
import datetime
import time
from inbox.client.errors import NotFoundError
from conftest import calendar_accounts, timeout_loop
from inbox.models.session import new_session
from inbox.models import ActionLog
from inbox.ignition import main_engine
random.seed(None)
@pytest.yield_fixture(sc... | 3,387 | Python | .py | 89 | 33.52809 | 77 | 0.704518 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,674 | test_google_events.py | nylas_sync-engine/inbox/test/system/test_google_events.py | # flake8: noqa: F401, F811
# Google calendar-specific event creation tests.
#
# This is a little hackish -- test_events.py defines a bunch of helper
# functions to check that an event appears on the API server. We redefine
# these functions to check instead for changes to the event on
# the Google backend.
import pyt... | 2,647 | Python | .py | 66 | 33.681818 | 75 | 0.677344 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,675 | test_drafts.py | nylas_sync-engine/inbox/test/system/test_drafts.py | # -*- coding: utf-8 -*-
import pytest
import time
from conftest import timeout_loop, all_accounts
from inbox.client.errors import NotFoundError
@timeout_loop('file')
def wait_for_file(client, file_id):
try:
client.files.find(file_id)
return True
except NotFoundError:
return False
@ti... | 1,549 | Python | .py | 48 | 27.5 | 78 | 0.676747 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,676 | outlook_auth_helper.py | nylas_sync-engine/inbox/test/system/outlook_auth_helper.py | import requests
from HTMLParser import HTMLParser
from inbox.auth.outlook import OutlookAuthHandler
from inbox.util.url import url_concat
import re
class OutlookAuthParser(HTMLParser):
_in_script = False
params = {}
action = None
def handle_starttag(self, tag, attrs):
if tag == 'script':
... | 4,320 | Python | .py | 110 | 29.409091 | 75 | 0.560345 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,677 | random_words.py | nylas_sync-engine/inbox/test/system/random_words.py | #!/usr/bin/env python
import string
import random
import json
DICT_FILE = '/etc/dictionaries-common/words'
def get_words():
words = []
try:
with open(DICT_FILE, 'r') as f:
words.extend(f.read().split('\n'))
except IOError:
try:
with open('LICENSE', 'r') as f:
... | 2,194 | Python | .py | 56 | 29.303571 | 86 | 0.515809 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,678 | test_labels.py | nylas_sync-engine/inbox/test/system/test_labels.py | # gmail-specific label handling tests.
import pytest
import random
from datetime import datetime
from inbox.crispin import writable_connection_pool
from inbox.models.session import session_scope
from inbox.models import Account
from inbox.mailsync.backends.imap.generic import uidvalidity_cb
from conftest import gmail... | 2,354 | Python | .py | 49 | 40.734694 | 79 | 0.67701 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,679 | google_auth_helper.py | nylas_sync-engine/inbox/test/system/google_auth_helper.py | import requests
from HTMLParser import HTMLParser
from inbox.auth.gmail import GmailAuthHandler
from inbox.util.url import url_concat
class GoogleAuthParser(HTMLParser):
_in_form = False
def handle_starttag(self, tag, attrs):
if tag == 'form':
self._in_form = True
self.params... | 2,818 | Python | .py | 79 | 25.962025 | 71 | 0.563261 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,680 | test_sending.py | nylas_sync-engine/inbox/test/system/test_sending.py | # -*- coding: utf-8 -*-
import pytest
from time import strftime
from conftest import timeout_loop, all_accounts
from random_words import random_words
from inbox.util.url import provider_from_address
import json
@timeout_loop('send')
def wait_for_send(client, subject):
thread_query = client.threads.where(subject=s... | 4,310 | Python | .py | 94 | 35.925532 | 78 | 0.603675 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,681 | __init__.py | nylas_sync-engine/inbox/test/providers/__init__.py | # Allow out-of-tree backend submodules.
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
from inbox.util.misc import register_backends
module_registry = register_backends(__name__, __path__)
| 217 | Python | .py | 5 | 42.4 | 55 | 0.740566 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,682 | test_merge.py | nylas_sync-engine/inbox/test/events/test_merge.py | # Basic tests for events merging.
from inbox.models.event import Event
def fake_event():
return Event(title="The fifth element",
participants=[{"name": "Ronald Zubar",
"email": "ronald@example.com",
"status": "noreply",
... | 2,980 | Python | .py | 67 | 34.208955 | 70 | 0.589699 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,683 | test_google_events.py | nylas_sync-engine/inbox/test/events/test_google_events.py | import arrow
import json
import gevent
import mock
import pytest
import requests
from inbox.basicauth import AccessNotEnabledError
from inbox.events.google import GoogleEventsProvider, parse_event_response
from inbox.models import Calendar, Event
from inbox.models.event import RecurringEvent, RecurringEventOverride
d... | 22,972 | Python | .py | 553 | 30.927667 | 93 | 0.564973 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,684 | test_inviting.py | nylas_sync-engine/inbox/test/events/test_inviting.py | # -*- coding: utf-8 -*-
# flake8: noqa: F401,F811
from inbox.test.util.base import event
def test_invite_generation(event, default_account):
from inbox.events.ical import generate_icalendar_invite
event.sequence_number = 1
event.participants = [{'email': 'helena@nylas.com'},
{'e... | 2,885 | Python | .py | 57 | 41.298246 | 77 | 0.641476 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,685 | test_recurrence.py | nylas_sync-engine/inbox/test/events/test_recurrence.py | import pytest
import arrow
import datetime
from dateutil import tz
from dateutil.rrule import rrulestr
from datetime import timedelta
from inbox.models.event import Event, RecurringEvent, RecurringEventOverride
from inbox.models.when import Date, Time, DateSpan, TimeSpan
from inbox.events.remote_sync import handle_even... | 24,497 | Python | .py | 511 | 37.056751 | 82 | 0.607513 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,686 | test_rsvp.py | nylas_sync-engine/inbox/test/events/test_rsvp.py | from inbox.models.event import Event
from inbox.events.ical import rsvp_recipient
def test_rsvp_recipient(default_account, message):
assert rsvp_recipient(None) is None
event = Event()
event.owner = 'Georges Perec <georges@gmail.com>'
assert rsvp_recipient(event) == 'georges@gmail.com'
event = E... | 1,116 | Python | .py | 28 | 34.892857 | 64 | 0.688951 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,687 | test_events_util.py | nylas_sync-engine/inbox/test/events/test_events_util.py | # -*- coding: utf-8 -*-
# flake8: noqa: F811
from datetime import datetime
from inbox.models.event import Event
def test_base36_validation():
from inbox.events.util import valid_base36
assert valid_base36("1234zerzerzedsfsd") is True
assert valid_base36("zerzerzedsfsd") is True
assert valid_base36("Ã... | 2,831 | Python | .py | 58 | 42.224138 | 83 | 0.65676 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,688 | test_datetime.py | nylas_sync-engine/inbox/test/events/test_datetime.py | import arrow
from datetime import timedelta
from inbox.models.when import (Time, TimeSpan, Date, DateSpan, parse_as_when,
parse_utc)
from inbox.models.event import time_parse
from inbox.events.util import (google_to_event_time, parse_google_time,
parse_date... | 5,401 | Python | .py | 136 | 33.897059 | 77 | 0.637684 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,689 | test_ics_parsing.py | nylas_sync-engine/inbox/test/events/test_ics_parsing.py | # -*- coding: utf-8 -*-
# flake8: noqa: F401
import pytest
import arrow
from inbox.models.event import Event, RecurringEvent
from inbox.events.util import MalformedEventError
from inbox.events.ical import events_from_ics, import_attached_events
from inbox.test.util.base import (absolute_path, add_fake_calendar,
... | 17,314 | Python | .py | 357 | 40.218487 | 80 | 0.656956 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,690 | test_sync.py | nylas_sync-engine/inbox/test/events/test_sync.py | # flake8: noqa: F401
from datetime import datetime
from inbox.events.remote_sync import EventSync
from inbox.events.util import CalendarSyncResponse
from inbox.models import Calendar, Event, Transaction
from inbox.models.constants import MAX_INDEXABLE_LENGTH
# Placeholder values for non-nullable attributes
default_pa... | 8,318 | Python | .py | 173 | 38.589595 | 222 | 0.640785 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,691 | test_gpush_calendar_notifications.py | nylas_sync-engine/inbox/test/webhooks/test_gpush_calendar_notifications.py | import pytest
from datetime import datetime, timedelta
from inbox.models.calendar import Calendar
from inbox.test.util.base import webhooks_client
__all__ = ['webhooks_client']
CALENDAR_LIST_PATH = '/calendar_list_update/{}'
CALENDAR_PATH = '/calendar_update/{}'
ACCOUNT_WATCH_UUID = 'this_is_a_unique_identifier'
CAL... | 7,124 | Python | .py | 143 | 44.538462 | 78 | 0.728623 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,692 | test_imap_smtp_auth.py | nylas_sync-engine/inbox/test/auth/test_imap_smtp_auth.py | import pytest
from inbox.auth.generic import GenericAuthHandler
from inbox.basicauth import ValidationError
creds = [
{
'provider': 'yahoo',
'settings': {
'name': 'Y.Y!',
'locale': 'fr',
'email': 'cypresstest@yahoo.com',
'password': 'IHate2Gmail'}
... | 3,076 | Python | .py | 78 | 30.564103 | 79 | 0.591304 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,693 | test_ssl_auth.py | nylas_sync-engine/inbox/test/auth/test_ssl_auth.py | import copy
import pytest
from imapclient import IMAPClient
from inbox.auth.generic import GenericAuthHandler, create_imap_connection
from inbox.sendmail.base import SendMailException
from inbox.sendmail.smtp.postel import SMTPClient
from inbox.basicauth import SSLNotSupportedError
settings = [
{
'provi... | 4,017 | Python | .py | 101 | 31.722772 | 76 | 0.638789 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,694 | __init__.py | nylas_sync-engine/inbox/test/auth/__init__.py | # Allow out-of-tree submodules.
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
| 107 | Python | .py | 3 | 34.666667 | 42 | 0.701923 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,695 | test_generic_auth.py | nylas_sync-engine/inbox/test/auth/test_generic_auth.py | # -*- coding: utf-8 -*-
import copy
import socket
import pytest
from inbox.util.url import parent_domain
from inbox.models.account import Account
from inbox.auth.generic import GenericAuthHandler
from inbox.basicauth import SettingUpdateError, ValidationError
settings = {
'provider': 'custom',
'settings': {... | 10,883 | Python | .py | 244 | 38.930328 | 85 | 0.691886 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,696 | test_gmail_auth.py | nylas_sync-engine/inbox/test/auth/test_gmail_auth.py | import copy
import mock
import pytest
from inbox.models.account import Account
from inbox.auth.gmail import GmailAuthHandler
from inbox.basicauth import ImapSupportDisabledError
settings = {'email': 't.est@gmail.com',
'name': 'T.Est',
'refresh_token': 'MyRefreshToken',
'scope': ''... | 3,994 | Python | .py | 94 | 36.914894 | 81 | 0.710676 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,697 | test_gmail_auth_credentials.py | nylas_sync-engine/inbox/test/auth/test_gmail_auth_credentials.py | # -*- coding: UTF-8 -*-
import pytest
from sqlalchemy.orm import joinedload, object_session
from inbox.auth.gmail import GmailAuthHandler
from inbox.models.session import session_scope
from inbox.models.account import Account
from inbox.models.backends.gmail import (GOOGLE_CALENDAR_SCOPE,
... | 16,309 | Python | .py | 391 | 34.015345 | 79 | 0.655911 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,698 | __init__.py | nylas_sync-engine/inbox/test/auth/providers/__init__.py | # Allow out-of-tree submodules.
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
| 107 | Python | .py | 3 | 34.666667 | 42 | 0.701923 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,699 | mock_gmail.py | nylas_sync-engine/inbox/test/auth/providers/mock_gmail.py | """
Mock provider which triggers failure at a specific step of the
authentication process depending on email entered.
Note that this uses live Gmail authentication, so auth should be called
using real email addresses with + parameters, eg.
foobar+no_all_mail@gmail.com.
* Gmail All Mail folder missing
* Gmail Trash fol... | 2,331 | Python | .py | 55 | 36.345455 | 76 | 0.729167 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |