From 82b131cf2afebbed3723df5b5dfd5cd820716f97 Mon Sep 17 00:00:00 2001 From: Yobmod Date: Wed, 30 Jun 2021 18:41:06 +0100 Subject: Type Traversable.traverse() better, start types of submodule --- git/config.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'git/config.py') diff --git a/git/config.py b/git/config.py index cc6fcfa4..7982baa3 100644 --- a/git/config.py +++ b/git/config.py @@ -29,8 +29,6 @@ import os.path as osp import configparser as cp -from pathlib import Path - # typing------------------------------------------------------- from typing import Any, Callable, IO, List, Dict, Sequence, TYPE_CHECKING, Tuple, Union, cast, overload @@ -330,7 +328,7 @@ class GitConfigParser(with_metaclass(MetaParserBuilder, cp.RawConfigParser, obje "Write-ConfigParsers can operate on a single file only, multiple files have been passed") # END single file check - if isinstance(self._file_or_files, (str, Path)): # cannot narrow by os._pathlike until 3.5 dropped + if isinstance(self._file_or_files, (str, os.PathLike)): file_or_files = self._file_or_files else: file_or_files = cast(IO, self._file_or_files).name -- cgit v1.2.1 From 02b8ef0f163ca353e27f6b4a8c2120444739fde5 Mon Sep 17 00:00:00 2001 From: Yobmod Date: Thu, 1 Jul 2021 10:35:11 +0100 Subject: Add missed types to Commit, uncomment to_native_path_linux() --- git/config.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'git/config.py') diff --git a/git/config.py b/git/config.py index 7982baa3..5c5ceea8 100644 --- a/git/config.py +++ b/git/config.py @@ -694,6 +694,16 @@ class GitConfigParser(with_metaclass(MetaParserBuilder, cp.RawConfigParser, obje """:return: True if this instance may change the configuration file""" return self._read_only + @overload + def get_value(self, section: str, option: str, default: str + ) -> str: + ... + + @overload + def get_value(self, section: str, option: str, default: float + ) -> float: + ... + def get_value(self, section: str, option: str, default: Union[int, float, str, bool, None] = None ) -> Union[int, float, str, bool]: # can default or return type include bool? -- cgit v1.2.1