<commit_before>#
# furl - URL manipulation made simple.
#
# <NAME>
# grunseid.com
# <EMAIL>
#
# License: Build Amazing Things (Unlicense)

import re
import abc
import urllib
import urlparse
import warnings
from itertools import izip
from posixpath import normpath

from omdict1D import omdict1D

_absent = object()

#
# TODO(grun): Subclass Path, PathCompositionInterface, Query, and
# QueryCompositionInterface into two subclasses each - one for the URL
# and one for the Fragment.
#
# Subclasses will clean up the code because the valid encodings are
# different between a URL Path and a Fragment Path and a URL Query and a
# Fragment Query.
#
# For example, '?' and '#' don't need to be encoded in Fragment Path
# segments but must be encoded in URL Path segments.
#
# Similarly, '#' doesn't need to be encoded in Fragment Query keys and
# values, but must be encoded in URL Query keys and values.
#

# Map of various URL schemes to their default ports. Scheme strings are
# lowercase.
DEFAULT_PORTS = {
    'ftp': 21,
    'ssh': 22,
    'http': 80,
    'https': 443,
}

# List of schemes that don't require two slashes after the colon. For example,
# 'mailto:<EMAIL>' instead of 'mailto://user@google.com'. Scheme
# strings are lowercase.
#
# TODO(grun): Support schemes separated by just ':', not '://' without having
# an explicit list. There are many such schemes in various URIs.
COLON_SEPARATED_SCHEMES = [
    'mailto',
    'tel',
    'sms'
]


class Path(object):

    """
    Represents a path comprised of zero or more path segments.

      http://tools.ietf.org/html/rfc3986#section-3.3

    Path parameters aren't supported.

    Attributes:
      _force_absolute: Function whos boolean return value specifies
        whether self.isabsolute should be forced to True or not. If
        _force_absolute(self) returns True, isabsolute is read only and
        raises an AttributeError if assigned to. If
        _force_absolute(self) returns False, isabsolute is mutable and
        can be set to True or False. URL paths use _force_absolute and
        return True if the netloc is non-empty (not equal to
        ''). Fragment paths are never read-only and their
        _force_absolute(self) always returns False.
      segments: List of zero or more path segments comprising this<commit_msg>Use consistent delimeter indentation.<commit_after>#
# furl - URL manipulation made simple.
#
# <NAME>
# grunseid.com
# <EMAIL>
#
# License: Build Amazing Things (Unlicense)

import re
import abc
import urllib
import urlparse
import warnings
from itertools import izip
from posixpath import normpath

from omdict1D import omdict1D

_absent = object()

#
# TODO(grun): Subclass Path, PathCompositionInterface, Query, and
# QueryCompositionInterface into two subclasses each - one for the URL
# and one for the Fragment.
#
# Subclasses will clean up the code because the valid encodings are
# different between a URL Path and a Fragment Path and a URL Query and a
# Fragment Query.
#
# For example, '?' and '#' don't need to be encoded in Fragment Path
# segments but must be encoded in URL Path segments.
#
# Similarly, '#' doesn't need to be encoded in Fragment Query keys and
# values, but must be encoded in URL Query keys and values.
#

# Map of various URL schemes to their default ports. Scheme strings are
# lowercase.
DEFAULT_PORTS = {
    'ftp': 21,
    'ssh': 22,
    'http': 80,
    'https': 443,
    }

# List of schemes that don't require two slashes after the colon. For example,
# 'mailto:<EMAIL>' instead of 'mailto://<EMAIL>@google.com'. Scheme
# strings are lowercase.
#
# TODO(grun): Support schemes separated by just ':', not '://' without having
# an explicit list. There are many such schemes in various URIs.
COLON_SEPARATED_SCHEMES = [
    'mailto',
    'tel',
    'sms'
    ]


class Path(object):

    """
    Represents a path comprised of zero or more path segments.

      http://tools.ietf.org/html/rfc3986#section-3.3

    Path parameters aren't supported.

    Attributes:
      _force_absolute: Function whos boolean return value specifies
        whether self.isabsolute should be forced to True or not. If
        _force_absolute(self) returns True, isabsolute is read only and
        raises an AttributeError if assigned to. If
        _force_absolute(self) returns False, isabsolute is mutable and
        can be set to True or False. URL paths use _force_absolute and
        return True if the netloc is non-empty (not equal to
        ''). Fragment paths are never read-only and their
        _force_absolute(self) always returns False.
      segments: List of zero or more path segments comprising this
{'fraction_non_alphanumeric': 0.07675768651902816, 'fraction_numerical': 0.007310255858955063, 'mean_word_length': 3.4516746411483252, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, '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': '4685791', 'n_tokens_mistral': 1392, 'n_tokens_neox': 1320, 'n_words': 592}