<commit_before># -*- coding: utf-8 -*-

"""
requests.utils
~~~~~~~~~~~~~~

This module provides utility functions that are used within Requests
that are also useful for external consumption.

"""

import cgi
import codecs
import os
import random
import re
import traceback
import zlib
from netrc import netrc, NetrcParseError

from .compat import parse_http_list as _parse_list_header
from .compat import quote, cookielib, SimpleCookie, is_py2, urlparse
from .compat import basestring, bytes, str


NETRC_FILES = ('.netrc', '_netrc')


def get_netrc_auth(url):
    """Returns the Requests tuple auth for a given url from netrc."""

    locations = (os.path.expanduser('~/{0}'.format(f)) for f in NETRC_FILES)
    netrc_path = None

    for loc in locations:
        if os.path.exists(loc) and not netrc_path:
            netrc_path = loc

    # Abort early if there isn't one.
    if netrc_path is None:
        return netrc_path

    ri = urlparse(url)

    # Strip port numbers from netloc<commit_msg>removing unused import<commit_after># -*- coding: utf-8 -*-

"""
requests.utils
~~~~~~~~~~~~~~

This module provides utility functions that are used within Requests
that are also useful for external consumption.

"""

import cgi
import codecs
import os
import random
import re
import zlib
from netrc import netrc, NetrcParseError

from .compat import parse_http_list as _parse_list_header
from .compat import quote, cookielib, SimpleCookie, is_py2, urlparse
from .compat import basestring, bytes, str


NETRC_FILES = ('.netrc', '_netrc')


def get_netrc_auth(url):
    """Returns the Requests tuple auth for a given url from netrc."""

    locations = (os.path.expanduser('~/{0}'.format(f)) for f in NETRC_FILES)
    netrc_path = None

    for loc in locations:
        if os.path.exists(loc) and not netrc_path:
            netrc_path = loc

    # Abort early if there isn't one.
    if netrc_path is None:
        return netrc_path

    ri = urlparse(url)

    # Strip port numbers from netloc
{'fraction_non_alphanumeric': 0.09509509509509509, 'fraction_numerical': 0.003003003003003003, 'mean_word_length': 3.574370709382151, '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': '4180572', 'n_tokens_mistral': 632, 'n_tokens_neox': 605, 'n_words': 227}