mirror of
https://gerrit.googlesource.com/git-repo
synced 2026-11-15 00:37:13 +00:00
style: use import urllib.xxx everywhere
Align with Google style guides and `import urllib.xxx` as a module rather than import symbols out of it. Change-Id: Ia177f4fd5ee2a3f38f8a8860e9a2ba8beac8078f Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/654804 Reviewed-by: Brian Gan <brgan@google.com> Tested-by: Mike Frysinger <vapier@google.com> Commit-Queue: Mike Frysinger <vapier@google.com>
This commit is contained in:
1 parent
a4b44c5026
commit
e15b3e0298
2 files changed
+4
-5
No files matched your search
@@ -7,7 +7,6 @@ per-file-ignores =
|
||||
# IMR241: When using the from syntax, only submodules are imported, not module elements.
|
||||
# NB: Do not add any more here.
|
||||
command.py: IMR241,
|
||||
fetch.py: IMR241,
|
||||
git_command.py: IMR241,
|
||||
git_status.py: IMR241,
|
||||
git_superproject.py: IMR241,
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
|
||||
import subprocess
|
||||
import sys
|
||||
from urllib.parse import urlparse
|
||||
from urllib.request import urlopen
|
||||
import urllib.parse
|
||||
import urllib.request
|
||||
|
||||
import error
|
||||
|
||||
@@ -32,7 +32,7 @@ def fetch_file(url, verbose=False):
|
||||
Returns:
|
||||
The contents of the file as bytes.
|
||||
"""
|
||||
scheme = urlparse(url).scheme
|
||||
scheme = urllib.parse.urlparse(url).scheme
|
||||
if scheme == "gs":
|
||||
cmd = ["gcloud", "storage", "cat", url]
|
||||
errors = []
|
||||
@@ -54,5 +54,5 @@ def fetch_file(url, verbose=False):
|
||||
file=sys.stderr,
|
||||
)
|
||||
raise FetchFileError(aggregate_errors=errors)
|
||||
with urlopen(url) as f:
|
||||
with urllib.request.urlopen(url) as f:
|
||||
return f.read()
|
||||
Reference in new issue
Block a user