Format: application/octet-stream
⬇ Download File (3.8 KB)
   1  from _typeshed import SupportsNoArgReadline
   2  from typing import IO, Any, Dict, List, Optional, Sequence, Tuple, Union
   3  
   4  DEFAULTSECT: str
   5  MAX_INTERPOLATION_DEPTH: int
   6  
   7  class Error(Exception):
   8      message: Any
   9      def __init__(self, msg: str = ...) -> None: ...
  10      def _get_message(self) -> None: ...
  11      def _set_message(self, value: str) -> None: ...
  12      def __repr__(self) -> str: ...
  13      def __str__(self) -> str: ...
  14  
  15  class NoSectionError(Error):
  16      section: str
  17      def __init__(self, section: str) -> None: ...
  18  
  19  class DuplicateSectionError(Error):
  20      section: str
  21      def __init__(self, section: str) -> None: ...
  22  
  23  class NoOptionError(Error):
  24      section: str
  25      option: str
  26      def __init__(self, option: str, section: str) -> None: ...
  27  
  28  class InterpolationError(Error):
  29      section: str
  30      option: str
  31      msg: str
  32      def __init__(self, option: str, section: str, msg: str) -> None: ...
  33  
  34  class InterpolationMissingOptionError(InterpolationError):
  35      reference: str
  36      def __init__(self, option: str, section: str, rawval: str, reference: str) -> None: ...
  37  
  38  class InterpolationSyntaxError(InterpolationError): ...
  39  
  40  class InterpolationDepthError(InterpolationError):
  41      def __init__(self, option: str, section: str, rawval: str) -> None: ...
  42  
  43  class ParsingError(Error):
  44      filename: str
  45      errors: List[Tuple[Any, Any]]
  46      def __init__(self, filename: str) -> None: ...
  47      def append(self, lineno: Any, line: Any) -> None: ...
  48  
  49  class MissingSectionHeaderError(ParsingError):
  50      lineno: Any
  51      line: Any
  52      def __init__(self, filename: str, lineno: Any, line: Any) -> None: ...
  53  
  54  class RawConfigParser:
  55      _dict: Any
  56      _sections: Dict[Any, Any]
  57      _defaults: Dict[Any, Any]
  58      _optcre: Any
  59      SECTCRE: Any
  60      OPTCRE: Any
  61      OPTCRE_NV: Any
  62      def __init__(self, defaults: Dict[Any, Any] = ..., dict_type: Any = ..., allow_no_value: bool = ...) -> None: ...
  63      def defaults(self) -> Dict[Any, Any]: ...
  64      def sections(self) -> List[str]: ...
  65      def add_section(self, section: str) -> None: ...
  66      def has_section(self, section: str) -> bool: ...
  67      def options(self, section: str) -> List[str]: ...
  68      def read(self, filenames: Union[str, Sequence[str]]) -> List[str]: ...
  69      def readfp(self, fp: SupportsNoArgReadline[str], filename: str = ...) -> None: ...
  70      def get(self, section: str, option: str) -> str: ...
  71      def items(self, section: str) -> List[Tuple[Any, Any]]: ...
  72      def _get(self, section: str, conv: type, option: str) -> Any: ...
  73      def getint(self, section: str, option: str) -> int: ...
  74      def getfloat(self, section: str, option: str) -> float: ...
  75      _boolean_states: Dict[str, bool]
  76      def getboolean(self, section: str, option: str) -> bool: ...
  77      def optionxform(self, optionstr: str) -> str: ...
  78      def has_option(self, section: str, option: str) -> bool: ...
  79      def set(self, section: str, option: str, value: Any = ...) -> None: ...
  80      def write(self, fp: IO[str]) -> None: ...
  81      def remove_option(self, section: str, option: Any) -> bool: ...
  82      def remove_section(self, section: str) -> bool: ...
  83      def _read(self, fp: IO[str], fpname: str) -> None: ...
  84  
  85  class ConfigParser(RawConfigParser):
  86      _KEYCRE: Any
  87      def get(self, section: str, option: str, raw: bool = ..., vars: Optional[Dict[Any, Any]] = ...) -> Any: ...
  88      def items(self, section: str, raw: bool = ..., vars: Optional[Dict[Any, Any]] = ...) -> List[Tuple[str, Any]]: ...
  89      def _interpolate(self, section: str, option: str, rawval: Any, vars: Any) -> str: ...
  90      def _interpolation_replace(self, match: Any) -> str: ...
  91  
  92  class SafeConfigParser(ConfigParser):
  93      _interpvar_re: Any
  94      def _interpolate(self, section: str, option: str, rawval: Any, vars: Any) -> str: ...
  95      def _interpolate_some(
  96          self, option: str, accum: List[Any], rest: str, section: str, map: Dict[Any, Any], depth: int
  97      ) -> None: ...
  98