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/src/pip/_vendor/pyparsing/helpers.py | # helpers.py
import html.entities
import re
import sys
import typing
from . import __diag__
from .core import *
from .util import (
_bslash,
_flatten,
_escape_regex_range_chars,
replaced_by_pep8,
)
#
# global helpers
#
def counted_array(
expr: ParserElement,
int_expr: typing.Optional[ParserEl... | 38,646 | 34.101726 | 120 | py |
pip | pip-main/src/pip/_vendor/pyparsing/diagram/__init__.py | # mypy: ignore-errors
import railroad
from pip._vendor import pyparsing
import typing
from typing import (
List,
NamedTuple,
Generic,
TypeVar,
Dict,
Callable,
Set,
Iterable,
)
from jinja2 import Template
from io import StringIO
import inspect
jinja2_template_source = """\
{% if not emb... | 24,215 | 35.858447 | 119 | py |
pip | pip-main/src/pip/_vendor/rich/file_proxy.py | import io
from typing import IO, TYPE_CHECKING, Any, List
from .ansi import AnsiDecoder
from .text import Text
if TYPE_CHECKING:
from .console import Console
class FileProxy(io.TextIOBase):
"""Wraps a file (e.g. sys.stdout) and redirects writes to a console."""
def __init__(self, console: "Console", fi... | 1,683 | 28.034483 | 87 | py |
pip | pip-main/src/pip/_vendor/rich/_extension.py | from typing import Any
def load_ipython_extension(ip: Any) -> None: # pragma: no cover
# prevent circular import
from pip._vendor.rich.pretty import install
from pip._vendor.rich.traceback import install as tr_install
install()
tr_install()
| 265 | 23.181818 | 64 | py |
pip | pip-main/src/pip/_vendor/rich/status.py | from types import TracebackType
from typing import Optional, Type
from .console import Console, RenderableType
from .jupyter import JupyterMixin
from .live import Live
from .spinner import Spinner
from .style import StyleType
class Status(JupyterMixin):
"""Displays a status indicator with a 'spinner' animation.
... | 4,425 | 32.278195 | 122 | py |
pip | pip-main/src/pip/_vendor/rich/box.py | import sys
from typing import TYPE_CHECKING, Iterable, List
if sys.version_info >= (3, 8):
from typing import Literal
else:
from pip._vendor.typing_extensions import Literal # pragma: no cover
from ._loop import loop_last
if TYPE_CHECKING:
from pip._vendor.rich.console import ConsoleOptions
class Box... | 9,190 | 16.743243 | 97 | py |
pip | pip-main/src/pip/_vendor/rich/_pick.py | from typing import Optional
def pick_bool(*values: Optional[bool]) -> bool:
"""Pick the first non-none bool or return the last value.
Args:
*values (bool): Any number of boolean or None values.
Returns:
bool: First non-none boolean.
"""
assert values, "1 or more values required"
... | 423 | 22.555556 | 61 | py |
pip | pip-main/src/pip/_vendor/rich/theme.py | import configparser
from typing import Dict, List, IO, Mapping, Optional
from .default_styles import DEFAULT_STYLES
from .style import Style, StyleType
class Theme:
"""A container for style information, used by :class:`~rich.console.Console`.
Args:
styles (Dict[str, Style], optional): A mapping of s... | 3,777 | 31.568966 | 128 | py |
pip | pip-main/src/pip/_vendor/rich/repr.py | import inspect
from functools import partial
from typing import (
Any,
Callable,
Iterable,
List,
Optional,
Tuple,
Type,
TypeVar,
Union,
overload,
)
T = TypeVar("T")
Result = Iterable[Union[Any, Tuple[Any], Tuple[str, Any], Tuple[str, Any, Any]]]
RichReprResult = Result
class... | 4,431 | 28.546667 | 103 | py |
pip | pip-main/src/pip/_vendor/rich/progress_bar.py | import math
from functools import lru_cache
from time import monotonic
from typing import Iterable, List, Optional
from .color import Color, blend_rgb
from .color_triplet import ColorTriplet
from .console import Console, ConsoleOptions, RenderResult
from .jupyter import JupyterMixin
from .measure import Measurement
fr... | 8,157 | 35.257778 | 120 | py |
pip | pip-main/src/pip/_vendor/rich/__main__.py | import colorsys
import io
from time import process_time
from pip._vendor.rich import box
from pip._vendor.rich.color import Color
from pip._vendor.rich.console import Console, ConsoleOptions, Group, RenderableType, RenderResult
from pip._vendor.rich.markdown import Markdown
from pip._vendor.rich.measure import Measure... | 8,320 | 29.258182 | 178 | py |
pip | pip-main/src/pip/_vendor/rich/_palettes.py | from .palette import Palette
# Taken from https://en.wikipedia.org/wiki/ANSI_escape_code (Windows 10 column)
WINDOWS_PALETTE = Palette(
[
(12, 12, 12),
(197, 15, 31),
(19, 161, 14),
(193, 156, 0),
(0, 55, 218),
(136, 23, 152),
(58, 150, 221),
(204, 2... | 7,063 | 21.787097 | 79 | py |
pip | pip-main/src/pip/_vendor/rich/spinner.py | from typing import cast, List, Optional, TYPE_CHECKING, Union
from ._spinners import SPINNERS
from .measure import Measurement
from .table import Table
from .text import Text
if TYPE_CHECKING:
from .console import Console, ConsoleOptions, RenderResult, RenderableType
from .style import StyleType
class Spinn... | 4,339 | 30.449275 | 137 | py |
pip | pip-main/src/pip/_vendor/rich/traceback.py | from __future__ import absolute_import
import linecache
import os
import platform
import sys
from dataclasses import dataclass, field
from traceback import walk_tb
from types import ModuleType, TracebackType
from typing import (
Any,
Callable,
Dict,
Iterable,
List,
Optional,
Sequence,
T... | 29,542 | 38.02642 | 126 | py |
pip | pip-main/src/pip/_vendor/rich/align.py | import sys
from itertools import chain
from typing import TYPE_CHECKING, Iterable, Optional
if sys.version_info >= (3, 8):
from typing import Literal
else:
from pip._vendor.typing_extensions import Literal # pragma: no cover
from .constrain import Constrain
from .jupyter import JupyterMixin
from .measure imp... | 10,368 | 32.233974 | 139 | py |
pip | pip-main/src/pip/_vendor/rich/tree.py | from typing import Iterator, List, Optional, Tuple
from ._loop import loop_first, loop_last
from .console import Console, ConsoleOptions, RenderableType, RenderResult
from .jupyter import JupyterMixin
from .measure import Measurement
from .segment import Segment
from .style import Style, StyleStack, StyleType
from .st... | 9,112 | 35.162698 | 99 | py |
pip | pip-main/src/pip/_vendor/rich/jupyter.py | from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Sequence
if TYPE_CHECKING:
from pip._vendor.rich.console import ConsoleRenderable
from . import get_console
from .segment import Segment
from .terminal_theme import DEFAULT_TERMINAL_THEME
if TYPE_CHECKING:
from pip._vendor.rich.console import Conso... | 3,252 | 30.892157 | 146 | py |
pip | pip-main/src/pip/_vendor/rich/pager.py | from abc import ABC, abstractmethod
from typing import Any
class Pager(ABC):
"""Base class for a pager."""
@abstractmethod
def show(self, content: str) -> None:
"""Show content in pager.
Args:
content (str): Content to be displayed.
"""
class SystemPager(Pager):
... | 827 | 22.657143 | 63 | py |
pip | pip-main/src/pip/_vendor/rich/panel.py | from typing import TYPE_CHECKING, Optional
from .align import AlignMethod
from .box import ROUNDED, Box
from .cells import cell_len
from .jupyter import JupyterMixin
from .measure import Measurement, measure_renderables
from .padding import Padding, PaddingDimensions
from .segment import Segment
from .style import Sty... | 10,574 | 33.223301 | 142 | py |
pip | pip-main/src/pip/_vendor/rich/_log_render.py | from datetime import datetime
from typing import Iterable, List, Optional, TYPE_CHECKING, Union, Callable
from .text import Text, TextType
if TYPE_CHECKING:
from .console import Console, ConsoleRenderable, RenderableType
from .table import Table
FormatTimeCallable = Callable[[datetime], Text]
class LogRen... | 3,225 | 32.957895 | 84 | py |
pip | pip-main/src/pip/_vendor/rich/style.py | import sys
from functools import lru_cache
from marshal import dumps, loads
from random import randint
from typing import Any, Dict, Iterable, List, Optional, Type, Union, cast
from . import errors
from .color import Color, ColorParseError, ColorSystem, blend_rgb
from .repr import Result, rich_repr
from .terminal_them... | 27,073 | 32.969887 | 121 | py |
pip | pip-main/src/pip/_vendor/rich/palette.py | from math import sqrt
from functools import lru_cache
from typing import Sequence, Tuple, TYPE_CHECKING
from .color_triplet import ColorTriplet
if TYPE_CHECKING:
from pip._vendor.rich.table import Table
class Palette:
"""A palette of available colors."""
def __init__(self, colors: Sequence[Tuple[int, i... | 3,394 | 32.613861 | 82 | py |
pip | pip-main/src/pip/_vendor/rich/table.py | from dataclasses import dataclass, field, replace
from typing import (
TYPE_CHECKING,
Dict,
Iterable,
List,
NamedTuple,
Optional,
Sequence,
Tuple,
Union,
)
from . import box, errors
from ._loop import loop_first_last, loop_last
from ._pick import pick_bool
from ._ratio import ratio_... | 39,684 | 38.566301 | 171 | py |
pip | pip-main/src/pip/_vendor/rich/progress.py | import io
import sys
import typing
import warnings
from abc import ABC, abstractmethod
from collections import deque
from dataclasses import dataclass, field
from datetime import timedelta
from io import RawIOBase, UnsupportedOperation
from math import ceil
from mmap import mmap
from operator import length_hint
from os... | 59,695 | 34.053435 | 165 | py |
pip | pip-main/src/pip/_vendor/rich/_timer.py | """
Timer context manager, only used in debug.
"""
from time import time
import contextlib
from typing import Generator
@contextlib.contextmanager
def timer(subject: str = "time") -> Generator[None, None, None]:
"""print the elapsed time. (only used in debugging)"""
start = time()
yield
elapsed = t... | 417 | 19.9 | 64 | py |
pip | pip-main/src/pip/_vendor/rich/color.py | import platform
import re
from colorsys import rgb_to_hls
from enum import IntEnum
from functools import lru_cache
from typing import TYPE_CHECKING, NamedTuple, Optional, Tuple
from ._palettes import EIGHT_BIT_PALETTE, STANDARD_PALETTE, WINDOWS_PALETTE
from .color_triplet import ColorTriplet
from .repr import Result, ... | 18,222 | 28.250401 | 112 | py |
pip | pip-main/src/pip/_vendor/rich/rule.py | from typing import Union
from .align import AlignMethod
from .cells import cell_len, set_cell_size
from .console import Console, ConsoleOptions, RenderResult
from .jupyter import JupyterMixin
from .measure import Measurement
from .style import Style
from .text import Text
class Rule(JupyterMixin):
"""A console r... | 4,598 | 34.10687 | 113 | py |
pip | pip-main/src/pip/_vendor/rich/errors.py | class ConsoleError(Exception):
"""An error in console operation."""
class StyleError(Exception):
"""An error in styles."""
class StyleSyntaxError(ConsoleError):
"""Style was badly formatted."""
class MissingStyle(StyleError):
"""No such style."""
class StyleStackError(ConsoleError):
"""Style... | 642 | 17.371429 | 40 | py |
pip | pip-main/src/pip/_vendor/rich/prompt.py | from typing import Any, Generic, List, Optional, TextIO, TypeVar, Union, overload
from . import get_console
from .console import Console
from .text import Text, TextType
PromptType = TypeVar("PromptType")
DefaultType = TypeVar("DefaultType")
class PromptError(Exception):
"""Exception base class for prompt relat... | 11,303 | 28.984085 | 110 | py |
pip | pip-main/src/pip/_vendor/rich/pretty.py | import builtins
import collections
import dataclasses
import inspect
import os
import sys
from array import array
from collections import Counter, UserDict, UserList, defaultdict, deque
from dataclasses import dataclass, fields, is_dataclass
from inspect import isclass
from itertools import islice
from types import Map... | 35,852 | 35.033166 | 134 | py |
pip | pip-main/src/pip/_vendor/rich/scope.py | from collections.abc import Mapping
from typing import TYPE_CHECKING, Any, Optional, Tuple
from .highlighter import ReprHighlighter
from .panel import Panel
from .pretty import Pretty
from .table import Table
from .text import Text, TextType
if TYPE_CHECKING:
from .console import ConsoleRenderable
def render_sc... | 2,843 | 31.689655 | 117 | py |
pip | pip-main/src/pip/_vendor/rich/_windows.py | import sys
from dataclasses import dataclass
@dataclass
class WindowsConsoleFeatures:
"""Windows features available."""
vt: bool = False
"""The console supports VT codes."""
truecolor: bool = False
"""The console supports truecolor."""
try:
import ctypes
from ctypes import LibraryLoader... | 1,926 | 25.39726 | 80 | py |
pip | pip-main/src/pip/_vendor/rich/logging.py | import logging
from datetime import datetime
from logging import Handler, LogRecord
from pathlib import Path
from types import ModuleType
from typing import ClassVar, Iterable, List, Optional, Type, Union
from pip._vendor.rich._null_file import NullFile
from . import get_console
from ._log_render import FormatTimeCal... | 11,903 | 40.048276 | 184 | py |
pip | pip-main/src/pip/_vendor/rich/_inspect.py | from __future__ import absolute_import
import inspect
from inspect import cleandoc, getdoc, getfile, isclass, ismodule, signature
from typing import Any, Collection, Iterable, Optional, Tuple, Type, Union
from .console import Group, RenderableType
from .control import escape_control_codes
from .highlighter import Rep... | 9,695 | 34.778598 | 112 | py |
pip | pip-main/src/pip/_vendor/rich/columns.py | from collections import defaultdict
from itertools import chain
from operator import itemgetter
from typing import Dict, Iterable, List, Optional, Tuple
from .align import Align, AlignMethod
from .console import Console, ConsoleOptions, RenderableType, RenderResult
from .constrain import Constrain
from .measure import... | 7,131 | 36.93617 | 117 | py |
pip | pip-main/src/pip/_vendor/rich/live_render.py | import sys
from typing import Optional, Tuple
if sys.version_info >= (3, 8):
from typing import Literal
else:
from pip._vendor.typing_extensions import Literal # pragma: no cover
from ._loop import loop_last
from .console import Console, ConsoleOptions, RenderableType, RenderResult
from .control import Cont... | 3,667 | 31.175439 | 98 | py |
pip | pip-main/src/pip/_vendor/rich/diagnose.py | import os
import platform
from pip._vendor.rich import inspect
from pip._vendor.rich.console import Console, get_windows_console_features
from pip._vendor.rich.panel import Panel
from pip._vendor.rich.pretty import Pretty
def report() -> None: # pragma: no cover
"""Print a report to the terminal with debugging ... | 972 | 24.605263 | 77 | py |
pip | pip-main/src/pip/_vendor/rich/_emoji_replace.py | from typing import Callable, Match, Optional
import re
from ._emoji_codes import EMOJI
_ReStringMatch = Match[str] # regex match object
_ReSubCallable = Callable[[_ReStringMatch], str] # Callable invoked by re.sub
_EmojiSubMethod = Callable[[_ReSubCallable, str], str] # Sub method of a compiled re
def _emoji_re... | 1,064 | 31.272727 | 87 | py |
pip | pip-main/src/pip/_vendor/rich/cells.py | import re
from functools import lru_cache
from typing import Callable, List
from ._cell_widths import CELL_WIDTHS
# Regex to match sequence of the most common character ranges
_is_single_cell_widths = re.compile("^[\u0020-\u006f\u00a0\u02ff\u0370-\u0482]*$").match
@lru_cache(4096)
def cached_cell_len(text: str) -> ... | 4,382 | 27.277419 | 89 | py |
pip | pip-main/src/pip/_vendor/rich/default_styles.py | from typing import Dict
from .style import Style
DEFAULT_STYLES: Dict[str, Style] = {
"none": Style.null(),
"reset": Style(
color="default",
bgcolor="default",
dim=False,
bold=False,
italic=False,
underline=False,
blink=False,
blink2=False,
... | 8,082 | 41.319372 | 87 | py |
pip | pip-main/src/pip/_vendor/rich/segment.py | from enum import IntEnum
from functools import lru_cache
from itertools import filterfalse
from logging import getLogger
from operator import attrgetter
from typing import (
TYPE_CHECKING,
Dict,
Iterable,
List,
NamedTuple,
Optional,
Sequence,
Tuple,
Type,
Union,
)
from .cells im... | 24,247 | 31.767568 | 110 | py |
pip | pip-main/src/pip/_vendor/rich/control.py | import sys
import time
from typing import TYPE_CHECKING, Callable, Dict, Iterable, List, Union
if sys.version_info >= (3, 8):
from typing import Final
else:
from pip._vendor.typing_extensions import Final # pragma: no cover
from .segment import ControlCode, ControlType, Segment
if TYPE_CHECKING:
from .c... | 6,627 | 28.327434 | 100 | py |
pip | pip-main/src/pip/_vendor/rich/layout.py | from abc import ABC, abstractmethod
from itertools import islice
from operator import itemgetter
from threading import RLock
from typing import (
TYPE_CHECKING,
Dict,
Iterable,
List,
NamedTuple,
Optional,
Sequence,
Tuple,
Union,
)
from ._ratio import ratio_resolve
from .align import... | 14,003 | 30.540541 | 123 | py |
pip | pip-main/src/pip/_vendor/rich/styled.py | from typing import TYPE_CHECKING
from .measure import Measurement
from .segment import Segment
from .style import StyleType
if TYPE_CHECKING:
from .console import Console, ConsoleOptions, RenderResult, RenderableType
class Styled:
"""Apply a style to a renderable.
Args:
renderable (RenderableTy... | 1,258 | 28.27907 | 81 | py |
pip | pip-main/src/pip/_vendor/rich/emoji.py | import sys
from typing import TYPE_CHECKING, Optional, Union
from .jupyter import JupyterMixin
from .segment import Segment
from .style import Style
from ._emoji_codes import EMOJI
from ._emoji_replace import _emoji_replace
if sys.version_info >= (3, 8):
from typing import Literal
else:
from pip._vendor.typin... | 2,501 | 24.793814 | 86 | py |
pip | pip-main/src/pip/_vendor/rich/_ratio.py | import sys
from fractions import Fraction
from math import ceil
from typing import cast, List, Optional, Sequence
if sys.version_info >= (3, 8):
from typing import Protocol
else:
from pip._vendor.typing_extensions import Protocol # pragma: no cover
class Edge(Protocol):
"""Any object that defines an edg... | 5,472 | 32.993789 | 95 | py |
pip | pip-main/src/pip/_vendor/rich/measure.py | from operator import itemgetter
from typing import TYPE_CHECKING, Callable, NamedTuple, Optional, Sequence
from . import errors
from .protocol import is_renderable, rich_cast
if TYPE_CHECKING:
from .console import Console, ConsoleOptions, RenderableType
class Measurement(NamedTuple):
"""Stores the minimum a... | 5,305 | 33.907895 | 111 | py |
pip | pip-main/src/pip/_vendor/rich/text.py | import re
from functools import partial, reduce
from math import gcd
from operator import itemgetter
from typing import (
TYPE_CHECKING,
Any,
Callable,
Dict,
Iterable,
List,
NamedTuple,
Optional,
Tuple,
Union,
)
from ._loop import loop_last
from ._pick import pick_bool
from ._wr... | 45,519 | 33.801223 | 463 | py |
pip | pip-main/src/pip/_vendor/rich/_fileno.py | from __future__ import annotations
from typing import IO, Callable
def get_fileno(file_like: IO[str]) -> int | None:
"""Get fileno() from a file, accounting for poorly implemented file-like objects.
Args:
file_like (IO): A file-like object.
Returns:
int | None: The result of fileno if a... | 799 | 31 | 92 | py |
pip | pip-main/src/pip/_vendor/rich/syntax.py | import os.path
import platform
import re
import sys
import textwrap
from abc import ABC, abstractmethod
from pathlib import Path
from typing import (
Any,
Dict,
Iterable,
List,
NamedTuple,
Optional,
Sequence,
Set,
Tuple,
Type,
Union,
)
from pip._vendor.pygments.lexer import ... | 35,171 | 36.062171 | 163 | py |
pip | pip-main/src/pip/_vendor/rich/bar.py | from typing import Optional, Union
from .color import Color
from .console import Console, ConsoleOptions, RenderResult
from .jupyter import JupyterMixin
from .measure import Measurement
from .segment import Segment
from .style import Style
# There are left-aligned characters for 1/8 to 7/8, but
# the right-aligned ch... | 3,232 | 33.031579 | 97 | py |
pip | pip-main/src/pip/_vendor/rich/_null_file.py | from types import TracebackType
from typing import IO, Iterable, Iterator, List, Optional, Type
class NullFile(IO[str]):
def close(self) -> None:
pass
def isatty(self) -> bool:
return False
def read(self, __n: int = 1) -> str:
return ""
def readable(self) -> bool:
re... | 1,387 | 18.828571 | 63 | py |
pip | pip-main/src/pip/_vendor/rich/protocol.py | from typing import Any, cast, Set, TYPE_CHECKING
from inspect import isclass
if TYPE_CHECKING:
from pip._vendor.rich.console import RenderableType
_GIBBERISH = """aihwerij235234ljsdnp34ksodfipwoe234234jlskjdf"""
def is_renderable(check_object: Any) -> bool:
"""Check if an object may be rendered by Rich."""
... | 1,391 | 31.372093 | 74 | py |
pip | pip-main/src/pip/_vendor/rich/filesize.py | # coding: utf-8
"""Functions for reporting filesizes. Borrowed from https://github.com/PyFilesystem/pyfilesystem2
The functions declared in this module should cover the different
use cases needed to generate a string representation of a file size
using several different units. Since there are many standards regarding
... | 2,508 | 26.877778 | 97 | py |
pip | pip-main/src/pip/_vendor/rich/color_triplet.py | from typing import NamedTuple, Tuple
class ColorTriplet(NamedTuple):
"""The red, green, and blue components of a color."""
red: int
"""Red component in 0 to 255 range."""
green: int
"""Green component in 0 to 255 range."""
blue: int
"""Blue component in 0 to 255 range."""
@property
... | 1,054 | 26.051282 | 86 | py |
pip | pip-main/src/pip/_vendor/rich/markup.py | import re
from ast import literal_eval
from operator import attrgetter
from typing import Callable, Iterable, List, Match, NamedTuple, Optional, Tuple, Union
from ._emoji_replace import _emoji_replace
from .emoji import EmojiVariant
from .errors import MarkupError
from .style import Style
from .text import Span, Text
... | 8,198 | 32.194332 | 107 | py |
pip | pip-main/src/pip/_vendor/rich/screen.py | from typing import Optional, TYPE_CHECKING
from .segment import Segment
from .style import StyleType
from ._loop import loop_last
if TYPE_CHECKING:
from .console import (
Console,
ConsoleOptions,
RenderResult,
RenderableType,
Group,
)
class Screen:
"""A renderabl... | 1,591 | 27.945455 | 81 | py |
pip | pip-main/src/pip/_vendor/rich/highlighter.py | import re
from abc import ABC, abstractmethod
from typing import List, Union
from .text import Span, Text
def _combine_regex(*regexes: str) -> str:
"""Combine a number of regexes in to a single regex.
Returns:
str: New regex with all regexes ORed together.
"""
return "|".join(regexes)
clas... | 9,584 | 40.137339 | 269 | py |
pip | pip-main/src/pip/_vendor/rich/__init__.py | """Rich text and beautiful formatting in the terminal."""
import os
from typing import IO, TYPE_CHECKING, Any, Callable, Optional, Union
from ._extension import load_ipython_extension # noqa: F401
__all__ = ["get_console", "reconfigure", "print", "inspect", "print_json"]
if TYPE_CHECKING:
from .console import ... | 6,090 | 33.219101 | 112 | py |
pip | pip-main/src/pip/_vendor/rich/_loop.py | from typing import Iterable, Tuple, TypeVar
T = TypeVar("T")
def loop_first(values: Iterable[T]) -> Iterable[Tuple[bool, T]]:
"""Iterate and generate a tuple with a flag for first value."""
iter_values = iter(values)
try:
value = next(iter_values)
except StopIteration:
return
yiel... | 1,236 | 27.113636 | 76 | py |
pip | pip-main/src/pip/_vendor/rich/console.py | import inspect
import os
import platform
import sys
import threading
import zlib
from abc import ABC, abstractmethod
from dataclasses import dataclass, field
from datetime import datetime
from functools import wraps
from getpass import getpass
from html import escape
from inspect import isclass
from itertools import is... | 99,214 | 36.667046 | 197 | py |
pip | pip-main/src/pip/_vendor/rich/_win32_console.py | """Light wrapper around the Win32 Console API - this module should only be imported on Windows
The API that this module wraps is documented at https://docs.microsoft.com/en-us/windows/console/console-functions
"""
import ctypes
import sys
from typing import Any
windll: Any = None
if sys.platform == "win32":
windl... | 22,820 | 33.420814 | 123 | py |
pip | pip-main/src/pip/_vendor/rich/_stack.py | from typing import List, TypeVar
T = TypeVar("T")
class Stack(List[T]):
"""A small shim over builtin list."""
@property
def top(self) -> T:
"""Get top of stack."""
return self[-1]
def push(self, item: T) -> None:
"""Push an item on to the stack (append in stack nomenclature)... | 351 | 19.705882 | 74 | py |
pip | pip-main/src/pip/_vendor/rich/_spinners.py | """
Spinners are from:
* cli-spinners:
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
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 withou... | 14,144 | 28.285714 | 99 | py |
pip | pip-main/src/pip/_vendor/rich/_emoji_codes.py | EMOJI = {
"1st_place_medal": "🥇",
"2nd_place_medal": "🥈",
"3rd_place_medal": "🥉",
"ab_button_(blood_type)": "🆎",
"atm_sign": "🏧",
"a_button_(blood_type)": "🅰",
"afghanistan": "🇦🇫",
"albania": "🇦🇱",
"algeria": "🇩🇿",
"american_samoa": "🇦🇸",
"andorra": "🇦🇩",
... | 122,105 | 32.81501 | 80 | py |
pip | pip-main/src/pip/_vendor/rich/ansi.py | import re
import sys
from contextlib import suppress
from typing import Iterable, NamedTuple, Optional
from .color import Color
from .style import Style
from .text import Text
re_ansi = re.compile(
r"""
(?:\x1b\](.*?)\x1b\\)|
(?:\x1b([(@-Z\\-_]|\[[0-?]*[ -/]*[@-~]))
""",
re.VERBOSE,
)
class _AnsiToken(Named... | 6,905 | 27.655602 | 75 | py |
pip | pip-main/src/pip/_vendor/rich/_cell_widths.py | # Auto generated by make_terminal_widths.py
CELL_WIDTHS = [
(0, 0, 0),
(1, 31, -1),
(127, 159, -1),
(768, 879, 0),
(1155, 1161, 0),
(1425, 1469, 0),
(1471, 1471, 0),
(1473, 1474, 0),
(1476, 1477, 0),
(1479, 1479, 0),
(1552, 1562, 0),
(1611, 1631, 0),
(1648, 1648, 0),... | 10,096 | 21.338496 | 43 | py |
pip | pip-main/src/pip/_vendor/rich/json.py | from pathlib import Path
from json import loads, dumps
from typing import Any, Callable, Optional, Union
from .text import Text
from .highlighter import JSONHighlighter, NullHighlighter
class JSON:
"""A renderable which pretty prints JSON.
Args:
json (str): JSON encoded data.
indent (Union[N... | 5,032 | 34.695035 | 137 | py |
pip | pip-main/src/pip/_vendor/rich/containers.py | from itertools import zip_longest
from typing import (
Iterator,
Iterable,
List,
Optional,
Union,
overload,
TypeVar,
TYPE_CHECKING,
)
if TYPE_CHECKING:
from .console import (
Console,
ConsoleOptions,
JustifyMethod,
OverflowMethod,
RenderResult... | 5,497 | 31.72619 | 126 | py |
pip | pip-main/src/pip/_vendor/rich/_wrap.py | import re
from typing import Iterable, List, Tuple
from ._loop import loop_last
from .cells import cell_len, chop_cells
re_word = re.compile(r"\s*\S+\s*")
def words(text: str) -> Iterable[Tuple[int, int, str]]:
position = 0
word_match = re_word.match(text, position)
while word_match is not None:
... | 1,840 | 31.298246 | 85 | py |
pip | pip-main/src/pip/_vendor/rich/themes.py | from .default_styles import DEFAULT_STYLES
from .theme import Theme
DEFAULT = Theme(DEFAULT_STYLES)
| 102 | 16.166667 | 42 | py |
pip | pip-main/src/pip/_vendor/rich/live.py | import sys
from threading import Event, RLock, Thread
from types import TracebackType
from typing import IO, Any, Callable, List, Optional, TextIO, Type, cast
from . import get_console
from .console import Console, ConsoleRenderable, RenderableType, RenderHook
from .control import Control
from .file_proxy import FileP... | 14,273 | 36.962766 | 156 | py |
pip | pip-main/src/pip/_vendor/rich/padding.py | from typing import cast, List, Optional, Tuple, TYPE_CHECKING, Union
if TYPE_CHECKING:
from .console import (
Console,
ConsoleOptions,
RenderableType,
RenderResult,
)
from .jupyter import JupyterMixin
from .measure import Measurement
from .style import Style
from .segment import... | 4,970 | 34.007042 | 99 | py |
pip | pip-main/src/pip/_vendor/rich/_export_format.py | CONSOLE_HTML_FORMAT = """\
<!DOCTYPE html>
<head>
<meta charset="UTF-8">
<style>
{stylesheet}
body {{
color: {foreground};
background-color: {background};
}}
</style>
</head>
<html>
<body>
<pre style="font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace"><code>{code}</code></pre>
</body>
</... | 2,100 | 26.285714 | 122 | py |
pip | pip-main/src/pip/_vendor/rich/abc.py | from abc import ABC
class RichRenderable(ABC):
"""An abstract base class for Rich renderables.
Note that there is no need to extend this class, the intended use is to check if an
object supports the Rich renderable protocol. For example::
if isinstance(my_object, RichRenderable):
con... | 890 | 25.205882 | 87 | py |
pip | pip-main/src/pip/_vendor/rich/region.py | from typing import NamedTuple
class Region(NamedTuple):
"""Defines a rectangular region of the screen."""
x: int
y: int
width: int
height: int
| 166 | 14.181818 | 53 | py |
pip | pip-main/src/pip/_vendor/rich/constrain.py | from typing import Optional, TYPE_CHECKING
from .jupyter import JupyterMixin
from .measure import Measurement
if TYPE_CHECKING:
from .console import Console, ConsoleOptions, RenderableType, RenderResult
class Constrain(JupyterMixin):
"""Constrain the width of a renderable to a given number of characters.
... | 1,288 | 32.921053 | 91 | py |
pip | pip-main/src/pip/_vendor/rich/terminal_theme.py | from typing import List, Optional, Tuple
from .color_triplet import ColorTriplet
from .palette import Palette
_ColorTuple = Tuple[int, int, int]
class TerminalTheme:
"""A color theme used when exporting console content.
Args:
background (Tuple[int, int, int]): The background color.
foregrou... | 3,370 | 20.88961 | 89 | py |
pip | pip-main/src/pip/_vendor/rich/_windows_renderer.py | from typing import Iterable, Sequence, Tuple, cast
from pip._vendor.rich._win32_console import LegacyWindowsTerm, WindowsCoordinates
from pip._vendor.rich.segment import ControlCode, ControlType, Segment
def legacy_windows_render(buffer: Iterable[Segment], term: LegacyWindowsTerm) -> None:
"""Makes appropriate W... | 2,783 | 47.842105 | 87 | py |
pip | pip-main/src/pip/_vendor/requests/auth.py | """
requests.auth
~~~~~~~~~~~~~
This module contains the authentication handlers for Requests.
"""
import hashlib
import os
import re
import threading
import time
import warnings
from base64 import b64encode
from ._internal_utils import to_native_string
from .compat import basestring, str, urlparse
from .cookies imp... | 10,187 | 31.240506 | 88 | py |
pip | pip-main/src/pip/_vendor/requests/hooks.py | """
requests.hooks
~~~~~~~~~~~~~~
This module provides the capabilities for the Requests hooks system.
Available hooks:
``response``:
The response generated from a Request.
"""
HOOKS = ["response"]
def default_hooks():
return {event: [] for event in HOOKS}
# TODO: response is the only one
def dispatch_... | 733 | 20.588235 | 68 | py |
pip | pip-main/src/pip/_vendor/requests/structures.py | """
requests.structures
~~~~~~~~~~~~~~~~~~~
Data structures that power Requests.
"""
from collections import OrderedDict
from .compat import Mapping, MutableMapping
class CaseInsensitiveDict(MutableMapping):
"""A case-insensitive ``dict``-like object.
Implements all methods and operations of
``Mutable... | 2,912 | 28.13 | 84 | py |
pip | pip-main/src/pip/_vendor/requests/exceptions.py | """
requests.exceptions
~~~~~~~~~~~~~~~~~~~
This module contains the set of Requests' exceptions.
"""
from pip._vendor.urllib3.exceptions import HTTPError as BaseHTTPError
from .compat import JSONDecodeError as CompatJSONDecodeError
class RequestException(IOError):
"""There was an ambiguous exception that occur... | 3,823 | 25.929577 | 86 | py |
pip | pip-main/src/pip/_vendor/requests/cookies.py | """
requests.cookies
~~~~~~~~~~~~~~~~
Compatibility code to be able to use `cookielib.CookieJar` with requests.
requests.utils imports from here, so be careful with imports.
"""
import calendar
import copy
import time
from ._internal_utils import to_native_string
from .compat import Morsel, MutableMapping, cookieli... | 18,560 | 32.02669 | 91 | py |
pip | pip-main/src/pip/_vendor/requests/__version__.py | # .-. .-. .-. . . .-. .-. .-. .-.
# |( |- |.| | | |- `-. | `-.
# ' ' `-' `-`.`-' `-' `-' ' `-'
__title__ = "requests"
__description__ = "Python HTTP for Humans."
__url__ = "https://requests.readthedocs.io"
__version__ = "2.31.0"
__build__ = 0x023100
__author__ = "Kenneth Reitz"
__author_email__ = "me@kennethrei... | 435 | 28.066667 | 43 | py |
pip | pip-main/src/pip/_vendor/requests/utils.py | """
requests.utils
~~~~~~~~~~~~~~
This module provides utility functions that are used within Requests
that are also useful for external consumption.
"""
import codecs
import contextlib
import io
import os
import re
import socket
import struct
import sys
import tempfile
import warnings
import zipfile
from collections... | 33,460 | 29.557991 | 128 | py |
pip | pip-main/src/pip/_vendor/requests/packages.py | import sys
# This code exists for backwards compatibility reasons.
# I don't like it either. Just look the other way. :)
for package in ('urllib3', 'idna', 'chardet'):
vendored_package = "pip._vendor." + package
locals()[package] = __import__(vendored_package)
# This traversal is apparently necessary such... | 695 | 39.941176 | 93 | py |
pip | pip-main/src/pip/_vendor/requests/status_codes.py | r"""
The ``codes`` object defines a mapping from common names for HTTP statuses
to their numerical codes, accessible either as attributes or as dictionary
items.
Example::
>>> import requests
>>> requests.codes['temporary_redirect']
307
>>> requests.codes.teapot
418
>>> requests.codes['\o/']
... | 4,231 | 31.806202 | 87 | py |
pip | pip-main/src/pip/_vendor/requests/_internal_utils.py | """
requests._internal_utils
~~~~~~~~~~~~~~
Provides utility functions that are consumed internally by Requests
which depend on extremely few external helpers (such as compat)
"""
import re
from .compat import builtin_str
_VALID_HEADER_NAME_RE_BYTE = re.compile(rb"^[^:\s][^:\r\n]*$")
_VALID_HEADER_NAME_RE_STR = re.c... | 1,495 | 28.333333 | 83 | py |
pip | pip-main/src/pip/_vendor/requests/api.py | """
requests.api
~~~~~~~~~~~~
This module implements the Requests API.
:copyright: (c) 2012 by Kenneth Reitz.
:license: Apache2, see LICENSE for more details.
"""
from . import sessions
def request(method, url, **kwargs):
"""Constructs and sends a :class:`Request <Request>`.
:param method: method for the ... | 6,449 | 39.822785 | 139 | py |
pip | pip-main/src/pip/_vendor/requests/help.py | """Module containing bug report helper(s)."""
import json
import platform
import ssl
import sys
from pip._vendor import idna
from pip._vendor import urllib3
from . import __version__ as requests_version
charset_normalizer = None
try:
from pip._vendor import chardet
except ImportError:
chardet = None
try:
... | 3,879 | 28.393939 | 86 | py |
pip | pip-main/src/pip/_vendor/requests/sessions.py | """
requests.sessions
~~~~~~~~~~~~~~~~~
This module provides a Session object to manage and persist settings across
requests (cookies, auth, proxies).
"""
import os
import sys
import time
from collections import OrderedDict
from datetime import timedelta
from ._internal_utils import to_native_string
from .adapters im... | 30,373 | 35.419664 | 100 | py |
pip | pip-main/src/pip/_vendor/requests/models.py | """
requests.models
~~~~~~~~~~~~~~~
This module contains the primary objects that power Requests.
"""
import datetime
# Import encoding now, to avoid implicit import later.
# Implicit import within threads may cause LookupError when standard library is in a ZIP,
# such as in Embedded Python. See https://github.com/p... | 35,288 | 33.095652 | 102 | py |
pip | pip-main/src/pip/_vendor/requests/__init__.py | # __
# /__) _ _ _ _ _/ _
# / ( (- (/ (/ (- _) / _)
# /
"""
Requests HTTP Library
~~~~~~~~~~~~~~~~~~~~~
Requests is an HTTP library, written in Python, for human beings.
Basic GET usage:
>>> import requests
>>> r = requests.get('https://www.python.org')
>>> r.status_code
200
>... | 5,169 | 27.251366 | 89 | py |
pip | pip-main/src/pip/_vendor/requests/compat.py | """
requests.compat
~~~~~~~~~~~~~~~
This module previously handled import compatibility issues
between Python 2 and Python 3. It remains for backwards
compatibility until the next major version.
"""
from pip._vendor import chardet
import sys
# -------
# Pythons
# -------
# Syntax sugar.
_ver = sys.version_info
#:... | 1,286 | 17.926471 | 71 | py |
pip | pip-main/src/pip/_vendor/requests/adapters.py | """
requests.adapters
~~~~~~~~~~~~~~~~~
This module contains the transport adapters that Requests uses to define
and maintain connections.
"""
import os.path
import socket # noqa: F401
from pip._vendor.urllib3.exceptions import ClosedPoolError, ConnectTimeoutError
from pip._vendor.urllib3.exceptions import HTTPErro... | 19,697 | 35.545455 | 97 | py |
pip | pip-main/src/pip/_vendor/requests/certs.py | #!/usr/bin/env python
"""
requests.certs
~~~~~~~~~~~~~~
This module returns the preferred default CA certificate bundle. There is
only one — the one from the certifi package.
If you are packaging Requests, e.g., for a Linux distribution or a managed
environment, you can change the definition of where() to return a s... | 573 | 21.96 | 76 | py |
pip | pip-main/src/pip/_vendor/certifi/__main__.py | import argparse
from pip._vendor.certifi import contents, where
parser = argparse.ArgumentParser()
parser.add_argument("-c", "--contents", action="store_true")
args = parser.parse_args()
if args.contents:
print(contents())
else:
print(where())
| 255 | 18.692308 | 60 | py |
pip | pip-main/src/pip/_vendor/certifi/core.py | """
certifi.py
~~~~~~~~~~
This module returns the installation location of cacert.pem or its contents.
"""
import sys
if sys.version_info >= (3, 11):
from importlib.resources import as_file, files
_CACERT_CTX = None
_CACERT_PATH = None
def where() -> str:
# This is slightly terrible, but w... | 4,279 | 38.266055 | 94 | py |
pip | pip-main/src/pip/_vendor/certifi/__init__.py | from .core import contents, where
__all__ = ["contents", "where"]
__version__ = "2023.05.07"
| 94 | 18 | 33 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.