<commit_before>import logging
import os

import requests
from dateutil.parser import parse as parse_date
from django.core.exceptions import ObjectDoesNotExist
from django.db import models
from django.db.models import Manager
from django.utils import timezone
from modularodm.exceptions import NoResultsFound
from typedmodels.models import TypedModel

from framework.analytics import get_basic_counters
from osf.models.base import BaseModel, OptionalGuidMixin, ObjectIDMixin
from osf.models.comment import CommentableMixin
from osf.models.mixins import Taggable
from osf.models.validators import validate_location
from osf.modm_compat import Q
from osf.utils.datetime_aware_jsonfield import DateTimeAwareJSONField
from osf.utils.fields import NonNaiveDateTimeField
from website.files import utils
from website.files.exceptions import VersionNotFoundError
from website.util import api_v2_url, waterbutler_api_url_for

__all__ = (
    'File',
    'Folder',
    'FileVersion',
    'StoredFileNode',
    'TrashedFileNode',
)

PROVIDER_MAP = {}
logger = logging.getLogger(__name__)


class BaseFileNodeManager(Manager):
    def get_queryset(self):
        qs = super(BaseFileNodeManager, self).get_queryset()
        if not issubclass(self.model, TrashedFileNode):
            qs = qs.exclude(type__in=TrashedFileNode._typedmodels_subtypes)
        if hasattr(self.model, '_provider') and self.model._provider is not None:
            return qs.filter(provider=self.model._provider)
        return qs


class UnableToResolveFileClass(Exception):
    pass


class DeprecatedException(Exception):
    pass


class BaseFileNode(TypedModel, CommentableMixin, OptionalGuidMixin, Taggable, ObjectIDMixin, BaseModel):
    """
        The storage backend for FileNode objects.
        This class should generally not be used or created manually as FileNode<commit_msg>Add BaseFileNode to __all__<commit_after>import logging
import os

import requests
from dateutil.parser import parse as parse_date
from django.core.exceptions import ObjectDoesNotExist
from django.db import models
from django.db.models import Manager
from django.utils import timezone
from modularodm.exceptions import NoResultsFound
from typedmodels.models import TypedModel

from framework.analytics import get_basic_counters
from osf.models.base import BaseModel, OptionalGuidMixin, ObjectIDMixin
from osf.models.comment import CommentableMixin
from osf.models.mixins import Taggable
from osf.models.validators import validate_location
from osf.modm_compat import Q
from osf.utils.datetime_aware_jsonfield import DateTimeAwareJSONField
from osf.utils.fields import NonNaiveDateTimeField
from website.files import utils
from website.files.exceptions import VersionNotFoundError
from website.util import api_v2_url, waterbutler_api_url_for

__all__ = (
    'File',
    'Folder',
    'FileVersion',
    'StoredFileNode',
    'BaseFileNode',
    'TrashedFileNode',
)

PROVIDER_MAP = {}
logger = logging.getLogger(__name__)


class BaseFileNodeManager(Manager):
    def get_queryset(self):
        qs = super(BaseFileNodeManager, self).get_queryset()
        if not issubclass(self.model, TrashedFileNode):
            qs = qs.exclude(type__in=TrashedFileNode._typedmodels_subtypes)
        if hasattr(self.model, '_provider') and self.model._provider is not None:
            return qs.filter(provider=self.model._provider)
        return qs


class UnableToResolveFileClass(Exception):
    pass


class DeprecatedException(Exception):
    pass


class BaseFileNode(TypedModel, CommentableMixin, OptionalGuidMixin, Taggable, ObjectIDMixin, BaseModel):
    """
        The storage backend for FileNode objects.
        This class should generally not be used or created manually as FileNode
{'fraction_non_alphanumeric': 0.06226616782469268, 'fraction_numerical': 0.0005344735435595938, 'mean_word_length': 4.857589984350548, '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': '2054154', 'n_tokens_mistral': 1069, 'n_tokens_neox': 1056, 'n_words': 299}