repo stringlengths 2 99 | file stringlengths 13 225 | code stringlengths 0 18.3M | file_length int64 0 18.3M | avg_line_length float64 0 1.36M | max_line_length int64 0 4.26M | extension_type stringclasses 1
value |
|---|---|---|---|---|---|---|
pip | pip-main/noxfile.py | """Automation using nox.
"""
import argparse
import glob
import os
import shutil
import sys
from pathlib import Path
from typing import Iterator, List, Tuple
import nox
# fmt: off
sys.path.append(".")
from tools import release # isort:skip # noqa
sys.path.pop()
# fmt: on
nox.options.reuse_existing_virtualenvs = T... | 13,090 | 32.310433 | 85 | py |
pip | pip-main/tools/protected_pip.py | import os
import pathlib
import shutil
import subprocess
import sys
from glob import glob
from typing import Iterable, Union
VIRTUAL_ENV = os.environ["VIRTUAL_ENV"]
TOX_PIP_DIR = os.path.join(VIRTUAL_ENV, "pip")
def pip(args: Iterable[Union[str, pathlib.Path]]) -> None:
# First things first, get a recent (stable... | 1,127 | 27.923077 | 87 | py |
pip | pip-main/tools/update-rtd-redirects.py | """Update the 'exact' redirects on Read the Docs to match an in-tree file's contents.
Relevant API reference: https://docs.readthedocs.io/en/stable/api/v3.html#redirects
"""
import operator
import os
import sys
from pathlib import Path
import httpx
import rich
import yaml
try:
_TOKEN = os.environ["RTD_API_TOKEN"... | 4,487 | 27.769231 | 88 | py |
pip | pip-main/tools/release/check_version.py | """Checks if the version is acceptable, as per this project's release process.
"""
import sys
from datetime import datetime
from typing import Optional
from packaging.version import InvalidVersion, Version
def is_this_a_good_version_number(string: str) -> Optional[str]:
try:
v = Version(string)
exce... | 1,030 | 22.431818 | 78 | py |
pip | pip-main/tools/release/__init__.py | """Helpers for release automation.
These are written according to the order they are called in.
"""
import contextlib
import os
import pathlib
import subprocess
import tempfile
from typing import Iterator, List, Optional, Set
from nox.sessions import Session
def get_version_from_arguments(session: Session) -> Opti... | 5,781 | 27.067961 | 81 | py |
pip | pip-main/src/pip/__pip-runner__.py | """Execute exactly this copy of pip, within a different environment.
This file is named as it is, to ensure that this module can't be imported via
an import statement.
"""
# /!\ This version compatibility check section must be Python 2 compatible. /!\
import sys
# Copied from setup.py
PYTHON_REQUIRES = (3, 7)
def... | 1,444 | 27.333333 | 82 | py |
pip | pip-main/src/pip/__main__.py | import os
import sys
# Remove '' and current working directory from the first entry
# of sys.path, if present to avoid using current directory
# in pip commands check, freeze, install, list and show,
# when invoked as python -m pip <command>
if sys.path[0] in ("", os.getcwd()):
sys.path.pop(0)
# If we are running... | 854 | 33.2 | 75 | py |
pip | pip-main/src/pip/__init__.py | from typing import List, Optional
__version__ = "23.3.dev0"
def main(args: Optional[List[str]] = None) -> int:
"""This is an internal API only meant for use by pip's own console scripts.
For additional details, see https://github.com/pypa/pip/issues/7498.
"""
from pip._internal.utils.entrypoints imp... | 360 | 24.785714 | 79 | py |
pip | pip-main/src/pip/_vendor/six.py | # Copyright (c) 2010-2020 Benjamin Peterson
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publi... | 34,549 | 33.584585 | 118 | py |
pip | pip-main/src/pip/_vendor/typing_extensions.py | import abc
import collections
import collections.abc
import functools
import inspect
import operator
import sys
import types as _types
import typing
import warnings
__all__ = [
# Super-special typing primitives.
'Any',
'ClassVar',
'Concatenate',
'Final',
'LiteralString',
'ParamSpec',
'P... | 111,130 | 35.163684 | 90 | py |
pip | pip-main/src/pip/_vendor/__init__.py | """
pip._vendor is for vendoring dependencies of pip to prevent needing pip to
depend on something external.
Files inside of pip._vendor should be considered immutable and should only be
updated to versions from upstream.
"""
from __future__ import absolute_import
import glob
import os.path
import sys
# Downstream r... | 4,966 | 40.049587 | 79 | py |
pip | pip-main/src/pip/_vendor/colorama/winterm.py | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
try:
from msvcrt import get_osfhandle
except ImportError:
def get_osfhandle(_):
raise OSError("This isn't windows!")
from . import win32
# from wincon.h
class WinColor(object):
BLACK = 0
BLUE = 1
GREEN = 2
... | 7,134 | 35.403061 | 95 | py |
pip | pip-main/src/pip/_vendor/colorama/ansitowin32.py | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
import re
import sys
import os
from .ansi import AnsiFore, AnsiBack, AnsiStyle, Style, BEL
from .winterm import enable_vt_processing, WinTerm, WinColor, WinStyle
from .win32 import windll, winapi_test
winterm = None
if windll is not None:
... | 11,128 | 39.032374 | 103 | py |
pip | pip-main/src/pip/_vendor/colorama/__init__.py | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
from .initialise import init, deinit, reinit, colorama_text, just_fix_windows_console
from .ansi import Fore, Back, Style, Cursor
from .ansitowin32 import AnsiToWin32
__version__ = '0.4.6'
| 266 | 32.375 | 85 | py |
pip | pip-main/src/pip/_vendor/colorama/initialise.py | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
import atexit
import contextlib
import sys
from .ansitowin32 import AnsiToWin32
def _wipe_internal_state_for_tests():
global orig_stdout, orig_stderr
orig_stdout = None
orig_stderr = None
global wrapped_stdout, wrapped_stderr... | 3,325 | 26.262295 | 84 | py |
pip | pip-main/src/pip/_vendor/colorama/win32.py | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
# from winbase.h
STDOUT = -11
STDERR = -12
ENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x0004
try:
import ctypes
from ctypes import LibraryLoader
windll = LibraryLoader(ctypes.WinDLL)
from ctypes import wintypes
except (AttributeErro... | 6,181 | 33.154696 | 111 | py |
pip | pip-main/src/pip/_vendor/colorama/ansi.py | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
'''
This module generates ANSI character codes to printing colors to terminals.
See: http://en.wikipedia.org/wiki/ANSI_escape_code
'''
CSI = '\033['
OSC = '\033]'
BEL = '\a'
def code_to_chars(code):
return CSI + str(code) + 'm'
def set_t... | 2,522 | 23.495146 | 78 | py |
pip | pip-main/src/pip/_vendor/colorama/tests/initialise_test.py | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
import sys
from unittest import TestCase, main, skipUnless
try:
from unittest.mock import patch, Mock
except ImportError:
from mock import patch, Mock
from ..ansitowin32 import StreamWrapper
from ..initialise import init, just_fix_wind... | 6,741 | 34.484211 | 87 | py |
pip | pip-main/src/pip/_vendor/colorama/tests/utils.py | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
from contextlib import contextmanager
from io import StringIO
import sys
import os
class StreamTTY(StringIO):
def isatty(self):
return True
class StreamNonTTY(StringIO):
def isatty(self):
return False
@contextmanager
... | 1,079 | 20.6 | 74 | py |
pip | pip-main/src/pip/_vendor/colorama/tests/ansitowin32_test.py | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
from io import StringIO, TextIOWrapper
from unittest import TestCase, main
try:
from contextlib import ExitStack
except ImportError:
# python 2
from contextlib2 import ExitStack
try:
from unittest.mock import MagicMock, Mock, pa... | 10,678 | 35.2 | 87 | py |
pip | pip-main/src/pip/_vendor/colorama/tests/winterm_test.py | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
import sys
from unittest import TestCase, main, skipUnless
try:
from unittest.mock import Mock, patch
except ImportError:
from mock import Mock, patch
from ..winterm import WinColor, WinStyle, WinTerm
class WinTermTest(TestCase):
... | 3,709 | 27.106061 | 74 | py |
pip | pip-main/src/pip/_vendor/colorama/tests/__init__.py | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
| 75 | 37 | 74 | py |
pip | pip-main/src/pip/_vendor/colorama/tests/ansi_test.py | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
import sys
from unittest import TestCase, main
from ..ansi import Back, Fore, Style
from ..ansitowin32 import AnsiToWin32
stdout_orig = sys.stdout
stderr_orig = sys.stderr
class AnsiTest(TestCase):
def setUp(self):
# sanity chec... | 2,839 | 35.883117 | 74 | py |
pip | pip-main/src/pip/_vendor/colorama/tests/isatty_test.py | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
import sys
from unittest import TestCase, main
from ..ansitowin32 import StreamWrapper, AnsiToWin32
from .utils import pycharm, replace_by, replace_original_by, StreamTTY, StreamNonTTY
def is_a_tty(stream):
return StreamWrapper(stream, No... | 1,866 | 31.189655 | 84 | py |
pip | pip-main/src/pip/_vendor/pyproject_hooks/_compat.py | __all__ = ("tomllib",)
import sys
if sys.version_info >= (3, 11):
import tomllib
else:
from pip._vendor import tomli as tomllib
| 138 | 14.444444 | 44 | py |
pip | pip-main/src/pip/_vendor/pyproject_hooks/_impl.py | import json
import os
import sys
import tempfile
from contextlib import contextmanager
from os.path import abspath
from os.path import join as pjoin
from subprocess import STDOUT, check_call, check_output
from ._in_process import _in_proc_script_path
def write_json(obj, path, **kwargs):
with open(path, 'w', enco... | 11,920 | 35.015106 | 79 | py |
pip | pip-main/src/pip/_vendor/pyproject_hooks/__init__.py | """Wrappers to call pyproject.toml-based build backend hooks.
"""
from ._impl import (
BackendInvalid,
BackendUnavailable,
BuildBackendHookCaller,
HookMissing,
UnsupportedOperation,
default_subprocess_runner,
quiet_subprocess_runner,
)
__version__ = '1.0.0'
__all__ = [
'BackendUnavaila... | 491 | 19.5 | 61 | py |
pip | pip-main/src/pip/_vendor/pyproject_hooks/_in_process/_in_process.py | """This is invoked in a subprocess to call the build backend hooks.
It expects:
- Command line args: hook_name, control_dir
- Environment variables:
PEP517_BUILD_BACKEND=entry.point:spec
PEP517_BACKEND_PATH=paths (separated with os.pathsep)
- control_dir/input.json:
- {"kwargs": {...}}
Results:
- contro... | 10,927 | 29.870056 | 79 | py |
pip | pip-main/src/pip/_vendor/pyproject_hooks/_in_process/__init__.py | """This is a subpackage because the directory is on sys.path for _in_process.py
The subpackage should stay as empty as possible to avoid shadowing modules that
the backend might import.
"""
import importlib.resources as resources
try:
resources.files
except AttributeError:
# Python 3.8 compatibility
def ... | 546 | 27.789474 | 79 | py |
pip | pip-main/src/pip/_vendor/resolvelib/structs.py | import itertools
from .compat import collections_abc
class DirectedGraph(object):
"""A graph structure with directed edges."""
def __init__(self):
self._vertices = set()
self._forwards = {} # <key> -> Set[<key>]
self._backwards = {} # <key> -> Set[<key>]
def __iter__(self):
... | 4,963 | 28.02924 | 81 | py |
pip | pip-main/src/pip/_vendor/resolvelib/providers.py | class AbstractProvider(object):
"""Delegate class to provide the required interface for the resolver."""
def identify(self, requirement_or_candidate):
"""Given a requirement, return an identifier for it.
This is used to identify a requirement, e.g. whether two requirements
should have ... | 5,871 | 42.820896 | 81 | py |
pip | pip-main/src/pip/_vendor/resolvelib/reporters.py | class BaseReporter(object):
"""Delegate class to provider progress reporting for the resolver."""
def starting(self):
"""Called before the resolution actually starts."""
def starting_round(self, index):
"""Called before each round of resolution starts.
The index is zero-based.
... | 1,601 | 35.409091 | 85 | py |
pip | pip-main/src/pip/_vendor/resolvelib/resolvers.py | import collections
import itertools
import operator
from .providers import AbstractResolver
from .structs import DirectedGraph, IteratorMapping, build_iter_view
RequirementInformation = collections.namedtuple(
"RequirementInformation", ["requirement", "parent"]
)
class ResolverException(Exception):
"""A bas... | 20,511 | 36.430657 | 86 | py |
pip | pip-main/src/pip/_vendor/resolvelib/__init__.py | __all__ = [
"__version__",
"AbstractProvider",
"AbstractResolver",
"BaseReporter",
"InconsistentCandidate",
"Resolver",
"RequirementsConflicted",
"ResolutionError",
"ResolutionImpossible",
"ResolutionTooDeep",
]
__version__ = "1.0.1"
from .providers import AbstractProvider, Ab... | 537 | 18.925926 | 57 | py |
pip | pip-main/src/pip/_vendor/resolvelib/compat/collections_abc.py | __all__ = ["Mapping", "Sequence"]
try:
from collections.abc import Mapping, Sequence
except ImportError:
from collections import Mapping, Sequence
| 156 | 21.428571 | 49 | py |
pip | pip-main/src/pip/_vendor/resolvelib/compat/__init__.py | 0 | 0 | 0 | py | |
pip | pip-main/src/pip/_vendor/idna/core.py | from . import idnadata
import bisect
import unicodedata
import re
from typing import Union, Optional
from .intranges import intranges_contain
_virama_combining_class = 9
_alabel_prefix = b'xn--'
_unicode_dots_re = re.compile('[\u002e\u3002\uff0e\uff61]')
class IDNAError(UnicodeError):
""" Base exception for all I... | 12,950 | 31.296758 | 150 | py |
pip | pip-main/src/pip/_vendor/idna/codec.py | from .core import encode, decode, alabel, ulabel, IDNAError
import codecs
import re
from typing import Tuple, Optional
_unicode_dots_re = re.compile('[\u002e\u3002\uff0e\uff61]')
class Codec(codecs.Codec):
def encode(self, data: str, errors: str = 'strict') -> Tuple[bytes, int]:
if errors != 'strict':
... | 3,374 | 28.867257 | 101 | py |
pip | pip-main/src/pip/_vendor/idna/intranges.py | """
Given a list of integers, made up of (hopefully) a small number of long runs
of consecutive integers, compute a representation of the form
((start1, end1), (start2, end2) ...). Then answer the question "was x present
in the original list?" in time O(log(# runs)).
"""
import bisect
from typing import List, Tuple
d... | 1,881 | 33.218182 | 77 | py |
pip | pip-main/src/pip/_vendor/idna/package_data.py | __version__ = '3.4'
| 21 | 6.333333 | 19 | py |
pip | pip-main/src/pip/_vendor/idna/__init__.py | from .package_data import __version__
from .core import (
IDNABidiError,
IDNAError,
InvalidCodepoint,
InvalidCodepointContext,
alabel,
check_bidi,
check_hyphen_ok,
check_initial_combiner,
check_label,
check_nfc,
decode,
encode,
ulabel,
uts46_remap,
valid_conte... | 849 | 17.888889 | 40 | py |
pip | pip-main/src/pip/_vendor/idna/uts46data.py | # This file is automatically generated by tools/idna-data
# vim: set fileencoding=utf-8 :
from typing import List, Tuple, Union
"""IDNA Mapping Table from UTS46."""
__version__ = '15.0.0'
def _seg_0() -> List[Union[Tuple[int, str], Tuple[int, str, str]]]:
return [
(0x0, '3'),
(0x1, '3'),
(0x2, '3')... | 197,261 | 21.934775 | 68 | py |
pip | pip-main/src/pip/_vendor/idna/compat.py | from .core import *
from .codec import *
from typing import Any, Union
def ToASCII(label: str) -> bytes:
return encode(label)
def ToUnicode(label: Union[bytes, bytearray]) -> str:
return decode(label)
def nameprep(s: Any) -> None:
raise NotImplementedError('IDNA 2008 does not utilise nameprep protocol')
... | 321 | 22 | 77 | py |
pip | pip-main/src/pip/_vendor/idna/idnadata.py | # This file is automatically generated by tools/idna-data
__version__ = '15.0.0'
scripts = {
'Greek': (
0x37000000374,
0x37500000378,
0x37a0000037e,
0x37f00000380,
0x38400000385,
0x38600000387,
0x3880000038b,
0x38c0000038d,
0x38e000003a2,
... | 44,375 | 19.620818 | 57 | py |
pip | pip-main/src/pip/_vendor/pkg_resources/__init__.py | """
Package resource API
--------------------
A resource is a logical file contained within a package, or a logical
subdirectory thereof. The package resource API expects resource names
to have their path parts separated with ``/``, *not* whatever the local
path separator is. Do not use os.path operations to manipul... | 109,362 | 31.529149 | 88 | py |
pip | pip-main/src/pip/_vendor/webencodings/labels.py | """
webencodings.labels
~~~~~~~~~~~~~~~~~~~
Map encoding labels to their name.
:copyright: Copyright 2012 by Simon Sapin
:license: BSD, see LICENSE for details.
"""
# XXX Do not edit!
# This file is automatically generated by mklabels.py
LABELS = {
'unicode-1-1-utf-8': 'utf-8',
'utf-... | 8,979 | 37.706897 | 53 | py |
pip | pip-main/src/pip/_vendor/webencodings/tests.py | # coding: utf-8
"""
webencodings.tests
~~~~~~~~~~~~~~~~~~
A basic test suite for Encoding.
:copyright: Copyright 2012 by Simon Sapin
:license: BSD, see LICENSE for details.
"""
from __future__ import unicode_literals
from . import (lookup, LABELS, decode, encode, iter_decode, iter_encode,
... | 6,524 | 41.37013 | 98 | py |
pip | pip-main/src/pip/_vendor/webencodings/mklabels.py | """
webencodings.mklabels
~~~~~~~~~~~~~~~~~~~~~
Regenarate the webencodings.labels module.
:copyright: Copyright 2012 by Simon Sapin
:license: BSD, see LICENSE for details.
"""
import json
try:
from urllib import urlopen
except ImportError:
from urllib.request import urlopen
def asser... | 1,305 | 20.766667 | 71 | py |
pip | pip-main/src/pip/_vendor/webencodings/x_user_defined.py | # coding: utf-8
"""
webencodings.x_user_defined
~~~~~~~~~~~~~~~~~~~~~~~~~~~
An implementation of the x-user-defined encoding.
:copyright: Copyright 2012 by Simon Sapin
:license: BSD, see LICENSE for details.
"""
from __future__ import unicode_literals
import codecs
### Codec APIs
class Code... | 4,307 | 12.214724 | 75 | py |
pip | pip-main/src/pip/_vendor/webencodings/__init__.py | # coding: utf-8
"""
webencodings
~~~~~~~~~~~~
This is a Python implementation of the `WHATWG Encoding standard
<http://encoding.spec.whatwg.org/>`. See README for details.
:copyright: Copyright 2012 by Simon Sapin
:license: BSD, see LICENSE for details.
"""
from __future__ import unicode_li... | 10,565 | 29.804665 | 78 | py |
pip | pip-main/src/pip/_vendor/cachecontrol/filewrapper.py | # SPDX-FileCopyrightText: 2015 Eric Larson
#
# SPDX-License-Identifier: Apache-2.0
from tempfile import NamedTemporaryFile
import mmap
class CallbackFileWrapper(object):
"""
Small wrapper around a fp object which will tee everything read into a
buffer, and when that file is closed it will execute a callb... | 3,946 | 34.241071 | 83 | py |
pip | pip-main/src/pip/_vendor/cachecontrol/adapter.py | # SPDX-FileCopyrightText: 2015 Eric Larson
#
# SPDX-License-Identifier: Apache-2.0
import types
import functools
import zlib
from pip._vendor.requests.adapters import HTTPAdapter
from .controller import CacheController, PERMANENT_REDIRECT_STATUSES
from .cache import DictCache
from .filewrapper import CallbackFileWra... | 5,033 | 35.478261 | 85 | py |
pip | pip-main/src/pip/_vendor/cachecontrol/wrapper.py | # SPDX-FileCopyrightText: 2015 Eric Larson
#
# SPDX-License-Identifier: Apache-2.0
from .adapter import CacheControlAdapter
from .cache import DictCache
def CacheControl(
sess,
cache=None,
cache_etags=True,
serializer=None,
heuristic=None,
controller_class=None,
adapter_class=None,
ca... | 774 | 21.794118 | 56 | py |
pip | pip-main/src/pip/_vendor/cachecontrol/controller.py | # SPDX-FileCopyrightText: 2015 Eric Larson
#
# SPDX-License-Identifier: Apache-2.0
"""
The httplib2 algorithms ported for use with requests.
"""
import logging
import re
import calendar
import time
from email.utils import parsedate_tz
from pip._vendor.requests.structures import CaseInsensitiveDict
from .cache import... | 16,416 | 36.311364 | 87 | py |
pip | pip-main/src/pip/_vendor/cachecontrol/cache.py | # SPDX-FileCopyrightText: 2015 Eric Larson
#
# SPDX-License-Identifier: Apache-2.0
"""
The cache object API for implementing caches. The default is a thread
safe in-memory dictionary.
"""
from threading import Lock
class BaseCache(object):
def get(self, key):
raise NotImplementedError()
def set(sel... | 1,535 | 22.272727 | 78 | py |
pip | pip-main/src/pip/_vendor/cachecontrol/heuristics.py | # SPDX-FileCopyrightText: 2015 Eric Larson
#
# SPDX-License-Identifier: Apache-2.0
import calendar
import time
from email.utils import formatdate, parsedate, parsedate_tz
from datetime import datetime, timedelta
TIME_FMT = "%a, %d %b %Y %H:%M:%S GMT"
def expire_after(delta, date=None):
date = date or datetime... | 4,154 | 28.678571 | 98 | py |
pip | pip-main/src/pip/_vendor/cachecontrol/__init__.py | # SPDX-FileCopyrightText: 2015 Eric Larson
#
# SPDX-License-Identifier: Apache-2.0
"""CacheControl import Interface.
Make it easy to import from cachecontrol without long namespaces.
"""
__author__ = "Eric Larson"
__email__ = "eric@ionrock.org"
__version__ = "0.12.11"
from .wrapper import CacheControl
from .adapter ... | 465 | 23.526316 | 65 | py |
pip | pip-main/src/pip/_vendor/cachecontrol/compat.py | # SPDX-FileCopyrightText: 2015 Eric Larson
#
# SPDX-License-Identifier: Apache-2.0
try:
from urllib.parse import urljoin
except ImportError:
from urlparse import urljoin
try:
import cPickle as pickle
except ImportError:
import pickle
# Handle the case where the requests module has been patched to no... | 778 | 22.606061 | 75 | py |
pip | pip-main/src/pip/_vendor/cachecontrol/_cmd.py | # SPDX-FileCopyrightText: 2015 Eric Larson
#
# SPDX-License-Identifier: Apache-2.0
import logging
from pip._vendor import requests
from pip._vendor.cachecontrol.adapter import CacheControlAdapter
from pip._vendor.cachecontrol.cache import DictCache
from pip._vendor.cachecontrol.controller import logger
from argpars... | 1,379 | 21.258065 | 70 | py |
pip | pip-main/src/pip/_vendor/cachecontrol/serialize.py | # SPDX-FileCopyrightText: 2015 Eric Larson
#
# SPDX-License-Identifier: Apache-2.0
import base64
import io
import json
import zlib
from pip._vendor import msgpack
from pip._vendor.requests.structures import CaseInsensitiveDict
from .compat import HTTPResponse, pickle, text_type
def _b64_decode_bytes(b):
return... | 7,105 | 36.204188 | 85 | py |
pip | pip-main/src/pip/_vendor/cachecontrol/caches/redis_cache.py | # SPDX-FileCopyrightText: 2015 Eric Larson
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import division
from datetime import datetime
from pip._vendor.cachecontrol.cache import BaseCache
class RedisCache(BaseCache):
def __init__(self, conn):
self.conn = conn
def get(self, key):
... | 1,033 | 24.85 | 77 | py |
pip | pip-main/src/pip/_vendor/cachecontrol/caches/__init__.py | # SPDX-FileCopyrightText: 2015 Eric Larson
#
# SPDX-License-Identifier: Apache-2.0
from .file_cache import FileCache, SeparateBodyFileCache
from .redis_cache import RedisCache
__all__ = ["FileCache", "SeparateBodyFileCache", "RedisCache"]
| 242 | 23.3 | 62 | py |
pip | pip-main/src/pip/_vendor/cachecontrol/caches/file_cache.py | # SPDX-FileCopyrightText: 2015 Eric Larson
#
# SPDX-License-Identifier: Apache-2.0
import hashlib
import os
from textwrap import dedent
from ..cache import BaseCache, SeparateBodyBaseCache
from ..controller import CacheController
try:
FileNotFoundError
except NameError:
# py2.X
FileNotFoundError = (IOErr... | 5,271 | 26.89418 | 79 | py |
pip | pip-main/src/pip/_vendor/platformdirs/__main__.py | """Main entry point."""
from __future__ import annotations
from pip._vendor.platformdirs import PlatformDirs, __version__
PROPS = (
"user_data_dir",
"user_config_dir",
"user_cache_dir",
"user_state_dir",
"user_log_dir",
"user_documents_dir",
"user_downloads_dir",
"user_pictures_dir",
... | 1,476 | 26.351852 | 71 | py |
pip | pip-main/src/pip/_vendor/platformdirs/android.py | """Android."""
from __future__ import annotations
import os
import re
import sys
from functools import lru_cache
from typing import cast
from .api import PlatformDirsABC
class Android(PlatformDirsABC):
"""
Follows the guidance `from here <https://android.stackexchange.com/a/216132>`_. Makes use of the
`... | 7,211 | 33.180095 | 120 | py |
pip | pip-main/src/pip/_vendor/platformdirs/macos.py | """macOS."""
from __future__ import annotations
import os.path
from .api import PlatformDirsABC
class MacOS(PlatformDirsABC):
"""
Platform directories for the macOS operating system. Follows the guidance from `Apple documentation
<https://developer.apple.com/library/archive/documentation/FileManagement/... | 3,678 | 38.98913 | 160 | py |
pip | pip-main/src/pip/_vendor/platformdirs/unix.py | """Unix."""
from __future__ import annotations
import os
import sys
from configparser import ConfigParser
from pathlib import Path
from .api import PlatformDirsABC
if sys.platform == "win32":
def getuid() -> int:
msg = "should only be used on Unix"
raise RuntimeError(msg)
else:
from os impo... | 8,809 | 38.330357 | 120 | py |
pip | pip-main/src/pip/_vendor/platformdirs/api.py | """Base API."""
from __future__ import annotations
import os
from abc import ABC, abstractmethod
from pathlib import Path
from typing import TYPE_CHECKING
if TYPE_CHECKING:
import sys
if sys.version_info >= (3, 8): # pragma: no cover (py38+)
from typing import Literal
else: # pragma: no cover (... | 7,132 | 30.84375 | 120 | py |
pip | pip-main/src/pip/_vendor/platformdirs/version.py | # file generated by setuptools_scm
# don't change, don't track in version control
__version__ = version = '3.8.1'
__version_tuple__ = version_tuple = (3, 8, 1)
| 160 | 31.2 | 46 | py |
pip | pip-main/src/pip/_vendor/platformdirs/windows.py | """Windows."""
from __future__ import annotations
import ctypes
import os
import sys
from functools import lru_cache
from typing import TYPE_CHECKING
from .api import PlatformDirsABC
if TYPE_CHECKING:
from collections.abc import Callable
class Windows(PlatformDirsABC):
"""
`MSDN on where to store app d... | 9,573 | 36.398438 | 119 | py |
pip | pip-main/src/pip/_vendor/platformdirs/__init__.py | """
Utilities for determining application-specific dirs. See <https://github.com/platformdirs/platformdirs> for details and
usage.
"""
from __future__ import annotations
import os
import sys
from typing import TYPE_CHECKING
from .api import PlatformDirsABC
from .version import __version__
from .version import __versi... | 20,155 | 34.548501 | 119 | py |
pip | pip-main/src/pip/_vendor/distlib/resources.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2013-2017 Vinay Sajip.
# Licensed to the Python Software Foundation under a contributor agreement.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
from __future__ import unicode_literals
import bisect
import io
import logging
import os
import pkgutil
import sys
import types
import z... | 10,820 | 29.142061 | 79 | py |
pip | pip-main/src/pip/_vendor/distlib/scripts.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2013-2015 Vinay Sajip.
# Licensed to the Python Software Foundation under a contributor agreement.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
from io import BytesIO
import logging
import os
import re
import struct
import sys
import time
from zipfile import ZipInfo
from .compat ... | 18,099 | 40.324201 | 87 | py |
pip | pip-main/src/pip/_vendor/distlib/manifest.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2012-2013 Python Software Foundation.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
"""
Class representing the list of files in a distribution.
Equivalent to distutils.filelist, but fixes some problems.
"""
import fnmatch
import logging
import os
import re
import sys
from . impor... | 14,811 | 36.593909 | 83 | py |
pip | pip-main/src/pip/_vendor/distlib/metadata.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2012 The Python Software Foundation.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
"""Implementation of the Metadata for Python packages PEPs.
Supports all metadata formats (1.0, 1.1, 1.2, 1.3/2.1 and 2.2).
"""
from __future__ import unicode_literals
import codecs
from email impo... | 39,801 | 35.95636 | 84 | py |
pip | pip-main/src/pip/_vendor/distlib/wheel.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2013-2020 Vinay Sajip.
# Licensed to the Python Software Foundation under a contributor agreement.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
from __future__ import unicode_literals
import base64
import codecs
import datetime
from email import message_from_file
import hashlib
i... | 43,898 | 39.534626 | 101 | py |
pip | pip-main/src/pip/_vendor/distlib/locators.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2012-2015 Vinay Sajip.
# Licensed to the Python Software Foundation under a contributor agreement.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
import gzip
from io import BytesIO
import json
import logging
import os
import posixpath
import re
try:
import threading
except Impo... | 51,991 | 38.963105 | 95 | py |
pip | pip-main/src/pip/_vendor/distlib/markers.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2012-2017 Vinay Sajip.
# Licensed to the Python Software Foundation under a contributor agreement.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
"""
Parser for the environment markers micro-language defined in PEP 508.
"""
# Note: In PEP 345, the micro-language was Python compatib... | 5,058 | 32.065359 | 94 | py |
pip | pip-main/src/pip/_vendor/distlib/version.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2012-2017 The Python Software Foundation.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
"""
Implementation of a flexible versioning scheme providing support for PEP-440,
setuptools-compatible and semantic versioning.
"""
import logging
import re
from .compat import string_types
f... | 23,513 | 30.775676 | 78 | py |
pip | pip-main/src/pip/_vendor/distlib/util.py | #
# Copyright (C) 2012-2021 The Python Software Foundation.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
import codecs
from collections import deque
import contextlib
import csv
from glob import iglob as std_iglob
import io
import json
import logging
import os
import py_compile
import re
import socket
try:
import ssl
... | 66,262 | 33.279876 | 102 | py |
pip | pip-main/src/pip/_vendor/distlib/database.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2012-2017 The Python Software Foundation.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
"""PEP 376 implementation."""
from __future__ import unicode_literals
import base64
import codecs
import contextlib
import hashlib
import logging
import os
import posixpath
import sys
import z... | 51,697 | 37.266469 | 94 | py |
pip | pip-main/src/pip/_vendor/distlib/__init__.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2012-2022 Vinay Sajip.
# Licensed to the Python Software Foundation under a contributor agreement.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
import logging
__version__ = '0.3.6'
class DistlibException(Exception):
pass
try:
from logging import NullHandler
except Impor... | 581 | 23.25 | 75 | py |
pip | pip-main/src/pip/_vendor/distlib/compat.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2013-2017 Vinay Sajip.
# Licensed to the Python Software Foundation under a contributor agreement.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
from __future__ import absolute_import
import os
import re
import sys
try:
import ssl
except ImportError: # pragma: no cover
s... | 41,257 | 35.936437 | 101 | py |
pip | pip-main/src/pip/_vendor/distlib/index.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2013 Vinay Sajip.
# Licensed to the Python Software Foundation under a contributor agreement.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
import hashlib
import logging
import os
import shutil
import subprocess
import tempfile
try:
from threading import Thread
except ImportErr... | 20,834 | 39.933202 | 99 | py |
pip | pip-main/src/pip/_vendor/distro/__main__.py | from .distro import main
if __name__ == "__main__":
main()
| 64 | 12 | 26 | py |
pip | pip-main/src/pip/_vendor/distro/distro.py | #!/usr/bin/env python
# Copyright 2015,2016,2017 Nir Cohen
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | 49,330 | 34.236429 | 88 | py |
pip | pip-main/src/pip/_vendor/distro/__init__.py | from .distro import (
NORMALIZED_DISTRO_ID,
NORMALIZED_LSB_ID,
NORMALIZED_OS_ID,
LinuxDistribution,
__version__,
build_number,
codename,
distro_release_attr,
distro_release_info,
id,
info,
like,
linux_distribution,
lsb_release_attr,
lsb_release_info,
major... | 981 | 16.854545 | 27 | py |
pip | pip-main/src/pip/_vendor/tomli/_parser.py | # SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: 2021 Taneli Hukkinen
# Licensed to PSF under a Contributor Agreement.
from __future__ import annotations
from collections.abc import Iterable
import string
from types import MappingProxyType
from typing import Any, BinaryIO, NamedTuple
from ._re import (
R... | 22,633 | 31.708092 | 88 | py |
pip | pip-main/src/pip/_vendor/tomli/_types.py | # SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: 2021 Taneli Hukkinen
# Licensed to PSF under a Contributor Agreement.
from typing import Any, Callable, Tuple
# Type annotations
ParseFloat = Callable[[str], Any]
Key = Tuple[str, ...]
Pos = int
| 254 | 22.181818 | 48 | py |
pip | pip-main/src/pip/_vendor/tomli/__init__.py | # SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: 2021 Taneli Hukkinen
# Licensed to PSF under a Contributor Agreement.
__all__ = ("loads", "load", "TOMLDecodeError")
__version__ = "2.0.1" # DO NOT EDIT THIS LINE MANUALLY. LET bump2version UTILITY DO IT
from ._parser import TOMLDecodeError, load, loads
# Pre... | 396 | 32.083333 | 87 | py |
pip | pip-main/src/pip/_vendor/tomli/_re.py | # SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: 2021 Taneli Hukkinen
# Licensed to PSF under a Contributor Agreement.
from __future__ import annotations
from datetime import date, datetime, time, timedelta, timezone, tzinfo
from functools import lru_cache
import re
from typing import Any
from ._types import... | 2,943 | 26.259259 | 87 | py |
pip | pip-main/src/pip/_vendor/pyparsing/unicode.py | # unicode.py
import sys
from itertools import filterfalse
from typing import List, Tuple, Union
class _lazyclassproperty:
def __init__(self, fn):
self.fn = fn
self.__doc__ = fn.__doc__
self.__name__ = fn.__name__
def __get__(self, obj, cls):
if cls is None:
cls = ... | 10,490 | 27.980663 | 110 | py |
pip | pip-main/src/pip/_vendor/pyparsing/core.py | #
# core.py
#
from collections import deque
import os
import typing
from typing import (
Any,
Callable,
Generator,
List,
NamedTuple,
Sequence,
Set,
TextIO,
Tuple,
Union,
cast,
)
from abc import ABC, abstractmethod
from enum import Enum
import string
import copy
import warnin... | 224,443 | 35.697842 | 174 | py |
pip | pip-main/src/pip/_vendor/pyparsing/exceptions.py | # exceptions.py
import re
import sys
import typing
from .util import (
col,
line,
lineno,
_collapse_string_to_ranges,
replaced_by_pep8,
)
from .unicode import pyparsing_unicode as ppu
class ExceptionWordUnicode(ppu.Latin1, ppu.LatinA, ppu.LatinB, ppu.Greek, ppu.Cyrillic):
pass
_extract_alp... | 9,523 | 30.746667 | 106 | py |
pip | pip-main/src/pip/_vendor/pyparsing/testing.py | # testing.py
from contextlib import contextmanager
import typing
from .core import (
ParserElement,
ParseException,
Keyword,
__diag__,
__compat__,
)
class pyparsing_test:
"""
namespace class for classes useful in writing unit tests
"""
class reset_pyparsing_context:
"""
... | 13,480 | 39.605422 | 120 | py |
pip | pip-main/src/pip/_vendor/pyparsing/actions.py | # actions.py
from .exceptions import ParseException
from .util import col, replaced_by_pep8
class OnlyOnce:
"""
Wrapper for parse actions, to ensure they are only called once.
"""
def __init__(self, method_call):
from .core import _trim_arity
self.callable = _trim_arity(method_call)... | 6,567 | 29.12844 | 122 | py |
pip | pip-main/src/pip/_vendor/pyparsing/common.py | # common.py
from .core import *
from .helpers import DelimitedList, any_open_tag, any_close_tag
from datetime import datetime
# some other useful expressions - using lower-case class name since we are really using this as a namespace
class pyparsing_common:
"""Here are some common low-level expressions that may b... | 13,387 | 29.919169 | 156 | py |
pip | pip-main/src/pip/_vendor/pyparsing/util.py | # util.py
import inspect
import warnings
import types
import collections
import itertools
from functools import lru_cache, wraps
from typing import Callable, List, Union, Iterable, TypeVar, cast
_bslash = chr(92)
C = TypeVar("C", bound=Callable)
class __config_flags:
"""Internal class for defining compatibility ... | 8,670 | 29.424561 | 98 | py |
pip | pip-main/src/pip/_vendor/pyparsing/results.py | # results.py
from collections.abc import (
MutableMapping,
Mapping,
MutableSequence,
Iterator,
Sequence,
Container,
)
import pprint
from typing import Tuple, Any, Dict, Set, List
str_type: Tuple[type, ...] = (str, bytes)
_generator_type = type((_ for _ in ()))
class _ParseResultsWithOffset:
... | 26,692 | 32.491844 | 183 | py |
pip | pip-main/src/pip/_vendor/pyparsing/__init__.py | # module pyparsing.py
#
# Copyright (c) 2003-2022 Paul T. McGuire
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, cop... | 9,116 | 27.226006 | 120 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.