mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 05:24:52 +08:00
Stubs for humanfriendly (#5790)
Autogenerated with stubgen + manual adjustments to fix e.g. namedtuple, Python versioning, removing unneeded imports, required stubtest packages/allowlist.
This commit is contained in:
@@ -38,6 +38,7 @@
|
||||
"stubs/Flask",
|
||||
"stubs/html5lib",
|
||||
"stubs/httplib2",
|
||||
"stubs/humanfriendly",
|
||||
"stubs/Jinja2",
|
||||
"stubs/jmespath",
|
||||
"stubs/jsonschema",
|
||||
|
||||
2
stubs/humanfriendly/@tests/requirements-stubtest.txt
Normal file
2
stubs/humanfriendly/@tests/requirements-stubtest.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
docutils
|
||||
mock
|
||||
2
stubs/humanfriendly/@tests/stubtest_allowlist.txt
Normal file
2
stubs/humanfriendly/@tests/stubtest_allowlist.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
humanfriendly.compat.StringIO.seek
|
||||
humanfriendly.compat.StringIO.truncate
|
||||
1
stubs/humanfriendly/METADATA.toml
Normal file
1
stubs/humanfriendly/METADATA.toml
Normal file
@@ -0,0 +1 @@
|
||||
version = "9.2"
|
||||
48
stubs/humanfriendly/humanfriendly/__init__.pyi
Normal file
48
stubs/humanfriendly/humanfriendly/__init__.pyi
Normal file
@@ -0,0 +1,48 @@
|
||||
from typing import Any, NamedTuple
|
||||
|
||||
class SizeUnit(NamedTuple):
|
||||
divider: Any
|
||||
symbol: Any
|
||||
name: Any
|
||||
|
||||
class CombinedUnit(NamedTuple):
|
||||
decimal: Any
|
||||
binary: Any
|
||||
|
||||
disk_size_units: Any
|
||||
length_size_units: Any
|
||||
time_units: Any
|
||||
|
||||
def coerce_boolean(value): ...
|
||||
def coerce_pattern(value, flags: int = ...): ...
|
||||
def coerce_seconds(value): ...
|
||||
def format_size(num_bytes, keep_width: bool = ..., binary: bool = ...): ...
|
||||
def parse_size(size, binary: bool = ...): ...
|
||||
def format_length(num_metres, keep_width: bool = ...): ...
|
||||
def parse_length(length): ...
|
||||
def format_number(number, num_decimals: int = ...): ...
|
||||
def round_number(count, keep_width: bool = ...): ...
|
||||
def format_timespan(num_seconds, detailed: bool = ..., max_units: int = ...): ...
|
||||
def parse_timespan(timespan): ...
|
||||
def parse_date(datestring): ...
|
||||
def format_path(pathname): ...
|
||||
def parse_path(pathname): ...
|
||||
|
||||
class Timer:
|
||||
monotonic: bool
|
||||
resumable: bool
|
||||
start_time: float
|
||||
total_time: float
|
||||
def __init__(self, start_time: Any | None = ..., resumable: bool = ...) -> None: ...
|
||||
def __enter__(self): ...
|
||||
def __exit__(self, exc_type: Any | None = ..., exc_value: Any | None = ..., traceback: Any | None = ...) -> None: ...
|
||||
def sleep(self, seconds) -> None: ...
|
||||
@property
|
||||
def elapsed_time(self): ...
|
||||
@property
|
||||
def rounded(self): ...
|
||||
|
||||
class InvalidDate(Exception): ...
|
||||
class InvalidSize(Exception): ...
|
||||
class InvalidLength(Exception): ...
|
||||
class InvalidTimespan(Exception): ...
|
||||
23
stubs/humanfriendly/humanfriendly/case.pyi
Normal file
23
stubs/humanfriendly/humanfriendly/case.pyi
Normal file
@@ -0,0 +1,23 @@
|
||||
import collections
|
||||
from typing import Any
|
||||
|
||||
from humanfriendly.compat import unicode
|
||||
|
||||
class CaseInsensitiveDict(collections.OrderedDict):
|
||||
def __init__(self, other: Any | None = ..., **kw) -> None: ...
|
||||
def coerce_key(self, key): ...
|
||||
@classmethod
|
||||
def fromkeys(cls, iterable, value: Any | None = ...): ...
|
||||
def get(self, key, default: Any | None = ...): ...
|
||||
def pop(self, key, default: Any | None = ...): ...
|
||||
def setdefault(self, key, default: Any | None = ...): ...
|
||||
def update(self, other: Any | None = ..., **kw) -> None: ... # type: ignore
|
||||
def __contains__(self, key): ...
|
||||
def __delitem__(self, key): ...
|
||||
def __getitem__(self, key): ...
|
||||
def __setitem__(self, key, value): ...
|
||||
|
||||
class CaseInsensitiveKey(unicode):
|
||||
def __new__(cls, value): ...
|
||||
def __hash__(self): ...
|
||||
def __eq__(self, other): ...
|
||||
13
stubs/humanfriendly/humanfriendly/cli.pyi
Normal file
13
stubs/humanfriendly/humanfriendly/cli.pyi
Normal file
@@ -0,0 +1,13 @@
|
||||
from typing import Any
|
||||
|
||||
def main() -> None: ...
|
||||
def run_command(command_line) -> None: ...
|
||||
def print_formatted_length(value) -> None: ...
|
||||
def print_formatted_number(value) -> None: ...
|
||||
def print_formatted_size(value, binary) -> None: ...
|
||||
def print_formatted_table(delimiter) -> None: ...
|
||||
def print_formatted_timespan(value) -> None: ...
|
||||
def print_parsed_length(value) -> None: ...
|
||||
def print_parsed_size(value) -> None: ...
|
||||
def demonstrate_ansi_formatting() -> None: ...
|
||||
def demonstrate_256_colors(i, j, group: Any | None = ...) -> None: ...
|
||||
23
stubs/humanfriendly/humanfriendly/compat.pyi
Normal file
23
stubs/humanfriendly/humanfriendly/compat.pyi
Normal file
@@ -0,0 +1,23 @@
|
||||
import sys
|
||||
|
||||
if sys.version_info >= (3, 0):
|
||||
unicode = str
|
||||
unichr = chr
|
||||
basestring = str
|
||||
interactive_prompt = input
|
||||
from html.parser import HTMLParser as HTMLParser
|
||||
from io import StringIO as StringIO
|
||||
else:
|
||||
unicode = unicode
|
||||
unichr = unichr
|
||||
basestring = basestring
|
||||
interactive_prompt = raw_input
|
||||
from StringIO import StringIO as StringIO
|
||||
|
||||
from HTMLParser import HTMLParser as HTMLParser
|
||||
|
||||
def coerce_string(value): ...
|
||||
def is_string(value): ...
|
||||
def is_unicode(value): ...
|
||||
def on_macos(): ...
|
||||
def on_windows(): ...
|
||||
3
stubs/humanfriendly/humanfriendly/decorators.pyi
Normal file
3
stubs/humanfriendly/humanfriendly/decorators.pyi
Normal file
@@ -0,0 +1,3 @@
|
||||
RESULTS_ATTRIBUTE: str
|
||||
|
||||
def cached(function): ...
|
||||
14
stubs/humanfriendly/humanfriendly/deprecation.pyi
Normal file
14
stubs/humanfriendly/humanfriendly/deprecation.pyi
Normal file
@@ -0,0 +1,14 @@
|
||||
import types
|
||||
from typing import Any
|
||||
|
||||
def define_aliases(module_name, **aliases) -> None: ...
|
||||
def get_aliases(module_name): ...
|
||||
def deprecated_args(*names): ...
|
||||
def is_method(function): ...
|
||||
|
||||
class DeprecationProxy(types.ModuleType):
|
||||
module: Any
|
||||
aliases: Any
|
||||
def __init__(self, module, aliases) -> None: ...
|
||||
def __getattr__(self, name): ...
|
||||
def resolve(self, target): ...
|
||||
13
stubs/humanfriendly/humanfriendly/prompts.pyi
Normal file
13
stubs/humanfriendly/humanfriendly/prompts.pyi
Normal file
@@ -0,0 +1,13 @@
|
||||
from typing import Any
|
||||
|
||||
MAX_ATTEMPTS: int
|
||||
logger: Any
|
||||
|
||||
def prompt_for_confirmation(question, default: Any | None = ..., padding: bool = ...): ...
|
||||
def prompt_for_choice(choices, default: Any | None = ..., padding: bool = ...): ...
|
||||
def prompt_for_input(question, default: Any | None = ..., padding: bool = ..., strip: bool = ...): ...
|
||||
def prepare_prompt_text(prompt_text, **options): ...
|
||||
def prepare_friendly_prompts() -> None: ...
|
||||
def retry_limit(limit=...) -> None: ...
|
||||
|
||||
class TooManyInvalidReplies(Exception): ...
|
||||
15
stubs/humanfriendly/humanfriendly/sphinx.pyi
Normal file
15
stubs/humanfriendly/humanfriendly/sphinx.pyi
Normal file
@@ -0,0 +1,15 @@
|
||||
from typing import Any
|
||||
|
||||
logger: Any
|
||||
|
||||
def deprecation_note_callback(app, what, name, obj, options, lines) -> None: ...
|
||||
def enable_deprecation_notes(app) -> None: ...
|
||||
def enable_man_role(app) -> None: ...
|
||||
def enable_pypi_role(app) -> None: ...
|
||||
def enable_special_methods(app) -> None: ...
|
||||
def enable_usage_formatting(app) -> None: ...
|
||||
def man_role(role, rawtext, text, lineno, inliner, options=..., content=...): ...
|
||||
def pypi_role(role, rawtext, text, lineno, inliner, options=..., content=...): ...
|
||||
def setup(app): ...
|
||||
def special_methods_callback(app, what, name, obj, skip, options): ...
|
||||
def usage_message_callback(app, what, name, obj, options, lines) -> None: ...
|
||||
6
stubs/humanfriendly/humanfriendly/tables.pyi
Normal file
6
stubs/humanfriendly/humanfriendly/tables.pyi
Normal file
@@ -0,0 +1,6 @@
|
||||
from typing import Any
|
||||
|
||||
def format_smart_table(data, column_names): ...
|
||||
def format_pretty_table(data, column_names: Any | None = ..., horizontal_bar: str = ..., vertical_bar: str = ...): ...
|
||||
def format_robust_table(data, column_names): ...
|
||||
def format_rst_table(data, column_names: Any | None = ...): ...
|
||||
37
stubs/humanfriendly/humanfriendly/terminal/__init__.pyi
Normal file
37
stubs/humanfriendly/humanfriendly/terminal/__init__.pyi
Normal file
@@ -0,0 +1,37 @@
|
||||
from typing import Any
|
||||
|
||||
ANSI_CSI: str
|
||||
ANSI_SGR: str
|
||||
ANSI_ERASE_LINE: Any
|
||||
ANSI_RESET: Any
|
||||
ANSI_HIDE_CURSOR: Any
|
||||
ANSI_SHOW_CURSOR: Any
|
||||
ANSI_COLOR_CODES: Any
|
||||
ANSI_TEXT_STYLES: Any
|
||||
CLEAN_OUTPUT_PATTERN: Any
|
||||
DEFAULT_LINES: int
|
||||
DEFAULT_COLUMNS: int
|
||||
DEFAULT_ENCODING: str
|
||||
HIGHLIGHT_COLOR: Any
|
||||
|
||||
def ansi_strip(text, readline_hints: bool = ...): ...
|
||||
def ansi_style(**kw): ...
|
||||
def ansi_width(text): ...
|
||||
def ansi_wrap(text, **kw): ...
|
||||
def auto_encode(stream, text, *args, **kw) -> None: ...
|
||||
def clean_terminal_output(text): ...
|
||||
def connected_to_terminal(stream: Any | None = ...): ...
|
||||
def enable_ansi_support(): ...
|
||||
def find_terminal_size(): ...
|
||||
def find_terminal_size_using_ioctl(stream): ...
|
||||
def find_terminal_size_using_stty(): ...
|
||||
def get_pager_command(text: Any | None = ...): ...
|
||||
def have_windows_native_ansi_support(): ...
|
||||
def message(text, *args, **kw) -> None: ...
|
||||
def output(text, *args, **kw) -> None: ...
|
||||
def readline_strip(expr): ...
|
||||
def readline_wrap(expr): ...
|
||||
def show_pager(formatted_text, encoding=...) -> None: ...
|
||||
def terminal_supports_colors(stream: Any | None = ...): ...
|
||||
def usage(usage_text) -> None: ...
|
||||
def warning(text, *args, **kw) -> None: ...
|
||||
31
stubs/humanfriendly/humanfriendly/terminal/html.pyi
Normal file
31
stubs/humanfriendly/humanfriendly/terminal/html.pyi
Normal file
@@ -0,0 +1,31 @@
|
||||
from typing import Any
|
||||
|
||||
from humanfriendly.compat import HTMLParser
|
||||
|
||||
def html_to_ansi(data, callback: Any | None = ...): ...
|
||||
|
||||
class HTMLConverter(HTMLParser):
|
||||
BLOCK_TAGS: Any
|
||||
callback: Any
|
||||
output: Any
|
||||
def __init__(self, *args, **kw) -> None: ...
|
||||
def __call__(self, data): ...
|
||||
@property
|
||||
def current_style(self): ...
|
||||
stack: Any
|
||||
def close(self) -> None: ...
|
||||
def emit_style(self, style: Any | None = ...) -> None: ...
|
||||
def handle_charref(self, value) -> None: ...
|
||||
link_text: Any
|
||||
def handle_data(self, data) -> None: ...
|
||||
def handle_endtag(self, tag) -> None: ...
|
||||
def handle_entityref(self, name) -> None: ...
|
||||
link_url: Any
|
||||
def handle_starttag(self, tag, attrs) -> None: ...
|
||||
def normalize_url(self, url): ...
|
||||
def parse_color(self, value): ...
|
||||
def push_styles(self, **changes) -> None: ...
|
||||
def render_url(self, url): ...
|
||||
preformatted_text_level: int
|
||||
def reset(self) -> None: ...
|
||||
def urls_match(self, a, b): ...
|
||||
30
stubs/humanfriendly/humanfriendly/terminal/spinners.pyi
Normal file
30
stubs/humanfriendly/humanfriendly/terminal/spinners.pyi
Normal file
@@ -0,0 +1,30 @@
|
||||
from typing import Any
|
||||
|
||||
GLYPHS: Any
|
||||
MINIMUM_INTERVAL: float
|
||||
|
||||
class Spinner:
|
||||
interactive: Any
|
||||
interval: Any
|
||||
label: Any
|
||||
states: Any
|
||||
stream: Any
|
||||
timer: Any
|
||||
total: Any
|
||||
counter: int
|
||||
last_update: int
|
||||
def __init__(self, **options) -> None: ...
|
||||
def step(self, progress: int = ..., label: Any | None = ...) -> None: ...
|
||||
def sleep(self) -> None: ...
|
||||
def clear(self) -> None: ...
|
||||
def __enter__(self): ...
|
||||
def __exit__(self, exc_type: Any | None = ..., exc_value: Any | None = ..., traceback: Any | None = ...) -> None: ...
|
||||
|
||||
class AutomaticSpinner:
|
||||
label: Any
|
||||
show_time: Any
|
||||
shutdown_event: Any
|
||||
subprocess: Any
|
||||
def __init__(self, label, show_time: bool = ...) -> None: ...
|
||||
def __enter__(self) -> None: ...
|
||||
def __exit__(self, exc_type: Any | None = ..., exc_value: Any | None = ..., traceback: Any | None = ...) -> None: ...
|
||||
86
stubs/humanfriendly/humanfriendly/testing.pyi
Normal file
86
stubs/humanfriendly/humanfriendly/testing.pyi
Normal file
@@ -0,0 +1,86 @@
|
||||
import unittest
|
||||
from typing import Any
|
||||
|
||||
from humanfriendly.compat import StringIO
|
||||
|
||||
def configure_logging(log_level=...) -> None: ...
|
||||
def make_dirs(pathname) -> None: ...
|
||||
def retry(func, timeout: int = ..., exc_type=...): ...
|
||||
def run_cli(entry_point, *arguments, **options): ...
|
||||
def skip_on_raise(*exc_types): ...
|
||||
def touch(filename) -> None: ...
|
||||
|
||||
class CallableTimedOut(Exception): ...
|
||||
|
||||
class ContextManager:
|
||||
def __enter__(self): ...
|
||||
def __exit__(self, exc_type: Any | None = ..., exc_value: Any | None = ..., traceback: Any | None = ...) -> None: ...
|
||||
|
||||
class PatchedAttribute(ContextManager):
|
||||
object_to_patch: Any
|
||||
attribute_to_patch: Any
|
||||
patched_value: Any
|
||||
original_value: Any
|
||||
def __init__(self, obj, name, value) -> None: ...
|
||||
def __enter__(self): ...
|
||||
def __exit__(self, exc_type: Any | None = ..., exc_value: Any | None = ..., traceback: Any | None = ...) -> None: ...
|
||||
|
||||
class PatchedItem(ContextManager):
|
||||
object_to_patch: Any
|
||||
item_to_patch: Any
|
||||
patched_value: Any
|
||||
original_value: Any
|
||||
def __init__(self, obj, item, value) -> None: ...
|
||||
def __enter__(self): ...
|
||||
def __exit__(self, exc_type: Any | None = ..., exc_value: Any | None = ..., traceback: Any | None = ...) -> None: ...
|
||||
|
||||
class TemporaryDirectory(ContextManager):
|
||||
mkdtemp_options: Any
|
||||
temporary_directory: Any
|
||||
def __init__(self, **options) -> None: ...
|
||||
def __enter__(self): ...
|
||||
def __exit__(self, exc_type: Any | None = ..., exc_value: Any | None = ..., traceback: Any | None = ...) -> None: ...
|
||||
|
||||
class MockedHomeDirectory(PatchedItem, TemporaryDirectory):
|
||||
def __init__(self) -> None: ...
|
||||
patched_value: Any
|
||||
def __enter__(self): ...
|
||||
def __exit__(self, exc_type: Any | None = ..., exc_value: Any | None = ..., traceback: Any | None = ...) -> None: ...
|
||||
|
||||
class CustomSearchPath(PatchedItem, TemporaryDirectory):
|
||||
isolated_search_path: Any
|
||||
def __init__(self, isolated: bool = ...) -> None: ...
|
||||
patched_value: Any
|
||||
def __enter__(self): ...
|
||||
def __exit__(self, exc_type: Any | None = ..., exc_value: Any | None = ..., traceback: Any | None = ...) -> None: ...
|
||||
@property
|
||||
def current_search_path(self): ...
|
||||
|
||||
class MockedProgram(CustomSearchPath):
|
||||
program_name: Any
|
||||
program_returncode: Any
|
||||
program_script: Any
|
||||
program_signal_file: Any
|
||||
def __init__(self, name, returncode: int = ..., script: Any | None = ...) -> None: ...
|
||||
def __enter__(self): ...
|
||||
def __exit__(self, *args, **kw): ...
|
||||
|
||||
class CaptureOutput(ContextManager):
|
||||
stdin: Any
|
||||
stdout: Any
|
||||
stderr: Any
|
||||
patched_attributes: Any
|
||||
def __init__(self, merged: bool = ..., input: str = ..., enabled: bool = ...) -> None: ...
|
||||
def __enter__(self): ...
|
||||
def __exit__(self, exc_type: Any | None = ..., exc_value: Any | None = ..., traceback: Any | None = ...) -> None: ...
|
||||
def get_lines(self): ...
|
||||
def get_text(self): ...
|
||||
def getvalue(self): ...
|
||||
|
||||
class CaptureBuffer(StringIO):
|
||||
def get_lines(self): ...
|
||||
def get_text(self): ...
|
||||
|
||||
class TestCase(unittest.TestCase):
|
||||
def __init__(self, *args, **kw) -> None: ...
|
||||
def setUp(self, log_level=...) -> None: ...
|
||||
17
stubs/humanfriendly/humanfriendly/text.pyi
Normal file
17
stubs/humanfriendly/humanfriendly/text.pyi
Normal file
@@ -0,0 +1,17 @@
|
||||
from typing import Any
|
||||
|
||||
def compact(text, *args, **kw): ...
|
||||
def compact_empty_lines(text): ...
|
||||
def concatenate(items, conjunction: str = ..., serial_comma: bool = ...): ...
|
||||
def dedent(text, *args, **kw): ...
|
||||
def format(text, *args, **kw): ...
|
||||
def generate_slug(text, delimiter: str = ...): ...
|
||||
def is_empty_line(text): ...
|
||||
def join_lines(text): ...
|
||||
def pluralize(count, singular, plural: Any | None = ...): ...
|
||||
def pluralize_raw(count, singular, plural: Any | None = ...): ...
|
||||
def random_string(length=..., characters=...): ...
|
||||
def split(text, delimiter: str = ...): ...
|
||||
def split_paragraphs(text): ...
|
||||
def tokenize(text): ...
|
||||
def trim_empty_lines(text): ...
|
||||
7
stubs/humanfriendly/humanfriendly/usage.pyi
Normal file
7
stubs/humanfriendly/humanfriendly/usage.pyi
Normal file
@@ -0,0 +1,7 @@
|
||||
USAGE_MARKER: str
|
||||
|
||||
def format_usage(usage_text): ...
|
||||
def find_meta_variables(usage_text): ...
|
||||
def parse_usage(text): ...
|
||||
def render_usage(text): ...
|
||||
def inject_usage(module_name) -> None: ...
|
||||
Reference in New Issue
Block a user