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,500 | test_smtp.py | nylas_sync-engine/tests/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,501 | test_save_folder_names.py | nylas_sync-engine/tests/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,502 | test_crispin_client.py | nylas_sync-engine/tests/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,503 | test_full_imap_enabled.py | nylas_sync-engine/tests/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,504 | test_folder_sync.py | nylas_sync-engine/tests/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,633 | Python | .py | 273 | 38.56044 | 87 | 0.58454 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,505 | test_update_metadata.py | nylas_sync-engine/tests/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 tests.util.base import (add_fake_message, add_fake_imapuid... | 3,727 | Python | .py | 65 | 44.215385 | 79 | 0.592765 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,506 | test_delete_handling.py | nylas_sync-engine/tests/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,
... | 11,311 | Python | .py | 220 | 39.222727 | 84 | 0.625215 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,507 | test_labels.py | nylas_sync-engine/tests/imap/test_labels.py | import json
import pytest
from inbox.mailsync.backends.imap.common import update_message_metadata
from tests.util.base import (default_account, add_fake_folder, add_fake_message,
add_fake_thread, add_fake_imapuid)
from tests.api.base import api_client
__all__ = ['default_account', 'api_... | 11,057 | Python | .py | 223 | 42.973094 | 81 | 0.653254 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,508 | test_pooling.py | nylas_sync-engine/tests/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,811 | Python | .py | 51 | 30 | 70 | 0.706758 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,509 | test_folder_state.py | nylas_sync-engine/tests/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,510 | data.py | nylas_sync-engine/tests/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
from hypothesis import ... | 2,498 | Python | .py | 74 | 29.378378 | 79 | 0.688279 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,511 | test_actions_syncback.py | nylas_sync-engine/tests/imap/network/test_actions_syncback.py | from tests.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 local Inb... | 5,009 | Python | .py | 85 | 50.211765 | 78 | 0.693594 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,512 | test_drafts_syncback.py | nylas_sync-engine/tests/imap/network/test_drafts_syncback.py | import uuid
from datetime import datetime
import pytest
from tests.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='function'... | 3,701 | Python | .py | 77 | 40.12987 | 79 | 0.668613 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,513 | test_send.py | nylas_sync-engine/tests/imap/network/test_send.py | import json
from datetime import datetime
import pytest
from tests.util.base import default_account
from tests.util.crispin import crispin_client
from tests.api.base import api_client
__all__ = ['default_account', 'api_client']
@pytest.fixture
def example_draft(db, default_account):
return {
'subject':... | 1,737 | Python | .py | 38 | 37.947368 | 78 | 0.64566 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,514 | test_secret.py | nylas_sync-engine/tests/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,515 | test_blobstorage.py | nylas_sync-engine/tests/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,516 | test_smtp_ssl.py | nylas_sync-engine/tests/security/test_smtp_ssl.py | # flake8: noqa: F811
import ssl
import smtpd
import asyncore
import datetime
import pytest
import gevent
from tests.util.base import default_account
from tests.api.base import api_client, new_api_client
__all__ = ['api_client', 'default_account']
SELF_SIGNED_CERTFILE = 'tests/data/self_signed_cert.pem'
SELF_SIGNED_... | 3,032 | Python | .py | 70 | 33.128571 | 82 | 0.609125 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,517 | conftest.py | nylas_sync-engine/tests/heartbeat/conftest.py | # flake8: noqa: F401
import pytest
from mockredis import mock_strict_redis_client
from inbox.heartbeat.store import HeartbeatStore
def mock_client():
mock_client = mock_strict_redis_client()
# Adding a couple of methods we use that mockredis doesn't support yet.
def scan_iter_patch(match=None, count=100... | 1,671 | Python | .py | 38 | 37.026316 | 75 | 0.681061 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,518 | test_heartbeat.py | nylas_sync-engine/tests/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,519 | conftest.py | nylas_sync-engine/tests/api/conftest.py | """ Fixtures don't go here; see util/base.py and friends. """
# Monkeypatch first, to prevent "AttributeError: 'module' object has no
# attribute 'poll'" errors when tests import socket, then monkeypatch.
from gevent import monkey
monkey.patch_all(aggressive=False)
import gevent_openssl
gevent_openssl.monkey_patch()
| 319 | Python | .py | 7 | 44.428571 | 71 | 0.790997 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,520 | test_auth.py | nylas_sync-engine/tests/api/test_auth.py | import json
from base64 import b64encode
from tests.util.base import generic_account, db # noqa
from tests.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.namespace)
... | 1,856 | Python | .py | 38 | 43.315789 | 66 | 0.701002 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,521 | test_events.py | nylas_sync-engine/tests/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 tests.util.base import db, calendar, add_fake_event
from tests.api.base import api_client
__all__ = ['api_client', 'calendar', 'db']
def test_create_event(db, ... | 13,354 | Python | .py | 299 | 37.698997 | 81 | 0.604888 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,522 | test_folders.py | nylas_sync-engine/tests/api/test_folders.py | # flake8: noqa: F401, F811
import mock
import gevent
from tests.api.base import imap_api_client
from tests.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_folder_strippi... | 2,850 | Python | .py | 59 | 42.067797 | 78 | 0.695245 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,523 | test_data_processing.py | nylas_sync-engine/tests/api/test_data_processing.py | import json
from inbox.models import DataProcessingCache
from sqlalchemy.orm.exc import NoResultFound
from tests.util.base import (add_fake_thread,
add_fake_message, default_namespace)
from tests.api.base import api_client
__all__ = ['api_client', 'default_namespace']
def test_contact_r... | 5,594 | Python | .py | 125 | 33.688 | 73 | 0.566838 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,524 | test_contacts.py | nylas_sync-engine/tests/api/test_contacts.py | from inbox.models import Contact
from tests.util.base import contact_sync, contacts_provider
from tests.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):
contacts_provid... | 2,036 | Python | .py | 42 | 39.119048 | 68 | 0.649646 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,525 | test_streaming.py | nylas_sync-engine/tests/api/test_streaming.py | import json
import time
from gevent import Greenlet
import pytest
from tests.util.base import add_fake_message
from inbox.util.url import url_concat
from tests.api.base import api_client
GEVENT_EPSILON = .5 # Greenlet switching time. VMs on Macs suck :()
LONGPOLL_EPSILON = 2 + GEVENT_EPSILON # API implementation po... | 6,705 | Python | .py | 140 | 37.585714 | 78 | 0.600734 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,526 | test_messages.py | nylas_sync-engine/tests/api/test_messages.py | # flake8: noqa: F811
import pytest
import json
from inbox.api.ns_api import API_VERSIONS
from inbox.util.blockstore import get_from_blockstore
from tests.util.base import (add_fake_message, default_namespace,
new_message_from_synced, mime_message, thread,
add_... | 10,045 | Python | .py | 202 | 40.648515 | 80 | 0.635908 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,527 | test_files.py | nylas_sync-engine/tests/api/test_files.py | # -*- coding: utf-8 -*-
import os
import md5
import json
from datetime import datetime
import pytest
from tests.api.base import api_client
__all__ = ['api_client']
FILENAMES = ['muir.jpg', 'LetMeSendYouEmail.wav', 'piece-jointe.jpg',
'andra-moi-ennepe.txt', 'long-non-ascii-filename.txt']
@pytest.fix... | 6,579 | Python | .py | 143 | 39.286713 | 78 | 0.650103 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,528 | test_searching.py | nylas_sync-engine/tests/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,817 | Python | .py | 367 | 35.542234 | 92 | 0.554501 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,529 | test_events_recurring.py | nylas_sync-engine/tests/api/test_events_recurring.py | # flake8: noqa: F401
import arrow
import urllib
import pytest
from inbox.models import Event, Calendar
from tests.api.base import api_client
from tests.util.base import message
__all__ = ['api_client']
@pytest.fixture(params=[{"all_day": True}, {"all_day": False}])
def recurring_event(db, default_namespace, request)... | 6,882 | Python | .py | 151 | 37.13245 | 76 | 0.624701 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,530 | test_drafts.py | nylas_sync-engine/tests/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 tests.util.base import add_fake_message, add_fake_thread
from tests.api.base import api_client
__all_... | 15,564 | Python | .py | 361 | 35.562327 | 82 | 0.618114 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,531 | test_event_when.py | nylas_sync-engine/tests/api/test_event_when.py | import json
import pytest
import arrow
from tests.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("Expected st... | 9,198 | Python | .py | 201 | 36.940299 | 77 | 0.596686 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,532 | test_invalid_account.py | nylas_sync-engine/tests/api/test_invalid_account.py | import datetime
import json
import mock
import pytest
import requests
from tests.util.base import db
from tests.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_for_email... | 3,553 | Python | .py | 88 | 34.272727 | 77 | 0.648924 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,533 | test_calendars.py | nylas_sync-engine/tests/api/test_calendars.py | from tests.util.base import add_fake_event
from inbox.models import Calendar
from tests.api.base import api_client
from tests.util.base import db, default_namespace
__all__ = ['api_client', 'db', 'default_namespace']
def test_get_calendar(db, default_namespace, api_client):
cal = Calendar(
namespace_id=... | 2,991 | Python | .py | 74 | 33.040541 | 74 | 0.626165 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,534 | base.py | nylas_sync-engine/tests/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,535 | test_folders_labels.py | nylas_sync-engine/tests/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 tests.util.base import (add_fake_message, thread, add_fake_thread,
generic_accou... | 12,092 | Python | .py | 243 | 41.390947 | 86 | 0.638107 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,536 | test_account.py | nylas_sync-engine/tests/api/test_account.py | # flake8: noqa: F811
from tests.util.base import (generic_account, gmail_account, db,
add_fake_yahoo_account)
from tests.api.base import api_client, new_api_client
__all__ = ['db', 'api_client', 'generic_account', 'gmail_account']
def test_account(db, api_client, generic_account, gmail_a... | 3,544 | Python | .py | 72 | 43.458333 | 74 | 0.685003 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,537 | test_validation.py | nylas_sync-engine/tests/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 tests.util.base import db, calendar, add_fake_event
from tests.api.base import api_client
__all__ = ['api_client', 'db', 'calendar']
# TODO(emfree): Add more comprehensive param... | 3,236 | Python | .py | 63 | 43.825397 | 76 | 0.645172 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,538 | test_views.py | nylas_sync-engine/tests/api/test_views.py | # flake8: noqa: F811
import pytest
from tests.api.base import api_client, new_api_client
from tests.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',
['messages... | 1,352 | Python | .py | 25 | 46.8 | 72 | 0.665405 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,539 | test_event_participants.py | nylas_sync-engine/tests/api/test_event_participants.py | import pytest
import json
from tests.util.base import calendar
from tests.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': {'time': 1407... | 15,328 | Python | .py | 353 | 34.181303 | 77 | 0.565912 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,540 | test_threads.py | nylas_sync-engine/tests/api/test_threads.py | import json
import datetime
import pytest
from inbox.api.ns_api import API_VERSIONS
from tests.util.base import (add_fake_message, default_account,
add_fake_thread, db)
from tests.api.base import api_client
__all__ = ['db', 'api_client', 'default_account']
def test_thread_received_recent... | 6,075 | Python | .py | 113 | 43.902655 | 80 | 0.643942 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,541 | test_filtering.py | nylas_sync-engine/tests/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 tests.util.base import (test_client, add_fake_message,
add_fake_thread)
from tests.api.base import ap... | 14,668 | Python | .py | 277 | 40.920578 | 84 | 0.591687 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,542 | test_sending.py | nylas_sync-engine/tests/api/test_sending.py | # -*- coding: utf-8 -*-
# flake8: noqa: F811
import smtplib
import json
import time
import pytest
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 tests.util.base import thread, me... | 36,546 | Python | .py | 743 | 37.121131 | 79 | 0.574967 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,543 | conftest.py | nylas_sync-engine/tests/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,419 | Python | .py | 76 | 35.802632 | 123 | 0.630709 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,544 | test_auth.py | nylas_sync-engine/tests/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,073 | Python | .py | 50 | 35.94 | 77 | 0.692078 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,545 | client.py | nylas_sync-engine/tests/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,546 | test_events.py | nylas_sync-engine/tests/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,547 | test_google_events.py | nylas_sync-engine/tests/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,548 | test_drafts.py | nylas_sync-engine/tests/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,549 | outlook_auth_helper.py | nylas_sync-engine/tests/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,550 | random_words.py | nylas_sync-engine/tests/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,551 | test_labels.py | nylas_sync-engine/tests/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,552 | google_auth_helper.py | nylas_sync-engine/tests/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,553 | test_sending.py | nylas_sync-engine/tests/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,554 | __init__.py | nylas_sync-engine/tests/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,555 | test_merge.py | nylas_sync-engine/tests/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,556 | test_google_events.py | nylas_sync-engine/tests/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,557 | test_inviting.py | nylas_sync-engine/tests/events/test_inviting.py | # -*- coding: utf-8 -*-
# flake8: noqa: F401,F811
from tests.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'},
{'email'... | 2,873 | Python | .py | 57 | 41.087719 | 77 | 0.640288 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,558 | test_recurrence.py | nylas_sync-engine/tests/events/test_recurrence.py | import pytest
import arrow
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_event_updates
from i... | 23,732 | Python | .py | 495 | 36.991919 | 82 | 0.606632 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,559 | test_rsvp.py | nylas_sync-engine/tests/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,560 | test_datetime.py | nylas_sync-engine/tests/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,561 | test_util.py | nylas_sync-engine/tests/events/test_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,541 | Python | .py | 54 | 40.351852 | 80 | 0.653862 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,562 | test_ics_parsing.py | nylas_sync-engine/tests/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 tests.util.base import (absolute_path, add_fake_calendar,
... | 17,309 | Python | .py | 357 | 40.204482 | 80 | 0.656913 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,563 | test_sync.py | nylas_sync-engine/tests/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
# Placeholder values for non-nullable attributes
default_params = dict(raw_data='',
busy=True... | 6,302 | Python | .py | 138 | 36.057971 | 74 | 0.632034 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,564 | test_gpush_calendar_notifications.py | nylas_sync-engine/tests/webhooks/test_gpush_calendar_notifications.py | import pytest
from datetime import datetime, timedelta
from inbox.models.calendar import Calendar
from tests.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'
CALENDAR... | 7,119 | Python | .py | 143 | 44.503497 | 78 | 0.728571 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,565 | test_imap_smtp_auth.py | nylas_sync-engine/tests/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,566 | test_ssl_auth.py | nylas_sync-engine/tests/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,567 | test_generic_auth.py | nylas_sync-engine/tests/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,568 | test_gmail_auth.py | nylas_sync-engine/tests/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,569 | test_gmail_auth_credentials.py | nylas_sync-engine/tests/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,570 | __init__.py | nylas_sync-engine/tests/auth/providers/__init__.py | # Override the default inbox.auth.module_registry with this one
# to allow testing of different auth scenarios.
# Allow out-of-tree auth submodules.
from pkgutil import extend_path
from inbox.util.misc import register_backends
__path__ = extend_path(__path__, __name__)
module_registry = register_backends(__name__, __p... | 327 | Python | .py | 7 | 45.571429 | 63 | 0.76489 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,571 | mock_gmail.py | nylas_sync-engine/tests/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) |
33,572 | crispin.py | nylas_sync-engine/tests/util/crispin.py | # NOT a fixture because it needs args
def crispin_client(account_id, account_provider):
from inbox.crispin import connection_pool
return connection_pool(account_id, pool_size=1).get()
| 192 | Python | .py | 4 | 45 | 57 | 0.776596 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,573 | base.py | nylas_sync-engine/tests/util/base.py | import json
import mock
import os
import uuid
from datetime import datetime, timedelta
from pytest import fixture, yield_fixture
from flanker import mime
from inbox.util.testutils import setup_test_db, MockIMAPClient # noqa
def absolute_path(path):
"""
Returns the absolute path for a path specified as rela... | 19,009 | Python | .py | 480 | 31.7625 | 81 | 0.661881 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,574 | conftest.py | nylas_sync-engine/tests/search/conftest.py | from tests.util.base import (config, db, absolute_path,
default_namespace)
from tests.api.base import api_client
__all__ = ['config', 'db', 'absolute_path', 'default_namespace',
'api_client']
| 233 | Python | .py | 5 | 37.4 | 64 | 0.60793 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,575 | ignition.py | nylas_sync-engine/inbox/ignition.py | import time
import weakref
import gevent
from socket import gethostname
from urllib import quote_plus as urlquote
from sqlalchemy import create_engine, event
from inbox.sqlalchemy_ext.util import (ForceStrictMode,
disabled_dubiously_many_queries_warning)
from inbox.config import ... | 9,344 | Python | .py | 187 | 37.090909 | 84 | 0.589533 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,576 | config.py | nylas_sync-engine/inbox/config.py | import errno
import os
import yaml
# TODO[mike]: This should be removed once we've updated python to 2.7.9
# This tells urllib3 to use pyopenssl, which has the latest tls protocols and is
# more secure than the default python ssl module in python 2.7.4
import requests
import urllib3.contrib.pyopenssl
urllib3.contrib.p... | 4,147 | Python | .py | 98 | 36.122449 | 116 | 0.661186 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,577 | crispin.py | nylas_sync-engine/inbox/crispin.py | """ IMAPClient wrapper for the Nylas Sync Engine."""
import contextlib
import re
import time
import imaplib
import imapclient
# Even though RFC 2060 says that the date component must have two characters
# (either two digits or space+digit), it seems that some IMAP servers only
# return one digit. Fun times.
imaplib.In... | 45,360 | Python | .py | 985 | 35.246701 | 80 | 0.605204 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,578 | console.py | nylas_sync-engine/inbox/console.py | import sys
from inbox.mailsync.backends.imap.generic import uidvalidity_cb
from inbox.crispin import writable_connection_pool
from inbox.models.session import global_session_scope
from inbox.models import Account
import IPython
def user_console(user_email_address):
with global_session_scope() as db_session:
... | 2,790 | Python | .py | 61 | 34.098361 | 83 | 0.594694 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,579 | __init__.py | nylas_sync-engine/inbox/__init__.py | # Allow out-of-tree submodules.
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
try:
from inbox.client import APIClient
__all__ = ['APIClient']
except ImportError:
pass
| 209 | Python | .py | 8 | 23.5 | 42 | 0.695 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,580 | instrumentation.py | nylas_sync-engine/inbox/instrumentation.py | import collections
import math
import thread
import signal
import socket
import sys
import time
import traceback
import gevent.hub
import gevent._threading # This is a clone of the *real* threading module
import greenlet
import psutil
from inbox.config import config
from inbox.util.concurrency import retry_with_loggin... | 10,440 | Python | .py | 227 | 35.678414 | 97 | 0.613654 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,581 | providers.py | nylas_sync-engine/inbox/providers.py | from __future__ import absolute_import, division, print_function
from inbox.basicauth import NotSupportedError
__all__ = ['provider_info', 'providers']
def provider_info(provider_name):
"""
Like providers[provider_name] except raises
inbox.basicauth.NotSupportedError instead of KeyError when the provide... | 11,861 | Python | .py | 323 | 26.96904 | 79 | 0.475802 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,582 | basicauth.py | nylas_sync-engine/inbox/basicauth.py | # TODO(emfree): this is now legitimately just a grab-bag of nebulous
# exceptions. Rename module and clean up.
class AuthError(Exception):
pass
class SSLNotSupportedError(AuthError):
pass
class ConnectionError(AuthError):
pass
class ValidationError(AuthError):
pass
class NotSupportedError(Aut... | 873 | Python | .py | 30 | 24.933333 | 68 | 0.790441 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,583 | folder_edge_cases.py | nylas_sync-engine/inbox/folder_edge_cases.py | '''
This folder list was generated by aggregating examples of user folders
that were not properly labeled as trash, sent, or spam.
This list was constructed semi automatically, and manuallly verified.
Should we encounter problems with account folders in the future, add them
below to test for them.
'''
localized_folde... | 1,747 | Python | .py | 31 | 46.516129 | 79 | 0.600933 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,584 | gc.py | nylas_sync-engine/inbox/mailsync/gc.py | import datetime
import gevent
from sqlalchemy import func
from sqlalchemy.orm import load_only
from nylas.logging import get_logger
log = get_logger()
from inbox.models import Message, Thread
from inbox.models.category import Category, EPOCH
from inbox.models.message import MessageCategory
from inbox.models.folder imp... | 10,059 | Python | .py | 193 | 38.217617 | 132 | 0.599227 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,585 | frontend.py | nylas_sync-engine/inbox/mailsync/frontend.py | import gevent
import gevent._threading # This is a clone of the *real* threading module
from pympler import muppy, summary
from werkzeug.serving import run_simple, WSGIRequestHandler
from flask import Flask, jsonify, request
from inbox.instrumentation import (GreenletTracer, KillerGreenletTracer,
... | 4,226 | Python | .py | 95 | 34.210526 | 83 | 0.610516 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,586 | service.py | nylas_sync-engine/inbox/mailsync/service.py | import time
import platform
import random
from gevent.lock import BoundedSemaphore
from sqlalchemy import or_, and_
from sqlalchemy.exc import OperationalError
from inbox.providers import providers
from inbox.config import config
from inbox.contacts.remote_sync import ContactSync
from inbox.events.remote_sync import ... | 13,752 | Python | .py | 267 | 38.172285 | 109 | 0.60183 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,587 | gmail.py | nylas_sync-engine/inbox/mailsync/backends/gmail.py | """
-----------------
GMAIL SYNC ENGINE
-----------------
Gmail is theoretically an IMAP backend, but it differs enough from standard
IMAP that we handle it differently. The state-machine rigamarole noted in
.imap.py applies, but we change a lot of the internal algorithms to fit Gmail's
structure.
Gmail has server-si... | 23,283 | Python | .py | 446 | 38.29148 | 82 | 0.58767 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,588 | __init__.py | nylas_sync-engine/inbox/mailsync/backends/__init__.py | """
Per-provider backend modules.
A backend module *must* meet the following requirements:
1. Specify the provider it implements as the module-level `PROVIDER` variable.
For example, 'gmail', 'imap', 'eas', 'yahoo' etc.
2. Implement a sync monitor class which inherits from the
BaseMailSyncMonitor class.
3. Specify ... | 857 | Python | .py | 19 | 43.789474 | 78 | 0.778846 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,589 | base.py | nylas_sync-engine/inbox/mailsync/backends/base.py | from gevent import Greenlet, GreenletExit, event
from nylas.logging import get_logger
log = get_logger()
from inbox.util.debug import bind_context
from inbox.util.concurrency import retry_with_logging
from inbox.models.session import session_scope
THROTTLE_COUNT = 200
THROTTLE_WAIT = 60
class MailsyncError(Exceptio... | 2,564 | Python | .py | 68 | 27.367647 | 74 | 0.603469 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,590 | generic.py | nylas_sync-engine/inbox/mailsync/backends/imap/generic.py | # deal with unicode literals: http://www.python.org/dev/peps/pep-0263/
# vim: set fileencoding=utf-8 :
"""
----------------
IMAP SYNC ENGINE
----------------
Okay, here's the deal.
The IMAP sync engine runs per-folder on each account.
Only one initial sync can be running per-account at a time, to avoid
hammering the... | 38,201 | Python | .py | 753 | 37.98008 | 91 | 0.599904 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,591 | __init__.py | nylas_sync-engine/inbox/mailsync/backends/imap/__init__.py | from inbox.mailsync.backends.imap import common
from inbox.mailsync.backends.imap.monitor import ImapSyncMonitor
__all__ = ['common', 'ImapSyncMonitor']
PROVIDER = 'generic'
SYNC_MONITOR_CLS = 'ImapSyncMonitor'
| 214 | Python | .py | 5 | 41.2 | 64 | 0.805825 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,592 | monitor.py | nylas_sync-engine/inbox/mailsync/backends/imap/monitor.py | from gevent import sleep
from gevent.pool import Group
from gevent.coros import BoundedSemaphore
from inbox.basicauth import ValidationError
from nylas.logging import get_logger
from inbox.crispin import retry_crispin, connection_pool
from inbox.models import Account, Folder
from inbox.models.category import Category, ... | 7,012 | Python | .py | 145 | 35.262069 | 79 | 0.603479 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,593 | common.py | nylas_sync-engine/inbox/mailsync/backends/imap/common.py | """
Helper functions for actions that operate on accounts.
These could be methods of ImapAccount, but separating them gives us more
flexibility with calling code, as most don't need any attributes of the account
object other than the ID, to limit the action.
Types returned for data are the column types defined via SQ... | 9,877 | Python | .py | 204 | 38.808824 | 79 | 0.647829 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,594 | base_sync.py | nylas_sync-engine/inbox/sync/base_sync.py | from gevent import event, Greenlet, sleep
from nylas.logging import get_logger
logger = get_logger()
from inbox.util.concurrency import retry_with_logging
from inbox.heartbeat.store import HeartbeatStatusProxy
from inbox.basicauth import ConnectionError, ValidationError
from inbox.models import Account
from inbox.mod... | 2,829 | Python | .py | 62 | 32.983871 | 80 | 0.602471 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,595 | conftest.py | nylas_sync-engine/inbox/test/conftest.py | """ Fixtures don't go here; see util/base.py and friends. """
# Monkeypatch first, to prevent "AttributeError: 'module' object has no
# attribute 'poll'" errors when tests import socket, then monkeypatch.
from gevent import monkey
monkey.patch_all(aggressive=False)
import gevent_openssl
gevent_openssl.monkey_patch()
... | 790 | Python | .py | 14 | 43.142857 | 71 | 0.533592 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,596 | __init__.py | nylas_sync-engine/inbox/test/__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,597 | conftest.py | nylas_sync-engine/inbox/test/scheduling/conftest.py | # flake8: noqa: F401
from inbox.test.util.base import dbloader, db, default_account
| 84 | Python | .py | 2 | 41 | 62 | 0.792683 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,598 | test_sync_start_logic.py | nylas_sync-engine/inbox/test/scheduling/test_sync_start_logic.py | import json
import mock
import pytest
import platform
from inbox.ignition import engine_manager
from inbox.mailsync.frontend import SyncHTTPFrontend
from inbox.mailsync.service import SyncService
from inbox.models import Account
from inbox.models.session import session_scope_by_shard_id
from inbox.test.util.base import... | 7,653 | Python | .py | 170 | 37.794118 | 79 | 0.66698 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,599 | test_syncback_logic.py | nylas_sync-engine/inbox/test/scheduling/test_syncback_logic.py | import random
import pytest
import gevent
from inbox.ignition import engine_manager
from inbox.models.session import session_scope, session_scope_by_shard_id
from inbox.models.action_log import ActionLog, schedule_action
from inbox.transactions.actions import SyncbackService
from inbox.test.util.base import add_gene... | 6,704 | Python | .py | 141 | 39.163121 | 107 | 0.667586 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |