<commit_before>import requests

from modularodm import Q
from rest_framework import generics, permissions as drf_permissions
from rest_framework.exceptions import PermissionDenied, ValidationError

from framework.auth.core import Auth
from website.models import Node, Pointer
from api.users.serializers import ContributorSerializer
from api.base.filters import ODMFilterMixin, ListFilterMixin
from api.base.utils import get_object_or_404, waterbutler_url_for
from .serializers import NodeSerializer, NodePointersSerializer, NodeFilesSerializer
from .permissions import ContributorOrPublic, ReadOnlyIfRegistration, ContributorOrPublicForPointers


class NodeMixin(object):
    """Mixin with convenience methods for retrieving the current node based on the
    current URL. By default, fetches the current node based on the pk kwarg.
    """

    serializer_class = NodeSerializer
    node_lookup_url_kwarg = 'node_id'

    def get_node(self):
        obj = get_object_or_404(Node, self.kwargs[self.node_lookup_url_kwarg])
        # May raise a permission denied
        self.check_object_permissions(self.request, obj)
        return obj


class NodeList(generics.ListCreateAPIView, ODMFilterMixin):
    """Projects and components.

    On the front end, nodes are considered 'projects' or 'components'. The difference between a project and a component
    is that a project is the top-level node, and components are children of the project. There is also a category field
    that includes the option of project. The categorization essentially determines which icon is displayed by the
    Node in the front-end UI and helps with search organization. Top-level Nodes may have a category other than
    project, and children nodes may have a category of project.
<commit_msg>Changed comment variable name<commit_after>import requests

from modularodm import Q
from rest_framework import generics, permissions as drf_permissions
from rest_framework.exceptions import PermissionDenied, ValidationError

from framework.auth.core import Auth
from website.models import Node, Pointer
from api.users.serializers import ContributorSerializer
from api.base.filters import ODMFilterMixin, ListFilterMixin
from api.base.utils import get_object_or_404, waterbutler_url_for
from .serializers import NodeSerializer, NodePointersSerializer, NodeFilesSerializer
from .permissions import ContributorOrPublic, ReadOnlyIfRegistration, ContributorOrPublicForPointers


class NodeMixin(object):
    """Mixin with convenience methods for retrieving the current node based on the
    current URL. By default, fetches the current node based on the node_id kwarg.
    """

    serializer_class = NodeSerializer
    node_lookup_url_kwarg = 'node_id'

    def get_node(self):
        obj = get_object_or_404(Node, self.kwargs[self.node_lookup_url_kwarg])
        # May raise a permission denied
        self.check_object_permissions(self.request, obj)
        return obj


class NodeList(generics.ListCreateAPIView, ODMFilterMixin):
    """Projects and components.

    On the front end, nodes are considered 'projects' or 'components'. The difference between a project and a component
    is that a project is the top-level node, and components are children of the project. There is also a category field
    that includes the option of project. The categorization essentially determines which icon is displayed by the
    Node in the front-end UI and helps with search organization. Top-level Nodes may have a category other than
    project, and children nodes may have a category of project.

{'fraction_non_alphanumeric': 0.04539086578873634, 'fraction_numerical': 0.0033622863547212102, 'mean_word_length': 4.739549839228296, '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': '7512895', 'n_tokens_mistral': 921, 'n_tokens_neox': 890, 'n_words': 377}