97 lines
2.7 KiB
Python
97 lines
2.7 KiB
Python
|
# Copyright (C) 2023 Umorpha Systems
|
||
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||
|
|
||
|
import argparse
|
||
|
import io
|
||
|
from collections import OrderedDict
|
||
|
from collections.abc import Generator, Sequence
|
||
|
from typing import Any, Optional, TypedDict
|
||
|
|
||
|
import pyalpm
|
||
|
|
||
|
class InvalidSyntax(Warning):
|
||
|
filename: str
|
||
|
problem: str
|
||
|
arg: Any
|
||
|
|
||
|
def __init__(self, filename: str, problem: str, arg: Any) -> None: ...
|
||
|
|
||
|
LIST_OPTIONS: Sequence[str]
|
||
|
SINGLE_OPTIONS: Sequence[str]
|
||
|
BOOLEAN_OPTIONS: Sequence[str]
|
||
|
|
||
|
class PacmanConfEnumeratorSession:
|
||
|
path: str
|
||
|
file_descriptors: list[io.TextIOWrapper]
|
||
|
|
||
|
def __init__(self, path: str) -> None: ...
|
||
|
def __enter__(self) -> Generator[tuple[str, str, str], None, None]: ...
|
||
|
def __exit__(self, *exc_details: Any) -> None: ...
|
||
|
|
||
|
def cb_log(level: int, line: str) -> None: ...
|
||
|
|
||
|
class _PacmanConfigOptions(TypedDict):
|
||
|
# LIST_OPTIONS
|
||
|
CacheDir: list[str]
|
||
|
HookDir: list[str]
|
||
|
HoldPkg: list[str]
|
||
|
SyncFirst: list[str]
|
||
|
IgnoreGroup: list[str]
|
||
|
IgnorePkg: list[str]
|
||
|
NoExtract: list[str]
|
||
|
NoUpgrade: list[str]
|
||
|
Serve: list[str]
|
||
|
|
||
|
# SINGLE_OPTIONS
|
||
|
RootDir: str
|
||
|
DBPath: str
|
||
|
GPGDir: str
|
||
|
LogFile: str
|
||
|
Architecture: str
|
||
|
XferCommand: str
|
||
|
CleanMethod: str
|
||
|
SigLevel: str
|
||
|
LocalFileSigLevel: str
|
||
|
RemoteFileSigLevel: str
|
||
|
ParallelDownloads: str
|
||
|
|
||
|
# BOOLEAN_OPTIONS
|
||
|
UseSyslog: bool
|
||
|
ShowSize: bool
|
||
|
CheckSpace: bool
|
||
|
VerbosePkgLists: bool
|
||
|
ILoveCandy: bool
|
||
|
Color: bool
|
||
|
DisableDownloadTimeout: bool
|
||
|
NoProgressBar: bool
|
||
|
|
||
|
class PacmanConfig:
|
||
|
options: _PacmanConfigOptions
|
||
|
repos: OrderedDict[str, list[str]]
|
||
|
def __init__(
|
||
|
self, conf: Optional[str] = ..., options: Optional[argparse.Namespace] = ...
|
||
|
) -> None: ...
|
||
|
def load_from_file(self, filename: str) -> None: ...
|
||
|
def load_from_options(self, options: argparse.Namespace) -> None: ...
|
||
|
def apply(self, h: pyalpm.Handle) -> None: ...
|
||
|
def initialize_alpm(self) -> pyalpm.Handle: ...
|
||
|
|
||
|
def make_parser(
|
||
|
# This list is taken from /usr/lib/python3.11/site-packages/mypy/typeshed/stdlib/argparse.pyi
|
||
|
prog: str | None = None,
|
||
|
usage: str | None = None,
|
||
|
description: str | None = None,
|
||
|
epilog: str | None = None,
|
||
|
parents: Sequence[argparse.ArgumentParser] = [],
|
||
|
formatter_class: argparse._FormatterClass = ...,
|
||
|
prefix_chars: str = "-",
|
||
|
fromfile_prefix_chars: str | None = None,
|
||
|
argument_default: Any = None,
|
||
|
conflict_handler: str = "error",
|
||
|
add_help: bool = True,
|
||
|
allow_abbrev: bool = True,
|
||
|
exit_on_error: bool = True,
|
||
|
) -> argparse.ArgumentParser: ...
|
||
|
def init_with_config(configpath: str) -> pyalpm.Handle: ...
|
||
|
def init_with_config_and_options(options: argparse.Namespace) -> pyalpm.Handle: ...
|