<commit_before>"""
bughipster.project.models
~~~~~~~~~~~~~~~~~~~~~~~~~

:copyright: (c) 2014 by <NAME>, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import print_function, division
from __future__ import absolute_import, unicode_literals

import inspect
import new
 
from django.utils.encoding import python_2_unicode_compatible
from django.db.models import query
from django.db import models

from compositekey import db


 
class ManagerQuerySet(query.QuerySet):
    """
    A base class for querysets that support being converted to managers
    (for use as a model's `objects` manager) via `ManagerQuerySet.as_manager`.
    """
     
    def as_manager(self, base=models.Manager):
        """
        Creates a manager from the current queryset by copying any methods not
        defined in the queryset class's parent classes (`query.QuerySet` and
        `ManagerQuerySet`).
        """
        cls = self.__class__ # Nested class.
         
        class QuerySetManager(base):
            use_for_related_fields = True
             
            def get_query_set(self):
                return cls(self.model)
         
        base_classes = [ManagerQuerySet, query.QuerySet]
        base_methods = [
            inspect.getmembers(base, inspect.ismethod) for base in base_classes
        ]
         
        def in_base_class(method_name):
            for methods in base_methods:
                for (name, _) in methods:
                    if name == method_name:
                        return True
            return False
         
        for (method_name, method) in inspect.getmembers(self, inspect.ismethod):
             if not in_base_class(method_name):
                 new_method = new.instancemethod(
                     method.im_func, None, QuerySetManager
                 )
                 setattr(QuerySetManager, method_name, new_method)
     
        return QuerySetManager()

# TODO:
# Manage the field type #7
# Manage the field type #3
# Rename op_sys -> os
# Rename rep_platform -> Domain


CF_TYPE_CHOICES = (
    (0, 'Unknown'),<commit_msg>Removed comments.<commit_after>"""
bughipster.project.models
~~~~~~~~~~~~~~~~~~~~~~~~~

:copyright: (c) 2014 by <NAME>, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import print_function, division
from __future__ import absolute_import, unicode_literals

import inspect
import new
 
from django.utils.encoding import python_2_unicode_compatible
from django.db.models import query
from django.db import models

from compositekey import db


 
class ManagerQuerySet(query.QuerySet):
    """
    A base class for querysets that support being converted to managers
    (for use as a model's `objects` manager) via `ManagerQuerySet.as_manager`.
    """
     
    def as_manager(self, base=models.Manager):
        """
        Creates a manager from the current queryset by copying any methods not
        defined in the queryset class's parent classes (`query.QuerySet` and
        `ManagerQuerySet`).
        """
        cls = self.__class__ # Nested class.
         
        class QuerySetManager(base):
            use_for_related_fields = True
             
            def get_query_set(self):
                return cls(self.model)
         
        base_classes = [ManagerQuerySet, query.QuerySet]
        base_methods = [
            inspect.getmembers(base, inspect.ismethod) for base in base_classes
        ]
         
        def in_base_class(method_name):
            for methods in base_methods:
                for (name, _) in methods:
                    if name == method_name:
                        return True
            return False
         
        for (method_name, method) in inspect.getmembers(self, inspect.ismethod):
             if not in_base_class(method_name):
                 new_method = new.instancemethod(
                     method.im_func, None, QuerySetManager
                 )
                 setattr(QuerySetManager, method_name, new_method)
     
        return QuerySetManager()

# TODO:
# Manage the field type #7
# Manage the field type #3


CF_TYPE_CHOICES = (
    (0, 'Unknown'),
{'fraction_non_alphanumeric': 0.0833729216152019, 'fraction_numerical': 0.003800475059382423, 'mean_word_length': 2.246723207401696, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '1526045', 'n_tokens_mistral': 1140, 'n_tokens_neox': 1102, 'n_words': 342}