mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 08:24:40 +01:00
fix: mypy error on implicit optional
This commit is contained in:
parent
4c3c361cf9
commit
c60368ec82
1 changed files with 12 additions and 12 deletions
|
@ -99,19 +99,19 @@ def _unc_map_temp_drive(unc_path) -> str:
|
|||
|
||||
if not _unc_check_enabled():
|
||||
return unc_path
|
||||
else:
|
||||
unc_share, rem_path = os.path.splitdrive(unc_path)
|
||||
unc_share = unc_share.casefold()
|
||||
for d in _unc_tempDrives:
|
||||
if _unc_tempDrives[d] == unc_share:
|
||||
return os.path.join(d, rem_path)
|
||||
unc_share, rem_path = os.path.splitdrive(unc_path)
|
||||
unc_share = unc_share.casefold()
|
||||
for d in _unc_tempDrives:
|
||||
if _unc_tempDrives[d] == unc_share:
|
||||
return os.path.join(d, rem_path)
|
||||
|
||||
for dord in range(ord("z"), ord("a"), -1):
|
||||
d = chr(dord) + ":"
|
||||
if not os.path.isdir(d): # find unused drive letter starting from z:
|
||||
subprocess.check_output(["NET", "USE", d, unc_share], text=True)
|
||||
_unc_tempDrives[d] = unc_share
|
||||
return os.path.join(d, rem_path)
|
||||
for dord in range(ord("z"), ord("a"), -1):
|
||||
d = chr(dord) + ":"
|
||||
if not os.path.isdir(d): # find unused drive letter starting from z:
|
||||
subprocess.check_output(["NET", "USE", d, unc_share], text=True)
|
||||
_unc_tempDrives[d] = unc_share
|
||||
return os.path.join(d, rem_path)
|
||||
raise RuntimeError(f"Failed to find a drive for UNC Path({unc_path})")
|
||||
|
||||
|
||||
def _unc_unmap_temp_drive(left_drive, cwd):
|
||||
|
|
Loading…
Add table
Reference in a new issue