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,700 | crispin.py | nylas_sync-engine/inbox/test/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,701 | base.py | nylas_sync-engine/inbox/test/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 mockredis import mock_strict_redis_client
from inbox.util.testutils import setup_test_db, MockIMAPClient # noqa
def absolute_path(path):
"""
Returns... | 21,002 | Python | .py | 521 | 32.481766 | 86 | 0.663404 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,702 | conftest.py | nylas_sync-engine/inbox/test/search/conftest.py | from inbox.test.util.base import (config, db, absolute_path,
default_namespace)
from inbox.test.api.base import api_client
__all__ = ['config', 'db', 'absolute_path', 'default_namespace',
'api_client']
| 243 | Python | .py | 5 | 39.4 | 64 | 0.616034 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,703 | queue.py | nylas_sync-engine/inbox/scheduling/queue.py | """This module contains code for managing Redis-backed account sync allocation.
Structurally, that works like this:
Redis list Redis hash
(acct ids to be (acct ids -> proc ids)
synced) +------... | 6,779 | Python | .py | 159 | 33.767296 | 79 | 0.597968 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,704 | deferred_migration.py | nylas_sync-engine/inbox/scheduling/deferred_migration.py | import gevent
import json
import time
from inbox.models.account import Account
from inbox.models.session import session_scope
from inbox.scheduling import event_queue
from inbox.util.concurrency import retry_with_logging
from inbox.util.stats import statsd_client
from nylas.logging import get_logger
log = get_logger(... | 4,244 | Python | .py | 84 | 40.714286 | 124 | 0.660072 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,705 | event_queue.py | nylas_sync-engine/inbox/scheduling/event_queue.py | import json
from redis import StrictRedis
from inbox.config import config
from nylas.logging import get_logger
log = get_logger()
SOCKET_CONNECT_TIMEOUT = 5
SOCKET_TIMEOUT = 30
def _get_redis_client(host=None, port=6379, db=1):
return StrictRedis(host=host,
port=port,
... | 2,512 | Python | .py | 62 | 31.129032 | 93 | 0.616899 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,706 | search.py | nylas_sync-engine/inbox/transactions/search.py | import json
from datetime import datetime
from sqlalchemy import asc
from sqlalchemy.sql import func
from sqlalchemy.orm import joinedload
from gevent import Greenlet, sleep
from inbox.ignition import engine_manager
from inbox.util.itert import partition
from inbox.models import Transaction, Contact
from inbox.util.s... | 6,710 | Python | .py | 152 | 31.335526 | 77 | 0.583244 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,707 | delta_sync.py | nylas_sync-engine/inbox/transactions/delta_sync.py | import time
import gevent
import collections
from datetime import datetime
from sqlalchemy import asc, desc, bindparam
from inbox.api.kellogs import APIEncoder, encode
from inbox.models import Transaction, Message, Thread, Account, Namespace
from inbox.models.session import session_scope
from inbox.models.util import ... | 10,974 | Python | .py | 232 | 36.525862 | 86 | 0.614127 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,708 | actions.py | nylas_sync-engine/inbox/transactions/actions.py | """
Monitor the action log for changes that should be synced back to the remote
backend.
TODO(emfree):
* Make this more robust across multiple machines. If you started two instances
talking to the same database backend things could go really badly.
"""
from collections import defaultdict
from datetime import datetime... | 23,438 | Python | .py | 482 | 34.939834 | 123 | 0.583592 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,709 | icloud.py | nylas_sync-engine/inbox/contacts/icloud.py | """Provide iCloud contacts"""
from nylas.logging import get_logger
logger = get_logger()
from carddav import CardDav
import lxml.etree as ET
from inbox.contacts.vcard import vcard_from_string
from inbox.contacts.carddav import supports_carddav
from inbox.models.session import session_scope
from inbox.models import C... | 3,864 | Python | .py | 84 | 34.142857 | 79 | 0.599308 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,710 | crud.py | nylas_sync-engine/inbox/contacts/crud.py | """Utility functions for creating, reading, updating and deleting contacts.
Called by the API."""
import uuid
from inbox.models import Contact
INBOX_PROVIDER_NAME = 'inbox'
def create(namespace, db_session, name, email):
contact = Contact(
namespace=namespace,
provider_name=INBOX_PROVIDER_NAME,
... | 855 | Python | .py | 23 | 32.086957 | 75 | 0.726277 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,711 | algorithms.py | nylas_sync-engine/inbox/contacts/algorithms.py | import datetime
from collections import defaultdict
'''
This file currently contains algorithms for the contacts/rankings endpoint
and the groups/intrinsic endpoint.
'''
# For calculating message weights
LOOKBACK_TIME = 63072000.0 # datetime.timedelta(days=2*365).total_seconds()
MIN_MESSAGE_WEIGHT = .01
# For calcu... | 7,124 | Python | .py | 156 | 37.50641 | 78 | 0.638279 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,712 | search.py | nylas_sync-engine/inbox/contacts/search.py | import re
import json
import boto3
from flanker.addresslib import address
from inbox.config import config
from inbox.models import Contact
from inbox.models.session import session_scope
from inbox.sqlalchemy_ext.util import safer_yield_per
from sqlalchemy.orm import joinedload
from nylas.logging import get_logger
... | 9,663 | Python | .py | 201 | 37.950249 | 117 | 0.627578 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,713 | __init__.py | nylas_sync-engine/inbox/contacts/__init__.py | # Allow out-of-tree backend submodules.
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
| 115 | Python | .py | 3 | 37.333333 | 42 | 0.714286 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,714 | google.py | nylas_sync-engine/inbox/contacts/google.py | """Provide Google contacts."""
import posixpath
import random
import gevent
from datetime import datetime
import gdata.auth
import gdata.client
import gdata.contacts.client
from nylas.logging import get_logger
logger = get_logger()
from inbox.basicauth import ConnectionError, ValidationError
from inbox.basicauth impo... | 7,824 | Python | .py | 171 | 33.128655 | 79 | 0.596328 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,715 | carddav.py | nylas_sync-engine/inbox/contacts/carddav.py | """
This is a Python module for working with the iCloud CardDav implementation
based on .
Note that this will only download up to 5000 contacts+groups. To download more,
this implementation should be changed to WebDAV Sync
).
References:
- CardDav: https://tools.ietf.org/html/rfc6352
- http://sabre.io/dav/building-a-... | 7,065 | Python | .py | 177 | 33.60452 | 79 | 0.55909 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,716 | remote_sync.py | nylas_sync-engine/inbox/contacts/remote_sync.py | from datetime import datetime
from collections import Counter
from sqlalchemy.orm.exc import NoResultFound
from nylas.logging import get_logger
logger = get_logger()
from inbox.models import Contact, Account
from inbox.sync.base_sync import BaseSyncMonitor
from inbox.contacts.google import GoogleContactsProvider
from... | 4,891 | Python | .py | 99 | 34.525253 | 79 | 0.574486 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,717 | process_mail.py | nylas_sync-engine/inbox/contacts/process_mail.py | import uuid
from inbox.util.addr import valid_email
from inbox.util.addr import canonicalize_address as canonicalize
from inbox.models import Contact, MessageContactAssociation
from inbox.contacts.crud import INBOX_PROVIDER_NAME
def update_contacts_from_message(db_session, message, namespace):
with db_session.no... | 3,064 | Python | .py | 53 | 43.207547 | 95 | 0.607523 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,718 | vcard.py | nylas_sync-engine/inbox/contacts/vcard.py | # Originally from pycarddav
#
# Copyright (c) 2011-2014 Christian Geier & contributors
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation th... | 10,265 | Python | .py | 262 | 31.274809 | 78 | 0.59397 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,719 | message.py | nylas_sync-engine/inbox/models/message.py | import os
import binascii
import datetime
import itertools
from hashlib import sha256
from collections import defaultdict
from flanker import mime
from sqlalchemy import (Column, Integer, BigInteger, String, DateTime,
Boolean, Enum, Index, bindparam)
from sqlalchemy.dialects.mysql import LONGBL... | 25,590 | Python | .py | 536 | 37.45709 | 90 | 0.628353 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,720 | util.py | nylas_sync-engine/inbox/models/util.py | import time
import math
import gevent
import requests
import datetime
from collections import OrderedDict
from sqlalchemy.orm.exc import NoResultFound
from inbox.config import config
from inbox.models import Account, Namespace
from inbox.util.stats import statsd_client
from inbox.models.session import session_scope
fr... | 14,124 | Python | .py | 305 | 37.485246 | 106 | 0.644852 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,721 | transaction.py | nylas_sync-engine/inbox/models/transaction.py | from sqlalchemy import (Column, BigInteger, String, Index, Enum,
inspect)
from sqlalchemy.orm import relationship
from inbox.models.base import MailSyncBase
from inbox.models.mixins import HasPublicID, HasRevisions
from inbox.models.namespace import Namespace
class Transaction(MailSyncBase, H... | 5,285 | Python | .py | 102 | 42.980392 | 87 | 0.680876 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,722 | meta.py | nylas_sync-engine/inbox/models/meta.py | """Utility for loading SQLAlchemy model classes and friends. Please see
inbox/models/__init__.py for the explanation of why this is necessary."""
def load_models():
from inbox.models.account import Account
from inbox.models.base import MailSyncBase
from inbox.models.action_log import ActionLog
from in... | 1,642 | Python | .py | 30 | 47.1 | 78 | 0.748447 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,723 | roles.py | nylas_sync-engine/inbox/models/roles.py | from hashlib import sha256
from flanker import mime
from sqlalchemy import Column, Integer, String
from nylas.logging import get_logger
log = get_logger()
from inbox.config import config
from inbox.util import blockstore
from inbox.s3.base import get_raw_from_provider
from inbox.util.stats import statsd_client
# TODO... | 5,301 | Python | .py | 101 | 33.960396 | 103 | 0.514888 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,724 | mixins.py | nylas_sync-engine/inbox/models/mixins.py | import abc
from datetime import datetime
from sqlalchemy import Column, DateTime, String, inspect, Boolean, sql, func
from sqlalchemy.ext.hybrid import hybrid_property, Comparator
from inbox.sqlalchemy_ext.util import Base36UID, generate_public_id, ABCMixin
from inbox.models.constants import MAX_INDEXABLE_LENGTH
from... | 6,186 | Python | .py | 126 | 41.071429 | 82 | 0.693305 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,725 | category.py | nylas_sync-engine/inbox/models/category.py | from datetime import datetime
from sqlalchemy import Column, String, ForeignKey, Enum, DateTime
from sqlalchemy.orm import relationship, validates
from sqlalchemy.schema import UniqueConstraint
from sqlalchemy.orm.exc import MultipleResultsFound
from sqlalchemy.ext.hybrid import hybrid_property
from inbox.sqlalchemy_... | 6,198 | Python | .py | 126 | 38.801587 | 84 | 0.643602 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,726 | event.py | nylas_sync-engine/inbox/models/event.py | import arrow
from datetime import datetime
from dateutil.parser import parse as date_parse
import ast
from sqlalchemy import (Column, String, ForeignKey, Text, Boolean, Integer,
DateTime, Enum, Index, event)
from sqlalchemy.orm import relationship, backref, validates, reconstructor
from sqlalch... | 20,726 | Python | .py | 450 | 35.92 | 79 | 0.623427 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,727 | secret.py | nylas_sync-engine/inbox/models/secret.py | from sqlalchemy import Column, Enum, Integer
from sqlalchemy.types import BLOB
from sqlalchemy.orm import validates
from inbox.models.base import MailSyncBase
from inbox.models.mixins import UpdatedAtMixin, DeletedAtMixin
from inbox.security.oracles import get_encryption_oracle, get_decryption_oracle
class Secret(Ma... | 1,495 | Python | .py | 34 | 36.764706 | 79 | 0.690345 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,728 | folder.py | nylas_sync-engine/inbox/models/folder.py | from sqlalchemy import Column, String, ForeignKey, DateTime, bindparam
from sqlalchemy.orm import relationship, backref, synonym, validates
from sqlalchemy.schema import UniqueConstraint
from sqlalchemy.orm.exc import NoResultFound, MultipleResultsFound
from inbox.models.base import MailSyncBase
from inbox.models.cate... | 4,064 | Python | .py | 86 | 38.406977 | 78 | 0.656826 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,729 | constants.py | nylas_sync-engine/inbox/models/constants.py | # Size constants, set in this file to avoid annoying circular import
# errors
MAX_INDEXABLE_LENGTH = 191
MAX_FOLDER_NAME_LENGTH = MAX_INDEXABLE_LENGTH
MAX_LABEL_NAME_LENGTH = MAX_INDEXABLE_LENGTH
| 196 | Python | .py | 5 | 38.2 | 68 | 0.811518 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,730 | thread.py | nylas_sync-engine/inbox/models/thread.py | import datetime
import itertools
from collections import defaultdict
from sqlalchemy import Column, Integer, String, DateTime, ForeignKey, Index
from sqlalchemy.orm import (relationship, backref, validates, object_session,
subqueryload)
from nylas.logging import get_logger
log = get_logger... | 7,676 | Python | .py | 172 | 34.063953 | 102 | 0.621285 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,731 | search.py | nylas_sync-engine/inbox/models/search.py | from sqlalchemy import Column, ForeignKey
from inbox.models.base import MailSyncBase
from inbox.models.mixins import UpdatedAtMixin, DeletedAtMixin
from inbox.models.transaction import Transaction
class ContactSearchIndexCursor(MailSyncBase, UpdatedAtMixin,
DeletedAtMixin):
"""
... | 531 | Python | .py | 12 | 36.333333 | 70 | 0.726214 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,732 | block.py | nylas_sync-engine/inbox/models/block.py | from sqlalchemy import (Column, Integer, String, Boolean, Enum, ForeignKey,
event)
from sqlalchemy.orm import reconstructor, relationship, backref
from sqlalchemy.schema import UniqueConstraint
from sqlalchemy.sql.expression import false
from inbox.models.roles import Blob
from inbox.models.mix... | 4,664 | Python | .py | 100 | 33.72 | 79 | 0.5919 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,733 | label.py | nylas_sync-engine/inbox/models/label.py | from sqlalchemy import Column, String, ForeignKey
from sqlalchemy.orm import relationship, backref, validates
from sqlalchemy.schema import UniqueConstraint
from inbox.models.base import MailSyncBase
from inbox.models.category import Category, CategoryNameString, sanitize_name
from inbox.models.mixins import UpdatedAt... | 2,660 | Python | .py | 58 | 36.310345 | 77 | 0.643133 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,734 | account.py | nylas_sync-engine/inbox/models/account.py | import os
import traceback
from datetime import datetime
from sqlalchemy import (Column, BigInteger, String, DateTime, Boolean,
ForeignKey, Enum, inspect, bindparam, Index, event)
from sqlalchemy.orm import relationship
from sqlalchemy.orm.session import Session
from sqlalchemy.sql.expression i... | 15,882 | Python | .py | 348 | 34.497126 | 113 | 0.606755 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,735 | namespace.py | nylas_sync-engine/inbox/models/namespace.py | from sqlalchemy import Column, BigInteger, ForeignKey, bindparam
from sqlalchemy.orm import relationship, backref
from inbox.models.base import MailSyncBase
from inbox.models.mixins import HasPublicID, UpdatedAtMixin, DeletedAtMixin
from inbox.sqlalchemy_ext.util import bakery
class Namespace(MailSyncBase, HasPublic... | 1,765 | Python | .py | 36 | 34.388889 | 77 | 0.566783 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,736 | metadata.py | nylas_sync-engine/inbox/models/metadata.py | from sqlalchemy import Column, Integer, String, ForeignKey, BigInteger, Index
from sqlalchemy.orm import (relationship)
from inbox.sqlalchemy_ext.util import JSON
from inbox.models.base import MailSyncBase
from inbox.models.mixins import (HasPublicID, HasRevisions, UpdatedAtMixin,
Dele... | 2,484 | Python | .py | 46 | 48.195652 | 79 | 0.729295 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,737 | __init__.py | nylas_sync-engine/inbox/models/__init__.py | """
Caution: subtleties ahead.
It's desirable to ensure that all SQLAlchemy models are imported before you
try to issue any sort of query. The reason you want this assurance is because
if you have mutually dependent relationships between models in separate
files, at least one of those relationships must be specified b... | 1,457 | Python | .py | 27 | 52.740741 | 84 | 0.799157 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,738 | contact.py | nylas_sync-engine/inbox/models/contact.py | from sqlalchemy import Column, Integer, String, Enum, Text, Index, BigInteger, \
ForeignKey
from sqlalchemy.orm import relationship, backref, validates
from sqlalchemy.schema import UniqueConstraint
from inbox.sqlalchemy_ext.util import MAX_TEXT_CHARS
from inbox.models.mixins import (HasPublicID, HasEmailAddress, ... | 4,414 | Python | .py | 90 | 40.9 | 81 | 0.669998 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,739 | base.py | nylas_sync-engine/inbox/models/base.py | from sqlalchemy import Column, BigInteger
from sqlalchemy.ext.declarative import as_declarative, declared_attr
from sqlalchemy.orm.exc import DetachedInstanceError
from inbox.models.mixins import CreatedAtMixin
@as_declarative()
class MailSyncBase(CreatedAtMixin):
"""
Provides automated table name, primary k... | 1,056 | Python | .py | 24 | 37.375 | 99 | 0.656585 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,740 | action_log.py | nylas_sync-engine/inbox/models/action_log.py | from sqlalchemy import (Column, BigInteger, Integer, Text, ForeignKey, Enum,
Index, String)
from sqlalchemy.orm import relationship
from inbox.sqlalchemy_ext.util import JSON
from inbox.models.base import MailSyncBase
from inbox.models.mixins import UpdatedAtMixin, DeletedAtMixin
from inbox.mod... | 1,988 | Python | .py | 39 | 43.153846 | 77 | 0.696438 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,741 | data_processing.py | nylas_sync-engine/inbox/models/data_processing.py | from sqlalchemy import Column, ForeignKey
from sqlalchemy.schema import UniqueConstraint
from sqlalchemy.dialects.mysql import MEDIUMBLOB
from sqlalchemy import DateTime
from inbox.models.base import MailSyncBase
from inbox.models.namespace import Namespace
from inbox.models.mixins import UpdatedAtMixin, DeletedAtMixi... | 1,725 | Python | .py | 41 | 35.634146 | 79 | 0.718806 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,742 | when.py | nylas_sync-engine/inbox/models/when.py | import abc
import arrow
def parse_as_when(raw):
"""
Tries to parse a dictionary into a corresponding Date, DateSpan,
Time, or TimeSpan instance.
Raises
-------
ValueError
"""
when_classes = [TimeSpan, Time, DateSpan, Date]
keys_for_type = {tuple(cls_.json_keys): cls_ for cls_ in ... | 3,104 | Python | .py | 90 | 27.811111 | 79 | 0.629903 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,743 | session.py | nylas_sync-engine/inbox/models/session.py | import sys
import time
from contextlib import contextmanager
from sqlalchemy import event
from sqlalchemy.orm.session import Session
from sqlalchemy.exc import OperationalError
from sqlalchemy.ext.horizontal_shard import ShardedSession
from inbox.config import config
from inbox.ignition import engine_manager
from inb... | 6,535 | Python | .py | 159 | 32.389937 | 79 | 0.645712 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,744 | calendar.py | nylas_sync-engine/inbox/models/calendar.py | from datetime import datetime
from sqlalchemy import (Column, String, Text, Boolean,
UniqueConstraint, ForeignKey, DateTime, inspect)
from sqlalchemy.orm import relationship, backref, object_session
from inbox.models.base import MailSyncBase
from inbox.models.namespace import Namespace
from in... | 4,085 | Python | .py | 89 | 35.88764 | 76 | 0.64 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,745 | imap.py | nylas_sync-engine/inbox/models/backends/imap.py | import json
from datetime import datetime
from sqlalchemy import (Column, Integer, BigInteger, Boolean, Enum,
ForeignKey, Index, String, DateTime, desc)
from sqlalchemy.schema import UniqueConstraint
from sqlalchemy.orm import relationship, backref
from sqlalchemy.sql.expression import false
fr... | 16,706 | Python | .py | 349 | 37.962751 | 79 | 0.63843 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,746 | oauth.py | nylas_sync-engine/inbox/models/backends/oauth.py | """
Generic OAuth class that provides abstraction for access and
refresh tokens.
"""
from datetime import datetime, timedelta
from sqlalchemy import Column, ForeignKey
from sqlalchemy.orm import relationship
from sqlalchemy.ext.declarative import declared_attr
from inbox.models.secret import Secret
from nylas.logging... | 2,693 | Python | .py | 70 | 29.014286 | 71 | 0.622837 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,747 | outlook.py | nylas_sync-engine/inbox/models/backends/outlook.py | from sqlalchemy import Column, String, ForeignKey
from inbox.models.backends.imap import ImapAccount
from inbox.models.backends.oauth import OAuthAccount
PROVIDER = '_outlook'
class OutlookAccount(ImapAccount, OAuthAccount):
id = Column(ForeignKey(ImapAccount.id, ondelete='CASCADE'),
primary_key... | 1,238 | Python | .py | 34 | 30.647059 | 76 | 0.694305 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,748 | gmail.py | nylas_sync-engine/inbox/models/backends/gmail.py | from collections import defaultdict, namedtuple
from datetime import datetime, timedelta
from random import shuffle
from sqlalchemy import Boolean, Column, BigInteger, String, ForeignKey
from sqlalchemy import DateTime
from sqlalchemy.orm import relationship, backref
from sqlalchemy.orm.session import object_session
f... | 14,278 | Python | .py | 326 | 33.653374 | 79 | 0.633605 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,749 | generic.py | nylas_sync-engine/inbox/models/backends/generic.py | from sqlalchemy import Column, String, ForeignKey, Boolean
from sqlalchemy.orm import relationship
from inbox.models.backends.imap import ImapAccount
from inbox.models.secret import Secret
PROVIDER = 'generic'
class GenericAccount(ImapAccount):
id = Column(ForeignKey(ImapAccount.id, ondelete='CASCADE'),
... | 4,596 | Python | .py | 110 | 31.218182 | 75 | 0.610625 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,750 | __init__.py | nylas_sync-engine/inbox/models/backends/__init__.py | """
Per-provider table modules.
"""
# Allow out-of-tree table submodules.
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
from inbox.util.misc import register_backends
module_registry = register_backends(__name__, __path__)
| 251 | Python | .py | 8 | 30.375 | 55 | 0.73251 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,751 | util.py | nylas_sync-engine/inbox/sqlalchemy_ext/util.py | import abc
import contextlib
import uuid
import struct
import weakref
from bson import json_util, EPOCH_NAIVE
# Monkeypatch to not include tz_info in decoded JSON.
# Kind of a ridiculous solution, but works.
json_util.EPOCH_AWARE = EPOCH_NAIVE
from sqlalchemy import String, Text, event
from sqlalchemy.types import Ty... | 10,306 | Python | .py | 258 | 33.682171 | 80 | 0.682283 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,752 | oracles.py | nylas_sync-engine/inbox/security/oracles.py | from __future__ import absolute_import, division, print_function
import enum # Python 3 style enums from enum34
import nacl.secret
import nacl.utils
from inbox.config import config
class EncryptionScheme(enum.Enum):
# No encryption
NULL = 0
# nacl.secret.SecretBox with a static key
SECRETBOX_WITH_... | 5,757 | Python | .py | 132 | 34.431818 | 77 | 0.654542 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,753 | blobstorage.py | nylas_sync-engine/inbox/security/blobstorage.py | """
This module provides utilities for encoding data into compressed/encrypted
binary blobs. These have the following data format:
|<1 byte>|
+--------+--------+--------+--------+--------+--------+--------+--------+-----
| scheme | key version | data
+--------+--------+--------+----... | 1,654 | Python | .py | 38 | 40.421053 | 79 | 0.6702 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,754 | config.py | nylas_sync-engine/inbox/heartbeat/config.py | from redis import StrictRedis, BlockingConnectionPool
from inbox.config import config
STATUS_DATABASE = 1
ALIVE_EXPIRY = int(config.get('BASE_ALIVE_THRESHOLD', 480))
REDIS_SHARDS = config.get('REDIS_SHARDS')
REDIS_PORT = int(config.get('REDIS_PORT'))
CONTACTS_FOLDER_ID = '-1'
EVENTS_FOLDER_ID = '-2'
MAX_CONNECTION... | 1,646 | Python | .py | 36 | 39.416667 | 79 | 0.711599 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,755 | status.py | nylas_sync-engine/inbox/heartbeat/status.py | from collections import namedtuple
from datetime import timedelta
import time
from nylas.logging import get_logger
from inbox.heartbeat.config import ALIVE_EXPIRY
from inbox.heartbeat.store import HeartbeatStore
ALIVE_THRESHOLD = timedelta(seconds=ALIVE_EXPIRY)
log = get_logger()
# More lightweight statuses (dead... | 1,961 | Python | .py | 42 | 39.857143 | 79 | 0.690252 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,756 | store.py | nylas_sync-engine/inbox/heartbeat/store.py | import time
import itertools
from inbox.util.itert import chunk
from nylas.logging import get_logger
log = get_logger()
# We're doing this weird rename import to make it easier to monkeypatch
# get_redis_client. That's the only way we have to test our very brittle
# status code.
import inbox.heartbeat.config as heart... | 7,992 | Python | .py | 177 | 34.920904 | 101 | 0.62143 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,757 | srv.py | nylas_sync-engine/inbox/api/srv.py | from flask import Flask, request, jsonify, make_response, g
from flask.ext.restful import reqparse
from werkzeug.exceptions import default_exceptions, HTTPException
from sqlalchemy.orm.exc import NoResultFound
from inbox.api.kellogs import APIEncoder
from nylas.logging import get_logger
from inbox.models import Namesp... | 4,893 | Python | .py | 105 | 38.447619 | 79 | 0.660504 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,758 | kellogs.py | nylas_sync-engine/inbox/api/kellogs.py | import arrow
import datetime
import calendar
from json import JSONEncoder, dumps
from flask import Response
from inbox.models import (Message, Contact, Calendar, Event, When,
Thread, Namespace, Block, Category, Account,
Metadata)
from inbox.models.event import (Recur... | 15,269 | Python | .py | 370 | 29.824324 | 92 | 0.566903 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,759 | err.py | nylas_sync-engine/inbox/api/err.py | import sys
import traceback
from flask import jsonify, make_response, request
from nylas.logging.sentry import sentry_alert
from nylas.logging.log import get_logger, create_error_log_context
log = get_logger()
from inbox.config import is_live_env
def get_request_uid(headers):
return headers.get('X-Unique-ID')
... | 3,131 | Python | .py | 75 | 35.44 | 83 | 0.680106 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,760 | ns_api.py | nylas_sync-engine/inbox/api/ns_api.py | import os
import sys
import json
import time
import uuid
import base64
import gevent
import itertools
from hashlib import sha256
from datetime import datetime
from collections import namedtuple
from flask import (request, g, Blueprint, make_response, Response,
stream_with_context)
from flask import ... | 76,986 | Python | .py | 1,651 | 37.804967 | 163 | 0.643236 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,761 | validation.py | nylas_sync-engine/inbox/api/validation.py | """Utilities for validating user input to the API."""
import arrow
from arrow.parser import ParserError
from flanker.addresslib import address
from flask.ext.restful import reqparse
from sqlalchemy.orm.exc import NoResultFound
from inbox.models import Calendar, Thread, Block, Message, Category, Event
from inbox.models... | 13,990 | Python | .py | 319 | 35.144201 | 79 | 0.638378 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,762 | wsgi.py | nylas_sync-engine/inbox/api/wsgi.py | from inbox.config import config
import nylas.api.wsgi
from nylas.api.wsgi import (NylasWSGIHandler, NylasWSGIWorker,
NylasGunicornLogger)
nylas.api.wsgi.MAX_BLOCKING_TIME = config.get('MAX_BLOCKING_TIME',
nylas.api.wsgi.MAX_BLOCKING_TIME)
nyla... | 652 | Python | .py | 13 | 39.307692 | 79 | 0.665087 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,763 | sending.py | nylas_sync-engine/inbox/api/sending.py | from datetime import datetime
from nylas.logging import get_logger
from inbox.api.err import err
from inbox.api.kellogs import APIEncoder, encode
from inbox.sendmail.base import get_sendmail_client, SendMailException
log = get_logger()
def send_draft(account, draft, db_session):
"""Send the draft with id = `draft... | 3,464 | Python | .py | 77 | 38.766234 | 79 | 0.701749 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,764 | filtering.py | nylas_sync-engine/inbox/api/filtering.py | from sqlalchemy import and_, or_, desc, asc, func, bindparam
from sqlalchemy.orm import subqueryload, contains_eager
from inbox.api.err import InputError
from inbox.api.validation import valid_public_id
from inbox.models import (Contact, Event, Calendar, Message,
MessageContactAssociation, Thr... | 26,265 | Python | .py | 545 | 37.900917 | 79 | 0.617468 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,765 | update.py | nylas_sync-engine/inbox/api/update.py | from sqlalchemy.orm.exc import NoResultFound
from nylas.logging import get_logger
log = get_logger()
from inbox.models import Category
from inbox.models.action_log import schedule_action
from inbox.api.validation import valid_public_id
from inbox.api.err import InputError
# STOPSHIP(emfree): better naming/structure fo... | 12,027 | Python | .py | 246 | 39.195122 | 90 | 0.631345 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,766 | ical.py | nylas_sync-engine/inbox/events/ical.py | import sys
import pytz
import arrow
import requests
import icalendar
import traceback
from inbox.config import config
from icalendar import Calendar as iCalendar
from email.utils import formataddr
from datetime import datetime, date
from flanker import mime
from html2text import html2text
from util import serialize_da... | 26,717 | Python | .py | 548 | 36.636861 | 86 | 0.59831 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,767 | timezones.py | nylas_sync-engine/inbox/events/timezones.py | # Timezones.py --- a mapping of windows timezones to Olson timezones.
# It has been generated using the get_windows_info from tzlocal
# (https://github.com/regebro/tzlocal)
import pytz
windows_timezones = {
'AUS Central Standard Time': 'Australia/Darwin',
'AUS Eastern Standard Time': 'Australia/Sydney',
'A... | 13,303 | Python | .py | 262 | 46.083969 | 98 | 0.670324 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,768 | util.py | nylas_sync-engine/inbox/events/util.py | import arrow
import string
from dateutil.parser import parse
from collections import namedtuple
from inbox.models.when import parse_as_when
# TODO(emfree) remove (currently used in other repos)
class MalformedEventError(Exception):
pass
def parse_datetime(datetime):
# returns a UTC-aware datetime as an Arro... | 3,378 | Python | .py | 77 | 37.285714 | 95 | 0.664325 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,769 | recurring.py | nylas_sync-engine/inbox/events/recurring.py | import arrow
from dateutil.rrule import (rrulestr, rrule, rruleset,
MO, TU, WE, TH, FR, SA, SU)
from inbox.models.event import RecurringEvent, RecurringEventOverride
from inbox.events.util import parse_rrule_datetime
from timezones import timezones_table
from nylas.logging import get_logge... | 6,299 | Python | .py | 155 | 30.509677 | 76 | 0.599247 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,770 | __init__.py | nylas_sync-engine/inbox/events/__init__.py | # Allow out-of-tree backend submodules.
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
| 115 | Python | .py | 3 | 37.333333 | 42 | 0.714286 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,771 | google.py | nylas_sync-engine/inbox/events/google.py | """Provide Google Calendar events."""
import time
import datetime
import json
import random
import urllib
import gevent
import requests
import uuid
import arrow
from nylas.logging import get_logger
log = get_logger()
from inbox.auth.oauth import OAuthRequestsWrapper
from inbox.basicauth import AccessNotEnabledError
fr... | 22,208 | Python | .py | 499 | 32.603206 | 83 | 0.581737 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,772 | remote_sync.py | nylas_sync-engine/inbox/events/remote_sync.py | from datetime import datetime, timedelta
from requests.exceptions import HTTPError
from nylas.logging import get_logger
logger = get_logger()
from inbox.basicauth import AccessNotEnabledError, OAuthError
from inbox.config import config
from inbox.sync.base_sync import BaseSyncMonitor
from inbox.models import Event, C... | 13,667 | Python | .py | 280 | 35.05 | 80 | 0.588778 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,773 | base.py | nylas_sync-engine/inbox/events/actions/base.py | from inbox.models.account import Account
from inbox.models.event import Event
from inbox.models.session import session_scope
from inbox.events.actions.backends import module_registry
from inbox.events.ical import (generate_icalendar_invite, send_invite)
def create_event(account_id, event_id, extra_args):
with ses... | 4,196 | Python | .py | 75 | 44.493333 | 85 | 0.642421 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,774 | gmail.py | nylas_sync-engine/inbox/events/actions/backends/gmail.py | """ Operations for syncing back local Calendar changes to Gmail. """
from inbox.events.google import GoogleEventsProvider
PROVIDER = 'gmail'
__all__ = ['remote_create_event', 'remote_update_event', 'remote_delete_event']
def remote_create_event(account, event, db_session, extra_args):
provider = GoogleEventsPr... | 1,088 | Python | .py | 18 | 55.388889 | 79 | 0.740811 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,775 | __init__.py | nylas_sync-engine/inbox/events/actions/backends/__init__.py | # Allow out-of-tree action submodules.
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
from inbox.util.misc import register_backends
module_registry = register_backends(__name__, __path__)
| 216 | Python | .py | 5 | 42.2 | 55 | 0.739336 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,776 | gpush_notifications.py | nylas_sync-engine/inbox/webhooks/gpush_notifications.py | import random
from datetime import datetime
from flask import request, g, Blueprint, make_response
from flask import jsonify
from sqlalchemy.orm.exc import NoResultFound
from inbox.api.err import APIException, NotFoundError, InputError
from inbox.api.validation import valid_public_id
from nylas.logging import get_logg... | 3,638 | Python | .py | 87 | 33.850575 | 77 | 0.661665 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,777 | exc.py | nylas_sync-engine/inbox/s3/exc.py | class S3Exception(Exception):
pass
class EmailFetchException(S3Exception):
pass
class EmailDeletedException(EmailFetchException):
"""Raises an error when the message is deleted on the remote."""
pass
class TemporaryEmailFetchException(EmailFetchException):
"""A class for temporary errors when ... | 424 | Python | .py | 11 | 34.454545 | 70 | 0.786241 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,778 | __init__.py | nylas_sync-engine/inbox/s3/__init__.py | # Allow out-of-tree backend submodules.
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
| 115 | Python | .py | 3 | 37.333333 | 42 | 0.714286 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,779 | base.py | nylas_sync-engine/inbox/s3/base.py | def get_raw_from_provider(message):
"""Get the raw contents of a message from the provider."""
account = message.account
return account.get_raw_message_contents(message)
| 182 | Python | .py | 4 | 41.5 | 62 | 0.741573 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,780 | imap.py | nylas_sync-engine/inbox/s3/backends/imap.py | import imapclient
from inbox.s3.exc import EmailFetchException, EmailDeletedException
from inbox.crispin import connection_pool
from inbox.mailsync.backends.imap.generic import uidvalidity_cb
from nylas.logging import get_logger
log = get_logger()
def get_imap_raw_contents(message):
account = message.namespace.a... | 1,173 | Python | .py | 24 | 39.708333 | 89 | 0.680982 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,781 | gmail.py | nylas_sync-engine/inbox/s3/backends/gmail.py | import base64
import requests
from inbox.s3.exc import TemporaryEmailFetchException, EmailDeletedException
from inbox.auth.oauth import OAuthRequestsWrapper
from inbox.models.backends.gmail import g_token_manager
from nylas.logging import get_logger
log = get_logger()
# We use the Google API so we don't have to worry... | 1,676 | Python | .py | 33 | 46 | 106 | 0.723378 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,782 | __init__.py | nylas_sync-engine/inbox/s3/backends/__init__.py | # Allow out-of-tree backend submodules.
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
| 115 | Python | .py | 3 | 37.333333 | 42 | 0.714286 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,783 | oauth.py | nylas_sync-engine/inbox/auth/oauth.py | import urllib
import socket
from simplejson import JSONDecodeError
import requests
from imapclient import IMAPClient
from nylas.logging import get_logger
log = get_logger()
from inbox.auth.base import AuthHandler
from inbox.auth.generic import create_imap_connection
from inbox.basicauth import ConnectionError, OAuthE... | 6,913 | Python | .py | 149 | 34.389262 | 78 | 0.60404 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,784 | gmail.py | nylas_sync-engine/inbox/auth/gmail.py | import requests
from imapclient import IMAPClient
from inbox.models import Namespace
from inbox.models.backends.gmail import GmailAccount
from inbox.models.backends.gmail import GmailAuthCredentials
from inbox.models.backends.gmail import g_token_manager
from inbox.config import config
from inbox.auth.base import acc... | 11,446 | Python | .py | 228 | 39.201754 | 80 | 0.635283 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,785 | generic.py | nylas_sync-engine/inbox/auth/generic.py | import datetime
import getpass
from backports import ssl
from imapclient import IMAPClient
import socket
from OpenSSL._util import lib as ossllib
from nylas.logging import get_logger
log = get_logger()
from inbox.auth.base import AuthHandler, account_or_none
from inbox.basicauth import (ValidationError, UserRecoverab... | 18,087 | Python | .py | 367 | 36.46049 | 121 | 0.600476 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,786 | __init__.py | nylas_sync-engine/inbox/auth/__init__.py | """
Per-provider auth modules.
An auth module *must* meet the following requirement:
1. Specify the provider it implements as the module-level PROVIDER variable.
For example, 'gmail', 'imap', 'eas', 'yahoo' etc.
2. Live in the 'auth/' directory.
3. Register an AuthHandler class as an entry point in setup.py
"""
# A... | 531 | Python | .py | 13 | 39.538462 | 76 | 0.749027 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,787 | base.py | nylas_sync-engine/inbox/auth/base.py | from abc import ABCMeta, abstractmethod
from sqlalchemy.orm.exc import NoResultFound
from inbox.models.session import session_scope
from inbox.providers import providers
from inbox.basicauth import NotSupportedError
def handler_from_provider(provider_name):
"""
Return an authentication handler for the given... | 3,653 | Python | .py | 97 | 30.247423 | 79 | 0.671015 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,788 | base.py | nylas_sync-engine/inbox/actions/base.py | """ Code for propagating Nylas datastore changes to account backends.
Syncback actions don't update anything in the local datastore; the Nylas
datastore is updated asynchronously (see namespace.py) and bookkeeping about
the account backend state is updated when the changes show up in the mail sync
engine.
Dealing wit... | 7,046 | Python | .py | 134 | 41.992537 | 79 | 0.652351 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,789 | gmail.py | nylas_sync-engine/inbox/actions/backends/gmail.py | """ Operations for syncing back local datastore changes to Gmail. """
import imapclient
from inbox.actions.backends.generic import uids_by_folder
from inbox.mailsync.backends.imap.generic import uidvalidity_cb
from inbox.models.category import Category
from inbox.models.session import session_scope
from imaplib import... | 2,933 | Python | .py | 58 | 42.448276 | 177 | 0.689752 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,790 | generic.py | nylas_sync-engine/inbox/actions/backends/generic.py | # -*- coding: utf-8 -*-
""" Operations for syncing back local datastore changes to
generic IMAP providers.
"""
from collections import defaultdict
from nylas.logging import get_logger
from inbox.mailsync.backends.imap.generic import uidvalidity_cb
from inbox.models.backends.imap import ImapUid
from inbox.models imp... | 10,039 | Python | .py | 204 | 40.083333 | 82 | 0.664453 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,791 | __init__.py | nylas_sync-engine/inbox/actions/backends/__init__.py | """
An action module *must* meet the following requirement:
1. Specify the provider it implements as the module-level PROVIDER variable.
For example, 'gmail', 'imap', 'eas', 'yahoo' etc.
2. Live in the 'inbox.actions.backends' module tree.
"""
# Allow out-of-tree action submodules.
from pkgutil import extend_path
__... | 463 | Python | .py | 11 | 40.818182 | 76 | 0.743875 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,792 | db.py | nylas_sync-engine/inbox/util/db.py | from sqlalchemy.engine import reflection
from sqlalchemy.schema import MetaData, Table, ForeignKeyConstraint
from sqlalchemy.schema import DropTable, DropConstraint
# http://www.sqlalchemy.org/trac/wiki/UsageRecipes/DropEverything
def drop_everything(engine, keep_tables=[], reset_columns={}):
""" Drops all tables... | 1,977 | Python | .py | 45 | 33.911111 | 78 | 0.613139 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,793 | testutils.py | nylas_sync-engine/inbox/util/testutils.py | # -*- coding: utf-8 -*-
import contextlib
import dns
import json
import os
import re
import pytest
import subprocess
import pkgutil
from inbox.basicauth import ValidationError
FILENAMES = ['muir.jpg', 'LetMeSendYouEmail.wav', 'piece-jointe.jpg',
'andra-moi-ennepe.txt', 'long-non-ascii-filename.txt']
d... | 10,747 | Python | .py | 271 | 30.841328 | 84 | 0.600077 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,794 | blockstore.py | nylas_sync-engine/inbox/util/blockstore.py | import os
import time
from hashlib import sha256
from inbox.config import config
from inbox.util.stats import statsd_client
from nylas.logging import get_logger
log = get_logger()
# TODO: store AWS credentials in a better way.
STORE_MSG_ON_S3 = config.get('STORE_MESSAGES_ON_S3', None)
if STORE_MSG_ON_S3:
from bo... | 4,131 | Python | .py | 103 | 32.980583 | 76 | 0.651542 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,795 | fleet.py | nylas_sync-engine/inbox/util/fleet.py | from boto import ec2
import random
def get_sync_hosts_in_zone(zone, level, include_debug=False):
# Hack to make local dev VM work.
if zone is None:
return [{'name': 'localhost', 'ip_address': '127.0.0.1', 'num_procs': 4}]
instances = []
regions = ec2.regions()
for region in regions:
... | 2,879 | Python | .py | 76 | 27.486842 | 98 | 0.549301 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,796 | rdb.py | nylas_sync-engine/inbox/util/rdb.py | import socket
import sys
from gevent import monkey
monkey.patch_all(aggressive=False)
import gevent_openssl
gevent_openssl.monkey_patch()
from code import InteractiveConsole
from nylas.logging import get_logger
log = get_logger()
doc = """
This is the Nylas console - you can use it to interact with mailsync and track... | 4,152 | Python | .py | 114 | 26.72807 | 95 | 0.587942 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,797 | startup.py | nylas_sync-engine/inbox/util/startup.py | # XXX(dlitz): Most of this is deployment-related stuff that belongs outside the
# main Python invocation.
import os
import sys
import json
import time
from inbox.config import config
from nylas.logging import get_logger
log = get_logger()
def _absolute_path(relative_path):
return os.path.join(os.path.dirname(os... | 2,485 | Python | .py | 63 | 34.079365 | 79 | 0.71 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,798 | file.py | nylas_sync-engine/inbox/util/file.py | import string
import errno
import os
import fcntl
from gevent.coros import BoundedSemaphore
def safe_filename(filename):
""" Strip filesystem-unfriendly characters from a filename. """
valid_chars = "-_.() {}{}".format(string.ascii_letters, string.digits)
return ''.join(c for c in filename if c in valid_... | 3,551 | Python | .py | 100 | 27.97 | 102 | 0.625328 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |
33,799 | url.py | nylas_sync-engine/inbox/util/url.py | import dns
import socket
from dns.resolver import Resolver
from dns.resolver import NoNameservers, NXDOMAIN, Timeout, NoAnswer
from urllib import urlencode
from nylas.logging import get_logger
from tldextract import extract as tld_extract
import re
log = get_logger('inbox.util.url')
from inbox.providers import provide... | 7,145 | Python | .py | 182 | 32.307692 | 78 | 0.649435 | nylas/sync-engine | 3,502 | 354 | 69 | AGPL-3.0 | 9/5/2024, 5:14:54 PM (Europe/Amsterdam) |