Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
bpo-33440: Remove unneeded import renames.
  • Loading branch information
agfor committed May 14, 2018
commit 01d7fd4e86a511884dfc93e302ae7ec49d191486
10 changes: 5 additions & 5 deletions Lib/pathlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,16 +223,16 @@ def is_reserved(self, parts):

def make_uri(self, path):
# Under Windows, file URIs use the UTF-8 encoding.
from urllib.parse import quote_from_bytes as urlquote_from_bytes
from urllib.parse import quote_from_bytes
drive = path.drive
if len(drive) == 2 and drive[1] == ':':
# It's a path on a local drive => 'file:///c:/a/b'
rest = path.as_posix()[2:].lstrip('/')
return 'file:///%s/%s' % (
drive, urlquote_from_bytes(rest.encode('utf-8')))
drive, quote_from_bytes(rest.encode('utf-8')))
else:
# It's a path on a network drive => 'file://host/share/a/b'
return 'file:' + urlquote_from_bytes(path.as_posix().encode('utf-8'))
return 'file:' + quote_from_bytes(path.as_posix().encode('utf-8'))

def gethomedir(self, username):
if 'HOME' in os.environ:
Expand Down Expand Up @@ -345,9 +345,9 @@ def is_reserved(self, parts):
def make_uri(self, path):
# We represent the path using the local filesystem encoding,
# for portability to other applications.
from urllib.parse import quote_from_bytes as urlquote_from_bytes
from urllib.parse import quote_from_bytes
bpath = bytes(path)
return 'file://' + urlquote_from_bytes(bpath)
return 'file://' + quote_from_bytes(bpath)

def gethomedir(self, username):
if not username:
Expand Down