<commit_before># -*- coding: utf-8 -*-
import os
import time
import logging
from datetime import datetime

import furl
import pymongo
import requests
from modularodm import fields, StoredObject
from box import CredentialsV2, refresh_v2_token, BoxClientException

from framework.auth import Auth
from framework.exceptions import HTTPError

from website.addons.base import exceptions
from website.addons.base import AddonUserSettingsBase, AddonNodeSettingsBase, GuidFile

from website.addons.box import settings
from website.addons.box.utils import BoxNodeLogger
from website.addons.box.client import get_client_from_user_settings


logger = logging.getLogger(__name__)


class BoxFile(GuidFile):
    """A Box file model with a GUID. Created lazily upon viewing a
    file's detail page.
    """
    __indices__ = [
        {
            'key_or_list': [
                ('node', pymongo.ASCENDING),
                ('path', pymongo.ASCENDING),
            ],
            'unique': True,
        }
    ]
    path = fields.StringField(required=True, index=True)

    @property
    def waterbutler_path(self):
        if not self.path.startswith('/'):
            return '/{}'.format(self.path)
        return self.path

    @property
    def provider(self):
        return 'box'

    @property
    def version_identifier(self):
        return 'revision'

    @property
    def unique_identifier(self):
        return self._metadata_cache['extra'].get('etag') or self._metadata_cache['version']

    @property
    def extra(self):
        if not self._metadata_cache:
            return {}

        return {
            'fullPath': self._metadata_cache['extra']['fullPath'],
        }


class BoxOAuthSettings(StoredObject):
    """
    this model address the problem if we have two osf user link
    to the same box user and their access token conflicts issue
    """

    # Box user id, for example, "4974056"
    user_id = fields.StringField(primary=True, required=True)
    # Box user name this is the user's login
    username = fields.StringField()
    access_token = fields.StringField()
    refresh_token = fields.StringField()
    expires_at = fields.DateTimeField()
<commit_msg>fullPath is now its own key<commit_after># -*- coding: utf-8 -*-
import os
import time
import logging
from datetime import datetime

import furl
import pymongo
import requests
from modularodm import fields, StoredObject
from box import CredentialsV2, refresh_v2_token, BoxClientException

from framework.auth import Auth
from framework.exceptions import HTTPError

from website.addons.base import exceptions
from website.addons.base import AddonUserSettingsBase, AddonNodeSettingsBase, GuidFile

from website.addons.box import settings
from website.addons.box.utils import BoxNodeLogger
from website.addons.box.client import get_client_from_user_settings


logger = logging.getLogger(__name__)


class BoxFile(GuidFile):
    """A Box file model with a GUID. Created lazily upon viewing a
    file's detail page.
    """
    __indices__ = [
        {
            'key_or_list': [
                ('node', pymongo.ASCENDING),
                ('path', pymongo.ASCENDING),
            ],
            'unique': True,
        }
    ]
    path = fields.StringField(required=True, index=True)

    @property
    def waterbutler_path(self):
        if not self.path.startswith('/'):
            return '/{}'.format(self.path)
        return self.path

    @property
    def provider(self):
        return 'box'

    @property
    def version_identifier(self):
        return 'revision'

    @property
    def unique_identifier(self):
        return self._metadata_cache['extra'].get('etag') or self._metadata_cache['version']

    @property
    def extra(self):
        if not self._metadata_cache:
            return {}

        return {
            'fullPath': self._metadata_cache['fullPath'],
        }


class BoxOAuthSettings(StoredObject):
    """
    this model address the problem if we have two osf user link
    to the same box user and their access token conflicts issue
    """

    # Box user id, for example, "4974056"
    user_id = fields.StringField(primary=True, required=True)
    # Box user name this is the user's login
    username = fields.StringField()
    access_token = fields.StringField()
    refresh_token = fields.StringField()
    expires_at = fields.DateTimeField()

{'fraction_non_alphanumeric': 0.08964097873313515, 'fraction_numerical': 0.00457351932311914, 'mean_word_length': 2.9405405405405407, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5367356', 'n_tokens_mistral': 1253, 'n_tokens_neox': 1214, 'n_words': 359}