Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit38f5157

Browse files
committed
add type check to conf_encoding (in thoery could be bool or int)
1 parent9d844a6 commit38f5157

File tree

4 files changed

+6
-959
lines changed

4 files changed

+6
-959
lines changed

‎git/cmd.py‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,18 +109,16 @@ def pump_stream(cmdline: List[str], name: str, stream: Union[BinaryIO, TextIO],
109109
else:
110110
handler(line)
111111
exceptExceptionasex:
112-
log.error(f"Pumping{name!r} of cmd({remove_password_if_present(cmdline)})}faileddueto:{ex!r}")
112+
log.error(f"Pumping{name!r} of cmd({remove_password_if_present(cmdline)}) failed due to:{ex!r}")
113113
raiseCommandError([f'<{name}-pump>']+remove_password_if_present(cmdline),ex)fromex
114114
finally:
115115
stream.close()
116116

117-
118-
119117
ifhasattr(process,'proc'):
120118
process=cast('Git.AutoInterrupt',process)
121119
cmdline:str|Tuple[str, ...]|List[str]=getattr(process.proc,'args','')
122-
p_stdout=process.proc.stdout
123-
p_stderr=process.proc.stderr
120+
p_stdout=process.proc.stdoutifprocess.procelseNone
121+
p_stderr=process.proc.stderrifprocess.procelseNone
124122
else:
125123
process=cast(Popen,process)
126124
cmdline=getattr(process,'args','')

‎git/config.py‎

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
# typing-------------------------------------------------------
3232

3333
fromtypingimport (Any,Callable,Generic,IO,List,Dict,Sequence,
34-
TYPE_CHECKING,Tuple,TypeVar,Union,cast,overload)
34+
TYPE_CHECKING,Tuple,TypeVar,Union,cast)
3535

3636
fromgit.typesimportLit_config_levels,ConfigLevels_Tup,PathLike,assert_never,_T
3737

@@ -709,15 +709,6 @@ def read_only(self) -> bool:
709709
""":return: True if this instance may change the configuration file"""
710710
returnself._read_only
711711

712-
@overload
713-
defget_value(self,section:str,option:str,default:None=None)->Union[int,float,str,bool]: ...
714-
715-
@overload
716-
defget_value(self,section:str,option:str,default:str)->str: ...
717-
718-
@overload
719-
defget_value(self,section:str,option:str,default:float)->float: ...
720-
721712
defget_value(self,section:str,option:str,default:Union[int,float,str,bool,None]=None
722713
)->Union[int,float,str,bool]:
723714
# can default or return type include bool?

‎git/objects/commit.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,8 @@ def create_from_tree(cls, repo: 'Repo', tree: Union[Tree, str], message: str,
446446
# assume utf8 encoding
447447
enc_section,enc_option=cls.conf_encoding.split('.')
448448
conf_encoding=cr.get_value(enc_section,enc_option,cls.default_encoding)
449+
ifnotisinstance(conf_encoding,str):
450+
raiseTypeError("conf_encoding could not be coerced to str")
449451

450452
# if the tree is no object, make sure we create one - otherwise
451453
# the created commit object is invalid

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp