<commit_before># coding: utf-8
from __future__ import (absolute_import, division, print_function,
                        unicode_literals)

import os
import copy
from functools import partial
from itertools import chain, count

import click
from pip.req import InstallRequirement

from .cache import DependencyCache
from .exceptions import UnsupportedConstraint
from .logging import log
from .utils import (first, format_requirement, format_specifier, full_groupby,
                    get_pinned_version,
                    is_pinned_requirement, key_from_req, is_vcs_link,
                    UNSAFE_PACKAGES)

green = partial(click.style, fg='green')
magenta = partial(click.style, fg='magenta')


def _dep_key(ireq):
    if ireq.req is None and ireq.link is not None:
        return str(ireq.link)
    else:
        return key_from_req(ireq.req)


class RequirementSummary(object):
    """
    Summary of a requirement's properties for comparison purposes.
    """
    def __init__(self, req):
        self.req = req
        self.key = key_from_req(req)
        self.extras = str(sorted(req.extras))
        self.specifier = str(req.specifier)

    def __eq__(self, other):
        return str(self) == str(other)

    def __hash__(self):
        return hash(str(self))

    def __str__(self):
        return repr([self.key, self.specifier, self.extras])


class Resolver(object):
    def __init__(self, constraints, repository, cache=None, prereleases=False, clear_caches=False, allow_unsafe=False):
        """
        This class resolves a given set of constraints (a collection of
        InstallRequirement objects) by consulting the given Repository and the
        DependencyCache.
        """
        self.our_constraints = set(x for x in constraints if not x.constraint)
        self.limiters = set(x for x in constraints if x.constraint)
        self.their_constraints = set()
        self.repository = repository
        if cache is None:
            cache = DependencyCache()  # pragma: no cover
        self.dependency_cache = cache
        self.prereleases = prereleases
        self.clear_caches = clear_caches
        self.allow_unsafe = allow_unsafe

    @property
    def constraints(self):
        grouped = self._group_constraints(chain(
            self.our_constraints, self.their_constraints, self.limiters))
        return set(ireq for ireq in grouped if not ireq.constraint)

    def resolve_hashes(self, ireqs):
        """
        Finds acceptable hashes for all of the given InstallRequirements.
        """
        return {ireq: self.repository.get_hashes(ireq) for ireq in ireqs}<commit_msg>Remove one "no cover" pragma<commit_after># coding: utf-8
from __future__ import (absolute_import, division, print_function,
                        unicode_literals)

import os
import copy
from functools import partial
from itertools import chain, count

import click
from pip.req import InstallRequirement

from .cache import DependencyCache
from .exceptions import UnsupportedConstraint
from .logging import log
from .utils import (first, format_requirement, format_specifier, full_groupby,
                    get_pinned_version,
                    is_pinned_requirement, key_from_req, is_vcs_link,
                    UNSAFE_PACKAGES)

green = partial(click.style, fg='green')
magenta = partial(click.style, fg='magenta')


def _dep_key(ireq):
    if ireq.req is None and ireq.link is not None:
        return str(ireq.link)
    else:
        return key_from_req(ireq.req)


class RequirementSummary(object):
    """
    Summary of a requirement's properties for comparison purposes.
    """
    def __init__(self, req):
        self.req = req
        self.key = key_from_req(req)
        self.extras = str(sorted(req.extras))
        self.specifier = str(req.specifier)

    def __eq__(self, other):
        return str(self) == str(other)

    def __hash__(self):
        return hash(str(self))

    def __str__(self):
        return repr([self.key, self.specifier, self.extras])


class Resolver(object):
    def __init__(self, constraints, repository, cache=None, prereleases=False, clear_caches=False, allow_unsafe=False):
        """
        This class resolves a given set of constraints (a collection of
        InstallRequirement objects) by consulting the given Repository and the
        DependencyCache.
        """
        self.our_constraints = set(x for x in constraints if not x.constraint)
        self.limiters = set(x for x in constraints if x.constraint)
        self.their_constraints = set()
        self.repository = repository
        if cache is None:
            cache = DependencyCache()
        self.dependency_cache = cache
        self.prereleases = prereleases
        self.clear_caches = clear_caches
        self.allow_unsafe = allow_unsafe

    @property
    def constraints(self):
        grouped = self._group_constraints(chain(
            self.our_constraints, self.their_constraints, self.limiters))
        return set(ireq for ireq in grouped if not ireq.constraint)

    def resolve_hashes(self, ireqs):
        """
        Finds acceptable hashes for all of the given InstallRequirements.
        """
        return {ireq: self.repository.get_hashes(ireq) for ireq in ireqs}
{'fraction_non_alphanumeric': 0.07966457023060797, 'fraction_numerical': 0.0003811701924909472, 'mean_word_length': 2.8084179970972425, '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': '5477893', 'n_tokens_mistral': 1553, 'n_tokens_neox': 1491, 'n_words': 434}