repo stringlengths 7 90 | file_url stringlengths 81 315 | file_path stringlengths 4 228 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 14:38:15 2026-01-05 02:33:18 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/httpie/plugins/base.py | httpie/plugins/base.py | from typing import Tuple
class BasePlugin:
# The name of the plugin, eg. "My auth".
name = None
# Optional short description. It will be shown in the help
# under --auth-type.
description = None
# This be set automatically once the plugin has been loaded.
package_name = None
class Auth... | python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/httpie/plugins/manager.py | httpie/plugins/manager.py | import sys
import os
import warnings
from itertools import groupby
from operator import attrgetter
from typing import Dict, List, Type, Iterator, Iterable, Optional, ContextManager
from pathlib import Path
from contextlib import contextmanager, nullcontext
from ..compat import importlib_metadata, find_entry_points, g... | python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/httpie/internal/__build_channel__.py | httpie/internal/__build_channel__.py | # Represents the packaging method. This file should
# be overridden by every build system we support on
# the packaging step.
BUILD_CHANNEL = 'unknown'
| python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/httpie/internal/daemons.py | httpie/internal/daemons.py | """
This module provides an interface to spawn a detached task to be
run with httpie.internal.daemon_runner on a separate process. It is
based on DVC's daemon system.
https://github.com/iterative/dvc/blob/main/dvc/daemon.py
"""
import inspect
import os
import platform
import sys
import httpie.__main__
from contextlib ... | python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/httpie/internal/daemon_runner.py | httpie/internal/daemon_runner.py | import argparse
from contextlib import redirect_stderr, redirect_stdout
from typing import List
from httpie.context import Environment
from httpie.internal.update_warnings import _fetch_updates, _get_suppress_context
from httpie.status import ExitStatus
STATUS_FILE = '.httpie-test-daemon-status'
def _check_status(e... | python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/httpie/internal/__init__.py | httpie/internal/__init__.py | python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false | |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/httpie/internal/update_warnings.py | httpie/internal/update_warnings.py | import json
from contextlib import nullcontext, suppress
from datetime import datetime, timedelta
from pathlib import Path
from typing import Any, Optional, Callable
import requests
import httpie
from httpie.context import Environment, LogLevel
from httpie.internal.__build_channel__ import BUILD_CHANNEL
from httpie.i... | python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/httpie/legacy/v3_2_0_session_header_format.py | httpie/legacy/v3_2_0_session_header_format.py | from typing import Any, Type, List, Dict, TYPE_CHECKING
if TYPE_CHECKING:
from httpie.sessions import Session
OLD_HEADER_STORE_WARNING = '''\
Outdated layout detected for the current session. Please consider updating it,
in order to use the latest features regarding the header layout.
For fixing the current ses... | python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/httpie/legacy/v3_1_0_session_cookie_format.py | httpie/legacy/v3_1_0_session_cookie_format.py | import argparse
from typing import Any, Type, List, Dict, TYPE_CHECKING
if TYPE_CHECKING:
from httpie.sessions import Session
INSECURE_COOKIE_JAR_WARNING = '''\
Outdated layout detected for the current session. Please consider updating it,
in order to not get affected by potential security problems.
For fixing ... | python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/httpie/legacy/__init__.py | httpie/legacy/__init__.py | python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false | |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/httpie/cli/requestitems.py | httpie/cli/requestitems.py | import os
import functools
from typing import Callable, Dict, IO, List, Optional, Tuple, Union
from .argtypes import KeyValueArg
from .constants import (
SEPARATORS_GROUP_MULTIPART, SEPARATOR_DATA_EMBED_FILE_CONTENTS,
SEPARATOR_DATA_EMBED_RAW_JSON_FILE, SEPARATOR_GROUP_NESTED_JSON_ITEMS,
SEPARATOR_DATA_RAW... | python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/httpie/cli/dicts.py | httpie/cli/dicts.py | from collections import OrderedDict
from multidict import MultiDict, CIMultiDict
class BaseMultiDict(MultiDict):
"""
Base class for all MultiDicts.
"""
class HTTPHeadersDict(CIMultiDict, BaseMultiDict):
"""
Headers are case-insensitive and multiple values are supported
through the `add()` A... | python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/httpie/cli/definition.py | httpie/cli/definition.py | from __future__ import annotations
import os
import textwrap
from argparse import FileType
from httpie import __doc__, __version__
from httpie.cli.argtypes import (KeyValueArgType, SessionNameValidator,
SSLCredentials, readable_file_arg,
response_chars... | python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/httpie/cli/constants.py | httpie/cli/constants.py | """Parsing and processing of CLI input (args, auth credentials, files, stdin).
"""
import enum
import re
URL_SCHEME_RE = re.compile(r'^[a-z][a-z0-9.+-]*://', re.IGNORECASE)
HTTP_POST = 'POST'
HTTP_GET = 'GET'
HTTP_OPTIONS = 'OPTIONS'
# Various separators used in args
SEPARATOR_HEADER = ':'
SEPARATOR_HEADER_EMPTY =... | python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/httpie/cli/exceptions.py | httpie/cli/exceptions.py | class ParseError(Exception):
pass
| python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/httpie/cli/argtypes.py | httpie/cli/argtypes.py | import argparse
import getpass
import os
import sys
from copy import deepcopy
from typing import List, Optional, Union
from .constants import DEFAULT_FORMAT_OPTIONS, SEPARATOR_CREDENTIALS
from ..sessions import VALID_SESSION_NAME_PATTERN
class KeyValueArg:
"""Base key-value pair parsed from CLI."""
def __in... | python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/httpie/cli/utils.py | httpie/cli/utils.py | import argparse
from typing import Any, Callable, Generic, Iterator, Iterable, Optional, TypeVar
T = TypeVar('T')
class Manual(argparse.Action):
def __init__(
self,
option_strings,
dest=argparse.SUPPRESS,
default=argparse.SUPPRESS,
help=None
):
super().__init__... | python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/httpie/cli/argparser.py | httpie/cli/argparser.py | import argparse
import errno
import os
import re
import sys
from argparse import RawDescriptionHelpFormatter
from textwrap import dedent
from urllib.parse import urlsplit
from requests.utils import get_netrc_auth
from .argtypes import (
AuthCredentials, SSLCredentials, KeyValueArgType,
PARSED_DEFAULT_FORMAT_O... | python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/httpie/cli/__init__.py | httpie/cli/__init__.py | python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false | |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/httpie/cli/options.py | httpie/cli/options.py | import argparse
import textwrap
import typing
from dataclasses import dataclass, field
from enum import Enum, auto
from typing import Any, Optional, Dict, List, Tuple, Type, TypeVar
from httpie.cli.argparser import HTTPieArgumentParser
from httpie.cli.utils import Manual, LazyChoices
class Qualifiers(Enum):
OPTI... | python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/httpie/cli/nested_json/interpret.py | httpie/cli/nested_json/interpret.py | from typing import Type, Union, Any, Iterable, Tuple
from .parse import parse, assert_cant_happen
from .errors import NestedJSONSyntaxError
from .tokens import EMPTY_STRING, TokenKind, Token, PathAction, Path, NestedJSONArray
__all__ = [
'interpret_nested_json',
'unwrap_top_level_list_if_needed',
]
JSONType... | python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/httpie/cli/nested_json/errors.py | httpie/cli/nested_json/errors.py | from typing import Optional
from .tokens import Token, HIGHLIGHTER
class NestedJSONSyntaxError(ValueError):
def __init__(
self,
source: str,
token: Optional[Token],
message: str,
message_kind: str = 'Syntax',
) -> None:
self.source = source
self.token =... | python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/httpie/cli/nested_json/parse.py | httpie/cli/nested_json/parse.py | from typing import Iterator
from .errors import NestedJSONSyntaxError
from .tokens import (
EMPTY_STRING,
BACKSLASH,
TokenKind,
OPERATORS,
SPECIAL_CHARS,
LITERAL_TOKENS,
Token,
PathAction,
Path,
)
__all__ = [
'parse',
'assert_cant_happen',
]
def parse(source: str) -> Ite... | python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/httpie/cli/nested_json/__init__.py | httpie/cli/nested_json/__init__.py | """
A library for parsing the HTTPie nested JSON key syntax and constructing the resulting objects.
<https://httpie.io/docs/cli/nested-json>
It has no dependencies.
"""
from .interpret import interpret_nested_json, unwrap_top_level_list_if_needed
from .errors import NestedJSONSyntaxError
from .tokens import EMPTY_ST... | python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/httpie/cli/nested_json/tokens.py | httpie/cli/nested_json/tokens.py | from enum import Enum, auto
from typing import NamedTuple, Union, Optional, List
EMPTY_STRING = ''
HIGHLIGHTER = '^'
OPEN_BRACKET = '['
CLOSE_BRACKET = ']'
BACKSLASH = '\\'
class TokenKind(Enum):
TEXT = auto()
NUMBER = auto()
LEFT_BRACKET = auto()
RIGHT_BRACKET = auto()
PSEUDO = auto() # Not a r... | python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/httpie/output/writer.py | httpie/output/writer.py | import errno
import requests
from typing import Any, Dict, IO, Optional, TextIO, Tuple, Type, Union
from ..cli.dicts import HTTPHeadersDict
from ..context import Environment
from ..models import (
HTTPRequest,
HTTPResponse,
HTTPMessage,
RequestsMessage,
RequestsMessageKind,
OutputOptions,
)
fro... | python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/httpie/output/models.py | httpie/output/models.py | import argparse
from typing import Any, Dict, Union, List, NamedTuple, Optional
from httpie.context import Environment
from httpie.cli.constants import PrettyOptions, PRETTY_MAP, PRETTY_STDOUT_TTY_ONLY
from httpie.cli.argtypes import PARSED_DEFAULT_FORMAT_OPTIONS
from httpie.output.formatters.colors import AUTO_STYLE
... | python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/httpie/output/utils.py | httpie/output/utils.py | import json
import re
from typing import Tuple
from ..utils import load_json_preserve_order_and_dupe_keys
from .lexers.json import PREFIX_REGEX
def load_prefixed_json(data: str) -> Tuple[str, json.JSONDecoder]:
"""Simple JSON loading from `data`.
"""
# First, the full data.
try:
return '', l... | python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/httpie/output/streams.py | httpie/output/streams.py | from abc import ABCMeta, abstractmethod
from itertools import chain
from typing import Callable, Iterable, Optional, Union
from .processing import Conversion, Formatting
from ..context import Environment
from ..encoding import smart_decode, smart_encode, UTF8
from ..models import HTTPMessage, OutputOptions
from ..util... | python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/httpie/output/__init__.py | httpie/output/__init__.py | python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false | |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/httpie/output/processing.py | httpie/output/processing.py | import re
from typing import Optional, List
from ..plugins import ConverterPlugin
from ..plugins.registry import plugin_manager
from ..context import Environment
MIME_RE = re.compile(r'^[^/]+/[^/]+$')
def is_valid_mime(mime):
return mime and MIME_RE.match(mime)
class Conversion:
@staticmethod
def ge... | python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/httpie/output/lexers/http.py | httpie/output/lexers/http.py | import re
import pygments
from httpie.output.lexers.common import precise
RE_STATUS_LINE = re.compile(r'(\d{3})( +)?(.+)?')
STATUS_TYPES = {
'1': pygments.token.Number.HTTP.INFO,
'2': pygments.token.Number.HTTP.OK,
'3': pygments.token.Number.HTTP.REDIRECT,
'4': pygments.token.Number.HTTP.CLIENT_ERR,
... | python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/httpie/output/lexers/common.py | httpie/output/lexers/common.py | def precise(lexer, precise_token, parent_token):
# Due to a pygments bug*, custom tokens will look bad
# on outside styles. Until it is fixed on upstream, we'll
# convey whether the client is using pie style or not
# through precise option and return more precise tokens
# depending on it's value.
... | python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/httpie/output/lexers/metadata.py | httpie/output/lexers/metadata.py | import pygments
from httpie.models import ELAPSED_TIME_LABEL
from httpie.output.lexers.common import precise
SPEED_TOKENS = {
0.45: pygments.token.Number.SPEED.FAST,
1.00: pygments.token.Number.SPEED.AVG,
2.50: pygments.token.Number.SPEED.SLOW,
}
def speed_based_token(lexer, match, ctx):
try:
... | python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/httpie/output/lexers/__init__.py | httpie/output/lexers/__init__.py | python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false | |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/httpie/output/lexers/json.py | httpie/output/lexers/json.py | import re
from pygments.lexer import bygroups, using, RegexLexer
from pygments.lexers.data import JsonLexer
from pygments.token import Token
PREFIX_TOKEN = Token.Error
PREFIX_REGEX = r'[^{\["]+'
class EnhancedJsonLexer(RegexLexer):
"""
Enhanced JSON lexer for Pygments.
It adds support for eventual data... | python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/httpie/output/formatters/xml.py | httpie/output/formatters/xml.py | from typing import TYPE_CHECKING, Optional
from ...encoding import UTF8
from ...plugins import FormatterPlugin
if TYPE_CHECKING:
from xml.dom.minidom import Document
XML_DECLARATION_OPEN = '<?xml'
XML_DECLARATION_CLOSE = '?>'
def parse_xml(data: str) -> 'Document':
"""Parse given XML `data` string into an... | python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/httpie/output/formatters/__init__.py | httpie/output/formatters/__init__.py | python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false | |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/httpie/output/formatters/headers.py | httpie/output/formatters/headers.py | from ...plugins import FormatterPlugin
class HeadersFormatter(FormatterPlugin):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.enabled = self.format_options['headers']['sort']
def format_headers(self, headers: str) -> str:
"""
Sorts headers by name while retain... | python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/httpie/output/formatters/json.py | httpie/output/formatters/json.py | import json
from ...plugins import FormatterPlugin
class JSONFormatter(FormatterPlugin):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.enabled = self.format_options['json']['format']
def format_body(self, body: str, mime: str) -> str:
maybe_json = [
'json... | python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/httpie/output/formatters/colors.py | httpie/output/formatters/colors.py | import json
from typing import Optional, Type, Tuple
import pygments.formatters
import pygments.lexer
import pygments.lexers
import pygments.style
import pygments.styles
import pygments.token
from pygments.formatters.terminal import TerminalFormatter
from pygments.formatters.terminal256 import Terminal256Formatter
fro... | python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/httpie/output/ui/rich_progress.py | httpie/output/ui/rich_progress.py | from dataclasses import dataclass
from typing import TYPE_CHECKING, Optional
from httpie.context import Environment
if TYPE_CHECKING:
from rich.console import Console
@dataclass
class BaseDisplay:
env: Environment
def start(
self, *, total: Optional[float], at: float, description: str
) -> ... | python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/httpie/output/ui/palette.py | httpie/output/ui/palette.py | from dataclasses import dataclass, field
from enum import Enum, auto
from typing import Optional, List
PYGMENTS_BRIGHT_BLACK = 'ansibrightblack'
AUTO_STYLE = 'auto' # Follows terminal ANSI color styles
class Styles(Enum):
PIE = auto()
ANSI = auto()
class PieStyle(str, Enum):
UNIVERSAL = 'pie'
DA... | python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/httpie/output/ui/rich_help.py | httpie/output/ui/rich_help.py | import re
import textwrap
from typing import AbstractSet, Iterable, Optional, Tuple
from rich.console import RenderableType
from rich.highlighter import RegexHighlighter
from rich.padding import Padding
from rich.table import Table
from rich.text import Text
from httpie.cli.constants import SEPARATOR_GROUP_ALL_ITEMS
... | python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/httpie/output/ui/man_pages.py | httpie/output/ui/man_pages.py | """Logic for checking and displaying man pages."""
import subprocess
import os
from httpie.context import Environment
MAN_COMMAND = 'man'
NO_MAN_PAGES = os.getenv('HTTPIE_NO_MAN_PAGES', False)
# On some systems, HTTP(n) might exist, but we are only interested in HTTP(1).
# For more information on man page sections:... | python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/httpie/output/ui/rich_utils.py | httpie/output/ui/rich_utils.py | import os
from typing import Iterator
from contextlib import contextmanager
from rich.console import Console, RenderableType
from rich.highlighter import Highlighter
from httpie.output.ui.rich_palette import _make_rich_color_theme
def render_as_string(renderable: RenderableType) -> str:
"""Render any `rich` ob... | python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/httpie/output/ui/rich_palette.py | httpie/output/ui/rich_palette.py | from collections import ChainMap
from typing import TYPE_CHECKING, Any, Optional
if TYPE_CHECKING:
from rich.theme import Theme
from httpie.output.ui.palette import GenericColor, PieStyle, Styles, ColorString, _StyledGenericColor # noqa
RICH_BOLD = ColorString('bold')
# Rich-specific color code declarations
# ... | python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/httpie/output/ui/__init__.py | httpie/output/ui/__init__.py | python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false | |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/extras/scripts/generate_man_pages.py | extras/scripts/generate_man_pages.py | import os
import re
from contextlib import contextmanager
from pathlib import Path
from typing import Optional, Iterator, Iterable
# So that httpie.cli.definition can provide man-page-specific output. Must be set before importing httpie.
os.environ['HTTPIE_BUILDING_MAN_PAGES'] = '1'
import httpie
from httpie.cli.def... | python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/extras/packaging/linux/build.py | extras/packaging/linux/build.py | import stat
import subprocess
from pathlib import Path
from typing import Iterator, Tuple
BUILD_DIR = Path(__file__).parent
HTTPIE_DIR = BUILD_DIR.parent.parent.parent
EXTRAS_DIR = HTTPIE_DIR / 'extras'
MAN_PAGES_DIR = EXTRAS_DIR / 'man'
SCRIPT_DIR = BUILD_DIR / Path('scripts')
HOOKS_DIR = SCRIPT_DIR / 'hooks'
DIS... | python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/extras/packaging/linux/scripts/httpie_cli.py | extras/packaging/linux/scripts/httpie_cli.py | from httpie.manager.__main__ import main
if __name__ == '__main__':
import sys
sys.exit(main())
| python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/extras/packaging/linux/scripts/http_cli.py | extras/packaging/linux/scripts/http_cli.py | from httpie.__main__ import main
if __name__ == '__main__':
import sys
sys.exit(main())
| python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/extras/packaging/linux/scripts/hooks/hook-pip.py | extras/packaging/linux/scripts/hooks/hook-pip.py | from pathlib import Path
from PyInstaller.utils.hooks import collect_all
def hook(hook_api):
for pkg in [
'pip',
'setuptools',
'distutils',
'pkg_resources'
]:
datas, binaries, hiddenimports = collect_all(pkg)
hook_api.add_datas(datas)
hook_api.add_binarie... | python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/extras/profiling/run.py | extras/profiling/run.py | """
Run the HTTPie benchmark suite with multiple environments.
This script is configured in a way that, it will create
two (or more) isolated environments and compare the *last
commit* of this repository with it's master.
> If you didn't commit yet, it won't be showing results.
You can also pass --fresh, which would... | python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false |
httpie/cli | https://github.com/httpie/cli/blob/5b604c37c6c67e18e7c3e9aee6c88a8c22b98345/extras/profiling/benchmarks.py | extras/profiling/benchmarks.py | """
This file is the declaration of benchmarks for HTTPie. It
is also used to run them with the current environment.
Each instance of BaseRunner class will be an individual
benchmark. And if run without any arguments, this file
will execute every benchmark instance and report the
timings.
The benchmarks are run throu... | python | BSD-3-Clause | 5b604c37c6c67e18e7c3e9aee6c88a8c22b98345 | 2026-01-04T14:41:41.864659Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/setup.py | setup.py | #!/usr/bin/env python3
"""
Parts of this file were taken from the pyzmq project
(https://github.com/zeromq/pyzmq) which have been permitted for use under the
BSD license. Parts are from lxml (https://github.com/lxml/lxml)
"""
import argparse
import multiprocessing
import os
from os.path import join as pjoin
import pl... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/generate_version.py | generate_version.py | #!/usr/bin/env python3
# Note: This file has to live next to setup.py or versioneer will not work
import argparse
import os
import sys
import versioneer
sys.path.insert(0, "")
def write_version_info(path) -> None:
version = None
git_version = None
try:
import _version_meson
version = ... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/generate_pxi.py | generate_pxi.py | import argparse
import os
from Cython import Tempita
def process_tempita(pxifile, outfile) -> None:
with open(pxifile, encoding="utf-8") as f:
tmpl = f.read()
pyxcontent = Tempita.sub(tmpl)
with open(outfile, "w", encoding="utf-8") as f:
f.write(pyxcontent)
def main() -> None:
pars... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/scripts/validate_docstrings.py | scripts/validate_docstrings.py | #!/usr/bin/env python3
"""
Analyze docstrings to detect errors.
If no argument is provided, it does a quick check of docstrings and returns
a csv with all API functions and results of basic checks.
If a function or method is provided in the form "pandas.function",
"pandas.module.class.method", etc. a list of all erro... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/scripts/sort_whatsnew_note.py | scripts/sort_whatsnew_note.py | """
Sort whatsnew note blocks by issue number.
NOTE: this assumes that each entry is on its own line, and ends with an issue number.
If that's not the case, then an entry might not get sorted. However, virtually all
recent-enough whatsnew entries follow this pattern. So, although not perfect, this
script should be goo... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/scripts/run_stubtest.py | scripts/run_stubtest.py | import os
from pathlib import Path
import sys
import tempfile
import warnings
from mypy import stubtest
import pandas as pd
pd_version = getattr(pd, "__version__", "")
# fail early if pandas is not installed
if not pd_version:
# fail on the CI, soft fail during local development
warnings.warn("You need to i... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/scripts/validate_min_versions_in_sync.py | scripts/validate_min_versions_in_sync.py | #!/usr/bin/env python3
"""
Check pandas required and optional dependencies are synced across:
ci/deps/actions-.*-minimum_versions.yaml
pandas/compat/_optional.py
setup.cfg
TODO: doc/source/getting_started/install.rst
This is meant to be run as a pre-commit hook - to run it manually, you can do:
pre-commit run v... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/scripts/check_test_naming.py | scripts/check_test_naming.py | """
Check that test names start with `test`, and that test classes start with `Test`.
This is meant to be run as a pre-commit hook - to run it manually, you can do:
pre-commit run check-test-naming --all-files
NOTE: if this finds a false positive, you can add the comment `# not a test` to the
class or function d... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/scripts/validate_unwanted_patterns.py | scripts/validate_unwanted_patterns.py | #!/usr/bin/env python3
"""
Unwanted patterns test cases.
The reason this file exist despite the fact we already have
`ci/code_checks.sh`,
(see https://github.com/pandas-dev/pandas/blob/master/ci/code_checks.sh)
is that some of the test cases are more complex/impossible to validate via regex.
So this file is somewhat ... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/scripts/run_vulture.py | scripts/run_vulture.py | """Look for unreachable code."""
import argparse
import sys
from vulture import Vulture
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("files", nargs="*")
args = parser.parse_args()
v = Vulture()
v.scavenge(args.files)
ret = 0
for item in v.get_unused_c... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/scripts/pandas_errors_documented.py | scripts/pandas_errors_documented.py | """
Check that doc/source/reference/testing.rst documents
all exceptions and warnings in pandas/errors/__init__.py.
This is meant to be run as a pre-commit hook - to run it manually, you can do:
pre-commit run pandas-errors-documented --all-files
"""
from __future__ import annotations
import argparse
import ast... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/scripts/check_for_inconsistent_pandas_namespace.py | scripts/check_for_inconsistent_pandas_namespace.py | """
Check that test suite file doesn't use the pandas namespace inconsistently.
We check for cases of ``Series`` and ``pd.Series`` appearing in the same file
(likewise for other pandas objects).
This is meant to be run as a pre-commit hook - to run it manually, you can do:
pre-commit run inconsistent-namespace-u... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/scripts/generate_pip_deps_from_conda.py | scripts/generate_pip_deps_from_conda.py | #!/usr/bin/env python3
"""
Convert the conda environment.yml to the pip requirements-dev.txt,
or check that they have the same packages (for the CI)
Usage:
Generate `requirements-dev.txt`
$ python scripts/generate_pip_deps_from_conda.py
Compare and fail (exit status != 0) if `requirements-dev.txt` has no... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/scripts/validate_exception_location.py | scripts/validate_exception_location.py | """
Validate that the exceptions and warnings are in appropriate places.
Checks for classes that inherit a python exception and warning and
flags them, unless they are exempted from checking. Exempt meaning
the exception/warning is defined in testing.rst. Testing.rst contains
a list of pandas defined exceptions and wa... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/scripts/validate_rst_title_capitalization.py | scripts/validate_rst_title_capitalization.py | """
Validate that the titles in the rst files follow the proper capitalization convention.
Print the titles that do not follow the convention.
Usage::
As pre-commit hook (recommended):
pre-commit run title-capitalization --all-files
From the command-line:
python scripts/validate_rst_title_capitalization.py ... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/scripts/__init__.py | scripts/__init__.py | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false | |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/scripts/tests/test_validate_min_versions_in_sync.py | scripts/tests/test_validate_min_versions_in_sync.py | import pathlib
import tomllib
import pytest
import yaml
from scripts.validate_min_versions_in_sync import (
get_toml_map_from,
get_yaml_map_from,
pin_min_versions_to_yaml_file,
)
DATA_PATH = pathlib.Path(__file__).parents[2] / "scripts/tests/data/"
@pytest.mark.parametrize(
"src_toml, src_yaml, exp... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/scripts/tests/test_validate_docstrings.py | scripts/tests/test_validate_docstrings.py | import io
import textwrap
import pytest
from scripts import validate_docstrings
# fmt: off
class BadDocstrings:
"""Everything here has a bad docstring"""
def private_classes(self) -> None:
"""
This mentions NDFrame, which is not correct.
"""
def prefix_pandas(self) -> None:
... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/scripts/tests/test_inconsistent_namespace_check.py | scripts/tests/test_inconsistent_namespace_check.py | import pytest
from scripts.check_for_inconsistent_pandas_namespace import (
check_for_inconsistent_pandas_namespace,
)
BAD_FILE_0 = (
"from pandas import Categorical\ncat_0 = Categorical()\ncat_1 = pd.Categorical()"
)
BAD_FILE_1 = (
"from pandas import Categorical\ncat_0 = pd.Categorical()\ncat_1 = Catego... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/scripts/tests/test_sort_whatsnew_note.py | scripts/tests/test_sort_whatsnew_note.py | from scripts.sort_whatsnew_note import sort_whatsnew_note
def test_sort_whatsnew_note() -> None:
content = (
".. _whatsnew_200:\n"
"\n"
"What's new in 2.0.0 (March XX, 2023)\n"
"------------------------------------\n"
"\n"
"Timedelta\n"
"^^^^^^^^^\n"
... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/scripts/tests/test_check_test_naming.py | scripts/tests/test_check_test_naming.py | import pytest
from scripts.check_test_naming import main
@pytest.mark.parametrize(
"src, expected_out, expected_ret",
[
(
"def foo(): pass\n",
"t.py:1:0 found test function which does not start with 'test'\n",
1,
),
(
"class Foo:\n de... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/scripts/tests/test_validate_exception_location.py | scripts/tests/test_validate_exception_location.py | import pytest
from scripts.validate_exception_location import (
ERROR_MESSAGE,
validate_exception_and_warning_placement,
)
PATH = "t.py"
# ERRORS_IN_TESTING_RST is the set returned when parsing testing.rst for all the
# exceptions and warnings.
CUSTOM_EXCEPTION_NOT_IN_TESTING_RST = "MyException"
CUSTOM_EXCEP... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/scripts/tests/conftest.py | scripts/tests/conftest.py | # pyproject.toml defines addopts: --strict-data-files
# strict-data-files is defined & used in pandas/conftest.py
def pytest_addoption(parser) -> None:
parser.addoption(
"--strict-data-files",
action="store_true",
help="Unused",
)
| python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/scripts/tests/test_validate_unwanted_patterns.py | scripts/tests/test_validate_unwanted_patterns.py | import io
import pytest
from scripts import validate_unwanted_patterns
class TestStringsWithWrongPlacedWhitespace:
@pytest.mark.parametrize(
"data",
[
(
r"""
msg = (
"foo\n"
" bar"
)
"""
),
(
"""
... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/scripts/tests/__init__.py | scripts/tests/__init__.py | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false | |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/asv_bench/benchmarks/series_methods.py | asv_bench/benchmarks/series_methods.py | from datetime import datetime
import numpy as np
from pandas import (
NA,
Index,
NaT,
Series,
date_range,
)
class SeriesConstructor:
def setup(self):
self.idx = date_range(
start=datetime(2015, 10, 26), end=datetime(2016, 1, 1), freq="50s"
)
self.data = di... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/asv_bench/benchmarks/timeseries.py | asv_bench/benchmarks/timeseries.py | from datetime import timedelta
import dateutil
import numpy as np
from pandas import (
DataFrame,
Series,
date_range,
period_range,
timedelta_range,
)
from pandas.tseries.frequencies import infer_freq
try:
from pandas.plotting._matplotlib.converter import DatetimeConverter
except ImportError... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/asv_bench/benchmarks/plotting.py | asv_bench/benchmarks/plotting.py | import contextlib
import importlib.machinery
import importlib.util
import os
import pathlib
import sys
import tempfile
from unittest import mock
import matplotlib
import numpy as np
from pandas import (
DataFrame,
DatetimeIndex,
Series,
date_range,
)
try:
from pandas.plotting import andrews_curve... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/asv_bench/benchmarks/frame_methods.py | asv_bench/benchmarks/frame_methods.py | import string
import warnings
import numpy as np
from pandas import (
NA,
DataFrame,
Index,
MultiIndex,
NaT,
Series,
date_range,
isnull,
period_range,
timedelta_range,
)
class AsType:
params = [
[
# from_dtype == to_dtype
("Float64", "Float... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/asv_bench/benchmarks/boolean.py | asv_bench/benchmarks/boolean.py | import numpy as np
import pandas as pd
class TimeLogicalOps:
def setup(self):
N = 10_000
left, right, lmask, rmask = np.random.randint(0, 2, size=(4, N)).astype("bool")
self.left = pd.arrays.BooleanArray(left, lmask)
self.right = pd.arrays.BooleanArray(right, rmask)
def time_... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/asv_bench/benchmarks/arithmetic.py | asv_bench/benchmarks/arithmetic.py | import operator
import warnings
import numpy as np
import pandas as pd
from pandas import (
DataFrame,
Index,
Series,
Timestamp,
date_range,
to_timedelta,
)
from .pandas_vb_common import numeric_dtypes
try:
import pandas.core.computation.expressions as expr
except ImportError:
import... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/asv_bench/benchmarks/inference.py | asv_bench/benchmarks/inference.py | """
The functions benchmarked in this file depend _almost_ exclusively on
_libs, but not in a way that is easy to formalize.
If a PR does not change anything in pandas/_libs/ or pandas/core/tools/, then
it is likely that these benchmarks will be unaffected.
"""
import numpy as np
from pandas import (
Index,
... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/asv_bench/benchmarks/eval.py | asv_bench/benchmarks/eval.py | import numpy as np
import pandas as pd
try:
import pandas.core.computation.expressions as expr
except ImportError:
import pandas.computation.expressions as expr
class Eval:
params = [["numexpr", "python"], [1, "all"]]
param_names = ["engine", "threads"]
def setup(self, engine, threads):
... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/asv_bench/benchmarks/attrs_caching.py | asv_bench/benchmarks/attrs_caching.py | import numpy as np
import pandas as pd
from pandas import DataFrame
try:
from pandas.core.construction import extract_array
except ImportError:
extract_array = None
class DataFrameAttributes:
def setup(self):
self.df = DataFrame(np.random.randn(10, 6))
self.cur_index = self.df.index
... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/asv_bench/benchmarks/strftime.py | asv_bench/benchmarks/strftime.py | import numpy as np
import pandas as pd
from pandas import offsets
class DatetimeStrftime:
timeout = 1500
params = [1000, 10000]
param_names = ["nobs"]
def setup(self, nobs):
d = "2018-11-29"
dt = "2018-11-26 11:18:27.0"
self.data = pd.DataFrame(
{
... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/asv_bench/benchmarks/pandas_vb_common.py | asv_bench/benchmarks/pandas_vb_common.py | from importlib import import_module
import os
import numpy as np
import pandas as pd
# Compatibility import for lib
for imp in ["pandas._libs.lib", "pandas.lib"]:
try:
lib = import_module(imp)
break
except (ImportError, TypeError, ValueError):
pass
# Compatibility import for the test... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/asv_bench/benchmarks/algorithms.py | asv_bench/benchmarks/algorithms.py | from importlib import import_module
import numpy as np
import pandas as pd
for imp in ["pandas.util", "pandas.tools.hashing"]:
try:
hashing = import_module(imp)
break
except (ImportError, TypeError, ValueError):
pass
class Factorize:
params = [
[True, False],
[Tr... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/asv_bench/benchmarks/finalize.py | asv_bench/benchmarks/finalize.py | import pandas as pd
class Finalize:
param_names = ["series", "frame"]
params = [pd.Series, pd.DataFrame]
def setup(self, param):
N = 1000
obj = param(dtype=float)
for i in range(N):
obj.attrs[i] = i
self.obj = obj
def time_finalize_micro(self, param):
... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/asv_bench/benchmarks/categoricals.py | asv_bench/benchmarks/categoricals.py | import string
import sys
import warnings
import numpy as np
import pandas as pd
try:
from pandas.api.types import union_categoricals
except ImportError:
try:
from pandas.types.concat import union_categoricals
except ImportError:
pass
class Constructor:
def setup(self):
N = 1... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/asv_bench/benchmarks/reshape.py | asv_bench/benchmarks/reshape.py | from itertools import product
import string
import numpy as np
import pandas as pd
from pandas import (
DataFrame,
MultiIndex,
date_range,
melt,
wide_to_long,
)
from pandas.api.types import CategoricalDtype
class Melt:
params = ["float64", "Float64"]
param_names = ["dtype"]
def setu... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/asv_bench/benchmarks/period.py | asv_bench/benchmarks/period.py | """
Period benchmarks with non-tslibs dependencies. See
benchmarks.tslibs.period for benchmarks that rely only on tslibs.
"""
from pandas import (
DataFrame,
Period,
PeriodIndex,
Series,
date_range,
period_range,
)
from pandas.tseries.frequencies import to_offset
class PeriodIndexConstructo... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/asv_bench/benchmarks/frame_ctor.py | asv_bench/benchmarks/frame_ctor.py | import numpy as np
import pandas as pd
from pandas import (
NA,
Categorical,
DataFrame,
Float64Dtype,
MultiIndex,
Series,
Timestamp,
date_range,
)
try:
from pandas.tseries.offsets import (
Hour,
Nano,
)
except ImportError:
# For compatibility with older vers... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/asv_bench/benchmarks/index_object.py | asv_bench/benchmarks/index_object.py | import gc
import numpy as np
from pandas import (
DatetimeIndex,
Index,
IntervalIndex,
MultiIndex,
RangeIndex,
Series,
date_range,
)
class SetOperations:
params = (
["monotonic", "non_monotonic"],
["datetime", "date_string", "int", "strings", "ea_int"],
["inte... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/asv_bench/benchmarks/join_merge.py | asv_bench/benchmarks/join_merge.py | import string
import numpy as np
from pandas import (
DataFrame,
Index,
MultiIndex,
Series,
array,
concat,
date_range,
merge,
merge_asof,
)
try:
from pandas import merge_ordered
except ImportError:
from pandas import ordered_merge as merge_ordered
class Concat:
param... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/asv_bench/benchmarks/strings.py | asv_bench/benchmarks/strings.py | import warnings
import numpy as np
from pandas import (
NA,
Categorical,
DataFrame,
Index,
Series,
StringDtype,
)
from pandas.arrays import StringArray
class Dtypes:
params = ["str", "string[python]", "string[pyarrow]"]
param_names = ["dtype"]
def setup(self, dtype):
try... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.